Mercurial > repos > devteam > samtool_filter2
annotate samtool_filter2.xml @ 5:b7aa423007bf draft
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit 94a7407227beb0139c49d92c7f922499dc7f0cd1
author | devteam |
---|---|
date | Fri, 20 Jan 2017 04:51:36 -0500 |
parents | d3292b4a0c78 |
children | dc6ff68ea5e8 |
rev | line source |
---|---|
3
c31a37f6d48a
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit d02925461fc5d6188099a60c1996c671a0bde828
devteam
parents:
2
diff
changeset
|
1 <tool id="samtool_filter2" name="Filter SAM or BAM, output SAM or BAM" version="1.1.2"> |
0 | 2 <description>files on FLAG MAPQ RG LN or by region</description> |
3 <requirements> | |
3
c31a37f6d48a
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit d02925461fc5d6188099a60c1996c671a0bde828
devteam
parents:
2
diff
changeset
|
4 <requirement type="package" version="1.2">samtools</requirement> |
0 | 5 </requirements> |
1
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
6 <stdio> |
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
7 <exit_code range="1:" /> |
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
8 </stdio> |
0 | 9 <command> |
1
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
10 <![CDATA[ |
0 | 11 ##set up input files, regions requires input.bam and input.bai |
5
b7aa423007bf
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit 94a7407227beb0139c49d92c7f922499dc7f0cd1
devteam
parents:
4
diff
changeset
|
12 #if $input1.is_of_type('bam') |
0 | 13 #set $input = 'input.bam' |
5
b7aa423007bf
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit 94a7407227beb0139c49d92c7f922499dc7f0cd1
devteam
parents:
4
diff
changeset
|
14 ln -s '$input1' $input && |
b7aa423007bf
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit 94a7407227beb0139c49d92c7f922499dc7f0cd1
devteam
parents:
4
diff
changeset
|
15 ln -s '$input1.metadata.bam_index' input.bai && |
b7aa423007bf
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit 94a7407227beb0139c49d92c7f922499dc7f0cd1
devteam
parents:
4
diff
changeset
|
16 #elif $input1.is_of_type('sam') |
0 | 17 #set $input = 'input.sam' |
5
b7aa423007bf
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit 94a7407227beb0139c49d92c7f922499dc7f0cd1
devteam
parents:
4
diff
changeset
|
18 ln -s '$input1' $input && |
0 | 19 #end if |
5
b7aa423007bf
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit 94a7407227beb0139c49d92c7f922499dc7f0cd1
devteam
parents:
4
diff
changeset
|
20 samtools view $possibly_select_inverse '$output1' $header |
1
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
21 |
5
b7aa423007bf
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit 94a7407227beb0139c49d92c7f922499dc7f0cd1
devteam
parents:
4
diff
changeset
|
22 #if $input1.is_of_type('sam') |
0 | 23 -S |
24 #end if | |
25 | |
5
b7aa423007bf
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit 94a7407227beb0139c49d92c7f922499dc7f0cd1
devteam
parents:
4
diff
changeset
|
26 #if str($outputtype) == 'bam' |
1
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
27 -b |
0 | 28 #end if |
1
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
29 |
5
b7aa423007bf
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit 94a7407227beb0139c49d92c7f922499dc7f0cd1
devteam
parents:
4
diff
changeset
|
30 #if str($mapq) |
0 | 31 -q $mapq |
32 #end if | |
5
b7aa423007bf
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit 94a7407227beb0139c49d92c7f922499dc7f0cd1
devteam
parents:
4
diff
changeset
|
33 #if $flag.filter == 'yes' |
b7aa423007bf
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit 94a7407227beb0139c49d92c7f922499dc7f0cd1
devteam
parents:
4
diff
changeset
|
34 #if str($flag.reqBits) != 'None' |
b7aa423007bf
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit 94a7407227beb0139c49d92c7f922499dc7f0cd1
devteam
parents:
4
diff
changeset
|
35 #set $reqs = str($flag.reqBits).split(',') |
0 | 36 #set $reqFlag = 0 |
37 #for $xn in $reqs: | |
5
b7aa423007bf
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit 94a7407227beb0139c49d92c7f922499dc7f0cd1
devteam
parents:
4
diff
changeset
|
38 #set $reqFlag += int($xn, 16) |
0 | 39 #end for |
40 -f $hex($reqFlag) | |
41 #end if | |
5
b7aa423007bf
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit 94a7407227beb0139c49d92c7f922499dc7f0cd1
devteam
parents:
4
diff
changeset
|
42 #if str($flag.skipBits) != 'None' |
b7aa423007bf
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit 94a7407227beb0139c49d92c7f922499dc7f0cd1
devteam
parents:
4
diff
changeset
|
43 #set $skips = str($flag.skipBits).split(',') |
0 | 44 #set $skipFlag = 0 |
45 #for $xn in $skips: | |
46 #set $skipFlag += int(xn,16) | |
47 #end for | |
48 -F $hex($skipFlag) | |
49 #end if | |
50 #end if | |
5
b7aa423007bf
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit 94a7407227beb0139c49d92c7f922499dc7f0cd1
devteam
parents:
4
diff
changeset
|
51 #if str($read_group).strip() |
b7aa423007bf
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit 94a7407227beb0139c49d92c7f922499dc7f0cd1
devteam
parents:
4
diff
changeset
|
52 -r '$read_group' |
0 | 53 #end if |
5
b7aa423007bf
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit 94a7407227beb0139c49d92c7f922499dc7f0cd1
devteam
parents:
4
diff
changeset
|
54 #if str($library).strip() |
b7aa423007bf
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit 94a7407227beb0139c49d92c7f922499dc7f0cd1
devteam
parents:
4
diff
changeset
|
55 -l '$library' |
0 | 56 #end if |
5
b7aa423007bf
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit 94a7407227beb0139c49d92c7f922499dc7f0cd1
devteam
parents:
4
diff
changeset
|
57 #if $bed_file |
b7aa423007bf
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit 94a7407227beb0139c49d92c7f922499dc7f0cd1
devteam
parents:
4
diff
changeset
|
58 -L '$bed_file' |
0 | 59 #end if |
60 $input | |
5
b7aa423007bf
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit 94a7407227beb0139c49d92c7f922499dc7f0cd1
devteam
parents:
4
diff
changeset
|
61 #if str($regions).strip() and $input1.is_of_type('bam') |
b7aa423007bf
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit 94a7407227beb0139c49d92c7f922499dc7f0cd1
devteam
parents:
4
diff
changeset
|
62 '$regions' |
0 | 63 #end if |
64 ## need to redirect stderr message so galaxy does not think this failed | |
1
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
65 2>&1 |
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
66 ]]> |
0 | 67 </command> |
68 <inputs> | |
1
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
69 <param name="input1" type="data" format="sam,bam" label="SAM or BAM file to filter" /> |
0 | 70 <param name="header" type="select" label="Header in output"> |
71 <option value="-h">Include Header</option> | |
72 <option value="">Exclude Header</option> | |
73 <option value="-H">Only the Header</option> | |
74 </param> | |
1
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
75 <param name="mapq" type="integer" value="" optional="true" label="Minimum MAPQ quality score" help="(-q)"> |
0 | 76 <validator type="in_range" message="The MAPQ quality score can't be negative" min="0"/> |
77 </param> | |
78 <conditional name="flag"> | |
79 <param name="filter" type="select" label="Filter on bitwise flag"> | |
80 <option value="no">no</option> | |
81 <option value="yes">yes</option> | |
82 </param> | |
83 <when value="no"/> | |
84 <when value="yes"> | |
1
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
85 <param name="reqBits" type="select" multiple="true" display="checkboxes" label="Only output alignments with all of these flag bits set" help="(-f)"> |
0 | 86 <option value="0x0001">Read is paired</option> |
87 <option value="0x0002">Read is mapped in a proper pair</option> | |
88 <option value="0x0004">The read is unmapped</option> | |
89 <option value="0x0008">The mate is unmapped</option> | |
90 <option value="0x0010">Read strand</option> | |
91 <option value="0x0020">Mate strand</option> | |
92 <option value="0x0040">Read is the first in a pair</option> | |
93 <option value="0x0080">Read is the second in a pair</option> | |
94 <option value="0x0100">The alignment or this read is not primary</option> | |
95 <option value="0x0200">The read fails platform/vendor quality checks</option> | |
96 <option value="0x0400">The read is a PCR or optical duplicate</option> | |
4
d3292b4a0c78
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit 47865f133813c9e61ffc63d70aad1ff782c645ac
devteam
parents:
3
diff
changeset
|
97 <option value="0x0800">Supplementary alignment</option> |
0 | 98 </param> |
1
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
99 <param name="skipBits" type="select" multiple="true" display="checkboxes" label="Skip alignments with any of these flag bits set" help="(-F)"> |
0 | 100 <option value="0x0001">Read is paired</option> |
101 <option value="0x0002">Read is mapped in a proper pair</option> | |
102 <option value="0x0004">The read is unmapped</option> | |
103 <option value="0x0008">The mate is unmapped</option> | |
104 <option value="0x0010">Read strand</option> | |
105 <option value="0x0020">Mate strand</option> | |
106 <option value="0x0040">Read is the first in a pair</option> | |
107 <option value="0x0080">Read is the second in a pair</option> | |
108 <option value="0x0100">The alignment or this read is not primary</option> | |
109 <option value="0x0200">The read fails platform/vendor quality checks</option> | |
110 <option value="0x0400">The read is a PCR or optical duplicate</option> | |
4
d3292b4a0c78
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit 47865f133813c9e61ffc63d70aad1ff782c645ac
devteam
parents:
3
diff
changeset
|
111 <option value="0x0800">Supplementary alignment</option> |
0 | 112 </param> |
113 </when> | |
114 </conditional> | |
2
886b73f04847
planemo upload commit 1869970193a1878acbc0f8a79b81dd02b37f1dc1
devteam
parents:
1
diff
changeset
|
115 <param name="library" type="text" value="" label="Select alignments from Library" |
1
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
116 help="(-l) Requires headers in the input SAM or BAM, otherwise no alignments will be output"/> |
2
886b73f04847
planemo upload commit 1869970193a1878acbc0f8a79b81dd02b37f1dc1
devteam
parents:
1
diff
changeset
|
117 <param name="read_group" type="text" value="" label="Select alignments from Read Group" |
1
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
118 help="(-r) Requires headers in the input SAM or BAM, otherwise no alignments will be output"/> |
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
119 <param name="bed_file" type="data" format="bed" optional="true" label="Output alignments overlapping the regions in the BED FILE" help="(-L)"/> |
3
c31a37f6d48a
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit d02925461fc5d6188099a60c1996c671a0bde828
devteam
parents:
2
diff
changeset
|
120 <param name="possibly_select_inverse" checked="false" label="Use inverse selection" type="boolean" truevalue="-U" falsevalue="-o" help="Select the opposite of the listed chromosomes" /> |
2
886b73f04847
planemo upload commit 1869970193a1878acbc0f8a79b81dd02b37f1dc1
devteam
parents:
1
diff
changeset
|
121 <param name="regions" type="text" value="" label="Select regions (only used when the input is in BAM format)" |
0 | 122 help="region should be presented in one of the following formats: `chr1', `chr2:1,000' and `chr3:1000-2,000'"/> |
123 <param name="outputtype" type="select" label="Select the output format"> | |
1
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
124 <option value="bam">BAM (-b)</option> |
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
125 <option value="sam">SAM</option> |
0 | 126 </param> |
127 </inputs> | |
128 <outputs> | |
1
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
129 <data name="output1" format="sam" label="${tool.name} on ${on_string}: ${outputtype}"> |
0 | 130 <change_format> |
131 <when input="outputtype" value="bam" format="bam" /> | |
132 </change_format> | |
133 </data> | |
134 </outputs> | |
135 <tests> | |
136 <test> | |
137 <param name="input1" value="bam_to_sam_in2.sam" ftype="sam" /> | |
138 <param name="header" value=""/> | |
139 <param name="filter" value="yes"/> | |
140 <param name="reqBits" value="0x0080"/> | |
141 <param name="outputtype" value="sam"/> | |
1
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
142 <output name="output1"> |
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
143 <assert_contents> |
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
144 <has_text text="141" /> |
0 | 145 <not_has_text text="77" /> |
1
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
146 </assert_contents> |
0 | 147 </output> |
148 </test> | |
149 <test> | |
150 <param name="input1" value="bam_to_sam_in2.sam" ftype="sam" /> | |
151 <param name="header" value=""/> | |
152 <param name="filter" value="no"/> | |
153 <param name="read_group" value="rg1"/> | |
154 <param name="outputtype" value="sam"/> | |
1
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
155 <output name="output1"> |
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
156 <assert_contents> |
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
157 <has_text text="rg1" /> |
0 | 158 <not_has_text text="rg2" /> |
1
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
159 </assert_contents> |
0 | 160 </output> |
161 </test> | |
162 <test> | |
163 <param name="input1" value="bam_to_sam_in1.sam" ftype="sam" /> | |
164 <param name="header" value=""/> | |
165 <param name="filter" value="yes"/> | |
166 <param name="skipBits" value="0x0008"/> | |
167 <param name="mapq" value="250"/> | |
168 <param name="outputtype" value="sam"/> | |
1
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
169 <output name="output1"> |
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
170 <assert_contents> |
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
171 <has_text text="both_reads_align_clip_marked" /> |
0 | 172 <not_has_text text="both_reads_present_only_first_aligns" /> |
1
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
173 </assert_contents> |
0 | 174 </output> |
175 </test> | |
176 </tests> | |
177 <help> | |
178 **What it does** | |
179 | |
1
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
180 This tool uses the samtools view command in SAMtools_ toolkit to filter a SAM or BAM file on the MAPQ (mapping quality), FLAG bits, Read Group, Library, or region. |
0 | 181 |
182 **Input** | |
183 | |
184 Input is either a SAM or BAM file. | |
185 | |
186 **Output** | |
187 | |
188 The output file will be SAM or BAM (depending on the chosen option), filtered by the selected options. | |
189 | |
190 **Options** | |
191 | |
1
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
192 Filtering by read group or library requires headers in the input SAM or BAM file. |
0 | 193 |
1
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
194 If regions are specified, only alignments overlapping the specified regions will be output. An alignment may be given multiple times if it is overlapping several regions. |
0 | 195 A region can be presented, for example, in the following format:: |
196 | |
197 chr2 (the whole chr2) | |
1
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
198 chr2:1000000 (region starting from 1,000,000bp) |
94d5786febc4
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
devteam
parents:
0
diff
changeset
|
199 chr2:1,000,000-2,000,000 (region between 1,000,000 and 2,000,000bp including the end points). |
0 | 200 |
201 Note: The coordinate is 1-based. | |
202 | |
203 Multiple regions may be specified, separated by a space character:: | |
204 | |
205 chr2:1000000-2000000 chr2:1,000,000-2,000,000 chrX | |
206 | |
207 | |
208 | |
5
b7aa423007bf
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tools/samtool_filter2 commit 94a7407227beb0139c49d92c7f922499dc7f0cd1
devteam
parents:
4
diff
changeset
|
209 .. _SAMtools: http://www.htslib.org/ |
0 | 210 |
211 </help> | |
212 </tool> |