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

Changeset 4:8bba31f628da (2018-03-04)
Previous changeset 3:5aaab36bc523 (2018-01-15) Next changeset 5:50f60f94c034 (2018-03-30)
Commit message:
planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 8f2dc8b66666340275cd8967e09c504720528462
modified:
w4mcorcov.xml
w4mcorcov_calc.R
b
diff -r 5aaab36bc523 -r 8bba31f628da w4mcorcov.xml
--- a/w4mcorcov.xml Mon Jan 15 14:30:15 2018 -0500
+++ b/w4mcorcov.xml Sun Mar 04 14:51:42 2018 -0500
[
b'@@ -1,4 +1,4 @@\n-\xef\xbb\xbf<tool id="w4mcorcov" name="OPLS-DA_Contrasts" version="0.98.6">\n+\xef\xbb\xbf<tool id="w4mcorcov" name="OPLS-DA_Contrasts" version="0.98.7">\n \n   <description>OPLS-DA Contrasts of Univariate Results</description>\n   \n@@ -326,7 +326,7 @@\n Motivation\n ----------\n \n-OPLS-DA\\ :superscript:`\xc2\xae` and the SIMCA\\ :superscript:`\xc2\xae` S-PLOT\\ :superscript:`\xc2\xae` (Wiklund *et al.*, 2008) may be employed to draw attention to metabolomic features that are potential biomarkers, i.e. features that are potentially useful to discriminate to which class a sample should be assigned (e.g. Sun *et al.*, 2016).  Workflow4Metabolomics (W4M, Giacomoni *et al.*, 2014, Guitton *et al.*, 2017) provides a suite of tools for preprocessing and statistical analysis of LC-MS, GC-MS, and NMR metabolomics data; however, it does not (as of release 3.0) include a tool for making the equivalent of an S-PLOT.\n+OPLS-DA and the SIMCA S-PLOT (Wiklund *et al.*, 2008) may be employed to draw attention to metabolomic features that are potential biomarkers, i.e. features that are potentially useful to discriminate to which class a sample should be assigned (e.g. Sun *et al.*, 2016).  Workflow4Metabolomics (W4M, Giacomoni *et al.*, 2014, Guitton *et al.*, 2017) provides a suite of tools for preprocessing and statistical analysis of LC-MS, GC-MS, and NMR metabolomics data; however, it does not (as of release 3.0) include a tool for making the equivalent of an S-PLOT.\n \n The S-PLOT is computed from mean-centered, pareto-scaled data.  This plot presents the correlation of the first score vector from an OPLS-DA model with the sample-variables used to produce that model versus the covariance of the scores with the sample-variables.  For OPLS-DA, the first score vector represents the variation among the sample-variables that is related to the predictor (i.e., the contrasting factor).\n \n@@ -342,7 +342,7 @@\n \n The purpose of the \'PLS-DA Contrasts\' tool is to visualize GC-MS or LC-MS features that are possible biomarkers.\n \n-The W4M \'Univariate\' tool (Th\xc3\xa9venot *et al.*, 2015) adds the results of family-wise corrected pairwise significance-tests as columns of the **variableMetadata** dataset.\n+The W4M \'Univariate\' tool (Th]]>&#233;<![CDATA[venot *et al.*, 2015) adds the results of family-wise corrected pairwise significance-tests as columns of the **variableMetadata** dataset.\n For instance, suppose that you ran Kruskal-Wallis testing for a column named \'cluster\' in sampleMetadata that has values \'k1\' and \'k2\' and at least one other value.\n \n - A column of variableMetadata would be labelled \'cluster_kruskal_sig\' and would have values \'1\' and \'0\'; when the samples are grouped by \'cluster\', \'1\' means that there is strong evidence against the hypothesis that there is no difference among the intensities for the feature across all sample-groups.\n@@ -352,7 +352,7 @@\n \n **Along the left-to-right axis, the plots show the supervised projection of the variation explained by the predictor** (i.e., the factor specified when invoking the tool); **the top-to-bottom axis displays the variation that is orthogonal to the predictor level** (i.e., independent of it).\n \n-Although this tool can be used in a purely exploratory manner by supplying the variableMetadata file without the columns added by the W4M \'Univariate\' tool, **the preferred workflow is to use univariate testing to exclude features that are not significantly different and use OPLS-DA to visualize the differences identified in univariate testing** (Th\xc3\xa9venot *et al.*, 2015); an appropriate exception would be to visualize contrasts of a specific list of metabolites.\n+Although this tool can be used in a purely exploratory manner by supplying the variableMetadata file without the columns added by the W4M \'Univariate\' tool, **the preferred workflow is to use univariate testing to exclude features that are not significantly different and use OPLS-DA to visualize the differences identified in univariate testing** (Th]]>&#233;<![CDATA['..b'-------------------------------------------------------------------------------------------------------+\n   | Number of features having extreme loadings | 0                                                                                                                                      |\n   +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+\n+  | Label feat. having extreme orth. loadings  | Yes                                                                                                                                    |\n+  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+\n   | Output primary table                       | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/test-data/expected_contrast_corcov_global.tsv             |\n   +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+\n   | Output salience table                      | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/test-data/expected_contrast_salience_global.tsv           |\n@@ -634,6 +640,8 @@\n   +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+\n   | Number of features having extreme loadings | 3                                                                                                                                      |\n   +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+\n+  | Label feat. having extreme orth. loadings  | Yes                                                                                                                                    |\n+  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+\n   | Output primary table                       | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/test-data/expected_contrast_corcov_lohi.tsv               |\n   +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+\n   | Output salience table                      | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/test-data/expected_contrast_salience_lohi.tsv             |\n@@ -645,12 +653,16 @@\n Trademarks\n ----------\n \n-OPLS-DA\\ :superscript:`\xc2\xae`, SIMCA\\ :superscript:`\xc2\xae`, and S-PLOT\\ :superscript:`\xc2\xae` are registered trademarks of the Umetrics company.  http://umetrics.com/about-us/trademarks\n+OPLS-DA, SIMCA, and S-PLOT are registered trademarks of the Umetrics company.  http://umetrics.com/about-us/trademarks\n \n \n Release notes\n -------------\n \n+0.98.7\n+\n+- bug fix: handle case of a treatment level with only one sample.\n+\n 0.98.6\n \n - bug fix: set \'crossvalI\' param (of R function \'ropls::opls\') to the number of samples when the there are fewer than seven samples.\n@@ -689,7 +701,7 @@\n     <citation type="doi">10.3389/fmolb.2016.00026</citation>\n     <!-- Sun_2016 Urinary Biomarkers for adolescent idiopathic scoliosis -->\n     <citation type="doi">10.1038/srep22274</citation>\n-    <!-- Th_venot_2015 Urinary metabolome statistics -->\n+    <!-- Thevenot_2015 Urinary metabolome statistics -->\n     <citation type="doi">10.1021/acs.jproteome.5b00354</citation>\n     <!-- ropls package -->\n     <citation type="bibtex"><![CDATA[\n'
b
diff -r 5aaab36bc523 -r 8bba31f628da w4mcorcov_calc.R
--- a/w4mcorcov_calc.R Mon Jan 15 14:30:15 2018 -0500
+++ b/w4mcorcov_calc.R Sun Mar 04 14:51:42 2018 -0500
b
@@ -9,7 +9,7 @@
 
 do_detail_plot <- function(x_dataMatrix, x_predictor, x_is_match, x_algorithm, x_prefix, x_show_labels, x_show_loado_labels, x_progress = print, x_env, x_crossval_i) {
   off <- function(x) if (x_show_labels == "0") 0 else x
-  if (x_is_match && ncol(x_dataMatrix) > 0 && length(unique(x_predictor))> 1) {
+  if ( x_is_match && ncol(x_dataMatrix) > 0 && length(unique(x_predictor))> 1 && x_crossval_i < nrow(x_dataMatrix) ) {
     my_oplsda <- opls(
         x      = x_dataMatrix
       , y      = x_predictor
@@ -121,14 +121,18 @@
     for (my_type in my_typevc) {
       if (my_type %in% typeVc) {
         # print(sprintf("plotting type %s", my_type))
-        plot(
-          x            = my_oplsda
-        , typeVc       = my_type
-        , parCexN      = 0.4
-        , parDevNewL   = FALSE
-        , parLayL      = TRUE
-        , parEllipsesL = TRUE
+        tryCatch({
+          plot(
+            x            = my_oplsda
+          , typeVc       = my_type
+          , parCexN      = 0.4
+          , parDevNewL   = FALSE
+          , parLayL      = TRUE
+          , parEllipsesL = TRUE
         )
+        }, error = function(e) {
+          x_progress(sprintf("factor level %s or %s may have only one sample", fctr_lvl_1, fctr_lvl_2))
+        })
       } else {
         # print("plotting dummy graph")
         plot(x=1, y=1, xaxt="n", yaxt="n", xlab="", ylab="", type="n")
@@ -306,7 +310,7 @@
         , x_show_labels = labelFeatures
         , x_show_loado_labels = labelOrthoFeatures
         , x_progress    = progress_action
- , x_crossval_i  = min(7, length(chosen_samples))
+        , x_crossval_i  = min(7, length(chosen_samples))
         , x_env         = calc_env
         )
         if ( is.null(my_cor_cov) ) {
@@ -363,7 +367,7 @@
           , x_show_labels = labelFeatures
           , x_show_loado_labels = labelOrthoFeatures
           , x_progress    = progress_action
-   , x_crossval_i  = min(7, length(chosen_samples))
+          , x_crossval_i  = min(7, length(chosen_samples))
           , x_env         = calc_env
           )
           if ( is.null(my_cor_cov) ) {
@@ -417,7 +421,7 @@
               , x_show_labels = labelFeatures
               , x_show_loado_labels = labelOrthoFeatures
               , x_progress    = progress_action
-       , x_crossval_i  = min(7, length(chosen_samples))
+              , x_crossval_i  = min(7, length(chosen_samples))
               , x_env         = calc_env
               )
               if ( is.null(my_cor_cov) ) {
@@ -463,7 +467,7 @@
             , x_show_labels = labelFeatures
             , x_show_loado_labels = labelOrthoFeatures
             , x_progress    = progress_action
-     , x_crossval_i  = min(7, length(chosen_samples))
+            , x_crossval_i  = min(7, length(chosen_samples))
             , x_env         = calc_env
             )
             if ( is.null(my_cor_cov) ) {