Mercurial > repos > recetox > recetox_xmsannotator_simple
changeset 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 |
files | macros.xml recetox_xmsannotator_macros.xml recetox_xmsannotator_simple.xml tool-data/recetox_metabolite_databases.loc.sample tool_data_table_conf.xml.sample |
diffstat | 5 files changed, 106 insertions(+), 79 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/macros.xml Thu Aug 12 11:12:32 2021 +0000 @@ -0,0 +1,57 @@ +<macros> + <token name="@TOOL_VERSION@">0.9.0</token> + <xml name="requirements"> + <requirements> + <requirement type="package" version="0.9.0">r-recetox-xmsannotator</requirement> + </requirements> + </xml> + + <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> + + <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> + <token name="@HELP@"> + <![CDATA[ + Annotate the peak intensity table (e.g. from an apLCMS run) with compounds from the compounds database + using advanced methods. + + 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. + ]]> + </token> + <xml name="citations"> + <citation type="doi">10.1021/acs.analchem.6b01214</citation> + </xml> +</macros>
--- a/recetox_xmsannotator_macros.xml Thu Sep 17 08:39:26 2020 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -<macros> - <xml name="requirements"> - <requirements> - <requirement type="package">recetox_datatypes</requirement> - <container type="docker">registry.gitlab.ics.muni.cz:443/recetox/mass-spectrometry/xmsannotator:v2.0</container> - </requirements> - </xml> - - <xml name="peaks"> - <param name="peaks" type="data" format="peak_table.feather" label="Peak intensity table"/> - </xml> - - <xml name="metabolites"> - <!-- <param name="metabolites" type="select" label="Metabolite database"> - <options from_data_table="recetox_metabolite_databases"> - <column name="name" index="2"/> - <column name="value" index="3"/> - </options> - </param> --> - <param name="metabolites" type="data" format="metabolites.h5" label="Metabolite database"/> - </xml> - - <xml name="mz_tolerance"> - <param name="mz_tolerance" type="float" value="10" min="0" label="Mass tolerance [ppm]" help="Mass tolerance in ppm for database matching."/> - </xml> - - <xml name="annotation_output"> - <data format="annotated_peak_list.feather" name="annotation"/> - </xml> - - <xml name="citations"> - <citations> - <citation type="doi">10.1021/acs.analchem.6b01214</citation> - </citations> - </xml> -</macros> \ No newline at end of file
--- 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>
--- a/tool-data/recetox_metabolite_databases.loc.sample Thu Sep 17 08:39:26 2020 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -# This file has the format (white space characters are -# TAB characters): -# -# <value> <name> <date> <path> -# \ No newline at end of file
--- a/tool_data_table_conf.xml.sample Thu Sep 17 08:39:26 2020 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -<tables> - <table name="recetox_metabolite_databases" comment_char="#"> - <columns>value, date, name, path</columns> - <file path="tool-data/recetox_metabolite_databases.loc" /> - </table> -</tables> \ No newline at end of file