view taxonomy-to-krona.xml @ 4:ec53d27ee602 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/mothur commit debdcdbb89f9bf3e2c3eed05cb078eddb27d4684"
author iuc
date Mon, 02 Dec 2019 06:33:57 -0500
parents 7bfd66707e6f
children db30eb96ea23
line wrap: on
line source

<tool id="mothur_taxonomy_to_krona" name="Taxonomy-to-Krona" version="1.0">
    <description>convert a mothur taxonomy file to Krona input format</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <command detect_errors="exit_code"><![CDATA[
cat $inputfile
| tail -n +2               ## remove header line
| cut -f2,3                ## remove first column
| sed 's/;/\t/g'           ## split taxonomy field on semicolon
| sed 's/"//g'             ## remove quotation marks
| sed 's/[ \t]*$//'        ## remove trailing whitespace
#if $stripconfidences
| sed -r 's/[(][0-9]+[)]//g'  ## remove confidence scores
#end if
> $outputfile
    ]]></command>
    <inputs>
        <param name="inputfile" type="data" format="mothur.cons.taxonomy" label="Taxonomy file"
            help="Mothur-formatted taxonomy file. Should have 3 columns; OTU-size-taxonomy"/>
        <param name="stripconfidences" type="boolean" checked="false" label="Strip confidence values?"
            help="Strip the confidence values enclosed in parentheses behind the taxonomy levels if present. e.g. Bacteria(100);Bacteroidetes(87);.."/>
    </inputs>
    <outputs>
        <data name="outputfile" format="tabular" label="${tool.name} on ${on_string}: krona-formatted taxonomy file"/>
    </outputs>
    <tests>
        <test><!-- test defaults -->
            <param name="inputfile" value="example.constaxonomy"/>
            <output name="outputfile">
                <assert_contents>
                    <has_line_matching expression="^\d+(\t[\w\d\-()]+)+$"/>
                    <not_has_text text="Otu01"/>
                    <not_has_text text=";"/>
                    <has_text text="Bacteria"/>
                    <has_text text="(100)"/>
                </assert_contents>
            </output>
        </test>
        <test><!-- test with stripping of confidence scores -->
            <param name="inputfile" value="example.constaxonomy"/>
            <param name="stripconfidences" value="true"/>
            <output name="outputfile">
                <assert_contents>
                    <has_line_matching expression="^\d+(\t[\w\d\-]+)+$"/>
                    <not_has_text text="Otu01"/>
                    <not_has_text text=";"/>
                    <has_text text="Bacteria"/>
                    <not_has_text text="(100)"/>
                </assert_contents>
            </output>
        </test>
    </tests>
    <help><![CDATA[
Krona text input requires a tab-delimited file with first column being a count, and the rest representing the hierarchy, for example::

    2 Fats Saturated fat
    3 Fats Unsaturated fat Monounsaturated fat
    3 Fats Unsaturated fat Polyunsaturated fat
    13 Carbohydrates Sugars
    4 Carbohydrates Dietary fiber
    21 Carbohydrates
    5 Protein
    4

This can be input into the Krona tool as generic text format, and would yield this `Krona plot`_.

.. _Krona plot: https://marbl.github.io/Krona/examples/xml.krona.html

    ]]></help>
    <expand macro="citations">
        <citation type="doi">10.1186/1471-2105-12-385</citation>
    </expand>
</tool>