annotate Intchecks/wrapper_intensity_check.R @ 3:bdee2c2c484b draft

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