Repository 'w4mcorcov'
hg clone https://toolshed.g2.bx.psu.edu/repos/eschen42/w4mcorcov

Changeset 14:90708fdbc22d (2020-11-18)
Previous changeset 13:2ae2d26e3270 (2018-12-12)
Commit message:
"planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 5fd9687d543a48a715b1180caf93abebebd58b0e"
modified:
LICENSE
README
w4mcorcov.xml
w4mcorcov_calc.R
w4mcorcov_input.R
w4mcorcov_lib.R
w4mcorcov_output.R
w4mcorcov_salience.R
w4mcorcov_util.R
w4mcorcov_wrapper.R
b
diff -r 2ae2d26e3270 -r 90708fdbc22d w4mcorcov.xml
--- a/w4mcorcov.xml Wed Dec 12 09:20:02 2018 -0500
+++ b/w4mcorcov.xml Wed Nov 18 18:53:37 2020 +0000
[
b'@@ -1,4 +1,4 @@\n-\xef\xbb\xbf<tool id="w4mcorcov" name="OPLS-DA_Contrasts" version="0.98.17">\n+\xef\xbb\xbf<tool id="w4mcorcov" name="OPLS-DA_Contrasts" version="0.98.18">\n     <description>OPLS-DA Contrasts of Univariate Results</description>\n     <macros>\n         <xml name="paramPairSigFeatOnly">\n@@ -25,7 +25,7 @@\n     <requirements>\n         <requirement type="package">r-base</requirement>\n         <requirement type="package">r-batch</requirement>\n-        <requirement type="package" version="1.10.0">bioconductor-ropls</requirement>\n+        <requirement type="package" version="1.22.0">bioconductor-ropls</requirement>\n     </requirements>\n     <command detect_errors="aggressive"><![CDATA[\n     Rscript \'$__tool_directory__/w4mcorcov_wrapper.R\'\n@@ -57,6 +57,7 @@\n         contrast_detail \'$contrast_detail\'\n         contrast_corcov \'$contrast_corcov\'\n         contrast_salience \'$contrast_salience\'\n+        min_crossval_i \'$min_crossval_i\'\n     ]]></command>\n     <inputs>\n         <param name="dataMatrix_in" format="tabular" label="Data matrix file" type="data"\n@@ -135,6 +136,9 @@\n         <param name="labelFeatures" type="text" value="3"\n             label="How many features having extreme loadings should be labelled on cov-vs.-cor plot?"\n             help="Specify the number of features at each of the loading-extremes that should be labelled (with the name of the feature) on the covariance-vs.-correlation plot; specify \'ALL\' to label all features or \'0\' to label no features; this choice has no effect on the OPLS-DA loadings plot."/>\n+        <param name="min_crossval_i" type="text" value="7"\n+            label="Minumum number of samples for OPLS-DA cross-validation."\n+            help="What is the minimum number of samples to be used by the ropls package for cross-validation of OPLS-DA predictions?  This should be not more than half the number of your samples."/>\n         <conditional name="advanced">\n             <param name="advancedFeatures" type="select" \n                 label="Advanced (C-plots and customized p-value adjustment)"\n@@ -179,7 +183,121 @@\n     <data name="contrast_salience" format="tabular" label="${tool.name}_${variableMetadata_in.name}_salience" />\n   </outputs>\n   <tests>\n-    <!-- test #1 -->\n+    <!-- test #1 - issue 14 -->\n+    <test>\n+      <param name="dataMatrix_in" value="issue14_input_dataMatrix.tsv"/>\n+      <param name="sampleMetadata_in" value="issue14_input_sampleMetadata.tsv"/>\n+      <param name="variableMetadata_in" value="issue14_input_variableMetadata.tsv"/>\n+      <param name="tesC" value="none"/>\n+      <param name="facC" value="tissue_flowering"/>\n+      <param name="labelFeatures" value="3"/>\n+      <param name="min_crossval_i" value="4"/>\n+      <param name="fdr_features" value="ALL"/>\n+      <param name="levCSV" value="*"/>\n+      <param name="matchingC" value="wildcard"/>\n+      <output name="contrast_corcov">\n+        <assert_contents>\n+          <!-- column-labels line -->\n+          <has_text text="featureID" />\n+          <has_text text="factorLevel1" />\n+          <has_text text="factorLevel2" />\n+          <has_text text="correlation" />\n+          <has_text text="covariance" />\n+          <has_text text="vip4p" />\n+          <has_text text="vip4o" />\n+          <!-- a matched line -->\n+          <has_text text="NM516T283_1" />\n+          <has_text text="flower_yes" />\n+          <has_text text="leaf_no" />\n+          <has_text text="-0.98475578586" />\n+          <has_text text="-58.1219648" />\n+          <has_text text="2.0103501" />\n+          <has_text text="2.872672881" />\n+          <has_text text="-0.1208407903" />\n+          <has_text text="-0.2032249" />\n+          <has_text text="-0.9857575" />\n+          <has_text text="-0.983684189899" />\n+          <has_text text="516.080116" />\n+          <has_text text="282.50076" />\n+        </assert_contents>\n+      </output>\n+    </test>\n+    <!-- test #2 - issue 6 -->\n+    <test>\n+      <param name="dataMatrix_in" value="input_dataMatrix.ts'..b'eatures" value="3"/>\n+      <param name="min_crossval_i" value="7"/>\n       <param name="fdr_features" value="ALL"/>\n       <param name="levCSV" value="*"/>\n       <param name="matchingC" value="wildcard"/>\n@@ -386,7 +508,7 @@\n         </assert_contents>\n       </output>\n     </test>\n-    <!-- test #5 -->\n+    <!-- test #8 -->\n     <test>\n       <param name="dataMatrix_in" value="input_dataMatrix.tsv"/>\n       <param name="sampleMetadata_in" value="issue6_input_sampleMetadata.tsv"/>\n@@ -394,6 +516,7 @@\n       <param name="tesC" value="none"/>\n       <param name="facC" value="k._10"/>\n       <param name="labelFeatures" value="3"/>\n+      <param name="min_crossval_i" value="7"/>\n       <param name="fdr_features" value="ALL"/>\n       <param name="levCSV" value="k1,k.2"/>\n       <param name="matchingC" value="none"/>\n@@ -422,79 +545,6 @@\n         </assert_contents>\n       </output>\n     </test>\n-    <!-- test #6 - issue 6 -->\n-    <test>\n-      <param name="dataMatrix_in" value="input_dataMatrix.tsv"/>\n-      <param name="sampleMetadata_in" value="issue6_input_sampleMetadata.tsv"/>\n-      <param name="variableMetadata_in" value="input_variableMetadata.tsv"/>\n-      <param name="tesC" value="none"/>\n-      <param name="facC" value="k._10"/>\n-      <param name="labelFeatures" value="3"/>\n-      <param name="fdr_features" value="ALL"/>\n-      <param name="levCSV" value="k_3,k-4"/>\n-      <param name="matchingC" value="none"/>\n-      <output name="contrast_corcov">\n-        <assert_contents>\n-          <!-- column-labels line -->\n-          <has_text text="featureID" />\n-          <has_text text="factorLevel1" />\n-          <has_text text="factorLevel2" />\n-          <has_text text="correlation" />\n-          <has_text text="covariance" />\n-          <has_text text="vip4p" />\n-          <has_text text="vip4o" />\n-          <!-- first matched line -->\n-          <has_text text="M349.2383T700" />\n-          <has_text text="-0.1221966" />\n-          <has_text text="-917311734" />\n-          <has_text text="0.0304592" />\n-          <has_text text="0.104748883" />\n-          <has_text text="-0.002736415" />\n-          <has_text text="-0.0113968" />\n-          <has_text text="0.387723" />\n-          <has_text text="-0.3812168081" />\n-          <has_text text="0.154611878" />\n-        </assert_contents>\n-      </output>\n-    </test>\n-    <!-- test #7 - issue 8 -->\n-    <test>\n-      <param name="dataMatrix_in" value="input_dataMatrix.tsv"/>\n-      <param name="sampleMetadata_in" value="issue8_input_sampleMetadata.tsv"/>\n-      <param name="variableMetadata_in" value="input_variableMetadata.tsv"/>\n-      <param name="tesC" value="none"/>\n-      <param name="facC" value="k._10"/>\n-      <param name="labelFeatures" value="3"/>\n-      <param name="fdr_features" value="ALL"/>\n-      <param name="levCSV" value="k_3,k-4"/>\n-      <param name="matchingC" value="none"/>\n-      <output name="contrast_corcov">\n-        <assert_contents>\n-          <!-- column-labels line -->\n-          <has_text text="featureID" />\n-          <has_text text="factorLevel1" />\n-          <has_text text="factorLevel2" />\n-          <has_text text="correlation" />\n-          <has_text text="covariance" />\n-          <has_text text="vip4p" />\n-          <has_text text="vip4o" />\n-          <!-- k1 rejected by levCSV, leaving only k_3 and k-4 -->\n-          <not_has_text text="k1" />\n-          <not_has_text text="other" />\n-          <!-- first matched line -->\n-          <has_text text="M200.005T296" />\n-          <has_text text="-0.1829149760" />\n-          <has_text text="-115723402" />\n-          <has_text text="0.0892595" />\n-          <has_text text="0.00492288" />\n-          <has_text text="-0.00801895" />\n-          <has_text text="0.0005356178" />\n-          <has_text text="0.1848186" />\n-          <has_text text="-0.428802311" />\n-          <has_text text="0.0882045811" />\n-        </assert_contents>\n-      </output>\n-    </test>\n   </tests>\n   <help><![CDATA[\n \n'
b
diff -r 2ae2d26e3270 -r 90708fdbc22d w4mcorcov_calc.R
--- a/w4mcorcov_calc.R Wed Dec 12 09:20:02 2018 -0500
+++ b/w4mcorcov_calc.R Wed Nov 18 18:53:37 2020 +0000
b
@@ -22,8 +22,8 @@
       , algoC  = x_algorithm
       , predI  = 1
       , orthoI = if (ncol(x_dataMatrix) > 1) 1 else 0
-      , printL = FALSE
-      , plotL  = FALSE
+      , fig.pdfC = 'none'
+      , info.txtC  = 'none'
       , crossvalI = x_crossval_i
       , scaleC = "pareto" # data centered and pareto scaled here only. This line fixes issue #2.
       )
@@ -443,6 +443,7 @@
   # matchingC is one of { "none", "wildcard", "regex" }
   matchingC <- calc_env$matchingC
   labelFeatures <- calc_env$labelFeatures
+  minCrossvalI <- as.integer(calc_env$min_crossval_i)
 
   # arg/env checking
   if (!(facC %in% names(smpl_metadata))) {
@@ -600,7 +601,7 @@
                           }
         , x_show_labels = labelFeatures
         , x_progress    = progress_action
-        , x_crossval_i  = min(7, length(chosen_samples))
+        , x_crossval_i  = min(minCrossvalI, length(chosen_samples))
         , x_env         = calc_env
         )
         if ( is.null(my_cor_cov) ) {
@@ -674,7 +675,7 @@
                               }
             , x_show_labels = labelFeatures
             , x_progress    = progress_action
-            , x_crossval_i  = min(7, length(chosen_samples))
+            , x_crossval_i  = min(minCrossvalI, length(chosen_samples))
             , x_env         = calc_env
             )
             if ( is.null(my_cor_cov) ) {
@@ -753,7 +754,7 @@
                 , x_prefix      = "Features"
                 , x_show_labels = labelFeatures
                 , x_progress    = progress_action
-                , x_crossval_i  = min(7, length(chosen_samples))
+                , x_crossval_i  = min(minCrossvalI, length(chosen_samples))
                 , x_env         = calc_env
                 )
                 if ( is.null(my_cor_cov) ) {
@@ -806,7 +807,7 @@
               , x_prefix      = "Features"
               , x_show_labels = labelFeatures
               , x_progress    = progress_action
-              , x_crossval_i  = min(7, length(chosen_samples))
+              , x_crossval_i  = min(minCrossvalI, length(chosen_samples))
               , x_env         = calc_env
               )
               if ( is.null(my_cor_cov) ) {
b
diff -r 2ae2d26e3270 -r 90708fdbc22d w4mcorcov_wrapper.R
--- 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) {