view samtools_coverage.xml @ 3:c4ff13d2aab3 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/samtools/sam_to_bam commit 69ce9eb437322f15750e532c6e9586e4e17fe424
author iuc
date Thu, 29 Jun 2023 10:40:07 +0000
parents 8a477224dfee
children
line wrap: on
line source

<tool id="samtools_coverage" name="Samtools coverage" version="@TOOL_VERSION@+galaxy2" profile="@PROFILE@">
    <description>computes the depth at each position or region</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="requirements"/>
    <expand macro="stdio"/>
    <expand macro="version_command"/>
    <command><![CDATA[
        #if $condition_input.input_pooling == "No":
            #set $input = $condition_input.input
            @PREPARE_IDX@
        #else:
            #set $input_bams = $condition_input.input_bams
            @PREPARE_IDX_MULTIPLE@
        #end if
        samtools coverage

            #if $condition_input.input_pooling == "Yes":
                ${ ' '.join( [ "'%s'" %  $i for $i, $x in enumerate($condition_input.input_bams)]) }
            #else
                infile
            #end if

            -l $additional_options.min_read_length
            -q $additional_options.min_mq
            -Q $additional_options.min_bq

            #set $filter = $additional_options.required_flags
            @FLAGS@
            --rf $flags

            #set $filter = $additional_options.skipped_flags
            @FLAGS@
            --ff $flags

            #if $additional_options.region != "":
                -r '$additional_options.region'
            #end if

            #if $condition_histogram.histogram_select == "yes"
                -m
                -w $condition_histogram.n_bins
            #end if

            -o '$output'
    ]]></command>
    <inputs>
        <conditional name="condition_input">
            <param name="input_pooling" type="select" label="Are you pooling bam files?" help="Calculate the coverage for multiple bam files" >
                <option value="No" selected="True">No</option>
                <option value="Yes">Yes</option>
            </param>
            <when value="No" >
                <param name="input" type="data" format="bam" label="BAM file"/>
            </when>
            <when value="Yes">
                <param name="input_bams" type="data" format="bam" multiple="true" label="BAM files to be pooled"/>
            </when>
        </conditional>

        <section name="additional_options" title="Additional Options" expanded="true">
            <param name="min_read_length" argument="-l" type="integer" min="0" value="0" label="Minimum read length" help="Ignore reads shorter than INT base pairs (Default = 0)" />
            <param name="min_mq" argument="-q" type="integer" min="0" value="0" label="Minimum mapping quality" help="Minimum mapping quality for an alignment to be used (Default = 0)" />
            <param name="min_bq" argument="-Q" type="integer" min="0" value="0" label="Minimum base quality" help="Minimum base quality for a base to be considered (Default = 0)" />

            <param name="required_flags" argument="--rf" type="select" multiple="True" label="Require that these flags are set">
                <expand macro="flag_options" />
            </param>

            <param name="skipped_flags" argument="--ff" type="select" multiple="True" label="Exclude reads with any of the following flags set">
                <expand macro="flag_options" s4="true" s256="true" s512="true" s1024="true"/>
            </param>
            <param name="region" argument="-r" type="text" value="" label="Show specified region" help="Show specified region. Format: chr:start-end." >
                <sanitizer invalid_char="">
                    <valid initial="string.ascii_letters,string.digits">
                        <add value=":" />
                        <add value="-" />
                        <add value="_" />
                    </valid>
                </sanitizer>
            </param>
        </section>

        <conditional name="condition_histogram">
            <param name="histogram_select" argument="-m" type="select" label="Histogram" help="Show histogram instead of tabular output">
                <option value="no" selected="true">No</option>
                <option value="yes">Yes</option>
            </param>
            <when value="yes">
                <param name="n_bins" argument="-w" type="integer" min="1" value="100" label="Number of bins in histogram" help="Number of bins in histogram" />
            </when>
            <when value="no" />
        </conditional>
    </inputs>

    <outputs>
        <data name="output" format="tabular" from_work_dir="outfile" label="${tool.name} on ${on_string}" />
    </outputs>

    <tests>
        <test>
            <param name="input" value="test_1.bam" ftype="bam" />
            <output name="output" file="results_1.tabular" ftype="tabular" />
        </test>
        <test>
            <param name="input" value="test_1.bam" ftype="bam" />
            <param name="histogram_select" value="yes" />
            <param name="n_bins" value="50" />
            <output name="output" file="results_2.txt" ftype="tabular" />
        </test>
        <test>
            <param name="input_pooling" value="Yes" />
            <param name="input_bams" value="test_1.bam,test_2.bam" ftype="bam" />
            <param name="histogram_select" value="yes" />
            <param name="n_bins" value="100" />
            <output name="output" file="results_3.txt" ftype="tabular" />
        </test>
        <test><!-- test with a region (requires index) -->
            <param name="input" value="test_1.bam" ftype="bam" />
            <param name="region" value="ref1" />
            <output name="output" file="results_4.tabular" ftype="tabular" />
        </test>
        <test><!-- test with pooled BAMs and a region -->
            <param name="input_pooling" value="Yes" />
            <param name="input_bams" value="test_1.bam,test_2.bam" ftype="bam" />
            <param name="region" value="ref2" />
            <output name="output" file="results_5.tabular" ftype="tabular" />
        </test>
    </tests>
    <help><![CDATA[
**What it does**

This tool runs the ``samtools coverage`` command.

Computes the depth at each position or region and draws an ASCII-art histogram or tabulated text. If you select to pool the bam files, then it calculates coverage for the combined files.

The tabulated form uses the following headings:

- rname	Reference name / chromosome
- startpos	Start position
- endpos	End position (or sequence length)
- numreads	Number reads aligned to the region (after filtering)
- covbases	Number of covered bases with depth >= 1
- coverage	Proportion of covered bases [0..1]
- meandepth	Mean depth of coverage
- meanbaseq	Mean baseQ in covered region
- meanmapq	Mean mapQ of selected reads

    ]]></help>
    <expand macro="citations"/>
</tool>