15
15
# ' @param drugName a single \code{character} string representing the
16
16
# ' selected drug.
17
17
# '
18
- # ' @param study a single \code{character} string representing the name of
18
+ # ' @param study a \code{vector} of \code{character} string representing the
19
+ # ' name(s) of
19
20
# ' the study selected for the analyses. The study must be present in the drug
20
21
# ' screening dataset. The study can be found in the 'study' column of the
21
22
# ' drug screening dataset.
@@ -52,7 +53,7 @@ filterDrugScreenOneDrug <- function(drugData, drugName, study, screenType,
52
53
doseType ) {
53
54
54
55
# # Select the specified study
55
- selectedDrug <- drugData [which(tolower(drugData $ study ) ==
56
+ selectedDrug <- drugData [which(tolower(drugData $ study ) %in%
56
57
tolower(study )), ]
57
58
58
59
# # Select the specified screen type
@@ -302,8 +303,9 @@ findOneDrugQuantile <- function(drugData, drugName, doseType="Averaged",
302
303
# ' @param drugName a single \code{character} string representing the name of
303
304
# ' the drug selected for the analyses.
304
305
# '
305
- # ' @param study a single \code{character} string representing the name of
306
- # ' the study selected for the analyses.
306
+ # ' @param study a \code{vector} of \code{character} string representing
307
+ # ' the name of the study selected for the analyses.
308
+ # '
307
309
# ' @param screenType a \code{vector} of \code{character} string representing
308
310
# ' the type of
309
311
# ' screening selected for the analyses.
@@ -380,10 +382,10 @@ validateSelectOrgForOneDrug <- function(drugScreening, drugName, study,
380
382
381
383
382
384
# ' @title Validate input parameters for the
383
- # ' selectOrgWithoutReplicateForOneDrug () function
385
+ # ' getClassNoReplicateOneDrug () function
384
386
# '
385
387
# ' @description The function validates the input parameters for the
386
- # ' selectOrgWithoutReplicateForOneDrug () function.
388
+ # ' getClassNoReplicateOneDrug () function.
387
389
# '
388
390
# ' @param drugScreening a single \code{character} string representing the path
389
391
# ' and name of the drug screening file that contains the information needed
@@ -431,7 +433,7 @@ validateSelectOrgForOneDrug <- function(drugScreening, drugName, study,
431
433
# ' @importFrom S4Vectors isSingleNumber
432
434
# ' @encoding UTF-8
433
435
# ' @keywords internal
434
- validateSelectOrgWithoutReplicateForOneDrug <- function (drugScreening ,
436
+ validateSelectOrgWithoutReplicateForOneDrug <- function (drugScreening ,
435
437
drugName , study , screenType , patientInfo , doseType , quantile ) {
436
438
437
439
# # Validate all but patientInfo parameter
@@ -452,3 +454,61 @@ validateSelectOrgWithoutReplicateForOneDrug<- function(drugScreening,
452
454
453
455
return (0L )
454
456
}
457
+
458
+
459
+ # ' @title Validate input parameters for the
460
+ # ' selectNoReplicateOrganoids() function
461
+ # '
462
+ # ' @description The function validates the input parameters for the
463
+ # ' selectNoReplicateOrganoids() function.
464
+ # '
465
+ # ' @param drugScreening a \code{data.frame} containing the drug screening
466
+ # ' information. The 'organoid_id' column is mandatory.
467
+ # '
468
+ # ' @param patientInfo a \code{data.frame} containing the meta-data information
469
+ # ' related to the organoids. The mandatory columns are: 'organoid_id'
470
+ # ' and 'patient_id'.
471
+ # '
472
+ # ' @return the value \code{0L} when successful.
473
+ # '
474
+ # ' @examples
475
+ # '
476
+ # ' ## Load drug screen dataset for 1 drug
477
+ # ' data(drugScreening)
478
+ # '
479
+ # ' ## Load patient information dataset
480
+ # ' data(patientInfo)
481
+ # '
482
+ # ' ## Validation should return OL as all parameters are valids
483
+ # ' OrganoidsToolBox:::validateSelectNoReplicateOrganoids(
484
+ # ' drugScreening=drugScreening, patientInfo=patientInfo)
485
+ # '
486
+ # ' @author Astrid Deschênes, Pascal Belleau
487
+ # ' @importFrom S4Vectors isSingleNumber
488
+ # ' @encoding UTF-8
489
+ # ' @keywords internal
490
+ validateSelectNoReplicateOrganoids <- function (drugScreening ,patientInfo ) {
491
+
492
+ if (! is.data.frame(drugScreening )) {
493
+ stop(" The \' drugScreening\' must be a data.frame." )
494
+ }
495
+
496
+ # # Check for mandatory columns in drugScreening
497
+ if (! (' organoid_id' %in% colnames(drugScreening ))) {
498
+ stop(" The mandatory column \' organoid_id\' is missing." )
499
+ }
500
+
501
+ if (! is.data.frame(patientInfo )) {
502
+ stop(" The \' patientInfo\' must be a data.frame." )
503
+ }
504
+
505
+ # # Check for mandatory columns in patientInfo
506
+ if (! all(c(' organoid_id' , ' patient_id' ) %in% colnames(patientInfo ))) {
507
+ stop(" Mandatory columns are missing from the patient info " ,
508
+ " dataset. The mandatory columns are: \' organoid_id\' and " ,
509
+ " \' patient_id\' ." )
510
+ }
511
+
512
+ return (0L )
513
+ }
514
+
0 commit comments