diff hamronize_tool.xml @ 4:cbfa52c8f1ef draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/hamronization commit b49fc153425676a82e77dec090676403112bcbe6
author iuc
date Tue, 05 Mar 2024 19:47:12 +0000
parents e13b801516dd
children
line wrap: on
line diff
--- a/hamronize_tool.xml	Fri Feb 09 21:27:18 2024 +0000
+++ b/hamronize_tool.xml	Tue Mar 05 19:47:12 2024 +0000
@@ -1,166 +1,306 @@
-<tool id="hamronize_tool" name="hamronize" version="@TOOL_VERSION@+galaxy1" profile="@PROFILE@">
-    <description> parse multiple Antimicrobial Resistance Analysis Reports into a common data structure</description>
+<tool id="hamronize_tool" name="hAMRonize" version="@TOOL_VERSION@+galaxy0" profile="@PROFILE@">
+    <description>Antimicrobial Resistance Analysis Reports into a common data structure</description>
     <macros>
         <import>macros.xml</import>
     </macros>
     <expand macro="bio_tools"/>
     <expand macro="requirements" />
     <expand macro="version_command" />
+    <command detect_errors="exit_code"><![CDATA[
+#import re
 
-    <command detect_errors="exit_code"><![CDATA[
-        #set $extra_2_params = str("ariba,srax,csstar,groot").split(",")
-        #set $extra_1_param = $extra_2_params + str("amrfinderplus,rgi,resfinder4,deeparg,kmerresistance,srst2,amrplusplus,resfarms").split(",")
-        
-        hamronize 
-        ${select_tool.tool}
-        --analysis_software_version '${analysis_software_version}'
-        --reference_database_version '${reference_database_version}'
-        --format ${output_format}
-        #if $output_format == "tsv" 
-            --output hamronized.tsv
+#set $no_origin_info_tools = ['mykrobe', 'tbprofiler']
+#set $origin_tools = ['abricate', 'amrfinderplus', 'fargene', 'srst2', 'staramr']
+#set $in_fname_tools = ['amrfinderplus', 'amrplusplus', 'ariba', 'csstar', 'deeparg', 'fargene', 'groot', 'kmerresistance', 'pointfinder', 'resfarms', 'rgi', 'srax', 'srst2']
+#set $ref_db_name_tools = ['ariba', 'csstar', 'groot', 'srax']
+#set $input_file_name = re.sub('[^\s\w\-\.]', '_', str($input.report.element_identifier))
+
+hamronize 
+    '$input.tool'
+    '$input.report'
+    --format '$format'
+    --output '$output'
+#if $input.tool not in $no_origin_info_tools
+    #if $input.tool in $origin_tools and $input.origin.origin
+        #if $input.origin.origin
+    --analysis_software_version '$input.report.tool_version'
         #else
-            --output hamronized.json
-        #end if 
-        
-        #if $select_tool.tool in $extra_1_param
-            --input_file_name $select_tool.input_file_name
+    --analysis_software_version '$input.origin.analysis_software_version'
         #end if
-        
-        #if $select_tool.tool in $extra_2_params
-            --reference_database_id $select_tool.reference_database_id
-        #end if
-        
-        $report
+    --reference_database_version '$input.reference_database_version'
+    #else
+    --analysis_software_version '$input.analysis_software_version'
+    --reference_database_version '$input.reference_database_version'
+    #end if
+#end if
+#if $input.tool in $in_fname_tools
+    #if str($input.input_file_name) != ''
+    --input_file_name '$input.input_file_name'
+    #else
+    --input_file_name '$input_file_name'
+    #end if
+#end if
+#if $input.tool in $ref_db_name_tools
+    --reference_database_name '$input.reference_database_name'
+#end if
     ]]>    </command>
-
     <inputs>
-        <param name="report" type="data" format="txt,tabular" label="Report file"/>
-        <conditional name="select_tool">
+        <conditional name="input">
             <param name="tool" type="select" label="Tool">
-                <option value="abricate" selected="true">abricate</option>
-                <option value="amrfinderplus">amrfinderplus</option>
-                <option value="ariba">ariba</option>
-                <option value="rgi">rgi</option>
-                <option value="resfinder">resfinder</option>
-                <option value="resfinder4">resfinder4</option>
-                <option value="srax">srax</option>
-                <option value="deeparg">deeparg</option>
-                <option value="kmerresistance">kmerresistance</option>
-                <option value="srst2">srst2</option>
-                <option value="staramr">staramr</option>
-                <option value="csstar">csstar</option>
-                <option value="amrplusplus">amrplusplus</option>
-                <option value="resfams">resfams</option>
-                <option value="groot">groot</option>
+                <option value="abricate" selected="true">ABRicate</option>
+                <option value="amrfinderplus">AMRFinderPlus</option>
+                <option value="amrplusplus">AMRplusplus</option>
+                <option value="ariba">ARIBA</option>
+                <option value="csstar">c-SSTAR</option>
+                <option value="deeparg">DeepARG</option>
+                <option value="fargene">fARGene</option>
+                <option value="groot">GROOT</option>
+                <option value="kmerresistance">KmerResistance</option>
+                <option value="mykrobe">Mykrobe</option>
+                <option value="pointfinder">PointFinder</option>
+                <option value="resfams">ResFams</option>
+                <option value="resfinder">ResFinder</option>
+                <option value="rgi">RGI</option>
+                <option value="srax">SraX</option>
+                <option value="srst2">SRST2</option>
+                <option value="staramr">StarAMR</option>
+                <option value="tbprofiler">TBProfiler</option>
             </param>
-            <when value="abricate" />
-            <when value="resfinder" />
-            <when value="staramr" />
+            <when value="abricate">
+                <expand macro="report" format="tabular" label="ABRicate Report file"/>
+                <expand macro="origin" software="ABRicate"/>
+            </when>
             <when value="amrfinderplus">
+                <expand macro="report" format="tabular" label="AMRFinderPlus Report file"/>
                 <expand macro="input_file_name"/>
+                <expand macro="origin" software="AMRFinderPlus"/>
+            </when>
+            <when value="amrplusplus">
+                <expand macro="report" format="tabular" label="AMRplusplus gene report"/>
+                <expand macro="input_file_name"/>
+                <expand macro="analysis_software_version" software="AMRplusplus"/>
+                <expand macro="reference_database_version"/>
             </when>
             <when value="ariba">
-                <expand macro="input_file_name"/>
-                <expand macro="reference_database_id"/>
-            </when>
-            <when value="rgi">
-                <expand macro="input_file_name"/>
-            </when>
-            <when value="resfinder4">
-                <expand macro="input_file_name"/>
-            </when>
-            <when value="srax">
+                <expand macro="report" format="tabular" label="ARIBA output"/>
                 <expand macro="input_file_name"/>
-                <expand macro="reference_database_id"/>
-            </when>
-            <when value="deeparg">
-                <expand macro="input_file_name"/>
-            </when>
-            <when value="kmerresistance">
-                <expand macro="input_file_name"/>
-            </when>
-            <when value="srst2">
-                <expand macro="input_file_name"/>
+                <expand macro="analysis_software_version" software="ARIBA"/>
+                <expand macro="reference_database_version"/>
+                <expand macro="reference_database_name" software="ARIBA"/>
             </when>
             <when value="csstar">
+                <expand macro="report" format="tabular" label="c-SSTAR output"/>
                 <expand macro="input_file_name"/>
-                <expand macro="reference_database_id"/>
+                <expand macro="analysis_software_version" software="c-SSTAR" />
+                <expand macro="reference_database_version"/>
+                <expand macro="reference_database_name" software="c-SSTAR"/>
+            </when>
+            <when value="deeparg">
+                <expand macro="report" format="tabular" label="DeepARG output"/>
+                <expand macro="input_file_name"/>
+                <expand macro="analysis_software_version" software="DeepARG"/>
+            </when>
+            <when value="fargene">
+                <expand macro="report" format="txt" label="fARGene HMM Search Result"/>
+                <expand macro="input_file_name"/>
+                <expand macro="origin" software="fARGene"/>
             </when>
-            <when value="amrplusplus">
+            <when value="groot">
+                <expand macro="report" format="tabular" label="GROOT output"/>
+                <expand macro="input_file_name"/>
+                <expand macro="analysis_software_version" software="GROOT" />
+                <expand macro="reference_database_version"/>
+                <expand macro="reference_database_name" software="GROOT"/>
+            </when>
+            <when value="kmerresistance">
+                <expand macro="report" format="tabular" label="KmerResistance gene report"/>
                 <expand macro="input_file_name"/>
+                <expand macro="analysis_software_version" software="KmerResistance"/>
+                <expand macro="reference_database_version"/>
+            </when>
+            <when value="mykrobe">
+                <expand macro="report" format="json" label="Mykrobe Report file"/>
+            </when>
+            <when value="pointfinder">
+                <param name="report" type="data" format="txt" label="PointFinder results"/>
+                <expand macro="input_file_name"/>
+                <expand macro="analysis_software_version" software="PointFinder"/>
+                <expand macro="reference_database_version"/>
             </when>
             <when value="resfams">
+                <param name="report" type="data" format="txt" label="ResFams results"/>
                 <expand macro="input_file_name"/>
+                <expand macro="analysis_software_version" software="ResFams"/>
+                <expand macro="reference_database_version"/>
+            </when>
+            <when value="resfinder">
+                <param name="report" type="data" format="tabular" label="ResFinder results"/>
+                <expand macro="input_file_name"/>
+                <expand macro="analysis_software_version" software="ResFinder"/>
+                <expand macro="reference_database_version"/>
+            </when>
+            <when value="rgi">
+                <param name="report" type="data" format="txt" label="RGI output"/>
+                <expand macro="input_file_name"/>
+                <expand macro="analysis_software_version" software="RGI"/>
+                <expand macro="reference_database_version"/>
             </when>
-            <when value="groot">
+            <when value="srax">
+                <param name="report" type="data" format="tabular" label="SraX detected ARGs"/>
                 <expand macro="input_file_name"/>
-                <expand macro="reference_database_id"/>
+                <expand macro="analysis_software_version" software="SraX"/>
+                <expand macro="reference_database_version"/>
+                <expand macro="reference_database_name" software="SraX"/>
+            </when>
+            <when value="srst2">
+                <expand macro="report" format="tabular" label="SRST2 report"/>
+                <expand macro="input_file_name"/>
+                <expand macro="origin" software="SRST2"/>
+            </when>
+            <when value="staramr">
+                <expand macro="report" format="tabular" label="StarAMR ResFinder output"/>
+                <expand macro="origin" software="StarAMR"/>
+            </when>
+            <when value="tbprofiler">
+                <param name="report" type="data" format="tabular" label="TBProfiler output"/>
             </when>
         </conditional>
-        <param name="output_format" type="select" label="Output format" multiple="false" display="radio">
-            <option value="tsv" selected="True">tsv</option>
-            <option value="json">json</option>
+        <param argument="--format" type="select" label="Output format">
+            <option value="tsv" selected="True">Tabular</option>
+            <option value="json">JSON</option>
         </param>
-        <param name="analysis_software_version" type="text" label="Analysis software version"></param>
-        <param name="reference_database_version" type="text" label="Reference database version"></param>
     </inputs>
-
     <outputs>
-        <data format="tabular" name="output_tsv" label="${tool.name} on ${on_string}: Table" from_work_dir="hamronized.tsv">
-            <filter>output_format == "tsv"</filter>
-        </data>
-        <data format="json" name="output_json" label="${tool.name} on ${on_string}: JSON" from_work_dir="hamronized.json">
-            <filter>output_format == "json"</filter>
+        <data name="output" format="tabular" label="${tool.name} on ${on_string} (${input.tool})">
+            <change_format>
+                <when input="format" value="json" format="json"/>
+            </change_format>
         </data>
     </outputs>
     <tests>
         <!-- abricate -->
         <test expect_num_outputs="1">
-            <param name="report" value="abricate/report.tsv" ftype="tabular" />
-            <param name="tool" value="abricate" />
-            <param name="output_format" value="tsv" />
-            <param name="reference_database_version" value="db_v_1" />
-            <param name="analysis_software_version" value="tool_v_1" />
-            <output name="output_tsv" file="hamronized_abricate.tsv" ftype="tabular" />
+            <conditional name="input">
+                <param name="tool" value="abricate" />
+                <param name="report" value="abricate/report.tsv" ftype="tabular" />
+                <conditional name="origin">
+                    <param name="origin" value="false"/>
+                    <param name="analysis_software_version" value="tool_v_1"/>
+                </conditional>
+                <param name="reference_database_version" value="db_v_1"/>
+            </conditional>
+            <param name="format" value="tsv" />
+            <output name="output" ftype="tabular">
+                <assert_contents>
+                    <has_n_lines n="8"/>
+                    <has_n_columns n="36"/>
+                    <has_text text="input_file_name"/>
+                    <has_text text="GCF_010120755.1_ASM1012075v1_genomic"/>
+                    <has_text text="vanS-M"/>
+                    <has_text text="db_v_1"/>
+                </assert_contents>
+            </output>
         </test>
         <test expect_num_outputs="1">
-            <param name="report" value="abricate/report.tsv" ftype="tabular" />
-            <param name="tool" value="abricate" />
-            <param name="output_format" value="json" />
-            <param name="reference_database_version" value="db_v_1" />
-            <param name="analysis_software_version" value="tool_v_1" />
-            <output name="output_json" file="hamronized_abricate.json" ftype="json" />
+            <conditional name="input">
+                <param name="tool" value="abricate" />
+                <param name="report" value="abricate/report.tsv" ftype="tabular" />
+                <conditional name="origin">
+                    <param name="origin" value="false"/>
+                    <param name="analysis_software_version" value="tool_v_1"/>
+                </conditional>
+                <param name="reference_database_version" value="db_v_1"/>
+            </conditional>
+            <param name="format" value="json" />
+            <output name="output" ftype="json">
+                <assert_contents>
+                    <has_text text="input_file_name"/>
+                    <has_text text="GCF_010120755.1_ASM1012075v1_genomic"/>
+                    <has_text text="vanS-M"/>
+                    <has_text text="db_v_1"/>
+                </assert_contents>
+            </output>
         </test>
         <!-- ariba -->
         <test expect_num_outputs="1">
-            <param name="report" value="ariba/report.tsv" ftype="tabular" />
-            <param name="tool" value="ariba" />
-            <param name="output_format" value="tsv" />
-            <param name="reference_database_version" value="db_v_1" />
-            <param name="analysis_software_version" value="ariba_v1" />
-            <param name="input_file_name" value="ariba_report" />
-            <param name="reference_database_id" value="dbname" />
-            <output name="output_tsv" file="hamronized_ariba.tsv" ftype="tabular" />
+            <conditional name="input">
+                <param name="tool" value="ariba" />
+                <param name="report" value="ariba/report.tsv" ftype="tabular" />
+                <param name="input_file_name" value="ariba_report" />
+                <param name="analysis_software_version" value="ariba_v1" />
+                <param name="reference_database_version" value="db_v_1" />
+                <param name="reference_database_name" value="dbname" />
+            </conditional>
+            <param name="format" value="tsv" />
+            <output name="output" ftype="tabular">
+                <assert_contents>
+                    <has_n_lines n="257"/>
+                    <has_n_columns n="36"/>
+                    <has_text text="input_file_name"/>
+                    <has_text text="ariba_report"/>
+                    <has_text text="AAC_3__IId"/>
+                    <has_text text="ariba_v1"/>
+                    <has_text text="db_v_1"/>
+                    <has_text text="dbname"/>
+                </assert_contents>
+            </output>
+        </test>
+        <!-- mykrobe -->
+        <test expect_num_outputs="1">
+            <conditional name="input">
+                <param name="tool" value="mykrobe" />
+                <param name="report" value="mykrobe/mykrobe.json" ftype="json" />
+            </conditional>
+            <param name="format" value="tsv" />
+            <output name="output" ftype="tabular">
+                <assert_contents>
+                    <has_n_lines n="2"/>
+                    <has_n_columns n="36"/>
+                    <has_text text="input_file_name"/>
+                    <has_text text="rpoB"/>
+                    <has_text text="v0.10.0"/>
+                    <has_text text="NC_000962.3"/>
+                    <has_text text="mykrobe"/>
+                </assert_contents>
+            </output>
         </test>
         <!-- rgi -->
         <test expect_num_outputs="1">
-            <param name="report" value="rgi/rgi.txt" ftype="txt" />
-            <param name="tool" value="rgi" />
-            <param name="output_format" value="tsv" />
-            <param name="reference_database_version" value="card_v1" />
-            <param name="analysis_software_version" value="rgi_v1" />
-            <param name="input_file_name" value="rgi_report" />
-            <output name="output_tsv" file="hamronized_rgi.tsv" ftype="tabular"/>
+            <conditional name="input">
+                <param name="tool" value="rgi" />
+                <param name="report" value="rgi/rgi.txt" ftype="txt" />
+                <param name="analysis_software_version" value="rgi_v1" />
+                <param name="reference_database_version" value="card_v1" />
+            </conditional>
+            <param name="format" value="tsv" />
+            <output name="output" ftype="tabular">
+                <assert_contents>
+                    <has_n_lines n="42"/>
+                    <has_n_columns n="36"/>
+                    <has_text text="input_file_name"/>
+                    <has_text text="rgi.txt"/>
+                    <has_text text="oqxA"/>
+                    <has_text text="CARD"/>
+                    <has_text text="card_v1"/>
+                    <has_text text="rgi_v1"/>
+                </assert_contents>
+            </output>
         </test>
     </tests>
     <help><![CDATA[
 **What it does**
 
-Hamronize parse multiple Antimicrobial Resistance Analysis Reports into a common data structure
+hAMRonization parses multiple Antimicrobial Resistance Analysis Reports 
+from disparate antimicrobial resistance gene detection tools into a single 
+unified format.
+
+This is an implementation of the hAMRonization AMR detection specification 
+scheme which supports gene presence/absence resistance and mutational resistance 
+(if supported by the underlying tool).
 
 **Inputs**
 
-Depends on the tools with hAMRonizable reports:
+Report or output of an antimicrobial resistance gene detection tool:
 
 * abricate: abricate's output report i.e., OUTPUT.tsv
 * amrfinderplus: amrfinderplus's output report i.e., OUTPUT.tsv