diff w4mcorcov_wrapper.R @ 14:90708fdbc22d draft default tip

"planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 5fd9687d543a48a715b1180caf93abebebd58b0e"
author eschen42
date Wed, 18 Nov 2020 18:53:37 +0000
parents 2ae2d26e3270
children
line wrap: on
line diff
--- a/w4mcorcov_wrapper.R	Wed Dec 12 09:20:02 2018 -0500
+++ b/w4mcorcov_wrapper.R	Wed Nov 18 18:53:37 2020 +0000
@@ -4,7 +4,7 @@
 #   - w4mcorcov_lib.R
 #   - w4mcorcov_input.R
 #   - w4mcorcov_calc.R
-
+options(warn=1)
 ## constants
 ##----------
 
@@ -108,6 +108,7 @@
 my_env$levCSV             <- as.character(argVc["levCSV"])
 my_env$matchingC          <- as.character(argVc["matchingC"])
 my_env$labelFeatures      <- as.character(argVc["labelFeatures"]) # number of features to label at each extreme of the loadings or 'ALL'
+my_env$min_crossval_i     <- as.character(argVc["min_crossval_i"]) # Minumum number of samples for OPLS-DA cross-validation
 my_env$fdr_features       <- as.character(argVc["fdr_features"]) # number of features to consider when adjusting p-value, or 'ALL'
 my_env$cplot_o            <- as.logical(argVc["cplot_o"]) # TRUE if orthogonal C-plot is requested
 my_env$cplot_p            <- as.logical(argVc["cplot_p"]) # TRUE if parallel C-plot is requested
@@ -131,6 +132,24 @@
   quit(save = "no", status = 10, runLast = TRUE)
 }
 
+min_crossval_i <- my_env$min_crossval_i
+crossval_check <- TRUE
+if ( is.na(min_crossval_i) ) {
+  crossval_check <- FALSE
+} else if ( is.null(min_crossval_i) ) {
+  crossval_check <- FALSE
+} else {
+  if ( is.na(as.numeric(min_crossval_i)) )
+    crossval_check <- FALSE
+  else if ( as.numeric(min_crossval_i) < 0 )
+    crossval_check <- FALSE
+}
+if ( !crossval_check ) {
+  my_log("invalid argument: min_crossval_i")
+  print(min_crossval_i)
+  quit(save = "no", status = 10, runLast = TRUE)
+}
+
 corcov_tsv_colnames <- TRUE
 corcov_tsv_append   <- FALSE
 corcov_tsv_action <- function(tsv) {