changeset 4:8bba31f628da draft

planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit 8f2dc8b66666340275cd8967e09c504720528462
author eschen42
date Sun, 04 Mar 2018 14:51:42 -0500
parents 5aaab36bc523
children 50f60f94c034
files w4mcorcov.xml w4mcorcov_calc.R
diffstat 2 files changed, 45 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/w4mcorcov.xml	Mon Jan 15 14:30:15 2018 -0500
+++ b/w4mcorcov.xml	Sun Mar 04 14:51:42 2018 -0500
@@ -1,4 +1,4 @@
-<tool id="w4mcorcov" name="OPLS-DA_Contrasts" version="0.98.6">
+<tool id="w4mcorcov" name="OPLS-DA_Contrasts" version="0.98.7">
 
   <description>OPLS-DA Contrasts of Univariate Results</description>
   
@@ -326,7 +326,7 @@
 Motivation
 ----------
 
-OPLS-DA\ :superscript:`®` and the SIMCA\ :superscript:`®` S-PLOT\ :superscript:`®` (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.
+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.
 
 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).
 
@@ -342,7 +342,7 @@
 
 The purpose of the 'PLS-DA Contrasts' tool is to visualize GC-MS or LC-MS features that are possible biomarkers.
 
-The W4M 'Univariate' tool (Thévenot *et al.*, 2015) adds the results of family-wise corrected pairwise significance-tests as columns of the **variableMetadata** dataset.
+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.
 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.
 
 - 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.
@@ -352,7 +352,7 @@
 
 **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).
 
-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évenot *et al.*, 2015); an appropriate exception would be to visualize contrasts of a specific list of metabolites.
+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[venot *et al.*, 2015); an appropriate exception would be to visualize contrasts of a specific list of metabolites.
 
 It must be stressed that there may be no *single* definitive computational approach to select features that are reliable biomarkers, especially from a small number of samples or experiments.  A few possible choices are:
 
@@ -450,8 +450,8 @@
   | Several plots for each two-projection OPLS-DA analysis:
 
 - (top-left) **correlation-versus-covariance plot** of OPLS-DA results (a work-alike for the S-PLOT, computed using formula in Supplement to Wiklund, *op. cit.*); point-color becomes saturated as the "variable importance in projection to the predictive components" (VIP\ :subscript:`4,p` from Galindo-Prieto *et al.* 2014) ranges from 0.83 and 1.21 (Mehmood *et al.* 2012)
-- (bottom-left) **model-overview plot** for the two projections; grey bars are the correlation coefficient for the fitted data; black bars indicate performance in cross-validation tests (Thévenot, 2017)
-- (top-right) OPLS-DA **scores-plot** for the two projections (Thévenot *et al.*, 2015)
+- (bottom-left) **model-overview plot** for the two projections; grey bars are the correlation coefficient for the fitted data; black bars indicate performance in cross-validation tests (Th]]>&#233;<![CDATA[venot, 2017)
+- (top-right) OPLS-DA **scores-plot** for the two projections (Th]]>&#233;<![CDATA[venot *et al.*, 2015)
 - (bottom-right) OPLS-DA **loadings-plot** for the two projections (*ibid.*)
 
 [OUT] Contrast Correlation-Covarinace data TABULAR
@@ -535,15 +535,15 @@
 
 **Input files**
 
-  +-------------------+-------------------------------------------------------------------------------------------------------------------+
-  | Input File        | Download from URL                                                                                                 |
-  +===================+===================================================================================================================+
-  | Data matrix       | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/test-data/input_dataMatrix.tsv       |
-  +-------------------+-------------------------------------------------------------------------------------------------------------------+
-  | Sample metadata   | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/test-data/input_sampleMetadata.tsv   |
-  +-------------------+-------------------------------------------------------------------------------------------------------------------+
-  | Variable metadata | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/test-data/input_variableMetadata.tsv |
-  +-------------------+-------------------------------------------------------------------------------------------------------------------+
+  +-------------------------------------------------------------------------------------------------------------------+
+  | Download from URL                                                                                                 |
+  +===================================================================================================================+
+  | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/test-data/input_dataMatrix.tsv       |
+  +-------------------------------------------------------------------------------------------------------------------+
+  | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/test-data/input_sampleMetadata.tsv   |
+  +-------------------------------------------------------------------------------------------------------------------+
+  | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/test-data/input_variableMetadata.tsv |
+  +-------------------------------------------------------------------------------------------------------------------+
 
 **Example 1:** Include in the analysis only features identified as pair-wise significant in the Univariate test.
 
@@ -562,6 +562,8 @@
   +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
   | Number of features having extreme loadings | ALL                                                                                                                                    |
   +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
+  | Label feat. having extreme orth. loadings  | Yes                                                                                                                                    |
+  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
   | Output primary table                       | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/test-data/expected_contrast_corcov.tsv                    |
   +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
   | Output salience table                      | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/test-data/expected_contrast_salience.tsv                  |
@@ -586,6 +588,8 @@
   +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
   | Number of features having extreme loadings | 5                                                                                                                                      |
   +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
+  | Label feat. having extreme orth. loadings  | No                                                                                                                                     |
+  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
   | Output primary table                       | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/test-data/expected_contrast_corcov_all.tsv                |
   +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
   | Output salience table                      | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/test-data/expected_contrast_salience_all.tsv              |
@@ -610,6 +614,8 @@
   +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
   | Number of features having extreme loadings | 0                                                                                                                                      |
   +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
+  | Label feat. having extreme orth. loadings  | Yes                                                                                                                                    |
+  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
   | Output primary table                       | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/test-data/expected_contrast_corcov_global.tsv             |
   +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
   | Output salience table                      | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/test-data/expected_contrast_salience_global.tsv           |
@@ -634,6 +640,8 @@
   +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
   | Number of features having extreme loadings | 3                                                                                                                                      |
   +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
+  | Label feat. having extreme orth. loadings  | Yes                                                                                                                                    |
+  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
   | Output primary table                       | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/test-data/expected_contrast_corcov_lohi.tsv               |
   +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
   | Output salience table                      | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/test-data/expected_contrast_salience_lohi.tsv             |
@@ -645,12 +653,16 @@
 Trademarks
 ----------
 
-OPLS-DA\ :superscript:`®`, SIMCA\ :superscript:`®`, and S-PLOT\ :superscript:`®` are registered trademarks of the Umetrics company.  http://umetrics.com/about-us/trademarks
+OPLS-DA, SIMCA, and S-PLOT are registered trademarks of the Umetrics company.  http://umetrics.com/about-us/trademarks
 
 
 Release notes
 -------------
 
+0.98.7
+
+- bug fix: handle case of a treatment level with only one sample.
+
 0.98.6
 
 - bug fix: set 'crossvalI' param (of R function 'ropls::opls') to the number of samples when the there are fewer than seven samples.
@@ -689,7 +701,7 @@
     <citation type="doi">10.3389/fmolb.2016.00026</citation>
     <!-- Sun_2016 Urinary Biomarkers for adolescent idiopathic scoliosis -->
     <citation type="doi">10.1038/srep22274</citation>
-    <!-- Th_venot_2015 Urinary metabolome statistics -->
+    <!-- Thevenot_2015 Urinary metabolome statistics -->
     <citation type="doi">10.1021/acs.jproteome.5b00354</citation>
     <!-- ropls package -->
     <citation type="bibtex"><![CDATA[
--- a/w4mcorcov_calc.R	Mon Jan 15 14:30:15 2018 -0500
+++ b/w4mcorcov_calc.R	Sun Mar 04 14:51:42 2018 -0500
@@ -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) ) {