changeset 4:69e0da4703b5 draft

"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/ramclustr commit b514d9bf91b62bb06d39e6ceee21d8f18876e12b"
author recetox
date Fri, 04 Feb 2022 08:31:26 +0000
parents 211cd88b5148
children 10ded21d47c0
files macros.xml ramclustr.xml ramclustr_wrapper.R test-data/gc-ramclustr-define-experiment.csv test-data/lc-ramclustr-define-experiment.csv test-data/test1_ramclustObj_xcms_1.rdata
diffstat 6 files changed, 129 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/macros.xml	Fri Jan 28 16:25:33 2022 +0000
+++ b/macros.xml	Fri Feb 04 08:31:26 2022 +0000
@@ -158,21 +158,7 @@
                    help="CSV with sample names (or indices, currently not handled) on rows and columns with: batch
                    number ('batch'), position in sequence ('order') and whether it is a qc sample or not
                    ('qc' with true/false OR 'sampleType' with 'sample/qc/blank')."/>
-            <!-- <param label="ExpDes" name="ExpDes" type="data" format="RData" optional="true" help=" an R object created by R ExpDes object: data used for record keeping and labelling msp spectral output" /> -->
-        </section>
-    </xml>
-
-    <xml name="parameters_define_experiment">
-        <section name="define_experiment" title="Define Experiment" expanded="false">
-            <param label="Experiment" name="experiment" type="text" help="Experiment name, no spaces"/>
-            <param label="Species" name="species" type="text" help="Species name"/>
-            <param label="Sample" name="sample" type="text" help="Sample type"/>
-            <param label="Contributor" name="contributor" type="text"
-                   help="Individual and/or organizational affiliation"/>
-            <param label="Platform" name="platform" type="select" display="radio" help="Platform">
-                <option value="GC-MS" selected="true">GC-MS</option>
-                <option value="LC-MS">LC-MS</option>
-            </param>
+             <param label="Experimental design" name="ExpDes" type="data" format="csv" optional="true" help="Definition of experimental design in CSV format." />
         </section>
     </xml>
 
@@ -224,11 +210,13 @@
                     For documentation on the tool see https://github.com/cbroeckl/RAMClustR/blob/master/vignettes/RAMClustR.Rmd
 
                 Upstream Tools
-                    +-------+----------------------+----------------------+------------+
-                    | Name  | Output File          | Format               | Parameter  |
-                    +=======+======================+======================+============+
-                    | xcms  | xset.fillPeaks.RData | rdata.xcms.fillpeaks | xcmsObj    |
-                    +-------+----------------------+----------------------+------------+
+                    +------------------------------+-------------------------------+----------------------+---------------------+
+                    | Name                         | Output File                   | Format               | Parameter           |
+                    +==============================+===============================+======================+=====================+
+                    | xcms                         | xset.fillPeaks.RData          | rdata.xcms.fillpeaks | xcmsObj             |
+                    +------------------------------+-------------------------------+----------------------+---------------------+
+                    | RAMClustR define experiment  | Table with experiment details | csv                  | Experimental design |
+                    +------------------------------+-------------------------------+----------------------+---------------------+
 
                     The tool takes an **xcmsSet** object as input and extracts all relevant information.
 
@@ -302,4 +290,18 @@
         is poisitive or negative ionization mode, EI or ESI, LC-MS GC-MS or CE-MS, in-source fragment or complex
         adduction event, and predictable or unpredictable signals.
     </token>
+
+        <token name="@HELP_experiment@">
+        <![CDATA[
+            Create an Experimental Design specification for RAMClustR experiment.
+
+            Downstream Tools
+                +-----------+-----------------------+--------+
+                | Name      | Output File           | Format |
+                +===========+=======================+========+
+                | RAMClustR | Experiment definition | csv    |
+                +-----------+-----------------------+--------+
+
+        ]]>
+    </token>
 </macros>
--- a/ramclustr.xml	Fri Jan 28 16:25:33 2022 +0000
+++ b/ramclustr.xml	Fri Feb 04 08:31:26 2022 +0000
@@ -1,4 +1,4 @@
-<tool id="ramclustr" name="RAMClustR" version="@TOOL_VERSION@+galaxy0">
+<tool id="ramclustr" name="RAMClustR" version="@TOOL_VERSION@+galaxy1">
     <macros>
         <import>macros.xml</import>
     </macros>
@@ -60,6 +60,9 @@
                     #if $filetype.metadata.batch_order_qc
                         metadata_file = "${filetype.metadata.batch_order_qc}",
                     #end if
+                    #if $filetype.metadata.ExpDes
+                        exp_design = "${filetype.metadata.ExpDes}"
+                    #end if
                 ),
             "$result", "$method_metadata", $filetype.required.merge_msp, "$spec_abundance")
         </configfile>
@@ -96,9 +99,10 @@
         <test><!-- TEST 1 -->
             <param name="type_choice" value="xcms"/>
             <param name="input_xcms" value="test1_xcmsObj_1.rdata.xcms.fillpeaks" ftype="rdata.xcms.fillpeaks"/>
+            <param name="ExpDes" value="lc-ramclustr-define-experiment.csv" ftype="csv"/>
             <output name="result" file="test1_ramclustObj_xcms_1.rdata" ftype="RData" compare="sim_size" delta="200"/>
             <output_collection name="mass_spectra" type="list">
-                <element name="fill" file="test1_fill_xcms_1.msp" ftype="msp"/>
+                <element name="experiment_lc" file="test1_fill_xcms_1.msp" ftype="msp"/>
             </output_collection>
             <output name="method_metadata" file="test1_metadata_xcms_1.txt" ftype="txt"/>
             <output name="spec_abundance" file="test1_spec_abundance_xcms_1.csv" ftype="csv" compare="sim_size" delta="100"/>
--- a/ramclustr_wrapper.R	Fri Jan 28 16:25:33 2022 +0000
+++ b/ramclustr_wrapper.R	Fri Feb 04 08:31:26 2022 +0000
@@ -10,6 +10,11 @@
     write.csv(ramclustr_obj$SpecAbund, file = output_spec_abundance, row.names = TRUE)
 }
 
+load_experiment_definition <- function(filename) {
+    experiment <- RAMClustR::defineExperiment(csv = filename)
+    return(experiment)
+}
+
 read_metadata <- function(filename) {
     data <- read.csv(filename, header = TRUE, stringsAsFactors = FALSE)
 
@@ -48,7 +53,8 @@
     st = NULL,
     maxt = NULL,
     fftempdir = NULL,
-    metadata_file = NULL
+    metadata_file = NULL,
+    exp_design = NULL
 ) {
     obj <- load(input_xcms)
 
@@ -63,6 +69,12 @@
         qc <- metadata$qc
     }
 
+    experiment <- NULL
+
+    if (!is.null(exp_design)) {
+        experiment <- load_experiment_definition(exp_design)
+    }
+
     x <- RAMClustR::ramclustR(
         xcmsObj = xdata,
         st = st,
@@ -86,7 +98,8 @@
         replace.zeros = replace_zeros,
         batch = batch,
         order = order,
-        qc = qc
+        qc = qc,
+        ExpDes = experiment
         )
     return(x)
 }
@@ -115,7 +128,8 @@
     st = NULL,
     maxt = NULL,
     fftempdir = NULL,
-    metadata_file = NULL
+    metadata_file = NULL,
+    exp_design = NULL
 ) {
     if (!file.exists(idmsms))
         idmsms <- NULL
@@ -131,6 +145,12 @@
         qc <- metadata$qc
     }
 
+    experiment <- NULL
+
+    if (!is.null(exp_design)) {
+        experiment <- load_experiment_definition(exp_design)
+    }
+
     x <- RAMClustR::ramclustR(
         ms = ms,
         idmsms = idmsms,
@@ -158,7 +178,8 @@
         replace.zeros = replace_zeros,
         batch = batch,
         order = order,
-        qc = qc
+        qc = qc,
+        ExpDes = experiment
         )
         return(x)
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/gc-ramclustr-define-experiment.csv	Fri Feb 04 08:31:26 2022 +0000
@@ -0,0 +1,38 @@
+parameter,Value,Description
+,,
+Experimental Design,,
+Experiment,experiment_gc,"Experiment name, no spaces."
+Species,mus musculus,Genus species from which samples are derived.
+Sample,serum,"Type of sample (e.g., serum, leaf)."
+Contributer,recetox,Your or your PI's name.
+platform,GC-MS,Either GC-MS or LC-MS.
+,,
+GC-MS,,
+chrominst,ISQ 7000,Model of LC/GC instrument.
+msinst,ISQ7K-VPI,Model of MS instrument.
+column,These columns enable analysis of ppm levels of amines without column priming,Column description.
+InletTemp,33,Temperature of inlet.
+TransferTemp,23,Temperature of GC to MS transfer line.
+mstype,QTOF,"Type of mass spectrometer (one of QQQ, TOF, QTOF, Orbi, Q)."
+msmode,positive,Positive or negative ion mode.
+ionization,AP,"Ionization (EI, AP, or CI)."
+msscanrange,100,Scan range used for acquisition.
+scantime,0.2,Time for each full scan spectrum (e.g. 0.2 seconds).
+deriv,TMS,"Derivitization (TMS, TBDMS, or None)."
+MSlevs,1.0,Number of levels of energy acquired - 1 typically.
+,,
+LC-MS,,
+chrominst,fill,Model of LC/GC instrument.
+msinst,fill,Model of MS instrument.
+column,fill,Column description.
+solvA,fill,Solvent A composition.
+solvB,fill,Solvent B composition.
+CE1,fill,Collision energy of acquisition of MS data.
+CE2,fill,Collision energy of acquisition for MSe/idMSMS data (when applicable).
+mstype,fill,"Type of mass spectrometer (one of QQQ, TOF, QTOF, Orbi, Q)."
+msmode,fill,Positive or negative ion mode.
+ionization,fill,"Ionization (EI, AP, or CI)."
+colgas,fill,Gas used for collisional dissociation.
+msscanrange,fill,Scan range used for acquisition.
+conevol,fill,Cone voltage used for acquisition.
+MSlevs,fill,Number of levels of energy acquired - 1 typically.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/lc-ramclustr-define-experiment.csv	Fri Feb 04 08:31:26 2022 +0000
@@ -0,0 +1,38 @@
+parameter,Value,Description
+,,
+Experimental Design,,
+Experiment,experiment_lc,"Experiment name, no spaces."
+Species,mus musculus,Genus species from which samples are derived.
+Sample,serum,"Type of sample (e.g., serum, leaf)."
+Contributer,recetox,Your or your PI's name.
+platform,LC-MS,Either GC-MS or LC-MS.
+,,
+GC-MS,,
+chrominst,fill,Model of LC/GC instrument.
+msinst,fill,Model of MS instrument.
+column,fill,Column description.
+InletTemp,fill,Temperature of inlet.
+TransferTemp,fill,Temperature of GC to MS transfer line.
+mstype,fill,"Type of mass spectrometer (one of QQQ, TOF, QTOF, Orbi, Q)."
+msmode,fill,Positive or negative ion mode.
+ionization,fill,"Ionization (EI, AP, or CI)."
+msscanrange,fill,Scan range used for acquisition.
+scantime,fill,Time for each full scan spectrum (e.g. 0.2 seconds).
+deriv,fill,"Derivitization (TMS, TBDMS, or None)."
+MSlevs,fill,Number of levels of energy acquired - 1 typically.
+,,
+LC-MS,,
+chrominst,UltiMateX 3000 BioRS System,Model of LC/GC instrument.
+msinst,FSN04-10000,Model of MS instrument.
+column,These columns enable analysis of ppm levels of amines without column priming,Column description.
+solvA,H20,Solvent A composition.
+solvB,CO2,Solvent B composition.
+CE1,50,Collision energy of acquisition of MS data.
+CE2,100,Collision energy of acquisition for MSe/idMSMS data (when applicable).
+mstype,Q,"Type of mass spectrometer (one of QQQ, TOF, QTOF, Orbi, Q)."
+msmode,negative,Positive or negative ion mode.
+ionization,ESI,"Ionization (EI, AP, or CI)."
+colgas,He,Gas used for collisional dissociation.
+msscanrange,1000,Scan range used for acquisition.
+conevol,12,Cone voltage used for acquisition.
+MSlevs,1.0,Number of levels of energy acquired - 1 typically.
Binary file test-data/test1_ramclustObj_xcms_1.rdata has changed