changeset 9:06c51af11531 draft

planemo upload for repository https://github.com/HegemanLab/w4mcorcov_galaxy_wrapper/tree/master commit fda7ea61f0a082fd0c28730e471e66c92aaa04d0
author eschen42
date Fri, 10 Aug 2018 11:15:31 -0400
parents 342570ad880c
children 9a52306991b3
files w4mcorcov.xml w4mcorcov_lib.R w4mcorcov_salience.R w4mcorcov_wrapper.R
diffstat 4 files changed, 101 insertions(+), 93 deletions(-) [+]
line wrap: on
line diff
--- a/w4mcorcov.xml	Sat Aug 04 17:43:16 2018 -0400
+++ b/w4mcorcov.xml	Fri Aug 10 11:15:31 2018 -0400
@@ -1,4 +1,4 @@
-<tool id="w4mcorcov" name="OPLS-DA_Contrasts" version="0.98.12">
+<tool id="w4mcorcov" name="OPLS-DA_Contrasts" version="0.98.13">
     <description>OPLS-DA Contrasts of Univariate Results</description>
     <macros>
         <xml name="paramPairSigFeatOnly">
@@ -20,8 +20,14 @@
         </xml>
     </macros>
     <requirements>
+        <!--
+        <requirement type="package" version="3.4.1">r-base</requirement>
+        <requirement type="package" version="1.1_4">r-batch</requirement>
+        <requirement type="package" version="1.2.14">bioconductor-ropls</requirement>
+        -->
+        <requirement type="package">r-base</requirement>
         <requirement type="package">r-batch</requirement>
-        <requirement type="package">bioconductor-ropls</requirement>
+        <requirement type="package" version="1.10.0">bioconductor-ropls</requirement>
     </requirements>
     <command detect_errors="aggressive"><![CDATA[
     Rscript '$__tool_directory__/w4mcorcov_wrapper.R'
@@ -54,13 +60,12 @@
   ]]></command>
 
     <inputs>
-        <param name="dataMatrix_in" type="data" format="tabular" label="Data matrix file"
-            help="Features x samples (tabular data - decimal: '.'; missing: NA; mode: numerical; separator: tab character)" />
-        <param name="sampleMetadata_in" type="data" format="tabular" label="Sample metadata file"
-            help="Samples x metadata (tabular data - decimal: '.'; missing: NA; mode: character or numerical; separator: tab character)" />
-        <param name="variableMetadata_in" type="data" format="tabular"
-            label="Variable metadata file (ideally from Univariate)"
-            help="Features x metadata (tabular data - decimal: '.'; missing: NA; mode: character or numerical; separator: tab character)" />
+        <param name="dataMatrix_in" format="tabular" label="Data matrix file" type="data"
+            help="variables &#10006; samples" />
+        <param name="sampleMetadata_in" format="tabular" label="Sample metadata file" type="data"
+            help="sample metadata, one row per sample" />
+        <param name="variableMetadata_in" format="tabular" label="Variable metadata file (ideally from Univariate)"
+            type="data" help="variable metadata, one row per variable" />
         <param name="facC" type="text"
             label="Factor of interest"
             help="REQUIRED - The name of the column of sampleMetadata corresponding to the qualitative variable used to define the contrasts.  Except when the 'Univariate Significance-test' is set to 'none', this also must be a portion of the column names in the variableMetadata file."/>
@@ -149,7 +154,7 @@
         * Wiklund_2008 covariance
         * Galindo_Prieto_2014 VIP for predictive components, VIP[4,p]
         * Galindo_Prieto_2014 VIP for orthogonal components, VIP[4,o]
-        * (When filtering on significance of univariate tests) Significance of test of null hypothesis that there is no difference between the two classes, i.e, the pair-wise test.
+        * When filtering on significance of univariate tests,significance of test of null hypothesis that there is no difference between the two classes, i.e, the pair-wise test.
     -->
     <data name="contrast_corcov" format="tabular" label="${tool.name}_${variableMetadata_in.name}_corcov" />
     <!--
@@ -424,7 +429,7 @@
 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:
 
 - picking features with maximum loadings along the projection parallel to the predictor (loadp),
-- examining extreme values on S-PLOTs (for which covariance is linearly related to loadp),
+- examining extreme values on S-PLOTs
 - examining "variable importance in projection VIP for OPLS-DA" (Galindo-Prieto *et al.* 2014), and
 - examining a feature's "selectivity ratio" (Rajalahti *et al.*, 2009).
 
@@ -600,15 +605,15 @@
 
 **Input files**
 
-  +-------------------------------------------------------------------------------------------------------------------+
-  | 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 |
-  +-------------------------------------------------------------------------------------------------------------------+
+  +-----------------------------------------------------------------------------------------------------------------------------------------------+
+  | Download from URL                                                                                                                             |
+  +===============================================================================================================================================+
+  | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/tools/w4mcorcov/test-data/input_dataMatrix.tsv                   |
+  +-----------------------------------------------------------------------------------------------------------------------------------------------+
+  | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/tools/w4mcorcov/test-data/input_sampleMetadata.tsv               |
+  +-----------------------------------------------------------------------------------------------------------------------------------------------+
+  | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/tools/w4mcorcov/test-data/input_variableMetadata.tsv             |
+  +-----------------------------------------------------------------------------------------------------------------------------------------------+
 
 **Example 1:** Include in the analysis only features identified as pair-wise significant in the Univariate test.
 
@@ -627,80 +632,80 @@
   +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
   | Number of features having extreme loadings | ALL                                                                                                                                    |
   +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
-  | Output primary table                       | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/test-data/expected_contrast_corcov.tsv                    |
+  | Output primary table                       | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/tools/w4mcorcov/test-data/expected_contrast_corcov.tsv    |
   +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
-  | Output salience table                      | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/test-data/expected_contrast_salience.tsv                  |
+  | Output salience table                      | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/tools/w4mcorcov/test-data/expected_contrast_salience.tsv  |
   +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
-  | Output figures PDF                         | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/test-data/expected_contrast_detail.pdf                    |
+  | Output figures PDF                         | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/tools/w4mcorcov/test-data/expected_contrast_detail.pdf    |
   +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
 
 **Example 2:** Include in the analysis only features identified as overall-significant in the Univariate test.  Note that this even includes these features in contrasts where they were not determined to be pair-wise significant in the Univariate test.  Thus, more features are included than in Example 1.
 
-  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
-  | Input Parameter or Result                  | Value                                                                                                                                  |
-  +============================================+========================================================================================================================================+
-  | Factor of interest                         | k10                                                                                                                                    |
-  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
-  | Univariate Significance-Test               | kruskal                                                                                                                                |
-  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
-  | Retain only pairwise-significant features  | No                                                                                                                                     |
-  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
-  | Levels of interest                         | ``*``                                                                                                                                  |
-  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
-  | Level-name matching                        | use wild cards for matching level-names                                                                                                |
-  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
-  | Number of features having extreme loadings | 5                                                                                                                                      |
-  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
-  | 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              |
-  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
-  | Output figures PDF                         | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/test-data/expected_contrast_detail_all.pdf                |
-  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
+  +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
+  | Input Parameter or Result                  | Value                                                                                                                                      |
+  +============================================+============================================================================================================================================+
+  | Factor of interest                         | k10                                                                                                                                        |
+  +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
+  | Univariate Significance-Test               | kruskal                                                                                                                                    |
+  +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
+  | Retain only pairwise-significant features  | No                                                                                                                                         |
+  +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
+  | Levels of interest                         | ``*``                                                                                                                                      |
+  +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
+  | Level-name matching                        | use wild cards for matching level-names                                                                                                    |
+  +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
+  | Number of features having extreme loadings | 5                                                                                                                                          |
+  +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
+  | Output primary table                       | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/tools/w4mcorcov/test-data/expected_contrast_corcov_all.tsv    |
+  +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
+  | Output salience table                      | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/tools/w4mcorcov/test-data/expected_contrast_salience_all.tsv  |
+  +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
+  | Output figures PDF                         | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/tools/w4mcorcov/test-data/expected_contrast_detail_all.pdf    |
+  +--------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------+
 
 **Example 3:** Include all features in the analysis without regard to Univariate testing.  Univariate testing is not even a pre-requisite to using the tool when 'none' is selected for the test.  Thus, more features are included than in Example 2.
 
-  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
-  | Input Parameter or Result                  | Value                                                                                                                                  |
-  +============================================+========================================================================================================================================+
-  | Factor of interest                         | k10                                                                                                                                    |
-  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
-  | Univariate Significance-Test               | none                                                                                                                                   |
-  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
-  | Levels of interest                         | k[12],k[3-4]                                                                                                                           |
-  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
-  | Level-name matching                        | use regular expressions for matching level-names                                                                                       |
-  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
-  | Number of features having extreme loadings | 0                                                                                                                                      |
-  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
-  | 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           |
-  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
-  | Output figures PDF                         | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/test-data/expected_contrast_detail_global.pdf             |
-  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
+  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
+  | Input Parameter or Result                  | Value                                                                                                                                        |
+  +============================================+==============================================================================================================================================+
+  | Factor of interest                         | k10                                                                                                                                          |
+  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
+  | Univariate Significance-Test               | none                                                                                                                                         |
+  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
+  | Levels of interest                         | k[12],k[3-4]                                                                                                                                 |
+  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
+  | Level-name matching                        | use regular expressions for matching level-names                                                                                             |
+  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
+  | Number of features having extreme loadings | 0                                                                                                                                            |
+  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
+  | Output primary table                       | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/tools/w4mcorcov/test-data/expected_contrast_corcov_global.tsv   |
+  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
+  | Output salience table                      | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/tools/w4mcorcov/test-data/expected_contrast_salience_global.tsv |
+  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
+  | Output figures PDF                         | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/tools/w4mcorcov/test-data/expected_contrast_detail_global.pdf   |
+  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
 
 **Example 4:** Analysis of a two-level factor (including all features).  This suppresses the contrasts of "each factor vs. the aggregate of all the others".
 
-  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
-  | Input Parameter or Result                  | Value                                                                                                                                  |
-  +============================================+========================================================================================================================================+
-  | Factor of interest                         | lohi                                                                                                                                   |
-  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
-  | Univariate Significance-Test               | none                                                                                                                                   |
-  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
-  | Levels of interest                         | low,high                                                                                                                               |
-  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
-  | Level-name matching                        | use regular expressions for matching level-names                                                                                       |
-  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
-  | Number of features having extreme loadings | 3                                                                                                                                      |
-  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
-  | 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             |
-  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
-  | Output figures PDF                         | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/test-data/expected_contrast_detail_lohi.pdf               |
-  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------+
+  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
+  | Input Parameter or Result                  | Value                                                                                                                                        |
+  +============================================+==============================================================================================================================================+
+  | Factor of interest                         | lohi                                                                                                                                         |
+  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
+  | Univariate Significance-Test               | none                                                                                                                                         |
+  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
+  | Levels of interest                         | low,high                                                                                                                                     |
+  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
+  | Level-name matching                        | use regular expressions for matching level-names                                                                                             |
+  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
+  | Number of features having extreme loadings | 3                                                                                                                                            |
+  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
+  | Output primary table                       | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/tools/w4mcorcov/test-data/expected_contrast_corcov_lohi.tsv     |
+  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
+  | Output salience table                      | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/tools/w4mcorcov/test-data/expected_contrast_salience_lohi.tsv   |
+  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
+  | Output figures PDF                         | https://raw.githubusercontent.com/HegemanLab/w4mcorcov_galaxy_wrapper/master/tools/w4mcorcov/test-data/expected_contrast_detail_lohi.pdf     |
+  +--------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
 
 
 Trademarks
--- a/w4mcorcov_lib.R	Sat Aug 04 17:43:16 2018 -0400
+++ b/w4mcorcov_lib.R	Fri Aug 10 11:15:31 2018 -0400
@@ -1,3 +1,12 @@
 suppressMessages(library(batch))
 # suppressMessages(library(foreach))
 suppressMessages(library(ropls))
+suppressMessages(library(methods))
+
+# cat("Installed packages:",stderr())
+# write.table((installed.packages(.Library, priority = "high"))[, c(1,3:5)], stderr())
+# cat("Loaded packages:",stderr())
+# write(.packages(), stderr())
+
+print(sessionInfo())
+
--- a/w4mcorcov_salience.R	Sat Aug 04 17:43:16 2018 -0400
+++ b/w4mcorcov_salience.R	Fri Aug 10 11:15:31 2018 -0400
@@ -61,8 +61,8 @@
   )
   rcvOfFeatureBySampleClassLevel[is.nan(rcvOfFeatureBySampleClassLevel)] <- max(9999,max(rcvOfFeatureBySampleClassLevel, na.rm = TRUE)) 
 
-  # "For each feature, 'select max(median_feature_intensity) from feature'."
-  maxApplyMedianOfFeatureBySampleClassLevel <- sapply(
+  # "For each feature, 'select max(max_feature_intensity) from feature'."
+  maxApplyMaxOfFeatureBySampleClassLevel <- sapply(
       X = 1:n_features
     , FUN = function(i) {
         match(
@@ -84,19 +84,19 @@
     # the feature name
     feature = features
     # the name (or factor-level) of the class-level with the highest median intensity for the feature
-  , max_level = medianOfFeatureBySampleClassLevel[maxApplyMedianOfFeatureBySampleClassLevel,1]
+  , max_level = medianOfFeatureBySampleClassLevel[maxApplyMaxOfFeatureBySampleClassLevel,1]
     # the median intensity for the feature and the level max_level
   , max_median = sapply(
         X = 1:n_features
       , FUN = function(i) {
-          maxOfFeatureBySampleClassLevel[maxApplyMedianOfFeatureBySampleClassLevel[i], 1 + i]
+          maxOfFeatureBySampleClassLevel[maxApplyMaxOfFeatureBySampleClassLevel[i], 1 + i]
         }
     )
     # the coefficient of variation (expressed as a proportion) for the intensity for the feature and the level max_level
   , max_rcv = sapply(
         X = 1:n_features
       , FUN = function(i) {
-          rcvOfFeatureBySampleClassLevel[maxApplyMedianOfFeatureBySampleClassLevel[i], i]
+          rcvOfFeatureBySampleClassLevel[maxApplyMaxOfFeatureBySampleClassLevel[i], i]
         }
     )
     # the mean of the medians of intensity for all class-levels for the feature
--- a/w4mcorcov_wrapper.R	Sat Aug 04 17:43:16 2018 -0400
+++ b/w4mcorcov_wrapper.R	Fri Aug 10 11:15:31 2018 -0400
@@ -55,12 +55,6 @@
 source(paste(script.dir, "w4mcorcov_salience.R", sep="/")) 
 source(paste(script.dir, "w4mcorcov_calc.R", sep="/")) 
 source(paste(script.dir, "w4mcorcov_output.R", sep="/")) 
-#source("w4mcorcov_lib.R")
-#source("w4mcorcov_util.R")
-#source("w4mcorcov_input.R")
-#source("w4mcorcov_salience.R")
-#source("w4mcorcov_calc.R")
-#source("w4mcorcov_output.R")
 
 ## log file
 ##---------