Mercurial > repos > devteam > samtool_filter2
comparison samtool_filter2.xml @ 1:94d5786febc4 draft
planemo upload commit 4381f4022eca6f3c58ae1d01096795cd28c15062
author | devteam |
---|---|
date | Mon, 10 Aug 2015 17:14:37 -0400 |
parents | 2d4ae2f8231e |
children | 886b73f04847 |
comparison
equal
deleted
inserted
replaced
0:2d4ae2f8231e | 1:94d5786febc4 |
---|---|
1 <tool id="samtool_filter2" name="Filter SAM or BAM, output SAM or BAM" version="1.1.1"> | 1 <tool id="samtool_filter2" name="Filter SAM or BAM, output SAM or BAM" version="1.1.1"> |
2 <description>files on FLAG MAPQ RG LN or by region</description> | 2 <description>files on FLAG MAPQ RG LN or by region</description> |
3 <requirements> | 3 <requirements> |
4 <requirement type="package" version="0.1.18">samtools</requirement> | 4 <requirement type="package" version="0.1.18">samtools</requirement> |
5 </requirements> | 5 </requirements> |
6 <!-- | 6 <stdio> |
7 samtools view [-bchuHS] [-t in.refList] [-o output] [-f reqFlag] [-F skipFlag] [-q minMapQ] [-l library] [-r readGroup] [-R rgFile] <in.bam>|<in.sam> [region1 [...]] | 7 <exit_code range="1:" /> |
8 Usage: samtools view [options] <in.bam>|<in.sam> [region1 [...]] | 8 </stdio> |
9 | |
10 Options: -b output BAM | |
11 -h print header for the SAM output | |
12 -H print header only (no alignments) | |
13 -S input is SAM | |
14 -u uncompressed BAM output (force -b) | |
15 -1 fast compression (force -b) | |
16 -x output FLAG in HEX (samtools-C specific) | |
17 -X output FLAG in string (samtools-C specific) | |
18 -c print only the count of matching records | |
19 -L FILE output alignments overlapping the input BED FILE [null] | |
20 -t FILE list of reference names and lengths (force -S) [null] | |
21 -T FILE reference sequence file (force -S) [null] | |
22 -o FILE output file name [stdout] | |
23 -R FILE list of read groups to be outputted [null] | |
24 -f INT required flag, 0 for unset [0] | |
25 -F INT filtering flag, 0 for unset [0] | |
26 -q INT minimum mapping quality [0] | |
27 -l STR only output reads in library STR [null] | |
28 -r STR only output reads in read group STR [null] | |
29 -? longer help | |
30 --> | |
31 <command> | 9 <command> |
10 <![CDATA[ | |
32 ##set up input files, regions requires input.bam and input.bai | 11 ##set up input files, regions requires input.bam and input.bai |
33 #if isinstance($input1.datatype, $__app__.datatypes_registry.get_datatype_by_extension('bam').__class__): | 12 #if isinstance($input1.datatype, $__app__.datatypes_registry.get_datatype_by_extension('bam').__class__): |
34 #set $input = 'input.bam' | 13 #set $input = 'input.bam' |
35 ln -s $input1 $input && | 14 ln -s "$input1" $input && |
36 ln -s $input1.metadata.bam_index input.bai && | 15 ln -s "$input1.metadata.bam_index" input.bai && |
37 #elif isinstance($input1.datatype, $__app__.datatypes_registry.get_datatype_by_extension('sam').__class__): | 16 #elif isinstance($input1.datatype, $__app__.datatypes_registry.get_datatype_by_extension('sam').__class__): |
38 #set $input = 'input.sam' | 17 #set $input = 'input.sam' |
39 ln -s $input1 $input && | 18 ln -s "$input1" $input && |
40 #end if | 19 #end if |
41 samtools view -o "$output1" $header | 20 samtools view -o "$output1" $header |
42 | 21 |
43 #if $input1.datatype.file_ext == 'sam': | 22 #if $input1.datatype.file_ext == 'sam': |
44 -S | 23 -S |
45 #end if | 24 #end if |
46 | 25 |
47 #if $outputtype.__str__ == "bam": | 26 #if $outputtype.__str__ == "bam": |
48 -b | 27 -b |
49 #end if | 28 #end if |
50 | 29 |
51 | |
52 #if $mapq.__str__ != '': | 30 #if $mapq.__str__ != '': |
53 -q $mapq | 31 -q $mapq |
54 #end if | 32 #end if |
55 #if $flag.filter.__str__ == 'yes': | 33 #if $flag.filter.__str__ == 'yes': |
56 #if $flag.reqBits.__str__ != 'None': | 34 #if $flag.reqBits.__str__ != 'None': |
57 #set $reqs = $flag.reqBits.__str__.split(',') | 35 #set $reqs = $flag.reqBits.__str__.split(',') |
58 #set $reqFlag = 0 | 36 #set $reqFlag = 0 |
59 #for $xn in $reqs: | 37 #for $xn in $reqs: |
60 #set $reqFlag += int(xn,16) | 38 #set $reqFlag += int(xn,16) |
61 #end for | 39 #end for |
62 -f $hex($reqFlag) | 40 -f $hex($reqFlag) |
63 #end if | 41 #end if |
64 #if $flag.skipBits.__str__ != 'None': | 42 #if $flag.skipBits.__str__ != 'None': |
65 #set $skips = $flag.skipBits.__str__.split(',') | 43 #set $skips = $flag.skipBits.__str__.split(',') |
66 #set $skipFlag = 0 | 44 #set $skipFlag = 0 |
67 #for $xn in $skips: | 45 #for $xn in $skips: |
68 #set $skipFlag += int(xn,16) | 46 #set $skipFlag += int(xn,16) |
69 #end for | 47 #end for |
70 -F $hex($skipFlag) | 48 -F $hex($skipFlag) |
75 #end if | 53 #end if |
76 #if $library.__str__.strip() != '': | 54 #if $library.__str__.strip() != '': |
77 -l $library | 55 -l $library |
78 #end if | 56 #end if |
79 #if $bed_file.__str__ != "None" and len($bed_file.__str__) > 0: | 57 #if $bed_file.__str__ != "None" and len($bed_file.__str__) > 0: |
80 -L $bed_file | 58 -L "$bed_file" |
81 #end if | 59 #end if |
82 $input | 60 $input |
83 #if $regions.__str__.strip() != '' and $input1.datatype.file_ext == 'bam': | 61 #if $regions.__str__.strip() != '' and $input1.datatype.file_ext == 'bam': |
84 $regions.__str__.strip() | 62 $regions.__str__.strip() |
85 #end if | 63 #end if |
86 ## need to redirect stderr message so galaxy does not think this failed | 64 ## need to redirect stderr message so galaxy does not think this failed |
87 2>&1 | 65 2>&1 |
66 ]]> | |
88 </command> | 67 </command> |
89 <inputs> | 68 <inputs> |
90 <param name="input1" type="data" format="sam,bam" label="SAM or BAM File to Filter" /> | 69 <param name="input1" type="data" format="sam,bam" label="SAM or BAM file to filter" /> |
91 <param name="header" type="select" label="Header in output"> | 70 <param name="header" type="select" label="Header in output"> |
92 <option value="-h">Include Header</option> | 71 <option value="-h">Include Header</option> |
93 <option value="">Exclude Header</option> | 72 <option value="">Exclude Header</option> |
94 <option value="-H">Only the Header</option> | 73 <option value="-H">Only the Header</option> |
95 </param> | 74 </param> |
96 <param name="mapq" type="integer" value="" optional="true" label="Minimum MAPQ quality score"> | 75 <param name="mapq" type="integer" value="" optional="true" label="Minimum MAPQ quality score" help="(-q)"> |
97 <validator type="in_range" message="The MAPQ quality score can't be negative" min="0"/> | 76 <validator type="in_range" message="The MAPQ quality score can't be negative" min="0"/> |
98 </param> | 77 </param> |
99 <conditional name="flag"> | 78 <conditional name="flag"> |
100 <param name="filter" type="select" label="Filter on bitwise flag"> | 79 <param name="filter" type="select" label="Filter on bitwise flag"> |
101 <option value="no">no</option> | 80 <option value="no">no</option> |
102 <option value="yes">yes</option> | 81 <option value="yes">yes</option> |
103 </param> | 82 </param> |
104 <when value="no"/> | 83 <when value="no"/> |
105 <when value="yes"> | 84 <when value="yes"> |
106 <param name="reqBits" type="select" multiple="true" display="checkboxes" label="Only output alignments with all of these flag bits set" > | 85 <param name="reqBits" type="select" multiple="true" display="checkboxes" label="Only output alignments with all of these flag bits set" help="(-f)"> |
107 <option value="0x0001">Read is paired</option> | 86 <option value="0x0001">Read is paired</option> |
108 <option value="0x0002">Read is mapped in a proper pair</option> | 87 <option value="0x0002">Read is mapped in a proper pair</option> |
109 <option value="0x0004">The read is unmapped</option> | 88 <option value="0x0004">The read is unmapped</option> |
110 <option value="0x0008">The mate is unmapped</option> | 89 <option value="0x0008">The mate is unmapped</option> |
111 <option value="0x0010">Read strand</option> | 90 <option value="0x0010">Read strand</option> |
114 <option value="0x0080">Read is the second in a pair</option> | 93 <option value="0x0080">Read is the second in a pair</option> |
115 <option value="0x0100">The alignment or this read is not primary</option> | 94 <option value="0x0100">The alignment or this read is not primary</option> |
116 <option value="0x0200">The read fails platform/vendor quality checks</option> | 95 <option value="0x0200">The read fails platform/vendor quality checks</option> |
117 <option value="0x0400">The read is a PCR or optical duplicate</option> | 96 <option value="0x0400">The read is a PCR or optical duplicate</option> |
118 </param> | 97 </param> |
119 <param name="skipBits" type="select" multiple="true" display="checkboxes" label="Skip alignments with any of these flag bits set" > | 98 <param name="skipBits" type="select" multiple="true" display="checkboxes" label="Skip alignments with any of these flag bits set" help="(-F)"> |
120 <option value="0x0001">Read is paired</option> | 99 <option value="0x0001">Read is paired</option> |
121 <option value="0x0002">Read is mapped in a proper pair</option> | 100 <option value="0x0002">Read is mapped in a proper pair</option> |
122 <option value="0x0004">The read is unmapped</option> | 101 <option value="0x0004">The read is unmapped</option> |
123 <option value="0x0008">The mate is unmapped</option> | 102 <option value="0x0008">The mate is unmapped</option> |
124 <option value="0x0010">Read strand</option> | 103 <option value="0x0010">Read strand</option> |
130 <option value="0x0400">The read is a PCR or optical duplicate</option> | 109 <option value="0x0400">The read is a PCR or optical duplicate</option> |
131 </param> | 110 </param> |
132 </when> | 111 </when> |
133 </conditional> | 112 </conditional> |
134 <param name="library" type="text" value="" size="20" label="Select alignments from Library" | 113 <param name="library" type="text" value="" size="20" label="Select alignments from Library" |
135 help="Requires headers in the input SAM or BAM, otherwise no alignments will be output."/> | 114 help="(-l) Requires headers in the input SAM or BAM, otherwise no alignments will be output"/> |
136 <param name="read_group" type="text" value="" size="20" label="Select alignments from Read Group" | 115 <param name="read_group" type="text" value="" size="20" label="Select alignments from Read Group" |
137 help="Requires headers in the input SAM or BAM, otherwise no alignments will be output."/> | 116 help="(-r) Requires headers in the input SAM or BAM, otherwise no alignments will be output"/> |
138 <param name="bed_file" type="data" format="bed" optional="true" label="Output alignments overlapping the regions in the BED FILE"/> | 117 <param name="bed_file" type="data" format="bed" optional="true" label="Output alignments overlapping the regions in the BED FILE" help="(-L)"/> |
139 <param name="regions" type="text" value="" size="180" label="Select regions (only used when the input is in BAM format)" | 118 <param name="regions" type="text" value="" size="180" label="Select regions (only used when the input is in BAM format)" |
140 help="region should be presented in one of the following formats: `chr1', `chr2:1,000' and `chr3:1000-2,000'"/> | 119 help="region should be presented in one of the following formats: `chr1', `chr2:1,000' and `chr3:1000-2,000'"/> |
141 <param name="outputtype" type="select" label="Select the output format"> | 120 <param name="outputtype" type="select" label="Select the output format"> |
142 <option value="bam">bam</option> | 121 <option value="bam">BAM (-b)</option> |
143 <option value="sam">sam</option> | 122 <option value="sam">SAM</option> |
144 </param> | 123 </param> |
145 </inputs> | 124 </inputs> |
146 <outputs> | 125 <outputs> |
147 <data name="output1" format_source="input1" label="${tool.name} on ${on_string}: ${input1.datatype.file_ext}"> | 126 <data name="output1" format="sam" label="${tool.name} on ${on_string}: ${outputtype}"> |
148 <change_format> | 127 <change_format> |
149 <when input="outputtype" value="bam" format="bam" /> | 128 <when input="outputtype" value="bam" format="bam" /> |
150 </change_format> | 129 </change_format> |
151 </data> | 130 </data> |
152 </outputs> | 131 </outputs> |
155 <param name="input1" value="bam_to_sam_in2.sam" ftype="sam" /> | 134 <param name="input1" value="bam_to_sam_in2.sam" ftype="sam" /> |
156 <param name="header" value=""/> | 135 <param name="header" value=""/> |
157 <param name="filter" value="yes"/> | 136 <param name="filter" value="yes"/> |
158 <param name="reqBits" value="0x0080"/> | 137 <param name="reqBits" value="0x0080"/> |
159 <param name="outputtype" value="sam"/> | 138 <param name="outputtype" value="sam"/> |
160 <output name="output1" > | 139 <output name="output1"> |
161 <assert_contents> | 140 <assert_contents> |
162 <has_text text="141" /> | 141 <has_text text="141" /> |
163 <not_has_text text="77" /> | 142 <not_has_text text="77" /> |
164 </assert_contents> | 143 </assert_contents> |
165 </output> | 144 </output> |
166 </test> | 145 </test> |
167 <test> | 146 <test> |
168 <param name="input1" value="bam_to_sam_in2.sam" ftype="sam" /> | 147 <param name="input1" value="bam_to_sam_in2.sam" ftype="sam" /> |
169 <param name="header" value=""/> | 148 <param name="header" value=""/> |
170 <param name="filter" value="no"/> | 149 <param name="filter" value="no"/> |
171 <param name="read_group" value="rg1"/> | 150 <param name="read_group" value="rg1"/> |
172 <param name="outputtype" value="sam"/> | 151 <param name="outputtype" value="sam"/> |
173 <output name="output1" > | 152 <output name="output1"> |
174 <assert_contents> | 153 <assert_contents> |
175 <has_text text="rg1" /> | 154 <has_text text="rg1" /> |
176 <not_has_text text="rg2" /> | 155 <not_has_text text="rg2" /> |
177 </assert_contents> | 156 </assert_contents> |
178 </output> | 157 </output> |
179 </test> | 158 </test> |
180 <test> | 159 <test> |
181 <param name="input1" value="bam_to_sam_in1.sam" ftype="sam" /> | 160 <param name="input1" value="bam_to_sam_in1.sam" ftype="sam" /> |
182 <param name="header" value=""/> | 161 <param name="header" value=""/> |
183 <param name="filter" value="yes"/> | 162 <param name="filter" value="yes"/> |
184 <param name="skipBits" value="0x0008"/> | 163 <param name="skipBits" value="0x0008"/> |
185 <param name="mapq" value="250"/> | 164 <param name="mapq" value="250"/> |
186 <param name="outputtype" value="sam"/> | 165 <param name="outputtype" value="sam"/> |
187 <output name="output1" > | 166 <output name="output1"> |
188 <assert_contents> | 167 <assert_contents> |
189 <has_text text="both_reads_align_clip_marked" /> | 168 <has_text text="both_reads_align_clip_marked" /> |
190 <not_has_text text="both_reads_present_only_first_aligns" /> | 169 <not_has_text text="both_reads_present_only_first_aligns" /> |
191 </assert_contents> | 170 </assert_contents> |
192 </output> | 171 </output> |
193 </test> | 172 </test> |
194 </tests> | 173 </tests> |
195 <help> | 174 <help> |
196 | |
197 | |
198 **What it does** | 175 **What it does** |
199 | 176 |
200 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. | 177 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. |
201 | 178 |
202 **Input** | 179 **Input** |
203 | 180 |
204 Input is either a SAM or BAM file. | 181 Input is either a SAM or BAM file. |
205 | 182 |
207 | 184 |
208 The output file will be SAM or BAM (depending on the chosen option), filtered by the selected options. | 185 The output file will be SAM or BAM (depending on the chosen option), filtered by the selected options. |
209 | 186 |
210 **Options** | 187 **Options** |
211 | 188 |
212 Filtering by read group or library requires headers in the input SAM or BAM file. | 189 Filtering by read group or library requires headers in the input SAM or BAM file. |
213 | 190 |
214 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. | 191 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. |
215 A region can be presented, for example, in the following format:: | 192 A region can be presented, for example, in the following format:: |
216 | 193 |
217 chr2 (the whole chr2) | 194 chr2 (the whole chr2) |
218 chr2:1000000 (region starting from 1,000,000bp) | 195 chr2:1000000 (region starting from 1,000,000bp) |
219 chr2:1,000,000-2,000,000 (region between 1,000,000 and 2,000,000bp including the end points). | 196 chr2:1,000,000-2,000,000 (region between 1,000,000 and 2,000,000bp including the end points). |
220 | 197 |
221 Note: The coordinate is 1-based. | 198 Note: The coordinate is 1-based. |
222 | 199 |
223 Multiple regions may be specified, separated by a space character:: | 200 Multiple regions may be specified, separated by a space character:: |
224 | 201 |
225 chr2:1000000-2000000 chr2:1,000,000-2,000,000 chrX | 202 chr2:1000000-2000000 chr2:1,000,000-2,000,000 chrX |
226 | 203 |
227 | 204 |
228 | 205 |
229 .. _SAMTools: http://samtools.sourceforge.net/samtools.shtml | 206 .. _SAMtools: http://samtools.sourceforge.net/ |
230 | 207 |
231 </help> | 208 </help> |
232 </tool> | 209 </tool> |