view kraken2.xml @ 5:20e2f64aa1fe draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/blob/master/tool_collections/kraken2/kraken2/ commit b5beeef6c90fe39ce3ace531877d632725839ee4
author iuc
date Fri, 09 Feb 2024 21:43:22 +0000
parents e674066930b2
children
line wrap: on
line source

<?xml version="1.0"?>
<tool id="kraken2" name="Kraken2" version="@TOOL_VERSION@+galaxy1">
    <description>
        assign taxonomic labels to sequencing reads
    </description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <xrefs>
        <xref type="bio.tools">kraken2</xref>
    </xrefs>
    <requirements>
        <requirement type="package" version="@TOOL_VERSION@">kraken2</requirement>
    </requirements>
    <version_command>kraken2 --version</version_command>
    <command detect_errors="exit_code">
        <![CDATA[

        #def get_type($data)
            #if $data.is_of_type('fastq'):
                #return 'fastq'
            #elif $data.is_of_type('fasta'):
                #return 'fasta'
            #elif $data.is_of_type('fastqsanger'):
                #return 'fastqsanger'
            #elif $data.is_of_type('fasta.gz'):
                #return 'fasta.gz'
            #elif $data.is_of_type('fasta.bz2'):
                #return 'fasta.bz2'
            #elif $data.is_of_type('fastq.gz'):
                #return 'fastq.gz'
            #elif $data.is_of_type('fastq.bz2'):
                #return 'fastq.bz2'
            #end if
        #end def

        kraken2
            --threads \${GALAXY_SLOTS:-1}
            --db '${kraken2_database.fields.path}'

            $quick

            #if $single_paired.single_paired_selector == "yes"
                --paired 
                '${single_paired.forward_input}' '${single_paired.reverse_input}'
            #elif $single_paired.single_paired_selector == "collection":
                --paired 
                '${single_paired.input_pair.forward}' '${single_paired.input_pair.reverse}'
            #else:
                '${single_paired.input_sequences}'
            #end if

            #if $split_reads:
                #if $single_paired.single_paired_selector == "no":
                    --classified-out '${classified_out_s}' --unclassified-out '${unclassified_out_s}'
                #elif $single_paired.single_paired_selector == "yes":
                    #set $result = $get_type($single_paired.forward_input)
                    --unclassified-out 'un_out#.${result}' --classified-out 'cl_out#.${result}'
                #else:
                    #set $result = $get_type($single_paired.input_pair.forward)
                    --unclassified-out 'un_out#.${result}' --classified-out 'cl_out#.${result}'
                #end if
            #end if

            --confidence '${confidence}'
            --minimum-base-quality '${min_base_quality}'
            --minimum-hit-groups '${minimum_hit_groups}'

            $use_names

            #if $report.create_report:
                --report '${report_output}'
                $report.use_mpa_style
                $report.report_zero_counts
                $report.report_minimizer_data
            #end if

            > '${output}'
    ]]></command>
    <inputs>
        <conditional name="single_paired">
            <param name="single_paired_selector" type="select" label="Single or paired reads" help="--paired">
                <option value="collection">Paired Collection</option>
                <option value="yes">Paired</option>
                <option selected="True" value="no">Single</option>
            </param>
            <when value="collection">
                <param format="@INTYPES@" name="input_pair" type="data_collection" collection_type="paired" label="Collection of paired reads"/>
            </when>
            <when value="yes">
                <param format="@INTYPES@" name="forward_input" type="data" label="Forward strand"/>
                <param format="@INTYPES@" name="reverse_input" type="data" label="Reverse strand"/>
            </when>
            <when value="no">
                <param format="@INTYPES@" label="Input sequences" name="input_sequences" type="data"/>
            </when>
        </conditional>
        <param argument="--use-names" type="boolean" truevalue="--use-names" falsevalue="" label="Print scientific names instead of just taxids"/>
        <param argument="--confidence" type="float" label="Confidence" value="0.0" min="0" max="1" help="Confidence score threshold. Must be in [0, 1]"/>
        <param argument="--minimum-base-quality" name="min_base_quality" type="integer" label="Minimum Base Quality" value="0" help="Minimum base quality used in classification (only effective with FASTQ input)"/>
        <param argument="--minimum-hit-groups" type="integer" label="Minimum hit goups" value="2" help="Number of overlapping k-mers sharing the same minimizer needed to make a call" />
        <param argument="--quick" type="boolean" truevalue="--quick" falsevalue="" label="Enable quick operation" help="Quick operation (use first hit)"/>
        <param name="split_reads" type="boolean" label="Split classified and unclassified outputs?" help="Sets --unclassified-out and --classified-out"/>

        <section name="report" title="Create Report" expanded="false">
            <param name="create_report" type="boolean"  label="Print a report with aggregrate counts/clade to file" help="--report" />
            <param argument="--use-mpa-style" type="boolean" truevalue="--use-mpa-style" falsevalue="" label="Format report output like Kraken 1's kraken-mpa-report" />
            <param argument="--report-zero-counts" type="boolean" truevalue="--report-zero-counts" falsevalue="" label="Report counts for ALL taxa, even if counts are zero" />
            <param argument="--report-minimizer-data" type="boolean" truevalue="--report-minimizer-data" falsevalue="" label="Report minimizer data" help="Report minimizer and distinct minimizer count information in addition to normal Kraken report" />
        </section>

        <expand macro="input_database"/>  
    </inputs>
    <outputs>
        <data name="classified_out_s" format_source="input_sequences" label="${tool.name} on ${on_string}: Classified reads">
            <filter>(split_reads and ('no' in single_paired['single_paired_selector']))</filter>   
        </data>
        <data name="unclassified_out_s" format_source="input_sequences" label="${tool.name} on ${on_string}: Unclassified reads">
            <filter>(split_reads and ('no' in single_paired['single_paired_selector']))</filter>	
        </data>
        <data name="report_output" format="tabular" label="${tool.name} on ${on_string}: Report">
            <filter>(report['create_report'])</filter>
        </data>

        <data name="out1" format_source="forward_input" label="${tool.name} on ${on_string}: Unclassified forward reads" from_work_dir="un_out_1.*">
            <filter>(split_reads and ("yes" in single_paired['single_paired_selector']))</filter>	
        </data>
        <data name="out2" format_source="forward_input" label="${tool.name} on ${on_string}: Unclassified reverse reads" from_work_dir="un_out_2.*">
            <filter>(split_reads and ("yes" in single_paired['single_paired_selector']))</filter>
        </data>
        <data name="out3" format_source="forward_input" label="${tool.name} on ${on_string}: Classified forward reads" from_work_dir="cl_out_1.*">
            <filter>(split_reads and ("yes" in single_paired['single_paired_selector']))</filter>	
        </data>
        <data name="out4" format_source="forward_input" label="${tool.name} on ${on_string}: Classified reverse reads" from_work_dir="cl_out_2.*">
            <filter>(split_reads and ("yes" in single_paired['single_paired_selector']))</filter>
        </data>

        <data name="out1_1" format_source="input_pair['forward']" label="${tool.name} on ${on_string}: Unclassified forward read collection" from_work_dir="un_out_1.*">
            <filter>(split_reads and ("collection" in single_paired['single_paired_selector']))</filter>	
        </data>
        <data name="out2_1" format_source="input_pair['forward']" label="${tool.name} on ${on_string}: Unclassified reverse read collection" from_work_dir="un_out_2.*">
            <filter>(split_reads and ("collection" in single_paired['single_paired_selector']))</filter>
        </data>
        <data name="out3_1" format_source="input_pair['forward']" label="${tool.name} on ${on_string}: Classified forward read collection" from_work_dir="cl_out_1.*">
            <filter>(split_reads and ("collection" in single_paired['single_paired_selector']))</filter>	
        </data>
        <data name="out4_1" format_source="input_pair['forward']" label="${tool.name} on ${on_string}: Classified reverse read collection" from_work_dir="cl_out_2.*">
            <filter>(split_reads and ("collection" in single_paired['single_paired_selector']))</filter>
        </data>

        <data name="output" format="tabular" label="${tool.name} on ${on_string}: Classification"/>
        <!--<data format="tabular" label="${tool.name} on ${on_string}: Translated classification" name="translated" />-->
    </outputs>
    <tests>
        <test expect_num_outputs="1">
            <param name="single_paired_selector" value="no"/>
            <param name="input_sequences" value="kraken_test1.fa" ftype="fasta"/>
            <param name="split_reads" value="false"/>
            <param name="quick" value="no"/>
            <param name="confidence" value=".2"/>
            <param name="kraken2_database" value="test_entry"/>
            <output name="output" file="kraken_test1_output.tab" ftype="tabular"/>
        </test>
        <test expect_num_outputs="5">
            <param name="single_paired_selector" value="yes"/>
            <param name="forward_input" value="kraken_test2_R1.fastq" ftype="fastq"/>
            <param name="reverse_input" value="kraken_test2_R2.fastq" ftype="fastq"/>
            <param name="split_reads" value="true"/>
            <param name="quick" value="no"/>
            <param name="confidence" value="0"/>
            <param name="kraken2_database" value="test_entry"/>
            <output name="out1" file="un_test2_output_1.fastq" ftype="fastq"/>
            <output name="out2" file="un_test2_output_2.fastq" ftype="fastq"/>
            <output name="out3" file="cl_test2_output_1.fastq" ftype="fastq"/>
            <output name="out4" file="cl_test2_output_2.fastq" ftype="fastq"/>
            <output name="output" file="kraken_test2_output.tab" ftype="tabular"/>
        </test>
        <test expect_num_outputs="2">
            <param name="single_paired_selector" value="yes"/>
            <param name="forward_input" value="kraken_test2_R1.fastq" ftype="fastq"/>
            <param name="reverse_input" value="kraken_test2_R2.fastq" ftype="fastq"/>
            <param name="use-names" value="true"/>
            <section name="report">
                <param name="create_report" value="true"/>
                <param name="report_minimizer_data" value="true"/>
            </section>
            <param name="kraken2_database" value="test_entry"/>
            <output name="report_output" file="kraken_test2_report.tab" ftype="tabular"/>
        </test>
    </tests>
    <help>
        <![CDATA[
**What it does**

Kraken2 is a taxonomic sequence classifier that assigns taxonomic labels to short DNA reads. It does this by examining the k-mers within a read and querying a database with those k-mers. This database contains a mapping of every k-mer in Kraken's genomic library to the lowest common ancestor (LCA) in a taxonomic tree of all genomes that contain that k-mer. The set of LCA taxa that correspond to the k-mers in a read are then analyzed to create a single taxonomic label for the read; this label can be any of the nodes in the taxonomic tree. Kraken is designed to be rapid, sensitive, and highly precise.

-----

**Output Format**

Each sequence classified by Kraken results in a single line of output. Output lines contain five tab-delimited fields; from left to right, they are::

    1. "C"/"U": a one letter code indicating that the sequence was either classified or unclassified.
    2. The sequence ID, obtained from the FASTA/FASTQ header.
    3. The taxonomy ID Kraken 2 used to label the sequence; this is 0 if the sequence is unclassified.
    4. The length of the sequence in bp.
    5. A space-delimited list indicating the LCA mapping of each k-mer in the sequence. For example, "562:13 561:4 A:31 0:1 562:3" would indicate that:
            a) the first 13 k-mers mapped to taxonomy ID #562
            b) the next 4 k-mers mapped to taxonomy ID #561
            c) the next 31 k-mers contained an ambiguous nucleotide
            d) the next k-mer was not in the database
            e) the last 3 k-mers mapped to taxonomy ID #562
        ]]>
    </help>
    <expand macro="citations" />
</tool>