diff cooc_pubmut.xml @ 1:f193fef5b19d draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/cojac commit 5b54fc7af13196445abda407054e01dd3e5603c6
author iuc
date Mon, 31 Jul 2023 15:23:17 +0000
parents d04ea6b052c5
children ce8b15a55bbe
line wrap: on
line diff
--- a/cooc_pubmut.xml	Thu Aug 11 13:49:40 2022 +0000
+++ b/cooc_pubmut.xml	Mon Jul 31 15:23:17 2023 +0000
@@ -1,69 +1,131 @@
 <tool id="cooc_pubmut" name="Cojac: pubmut" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@"
       profile="@PROFILE@">
     <description>
-        render a JSON or YAML file to a pretty table
+        pretty-prints cojac mutbamscan co-occurrence results
     </description>
     <macros>
         <import>macros.xml</import>
     </macros>
     <expand macro="biotools"/>
     <expand macro="requirements">
-        <requirement type="package" version="2.12">pandoc</requirement>
+        <requirement type="package" version="3.1.3">pandoc</requirement>
+        <requirement type="package" version="6.2.1">gmp</requirement>
     </expand>
     <expand macro="version"/>
     <command detect_errors="exit_code"><![CDATA[
-@VOCDIR_COMMAND@
-#for $input_file in $cooc_file
-    #set $cooc_ext = $input_file.ext
-#end for
-cooc-pubmut
-    -m '$vocdir'
-    -a '$amplicons'
-    #if $cooc_ext == 'json'
-        -j '$cooc_file'
-    #else if $cooc_ext == 'yaml'
-        -y '$cooc_file'
+#if $annotations.availability == 'full':
+  #set $voc_config = $annotations.voc_source
+  @VOCDIR_COMMAND@
+#end if
+cojac cooc-pubmut
+    #if $annotations.availability == 'full':
+      -m voc/
+    #end if
+    #if $annotations.availability != 'none':
+      -a '$annotations.in_amp'
     #end if
-    -o cooc-table.csv
+    #if $cooc_data.ext == 'json':
+      -j '$cooc_data'
+    #else
+      -y '$cooc_data'
+    #end if
     -q
-    $escape
-    #if $add_html
+    #if $out_opts.format == 'tsv':
+      -o cooc-table.tsv
+    #else:
+      -o cooc-table.csv
+      #if $out_opts.format == 'html':
         && pandoc cooc-table.csv -o cooc-table.html
-        && mkdir -p '$html.files_path'
-        && cp cooc-table.html '$html.files_path'
+      #end if
     #end if
     ]]></command>
     <inputs>
-        <expand macro="vocdir_input"/>
-        <param name="amplicons" type="data" format="yaml" label="List of query amplicons"
-               help="File generated by the Cojac mutbamscan tool"/>
-        <param name="cooc_file" type="data" format="json,yaml" multiple="true"
-               label="Results generated by mutbamscan"/>
-        <param argument="--escape" type="boolean" truevalue="--escape" falsevalue=""
-               checked="false" label="Use escape characters for newlines"/>
-        <param name="add_html" type="boolean" checked="false"
-               label="Convert CSV output table to HTML format"/>
+        <param name="cooc_data" type="data" format="json,yaml" label="Co-occurrence results generated by mutbamscan"
+        help="The tool can work with json- or yaml-formatted output of cojac mutbamscan."/>
+        <conditional name="annotations">
+            <param name="availability" type="select" label="Available amplicon and lineage annotations"
+            help="For best readability of its report the tool requires a per-lineage amplicon info dataset (in yaml format) produced by the mutbamscan tool and the original lineage definitions. If all you have is the per-lineage amplicon info, you can use it to obtain a nearly identical report, but cojac-internal lineage identifiers won't be translated into standard lineage names. With no available annotations a limited report can still be generated, but this is not recommended.">
+                <option value="full">per-lineage amplicon info and original lineage definitions</option>
+                <option value="amplicon">per-lineage amplicon info only</option>
+                <option value="none">no annotations</option>
+            </param>
+            <when value="full">
+                <param name="in_amp" type="data" format="yaml" label="Combined cojac per-amplicon lineage definitions"/>
+                <expand macro="vocdir_input"/>
+            </when>
+            <when value="amplicon">
+                <param name="in_amp" type="data" format="yaml" label="Combined per-amplicon lineage definitions"/>
+            </when>
+            <when value="none" />
+        </conditional>
+        <section name="out_opts" title="Output formatting" expanded="true">
+            <param name="format" type="select" label="Type of output to produce">
+                <option value="tsv">Tab-separated (TSV)</option>
+                <option value="csv">Comma-separated (CSV)</option>
+                <option value="html">HTML (for display in browsers)</option>
+            </param>
+        </section>
     </inputs>
     <outputs>
-        <data name="table" format="csv"
-              label="${tool.name} on ${on_string}: Mutation cooccurrence (CSV table)"
-              from_work_dir="cooc-table.csv">
+        <data name="table_tsv" format="tsv" label="${tool.name} on ${on_string}: Mutation co-occurrence (TSV table)" from_work_dir="cooc-table.tsv">
+            <filter>out_opts['format'] == 'tsv'</filter>
         </data>
-        <data name="html" format="html"
-              label="${tool.name} on ${on_string}: Mutation cooccurrence (HTML)"
-              from_work_dir="cooc-table.html">
-            <filter>add_html</filter>
+        <data name="table_csv" format="csv" label="${tool.name} on ${on_string}: Mutation co-occurrence (CSV table)" from_work_dir="cooc-table.csv">
+            <filter>out_opts['format'] == 'csv'</filter>
+        </data>
+        <data name="table_html" format="html" label="${tool.name} on ${on_string}: Mutation co-occurrence (HTML)" from_work_dir="cooc-table.html">
+            <filter>out_opts['format'] == 'html'</filter>
         </data>
     </outputs>
     <tests>
         <test expect_num_outputs="1">
-            <conditional name="vocdir_option">
-                <param name="choice" value="custom"/>
-                <param name="voc_file" value="omicron_ba1_mutations.yaml"/>
+            <param name="cooc_data" value="cooc-test111.json"/>
+            <conditional name="annotations">
+                <conditional name="vocdir_option">
+                    <param name="choice" value="custom"/>
+                    <param name="voc_file" value="omicron_ba1_mutations.yaml"/>
+                </conditional>
+                <param name="in_amp" value="amplicons111.yaml"/>
+            </conditional>
+            <output name="table_tsv" ftype="tsv">
+                <assert_contents>
+                    <has_text text="Amplicon 76"/>
+                    <has_text text="Amplicon 81"/>
+                </assert_contents>
+            </output>
+        </test>
+        <test expect_num_outputs="1">
+            <param name="cooc_data" value="cooc-test111.json"/>
+            <conditional name="annotations">
+                <conditional name="vocdir_option">
+                    <param name="choice" value="custom"/>
+                    <param name="voc_file" value="omicron_ba1_mutations.yaml"/>
+                </conditional>
+                <param name="in_amp" value="amplicons111.yaml"/>
             </conditional>
-            <param name="amplicons" value="amplicons111.yaml"/>
-            <param name="cooc_file" value="cooc-test111.json"/>
-            <output name="table" ftype="csv">
+            <section name="out_opts">
+                <param name="format" value="csv"/>
+            </section>
+            <output name="table_csv" ftype="csv">
+                <assert_contents>
+                    <has_text text="Amplicon 76"/>
+                    <has_text text="Amplicon 81"/>
+                </assert_contents>
+            </output>
+        </test>
+        <test expect_num_outputs="1">
+            <param name="cooc_data" value="cooc-test111.json"/>
+            <conditional name="annotations">
+                <conditional name="vocdir_option">
+                    <param name="choice" value="custom"/>
+                    <param name="voc_file" value="omicron_ba1_mutations.yaml"/>
+                </conditional>
+                <param name="in_amp" value="amplicons111.yaml"/>
+            </conditional>
+            <section name="out_opts">
+                <param name="format" value="html"/>
+            </section>
+            <output name="table_html" ftype="html">
                 <assert_contents>
                     <has_text text="Amplicon 76"/>
                     <has_text text="Amplicon 81"/>
@@ -74,12 +136,12 @@
     <help><![CDATA[
 @HELP_HEADER@
 
-Information about **cooc-pubmut** method
-========================================
+Information about **cojac cooc-pubmut**
+=======================================
 
-The method renders a JSON or YAML file to a table as in the publication.
-You need to open the output CSV in a spreadsheet that understands linebreaks.
+The tool pretty-prints json or yaml output of cojac cooc-mutbamscan.
 
+Hint: The output (unless you select html format) is best viewed in spreadsheet software that understands linebreaks.
     ]]></help>
     <expand macro="citations"/>
 </tool>