Source code

Download source archive ↓

upstream-extended/iuc/tool_collections/samtools/samtools_coverage/samtools_coverage.xml

1<tool id="samtools_coverage" name="Samtools coverage" version="@TOOL_VERSION@+galaxy3" profile="@PROFILE@">
2    <description>Produces a histogram or table of coverage per chromosome</description>
3    <macros>
4        <import>macros.xml</import>
5    </macros>
6    <expand macro="requirements"/>
7    <expand macro="stdio"/>
8    <expand macro="version_command"/>
9    <command><![CDATA[
10        #if $condition_input.input_pooling == "No":
11            #set $input = $condition_input.input
12            @PREPARE_IDX@
13        #else:
14            #set $input_bams = $condition_input.input_bams
15            @PREPARE_IDX_MULTIPLE@
16        #end if
17        samtools coverage
18
19            #if $condition_input.input_pooling == "Yes":
20                ${ ' '.join( [ "'%s'" %  $i for $i, $x in enumerate($condition_input.input_bams)]) }
21            #else
22                infile
23            #end if
24
25            -l $additional_options.min_read_length
26            -q $additional_options.min_mq
27            -Q $additional_options.min_bq
28
29            #set $filter = $additional_options.required_flags
30            @FLAGS@
31            --rf $flags
32
33            #set $filter = $additional_options.skipped_flags
34            @FLAGS@
35            --ff $flags
36
37            #if $additional_options.region != "":
38                -r '$additional_options.region'
39            #end if
40
41            #if $condition_histogram.histogram_select == "yes"
42                -m
43                -w $condition_histogram.n_bins
44            #end if
45
46            -o '$output'
47    ]]></command>
48    <inputs>
49        <conditional name="condition_input">
50            <param name="input_pooling" type="select" label="Are you pooling bam files?" help="Calculate the coverage for multiple bam files" >
51                <option value="No" selected="True">No</option>
52                <option value="Yes">Yes</option>
53            </param>
54            <when value="No" >
55                <param name="input" type="data" format="bam" label="BAM file"/>
56            </when>
57            <when value="Yes">
58                <param name="input_bams" type="data" format="bam" multiple="true" label="BAM files to be pooled"/>
59            </when>
60        </conditional>
61
62        <section name="additional_options" title="Additional Options" expanded="true">
63            <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)" />
64            <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)" />
65            <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)" />
66
67            <param name="required_flags" argument="--rf" type="select" multiple="True" label="Require that these flags are set">
68                <expand macro="flag_options" />
69            </param>
70
71            <param name="skipped_flags" argument="--ff" type="select" multiple="True" label="Exclude reads with any of the following flags set">
72                <expand macro="flag_options" s4="true" s256="true" s512="true" s1024="true"/>
73            </param>
74            <param name="region" argument="-r" type="text" value="" label="Show specified region" help="Show specified region. Format: chr:start-end." >
75                <sanitizer invalid_char="">
76                    <valid initial="string.ascii_letters,string.digits">
77                        <add value=":" />
78                        <add value="-" />
79                        <add value="_" />
80                    </valid>
81                </sanitizer>
82            </param>
83        </section>
84
85        <conditional name="condition_histogram">
86            <param name="histogram_select" argument="-m" type="select" label="Histogram" help="Show histogram instead of tabular output">
87                <option value="no" selected="true">No</option>
88                <option value="yes">Yes</option>
89            </param>
90            <when value="yes">
91                <param name="n_bins" argument="-w" type="integer" min="1" value="100" label="Number of bins in histogram" help="Number of bins in histogram" />
92            </when>
93            <when value="no" />
94        </conditional>
95    </inputs>
96
97    <outputs>
98        <data name="output" format="tabular" from_work_dir="outfile" label="${tool.name} on ${on_string}" />
99    </outputs>
100
101    <tests>
102        <test>
103            <conditional name="condition_input">
104                <param name="input" value="test_1.bam" ftype="bam" />
105            </conditional>
106            <output name="output" file="results_1.tabular" ftype="tabular" />
107        </test>
108        <test>
109            <conditional name="condition_input">
110                <param name="input" value="test_1.bam" ftype="bam" />
111            </conditional>
112            <conditional name="condition_histogram">
113                <param name="histogram_select" value="yes" />
114                <param name="n_bins" value="50" />
115            </conditional>
116            <output name="output" file="results_2.txt" ftype="tabular" />
117        </test>
118        <test>
119            <conditional name="condition_input">
120                <param name="input_pooling" value="Yes" />
121                <param name="input_bams" value="test_1.bam,test_2.bam" ftype="bam" />
122            </conditional>
123            <conditional name="condition_histogram">
124                <param name="histogram_select" value="yes" />
125                <param name="n_bins" value="100" />
126            </conditional>
127            <output name="output" file="results_3.txt" ftype="tabular" />
128        </test>
129        <test><!-- test with a region (requires index) -->
130            <conditional name="condition_input">
131                <param name="input" value="test_1.bam" ftype="bam" />
132            </conditional>
133            <section name="additional_options">
134                <param name="region" value="ref1" />
135            </section>
136            <output name="output" file="results_4.tabular" ftype="tabular" />
137        </test>
138        <test><!-- test with pooled BAMs and a region -->
139            <conditional name="condition_input">
140                <param name="input_pooling" value="Yes" />
141                <param name="input_bams" value="test_1.bam,test_2.bam" ftype="bam" />
142            </conditional>
143            <section name="additional_options">
144                <param name="region" value="ref2" />
145            </section>
146            <output name="output" file="results_5.tabular" ftype="tabular" />
147        </test>
148    </tests>
149    <help><![CDATA[
150**What it does**
151
152This tool runs the ``samtools coverage`` command.
153
154Computes 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.
155
156The tabulated form uses the following headings:
157
158- rname	Reference name / chromosome
159- startpos	Start position
160- endpos	End position (or sequence length)
161- numreads	Number reads aligned to the region (after filtering)
162- covbases	Number of covered bases with depth >= 1
163- coverage	Proportion of covered bases [0..1]
164- meandepth	Mean depth of coverage
165- meanbaseq	Mean baseQ in covered region
166- meanmapq	Mean mapQ of selected reads
167
168    ]]></help>
169    <expand macro="citations"/>
170</tool>