Mercurial > repos > devteam > bamtools_filter
comparison bamtools-filter.xml @ 2:2098a49ddf66 draft
planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/bamtools/bamtools_filter commit a1517c9d22029095120643bbe2c8fa53754dd2b7
author | devteam |
---|---|
date | Wed, 11 Nov 2015 12:33:46 -0500 |
parents | d64c7e752f4d |
children | 29ba2103739c |
comparison
equal
deleted
inserted
replaced
1:d64c7e752f4d | 2:2098a49ddf66 |
---|---|
1 <tool id="bamFilter" name="Filter" version="0.0.1"> | 1 <tool id="bamFilter" name="Filter" version="0.0.2"> |
2 <description>BAM datasets on a variety of attributes</description> | 2 <description>BAM datasets on a variety of attributes</description> |
3 <requirements> | 3 <requirements> |
4 <requirement type="package" version="2.3.0_2d7685d2ae">bamtools</requirement> | 4 <requirement type="package" version="2.3.0_2d7685d2ae">bamtools</requirement> |
5 </requirements> | 5 </requirements> |
6 <command> | 6 <command> |
7 | |
8 cat $script_file > $out_file2; | 7 cat $script_file > $out_file2; |
9 | 8 |
10 #for $bam_count, $input_bam in enumerate( $input_bams ): | 9 #for $bam_count, $input_bam in enumerate( $input_bams ): |
11 ln -s "${input_bam.input_bam}" "localbam_${bam_count}.bam" && | 10 ln -s "${input_bam}" "localbam_${bam_count}.bam" && |
12 ln -s "${input_bam.input_bam.metadata.bam_index}" "localbam_${bam_count}.bam.bai" && | 11 ln -s "${input_bam.metadata.bam_index}" "localbam_${bam_count}.bam.bai" && |
13 #end for | 12 #end for |
14 | 13 |
15 bamtools | 14 bamtools |
16 filter | 15 filter |
17 -script $script_file | 16 -script $script_file |
18 | 17 |
19 #for $bam_count, $input_bam in enumerate( $input_bams ): | 18 #for $bam_count, $input_bam in enumerate( $input_bams ): |
20 -in "localbam_${bam_count}.bam" | 19 -in "localbam_${bam_count}.bam" |
21 #end for | 20 #end for |
22 -out $out_file1 | 21 -out $out_file1 |
23 | |
24 </command> | 22 </command> |
25 | |
26 <inputs> | 23 <inputs> |
27 <repeat name="input_bams" title="BAM dataset(s) to filter" min="1"> | 24 <param name="input_bams" type="data" format="bam" label="BAM dataset(s) to filter" min="1" multiple="True"/> |
28 <param name="input_bam" type="data" format="bam" label="BAM dataset" /> | |
29 </repeat> | |
30 <repeat name="conditions" title="Condition" min="1"> | 25 <repeat name="conditions" title="Condition" min="1"> |
31 <repeat name="filters" title="Filter" min="1"> | 26 <repeat name="filters" title="Filter" min="1"> |
32 <conditional name="bam_property"> | 27 <conditional name="bam_property"> |
33 <param name="bam_property_selector" type="select" label="Select BAM property to filter on"> | 28 <param name="bam_property_selector" type="select" label="Select BAM property to filter on"> |
34 <option value="alignmentFlag"/> | 29 <option value="alignmentFlag"/> |
57 <!-- would be fanstastic to have AND and OR constructs in when statements --> | 52 <!-- would be fanstastic to have AND and OR constructs in when statements --> |
58 <when value="alignmentFlag"> | 53 <when value="alignmentFlag"> |
59 <param name="bam_property_value" type="integer" value="3" label="Filter on this alignment flag" help="Default (3) is for a paired read mapped in a proper pair"/> | 54 <param name="bam_property_value" type="integer" value="3" label="Filter on this alignment flag" help="Default (3) is for a paired read mapped in a proper pair"/> |
60 </when> | 55 </when> |
61 <when value="cigar"> | 56 <when value="cigar"> |
62 <param name="bam_property_value" type="text" size="10" value="101M" label="Filter on this CIGAR string" help="Default (101M) is for 101 continuously matched bases"/> | 57 <param name="bam_property_value" type="text" value="101M" label="Filter on this CIGAR string" help="Default (101M) is for 101 continuously matched bases"/> |
63 </when> | 58 </when> |
64 <when value="insertSize"> | 59 <when value="insertSize"> |
65 <param name="bam_property_value" type="text" size="10" value=">=250" label="Filter on inster size" help="You can use >, <, =, and ! (not) in your expression. E.g., to select pairs with inster size above 250 nt use ">=250""> | 60 <param name="bam_property_value" type="text" value=">=250" label="Filter on inster size" help="You can use >, <, =, and ! (not) in your expression. E.g., to select pairs with inster size above 250 nt use ">=250""> |
66 <sanitizer invalid_char=""> | 61 <sanitizer invalid_char=""> |
67 <valid initial="string.letters,string.digits"><add value=">"/><add value="<"/><add value="!="/></valid> | 62 <valid initial="string.letters,string.digits"><add value=">"/><add value="<"/><add value="!="/></valid> |
68 </sanitizer> | 63 </sanitizer> |
69 </param> | 64 </param> |
70 </when> | 65 </when> |
162 </repeat> | 157 </repeat> |
163 </repeat> | 158 </repeat> |
164 <conditional name="rule_configuration"> | 159 <conditional name="rule_configuration"> |
165 <param name="rules_selector" type="boolean" truevalue="true" falsevalue="false" label="Would you like to set rules?" help="Allows complex logical constructs. See Example 4 below." /> | 160 <param name="rules_selector" type="boolean" truevalue="true" falsevalue="false" label="Would you like to set rules?" help="Allows complex logical constructs. See Example 4 below." /> |
166 <when value="true"> | 161 <when value="true"> |
167 <param name="rules" type="text" size="20" label="Enter rules here" help="This option can only be used with at least two conditions. Read help below (Example 4) to understand how it works." > | 162 <param name="rules" type="text" label="Enter rules here" help="This option can only be used with at least two conditions. Read help below (Example 4) to understand how it works." > |
168 <sanitizer invalid_char=""> | 163 <sanitizer invalid_char=""> |
169 <valid initial="string.printable"/> | 164 <valid initial="string.printable"/> |
170 </sanitizer> | 165 </sanitizer> |
171 </param> | 166 </param> |
172 </when> | 167 </when> |
183 [ | 178 [ |
184 #end if | 179 #end if |
185 #for $i, $c in enumerate( $conditions, start=1 ) | 180 #for $i, $c in enumerate( $conditions, start=1 ) |
186 { "id": "$i", | 181 { "id": "$i", |
187 #for $j, $s in enumerate( $c.filters, start=1 ) | 182 #for $j, $s in enumerate( $c.filters, start=1 ) |
188 ##The if below takes care of the comma at the end of last condition within group | 183 ##The if below takes care of the comma at the end of last condition within group |
189 #if $j != len( $c.filters) | 184 #if $j != len( $c.filters) |
190 "${s.bam_property.bam_property_selector}":"${s.bam_property.bam_property_value}", | 185 "${s.bam_property.bam_property_selector}":"${s.bam_property.bam_property_value}", |
191 #else | 186 #else |
192 "${s.bam_property.bam_property_selector}":"${s.bam_property.bam_property_value}" | 187 "${s.bam_property.bam_property_selector}":"${s.bam_property.bam_property_value}" |
193 #end if | 188 #end if |
194 #end for | 189 #end for |
195 ##The if below takes care of the comma at the end of last condition within group | 190 ##The if below takes care of the comma at the end of last condition within group |
196 #if $i != len( $conditions ) | 191 #if $i != len( $conditions ) |
197 }, | 192 }, |
198 #else | 193 #else |
199 } | 194 } |
200 #end if | 195 #end if |
201 #end for | 196 #end for |
202 #if len( $conditions ) > 1 | 197 #if len( $conditions ) > 1 |
203 #if str( $rule_configuration.rules_selector ) == "True": | 198 #if str( $rule_configuration.rules_selector ) == "True": |
204 ], | 199 ], |
205 "rule" : "${rule_configuration.rules}" | 200 "rule" : "${rule_configuration.rules}" |
206 #else | 201 #else |
215 <data format="txt" name="out_file2" /> | 210 <data format="txt" name="out_file2" /> |
216 <data format="bam" name="out_file1" /> | 211 <data format="bam" name="out_file1" /> |
217 </outputs> | 212 </outputs> |
218 <tests> | 213 <tests> |
219 <test> | 214 <test> |
220 <param name="input_bam" ftype="bam" value="bamtools-input1.bam"/> | 215 <param name="input_bams" ftype="bam" value="bamtools-input1.bam"/> |
221 <param name="bam_property_selector" value="mapQuality"/> | 216 <param name="bam_property_selector" value="mapQuality"/> |
222 <param name="bam_property_value" value=">20"/> | 217 <param name="bam_property_value" value=">20"/> |
223 <output name="out_file1" file="bamtools-test1.bam" ftype="bam"/> | 218 <output name="out_file1" file="bamtools-test1.bam" ftype="bam"/> |
224 </test> | 219 </test> |
225 </tests> | 220 </tests> |
226 <help> | 221 <help> |
227 **What is does** | 222 **What is does** |
228 | 223 |
247 **Example 1. Using a single filter** | 242 **Example 1. Using a single filter** |
248 | 243 |
249 When filtering on a single condition there is no need to worry about filters and conditions. Just choose a filter from the **Select BAM property to filter on:** dropdown and enter a value (or click a checkbox for binary filters). | 244 When filtering on a single condition there is no need to worry about filters and conditions. Just choose a filter from the **Select BAM property to filter on:** dropdown and enter a value (or click a checkbox for binary filters). |
250 For example, for retaining reads with mapping quality of at least 20 one would set the tool interface as shown below: | 245 For example, for retaining reads with mapping quality of at least 20 one would set the tool interface as shown below: |
251 | 246 |
252 .. image:: ${static_path}/images/single-filter.png | 247 .. image:: single-filter.png |
253 | 248 |
254 ----- | 249 ----- |
255 | 250 |
256 **Example 2. Using multiple filters** | 251 **Example 2. Using multiple filters** |
257 | 252 |
258 Now suppose one needs to extract reads that (1) have mapping quality of at least 20, (2) contain at least 1 mismatch, and (3) are mapping onto forward strand only. | 253 Now suppose one needs to extract reads that (1) have mapping quality of at least 20, (2) contain at least 1 mismatch, and (3) are mapping onto forward strand only. |
259 To do so we will use three filters as shown below (multiple filters are added to the interface by clicking on the **Add new Filter** button): | 254 To do so we will use three filters as shown below (multiple filters are added to the interface by clicking on the **Add new Filter** button): |
260 | 255 |
261 .. image:: ${static_path}/images/multiple-filters.png | 256 .. image:: multiple-filters.png |
262 | 257 |
263 In this case (you can see that the three filters are grouped within a single Condition - **Condition 1**) the filter too use logical **AND** to perform filtering. | 258 In this case (you can see that the three filters are grouped within a single Condition - **Condition 1**) the filter too use logical **AND** to perform filtering. |
264 In other words only reads that (1) have mapping quality of at least 20 **AND** (2) contain at least 1 mismatch **AND** are mapping onto forward strand will be returned in this example. | 259 In other words only reads that (1) have mapping quality of at least 20 **AND** (2) contain at least 1 mismatch **AND** are mapping onto forward strand will be returned in this example. |
265 | 260 |
266 ----- | 261 ----- |
267 | 262 |
268 **Example 3. Complex filtering with multiple conditions** | 263 **Example 3. Complex filtering with multiple conditions** |
269 | 264 |
270 Suppose now you would like to select **either** reads that (**1**) have (*1.1*) no mismatches and (*1.2*) are on the forward strand **OR** (**2**) reads that have (*2.1*) | 265 Suppose now you would like to select **either** reads that (**1**) have (*1.1*) no mismatches and (*1.2*) are on the forward strand **OR** (**2**) reads that have (*2.1*) |
271 at least one mismatch and (*2.2*) are on the reverse strand. In this scenario we have to set up two conditions: (**1**) and (**2**) each with two filters: *1.1* and *1.2* as well as *2.1* and *2.2*. | 266 at least one mismatch and (*2.2*) are on the reverse strand. In this scenario we have to set up two conditions: (**1**) and (**2**) each with two filters: *1.1* and *1.2* as well as *2.1* and *2.2*. |
272 The following screenshot expalins how this can be done: | 267 The following screenshot expalins how this can be done: |
273 | 268 |
274 .. image:: ${static_path}/images/complex-filters.png | 269 .. image:: complex-filters.png |
275 | 270 |
276 ----- | 271 ----- |
277 | 272 |
278 **Example 4. Even more complex filtering with Rules** | 273 **Example 4. Even more complex filtering with Rules** |
279 | 274 |
280 In the above example we have used two conditions (Condition 1 and Condition 2). Using multiple conditions allows to combine them and a variety of ways to enable even more powerful filtering. | 275 In the above example we have used two conditions (Condition 1 and Condition 2). Using multiple conditions allows to combine them and a variety of ways to enable even more powerful filtering. |
281 For example, suppose get all reads that (**1**) do NOT map to mitochondria and either (**2**) have mapping quality over 20, or (**3**) are in properly mapped pairs. The logical rule to enable such | 276 For example, suppose get all reads that (**1**) do NOT map to mitochondria and either (**2**) have mapping quality over 20, or (**3**) are in properly mapped pairs. The logical rule to enable such |
282 filtering will look like this:: | 277 filtering will look like this:: |
283 | 278 |
284 !(1) & (2 | 3) | 279 !(1) & (2 | 3) |
285 | 280 |
286 Here, numbers 1, 2, and 3 represent conditions. The following screenshot illustrates how to do this in Galaxy: | 281 Here, numbers 1, 2, and 3 represent conditions. The following screenshot illustrates how to do this in Galaxy: |
287 | 282 |
288 .. image:: ${static_path}/images/rule.png | 283 .. image:: rule.png |
289 | 284 |
290 There are three conditions here, each with a single filter. A text entry area that can be opened by clicking on the **Would you like to set rules?** checkbox enables you to enter a rule. | 285 There are three conditions here, each with a single filter. A text entry area that can be opened by clicking on the **Would you like to set rules?** checkbox enables you to enter a rule. |
291 Here numbers correspond to numbers of conditions as they are shown in the interface. E.g., 1 corresponds to condition 1, 2 to condition 2 and so on... In human language this means:: | 286 Here numbers correspond to numbers of conditions as they are shown in the interface. E.g., 1 corresponds to condition 1, 2 to condition 2 and so on... In human language this means:: |
292 | 287 |
293 NOT condition 1 AND (condition 2 OR condition 3) | 288 NOT condition 1 AND (condition 2 OR condition 3) |
310 "tag":"NM:>0", | 305 "tag":"NM:>0", |
311 "isReverseStrand":"true" | 306 "isReverseStrand":"true" |
312 } | 307 } |
313 ] | 308 ] |
314 } | 309 } |
315 | 310 |
316 | |
317 | 311 |
318 ----- | 312 ----- |
319 | 313 |
320 **More information** | 314 **More information** |
321 | 315 |