diff Intchecks/wrapper_intensity_check.R @ 1:d1133a7c26f9 draft

Uploaded
author melpetera
date Fri, 03 Jan 2020 16:08:22 +0000
parents 51c39ea1fd54
children
line wrap: on
line diff
--- a/Intchecks/wrapper_intensity_check.R	Mon Jan 14 08:37:27 2019 -0500
+++ b/Intchecks/wrapper_intensity_check.R	Fri Jan 03 16:08:22 2020 +0000
@@ -9,7 +9,7 @@
 #                                                                           #
 #                                                                           #
 # Input: Data Matrix, VariableMetadata, SampleMetadata                      #
-# Output: VariableMetadata, Graphics (barplots and boxplots)                #
+# Output: VariableMetadata, Graphics                                        #
 #                                                                           #
 #                                                                           #
 #############################################################################
@@ -27,28 +27,58 @@
 source_local("Script_intensity_check.R", "RcheckLibrary.R")
 
 
-if(length(args) < 8){ stop("NOT enough argument !!!") }
+if(length(args) < 7){ stop("NOT enough argument !!!") }
 
+cat('\nJob starting time:\n',format(Sys.time(), "%a %d %b %Y %X"),
+'\n\n--------------------------------------------------------------------', 
+'\nIntensity Check parameters:\n\n')
+print(args)
+cat('--------------------------------------------------------------------\n\n')
 
+class_col <- NULL
+test_fold <- NULL
 class1 <- NULL
 fold_frac <- NULL
-if(args$type == "One_class"){
+logarithm <- NULL
+if(args$method == "each_class"){ 
+  class_col <- args$class_col
+  test_fold <- args$test_fold
+  if(args$test_fold == "Yes"){
+    logarithm <- args$logarithm
+  }
+}
+if(args$method == "one_class"){
+  class_col <- args$class_col
   class1 <- args$class1
-  fold_frac <- args$fold_frac
+  test_fold <- args$test_fold
+  if(args$test_fold == "Yes"){
+    fold_frac <- args$fold_frac
+    logarithm <- args$logarithm
+  }
+}
+
+err_no_option <- NULL
+
+if(((args$method == "no_class")&&(args$chosen_stat == "None"))||
+   ((args$method != "no_class") && (args$chosen_stat == "None") && (test_fold == "No"))){
+  err_no_option<- "You did not select any computational option. Program can not be executed."
+  stop("\n- - - - - - - - -\n",err_no_option,"\n- - - - - - - - -\n")
 }
 
 
-#print args
-cat("\n-------------------------------\nIntensity Check parameters:\n\n")
-print(args)
-cat("--------------------------------\n")
+if(is.null(err_no_option)){
+
+  intens_check(args$dataMatrix_in, args$sampleMetadata_in, args$variableMetadata_in, args$method, args$chosen_stat, 
+             class_col, test_fold, class1, fold_frac, logarithm, args$variableMetadata_out, args$graphs_out)
+}
 
 
-intens_check(args$dataMatrix_in, args$sampleMetadata_in, args$variableMetadata_in, args$class_col, args$type,
-            class1, fold_frac, args$logarithm, args$variableMetadata_out, args$graphs_out)
+cat('\n--------------------------------------------------------------------',
+'\nInformation about R (version, Operating System, attached or loaded packages):\n\n')
+sessionInfo()
+cat('--------------------------------------------------------------------\n',
+'\nJob ending time:\n',format(Sys.time(), "%a %d %b %Y %X"))
 
-sessionInfo()
-cat("--------------------------------\n")
 
 #delete the parameters to avoid the passage to the next tool in .RData image
 rm(args)