view samtools_depth.xml @ 4:971dc85e9441 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/samtools/samtools_depth commit cd62639660bef041ba14ecff337fb98e84e75d8a
author iuc
date Mon, 20 Nov 2023 22:14:44 +0000
parents 56faa6a57e50
children
line wrap: on
line source

<tool id="samtools_depth" name="Samtools depth" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
    <description>compute 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[
## create symlinks to bams and index files (0,..., n-1 + 0.[bai|crai],...,n-1.[bai|crai] )
@PREPARE_IDX_MULTIPLE@

samtools depth
$all
#if $cond_region.select_region == 'bed':
    -b '$cond_region.input_bed'
#else if $cond_region.select_region == 'text':
    -r $cond_region.region
#end if
#if str($minlength) != '':
    -l $minlength
#end if
#if str($maxdepth) != '':
    -m $maxdepth
#end if
#if str($basequality) != '':
    -q $basequality
#end if
#if str($mapquality) != '':
    -Q $mapquality
#end if
#for $i in range(len( $input_bams )):
    ${i}
#end for
#set $filter = $additional_options.required_flags
@FLAGS@
-g $flags
#set $filter = $additional_options.skipped_flags
@FLAGS@
-G $flags
$additional_options.deletions
$additional_options.single_read
$output_options.header
> '${output}'
    ]]></command>
    <inputs>
        <param name="input_bams" type="data" format="bam" multiple="true" label="BAM file(s)" />
        <conditional name="cond_region">
            <param name="select_region" type="select" label="Filter by regions">
                <option value="no" selected="True">No</option>
                <option value="text">Manualy specify a region</option>
                <option value="bed">Regions from BED file</option>
            </param>
            <when value="no"/>
            <when value="text">
                <param name="region" type="text" optional="false" argument="-r" label="Only report depth in a specified region" help="Format is CHROMOSOME:FROM-TO"/>
            </when>
            <when value="bed">
                <param name="input_bed" type="data" format="bed" argument="-b" label="Genomic intervals (in BED format)" help="Compute depth at list of positions or regions in specified BED FILE." />
            </when>
        </conditional>

        <param name="all" type="select" argument="-a/-aa" label="Output all positions" help="Note that if the all option (-a) is used in conjunction with a BED file it may sometimes operate as if -aa was specified if the reference sequence has coverage outside of the region specified in the BED file.">
            <option value="" selected="True">Default</option>
            <option value="-a">Output all positions (including those with zero depth) (-a)</option>
            <option value="-aa">Output absolutely all positions, including unused reference sequences. (-aa)</option>
        </param>
        <param name="minlength" type="integer" argument="-l" min="0" optional="true" label="Ignore reads shorter than" />
        <param name="maxdepth" type="integer" argument="-m" min="0" optional="true" label="Limits the maximum number of considered alignments starting at any sequence position to INT. Note that, the reported depths values might be larger than INT. If 0, depth is set to the maximum integer value, effectively removing any depth limit. (default = 8000)" />

        <param name="basequality" type="integer" argument="-q" min="0" optional="true" label="Only count reads with base quality greater than" />
        <param name="mapquality" type="integer" argument="-Q" min="0" optional="true" label="Only count reads with mapping quality greater than" />

        <section name="additional_options" title="Additional Filter Options">
            <param name="required_flags" argument="-g" type="select" multiple="True" label="Require that these flags are set.">
                <expand macro="flag_options" />
            </param>

            <param name="skipped_flags" argument="-G" type="select" multiple="True" label="Exclude reads with any of the following flags set (the default set is UNMAP,SECONDARY,QCFAIL,DUP or 0x704).">
                <expand macro="flag_options" s4="true" s256="true" s512="true" s1024="true"/>
            </param>

            <param name="deletions" type="boolean" argument="-J" truevalue="-J" falsevalue="" checked="false" label="Include reads with deletions in depth computation." />
            <param name="single_read" type="boolean" argument="-s" truevalue="-s" falsevalue="" checked="false" label="For the overlapping section of a read pair, count only the bases of a single read." />
        </section>

        <section name="output_options" title="Output Options" expanded="true">
            <param name="header" type="boolean" argument="-H" truevalue="-H" falsevalue="" checked="false" label="Print a file header to file." />
        </section>

    </inputs>
    <outputs>
        <data name="output" format="tabular" label="${tool.name} on ${on_string}" />
    </outputs>
    <tests>
        <!-- 1) -->
        <test>
            <conditional name="cond_region">
                <param name="select_region" value="bed"/>
                <param name="input_bed" value="eboVir3.1.bed" ftype="bed" />
            </conditional>
            <param name="input_bams" value="eboVir3.bam" ftype="bam" />
            <output name="output" file="samtools_depth_out1.tab" />
        </test>
        <!-- 2) -->
        <test>
            <conditional name="cond_region">
                <param name="select_region" value="text"/>
                <param name="region" value="eboVir3:500-1500" />
            </conditional>
            <param name="input_bams" value="eboVir3.bam" ftype="bam" />
            <output name="output" file="samtools_depth_out2.tab" />
        </test>
        <!-- 3) -->
        <test>
            <param name="input_bams" value="eboVir3.bam,eboVir3.2.bam" ftype="bam" />
            <param name="all" value="-a"/>
            <output name="output" file="samtools_depth_out3.tab" />
        </test>
        <!-- 4) -->
        <test>
            <param name="input_bams" value="eboVir3.bam,eboVir3.2.bam" ftype="bam" />
            <param name="minlength" value="10" />
            <!-- Odd thing: I did not expect values > 4 in the output, but there are ... ?
             see https://github.com/samtools/samtools/issues/889 -->
            <param name="maxdepth" value="4" />
            <param name="basequality" value="11"  />
            <param name="mapquality" value="12" />
            <output name="output" file="samtools_depth_out4.tab" />
        </test>
        <!-- 5) Testing argument -H -->
        <test>
            <conditional name="cond_region">
                <param name="select_region" value="bed"/>
                <param name="input_bed" value="eboVir3.1.bed" ftype="bed" />
            </conditional>
            <param name="input_bams" value="eboVir3.bam" ftype="bam" />
            <param name="header" value="true" />
            <output name="output" file="samtools_depth_out5.tab" />
        </test>
        <!-- 6) Tetsing argument -g -->
        <test>
            <param name="input_bams" value="eboVir3.bam" ftype="bam" />
            <param name="required_flags" value="2,16,64" />
            <output name="output" file="samtools_depth_out6.tab" />
        </test>
        <!-- 7) Tetsing argument -G -->
        <test>
            <param name="input_bams" value="eboVir3.bam" ftype="bam" />
            <param name="skipped_flags" value="2,16,64" />
            <output name="output" file="samtools_depth_out7.tab" />
        </test>
    </tests>
    <help>
**What it does**

Computes the depth at each position or region using the ``samtools depth`` command.

The output is a tabular file, with one line for each base of each reference
with any coverage (bases with no coverage may not appear).

The first column is the reference name, the second column is the reference
position, and then there is one column for each SAM/BAM file giving the
coverage depth at that position.
    </help>
    <expand macro="citations"/>
</tool>