Mercurial > repos > iuc > cooc_pubmut
changeset 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 | 0349d8981030 |
| files | cooc_pubmut.xml macros.xml test-data/ampl_info.tsv test-data/bed_cojac.bed test-data/primers.bed |
| diffstat | 5 files changed, 516 insertions(+), 64 deletions(-) [+] |
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>
--- a/macros.xml Thu Aug 11 13:49:40 2022 +0000 +++ b/macros.xml Mon Jul 31 15:23:17 2023 +0000 @@ -1,6 +1,6 @@ <?xml version="1.0"?> <macros> - <token name="@TOOL_VERSION@">0.2</token> + <token name="@TOOL_VERSION@">0.9</token> <token name="@VERSION_SUFFIX@">0</token> <token name="@PROFILE@">21.01</token> <xml name="biotools"> @@ -18,34 +18,28 @@ <version_command>echo @TOOL_VERSION@</version_command> </xml> <xml name="vocdir_input"> - <conditional name="vocdir_option"> + <conditional name="voc_source"> <param name="choice" type="select" - label="Source of YAML files with definition of the variant of concerns" - help="Cojac ships with a directory with variant definitions yaml files (https://github.com/cbg-ethz/cojac/tree/master/voc), which the tool can access internally. You can also download the latest version of the yaml files from https://github.com/phe-genomics/variant_definitions and use it as a custom yamls defining the variant of concerns."> - <option value="cache">Definitions shipped with the tool (can be outdated)</option> - <option value="custom">From history</option> + label="Source of lineage definitions" + help="Cojac detects lineage evidence based on lineage mutation patterns deined in tool-specific yaml format. You can choose between the (possibly outdated) definitions shipped with the tool or definitions provided as a collection of yaml datasets in your history. See the tool help below for more details."> + <option value="builtin">Lineage definitions shipped with the tool</option> + <option value="custom">YAML dataset collection in history</option> </param> - <when value="cache"/> + <when value="builtin"/> <when value="custom"> - <param name="voc_file" type="data" format="yaml" multiple="true" - label="YAML defining the variant of concern"/> + <param name="collection" type="data_collection" collection_type="list" format="yaml" label="Collection of lineage definitions" /> </when> </conditional> </xml> <token name="@VOCDIR_COMMAND@"><![CDATA[ -#if $vocdir_option.choice == 'custom' - #set vocdir = 'voc/' - #set file_paths1 = [] +#if $voc_config.choice == 'custom' mkdir -p voc && - #for $input_file in $voc_file - #set $file_path = $vocdir + $input_file.element_identifier - ln -s '$input_file' '$file_path' && - $file_paths1.append($file_path) + #for $input_file in $voc_config.collection + ln -s '$input_file' 'voc/$input_file.element_identifier' && #end for #else - DB_PATH="\$(dirname "\$(dirname "\$(which cooc-mutbamscan)")")/share/cojac" && - ln -s "\$DB_PATH" db && - #set $vocdir = 'db/voc' + DB_PATH="\$(dirname "\$(dirname "\$(which cojac)")")/share/cojac/voc" && + ln -s "\$DB_PATH" voc && #end if ]]></token> <token name="@HELP_HEADER@"><