diff recetox_xmsannotator_simple.xml @ 2:c72233720bdc draft

"planemo upload for repository https://github.com/RECETOX/galaxytools/tree/master/tools/recetox-xmsannotator commit e547915248546657de13b91f28e5f4488ae8f7e0"
author recetox
date Thu, 12 Aug 2021 11:12:32 +0000
parents fa85bd6fd713
children b8b1b865c82d
line wrap: on
line diff
--- a/recetox_xmsannotator_simple.xml	Thu Sep 17 08:39:26 2020 +0000
+++ b/recetox_xmsannotator_simple.xml	Thu Aug 12 11:12:32 2021 +0000
@@ -1,32 +1,49 @@
-<tool id="recetox_xmsannotator_simple" name="xmsannotator - simple" version="v2.0">
-    <macros>
-        <import>recetox_xmsannotator_macros.xml</import>
-    </macros>
-
-    <expand macro="requirements"/>
-
-    <command detect_errors="aggressive"><![CDATA[
-        Rscript -e 'annotation <- xmsannotator::simple_annotation(
-                        peaks = arrow::read_feather("$peaks"),
-                        adducts = rhdf5::h5read("$adducts", "adducts"),
-                        metabolites = rhdf5::h5read("$metabolites", "metabolites"),
-                        mz_tolerance = as.double($mass_tolerance)
-                   )'
-                -e 'arrow::write_feather(annotation, "$annotation")'
-    ]]></command>
-
-    <inputs>
-        <param name="peaks" type="data" format="feather" label="Peaks" help="Table of peak intensities."/>
-        <param name="metabolites" type="data" format="h5" label="Metabolite database"/>
-        <param name="adducts" type="data" format="h5" label="Adduct database"/>
-
-        <param name="mass_tolerance" type="float" value="10" min="0" label="Mass tolerance [ppm]" help="Mass tolerance in ppm for database matching."/>
-    </inputs>
-
-    <outputs>
-        <data format="feather" name="annotation"/>
-    </outputs>
-
-    <help><![CDATA[]]></help>
-    <expand macro="citations"/>
-</tool>
\ No newline at end of file
+<tool id="recetox_xmsannotator_simple" name="RECETOX xMSannotator simple" version="@TOOL_VERSION@+galaxy0">
+    <description>annotate peak intensity table</description>
+    <macros>
+        <import>macros.xml</import>
+    </macros>
+    <expand macro="requirements" />
+
+    <command detect_errors="aggressive"><![CDATA[
+        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="inputs"/>
+        <expand macro="tolerance"/>
+    </inputs>
+
+    <outputs>
+        <expand macro="outputs"/>
+    </outputs>
+
+    <help>        
+        <![CDATA[
+        @HELP@
+        ]]>
+    </help>
+
+    <citations>
+        <expand macro="citations"/>
+    </citations>
+</tool>