view taxonomy-to-krona.xml @ 0:7bfd66707e6f draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/mothur commit 3418f23b9768f5aafb86488f5ec1cb97530d4fb3
author iuc
date Tue, 20 Mar 2018 21:54:35 -0400
parents
children
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>