changeset 3:412d8bb4b54d draft

"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/xmsannotator commit 339f3b1b1243f353dd3ed115ac66320fdd2d2b68"
author recetox
date Mon, 14 Dec 2020 03:33:21 +0000
parents 041052875af0
children cd0729b7c3dc
files xmsannotator_macros.xml xmsannotator_simple.xml
diffstat 2 files changed, 66 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/xmsannotator_macros.xml	Thu Oct 08 00:41:12 2020 +0000
+++ b/xmsannotator_macros.xml	Mon Dec 14 03:33:21 2020 +0000
@@ -1,18 +1,44 @@
 <macros>
     <token name="@TOOL_VERSION@">1.3.2</token>
-    <token name="@DOCKER_IMAGE@">recetox/xmsannotator:1.3.2-recetox0</token>
+    <token name="@DOCKER_IMAGE@">recetox/xmsannotator:1.3.2-recetox2</token>
 
-    <xml name="annotation">
-        <param name="peaks" type="data" format="h5" label="Peaks" help="Peaks to annotate."/>
-        <param name="adducts" type="data" format="h5" label="Adduct database"/>
-        <param name="compounds" type="data" format="h5" label="Compound database"/>
+    <xml name="inputs">
+        <param name="peak_table" type="data" format="csv,h5,parquet">
+            <label>Peak table</label>
+            <help><![CDATA[
+                A peak-intensity table such as outputted from apLCMS.
+                The file is required to contain the fields <em>mz</em> and <em>rt</em>.
+            ]]></help>
+        </param>
+        <param name="compound_table" type="data" format="csv,parquet">
+            <label>Compound database</label>
+            <help><![CDATA[
+                Database of compounds according to which the annotation is performed.
+                The database is required to contain the fields <em>compound_id</em>, <em>monoisotopic_mass</em>, and <em>molecular_formula</em>.
+            ]]></help>
+        </param>
+        <param name="adduct_table" type="data" format="csv,parquet" optional="true">
+            <label>Adduct database (optional)</label>
+            <help><![CDATA[
+                Database of adduct which is combined with the database of compound to form a molecule-adduct pairs.
+                The database is required to contain <em>adduct</em>, <em>charge</em>, <em>mass</em>, and <em>n_molecules</em>.
+            ]]></help>
+        </param>
+    </xml>
 
-        <param name="mz_tolerance_ppm" type="float" value="5" min="0" label="Mass tolerance [ppm]" help="Mass tolerance in ppm for database matching."/>
+    <xml name="outputs">
+        <data name="annotation_parquet" format="parquet"/>
+    </xml>
+
+    <xml name="tolerance">
+        <param name="mass_tolerance_ppm" type="integer" min="0" value="5">
+            <label>Mass tolerance [ppm]</label>
+            <help>Mass tolerance in ppm for database matching.</help>
+        </param>
+        <yield/>
     </xml>
 
     <xml name="citations">
-        <citations>
-            <citation type="doi">10.1021/acs.analchem.6b01214</citation>
-        </citations>
+        <citation type="doi">10.1021/acs.analchem.6b01214</citation>
     </xml>
 </macros>
--- a/xmsannotator_simple.xml	Thu Oct 08 00:41:12 2020 +0000
+++ b/xmsannotator_simple.xml	Mon Dec 14 03:33:21 2020 +0000
@@ -1,4 +1,4 @@
-<tool id="xmsannotator_simple" name="xMSannotator (simple)" version="@TOOL_VERSION@+galaxy0">
+<tool id="xmsannotator_simple" name="xMSannotator (simple)" version="@TOOL_VERSION@+galaxy2">
     <macros>
         <import>xmsannotator_macros.xml</import>
     </macros>
@@ -8,29 +8,46 @@
     </requirements>
 
     <command detect_errors="aggressive"><![CDATA[
-        Rscript -e 'annotation <- xmsannotator::simple_annotation(
-                        peaks = xmsannotator::load_hdf("$peaks", "peaks"),
-                        adducts = xmsannotator::load_hdf("$adducts", "adducts"),
-                        compounds = xmsannotator::load_hdf("$compounds", "compounds"),
-                        mass_tolerance = 1e-6 * $mz_tolerance_ppm
-                   )'
-                -e 'xmsannotator::save_hdf("$annotation", "annotation", annotation)'
+        Rscript $wrapper
     ]]></command>
 
+    <configfiles>
+        <configfile name="wrapper"><![CDATA[
+            library(xmsannotator)
+
+            annotation <- simple_annotation(
+            #if $peak_table.is_of_type("h5")
+                peak_table = load_peak_table_hdf("${peak_table}"),
+            #elif $peak_table.is_of_type("parquet")
+                peak_table = load_peak_table_parquet("${peak_table}"),
+            #end if
+                adduct_table = load_adduct_table_parquet("${adduct_table}"),
+                compound_table = load_compound_table_parquet("${compound_table}"),
+                mass_tolerance = 1e-6 * ${mass_tolerance_ppm}
+            )
+
+            save_parquet(data = annotation, file = "${annotation_parquet}")
+        ]]></configfile>
+    </configfiles>
+
     <inputs>
-        <expand macro="annotation"/>
+        <expand macro="inputs"/>
+        <expand macro="tolerance"/>
     </inputs>
 
     <outputs>
-        <data format="h5" name="annotation"/>
+        <expand macro="outputs"/>
     </outputs>
 
     <help><![CDATA[
-        Annotate the peak intensity table (such as outputted from apLCMS) with metabolites from the metabolite database.
+        Annotate the peak intensity table (such as outputted from apLCMS) with compounds from the compounds database.
 
-        The annotation process generates all possible metabolite-adduct pairs from the metabolite and adduct databases and matches those pairs to the measured peaks.
-        A metabolite-adduct pair is pronounced as a match to the peak when the difference of their masses are withing some tolerance.
+        The annotation process generates all possible compound-adduct pairs and matches those pairs to the measured
+        peaks. A compound-adduct pair is pronounced as a match to a certain peak when the difference of their masses are
+        withing some tolerance.
     ]]></help>
 
-    <expand macro="citations"/>
+    <citations>
+        <expand macro="citations"/>
+    </citations>
 </tool>