0
|
1 #!/usr/bin/Rscript --vanilla --slave --no-site-file
|
|
2
|
1
|
3
|
|
4 #############################################################################
|
|
5 # WRAPPER for INTENSITY CHECK #
|
|
6 # #
|
|
7 #Script: Script_intensity_check.R #
|
|
8 #Xml: xml_intensity_check.xml #
|
|
9 # #
|
|
10 # #
|
|
11 # Input: Data Matrix, VariableMetadata, SampleMetadata #
|
3
|
12 # Output: VariableMetadata, Graphics #
|
1
|
13 # #
|
|
14 # #
|
|
15 #############################################################################
|
0
|
16
|
|
17
|
|
18 library(batch) #necessary for parseCommandArgs function
|
|
19 args = parseCommandArgs(evaluate=FALSE) #interpretation of arguments given in command line as an R list of objects
|
|
20
|
|
21 source_local <- function(...){
|
|
22 argv <- commandArgs(trailingOnly = FALSE)
|
|
23 base_dir <- dirname(substring(argv[grep("--file=", argv)], 8))
|
|
24 for(i in 1:length(list(...))){source(paste(base_dir, list(...)[[i]], sep="/"))}
|
|
25 }
|
|
26 #Import the different functions
|
|
27 source_local("Script_intensity_check.R", "RcheckLibrary.R")
|
|
28
|
|
29
|
3
|
30 if(length(args) < 7){ stop("NOT enough argument !!!") }
|
1
|
31
|
3
|
32 class_col <- NULL
|
|
33 test_fold <- NULL
|
0
|
34 class1 <- NULL
|
1
|
35 fold_frac <- NULL
|
3
|
36 logarithm <- NULL
|
|
37 if(args$method == "each_class"){
|
|
38 class_col <- args$class_col
|
|
39 test_fold <- args$test_fold
|
|
40 if(args$test_fold == "Yes"){
|
|
41 logarithm <- args$logarithm
|
|
42 }
|
|
43 }
|
|
44 if(args$method == "one_class"){
|
|
45 class_col <- args$class_col
|
0
|
46 class1 <- args$class1
|
3
|
47 test_fold <- args$test_fold
|
|
48 if(args$test_fold == "Yes"){
|
|
49 fold_frac <- args$fold_frac
|
|
50 logarithm <- args$logarithm
|
|
51 }
|
|
52 }
|
|
53
|
|
54 err_no_option <- NULL
|
|
55
|
|
56 if(((args$method == "no_class")&&(args$chosen_stat == "None"))||
|
|
57 ((args$method != "no_class") && (args$chosen_stat == "None") && (test_fold == "No"))){
|
|
58 err_no_option<- "You did not select any computational option. Program could not be executed."
|
|
59 stop("\n- - - - - - - - -\n",err_no_option,"\n- - - - - - - - -\n")
|
0
|
60 }
|
|
61
|
1
|
62
|
0
|
63 #print args
|
|
64 cat("\n-------------------------------\nIntensity Check parameters:\n\n")
|
|
65 print(args)
|
|
66 cat("--------------------------------\n")
|
|
67
|
3
|
68 if(is.null(err_no_option)){
|
0
|
69
|
3
|
70 intens_check(args$dataMatrix_in, args$sampleMetadata_in, args$variableMetadata_in, args$method, args$chosen_stat,
|
|
71 class_col, test_fold, class1, fold_frac, logarithm, args$variableMetadata_out, args$graphs_out)
|
|
72 }
|
|
73
|
0
|
74 sessionInfo()
|
|
75 cat("--------------------------------\n")
|
|
76
|
|
77 #delete the parameters to avoid the passage to the next tool in .RData image
|
|
78 rm(args)
|