annotate bamtools-filter.xml @ 0:2c2200cecea2 draft

Uploaded
author anton
date Wed, 10 Sep 2014 11:55:26 -0400
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
2c2200cecea2 Uploaded
anton
parents:
diff changeset
1 <tool id="bamFilter" name="Filter" version="0.0.1">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
2 <description>BAM datasets on a variety of attributes</description>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
3 <requirements>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
4 <requirement type="package" version="2.3.0_2d7685d2ae">bamtools</requirement>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
5 </requirements>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
6 <command>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
7
2c2200cecea2 Uploaded
anton
parents:
diff changeset
8 cat $script_file > $out_file2;
2c2200cecea2 Uploaded
anton
parents:
diff changeset
9
2c2200cecea2 Uploaded
anton
parents:
diff changeset
10 #for $bam_count, $input_bam in enumerate( $input_bams ):
2c2200cecea2 Uploaded
anton
parents:
diff changeset
11 ln -s "${input_bam.input_bam}" "localbam_${bam_count}.bam" &amp;&amp;
2c2200cecea2 Uploaded
anton
parents:
diff changeset
12 ln -s "${input_bam.input_bam.metadata.bam_index}" "localbam_${bam_count}.bam.bai" &amp;&amp;
2c2200cecea2 Uploaded
anton
parents:
diff changeset
13 #end for
2c2200cecea2 Uploaded
anton
parents:
diff changeset
14
2c2200cecea2 Uploaded
anton
parents:
diff changeset
15 bamtools
2c2200cecea2 Uploaded
anton
parents:
diff changeset
16 filter
2c2200cecea2 Uploaded
anton
parents:
diff changeset
17 -script $script_file
2c2200cecea2 Uploaded
anton
parents:
diff changeset
18
2c2200cecea2 Uploaded
anton
parents:
diff changeset
19 #for $bam_count, $input_bam in enumerate( $input_bams ):
2c2200cecea2 Uploaded
anton
parents:
diff changeset
20 -in "localbam_${bam_count}.bam"
2c2200cecea2 Uploaded
anton
parents:
diff changeset
21 #end for
2c2200cecea2 Uploaded
anton
parents:
diff changeset
22 -out $out_file1
2c2200cecea2 Uploaded
anton
parents:
diff changeset
23
2c2200cecea2 Uploaded
anton
parents:
diff changeset
24 </command>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
25
2c2200cecea2 Uploaded
anton
parents:
diff changeset
26 <inputs>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
27 <repeat name="input_bams" title="BAM dataset(s) to filter" min="1">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
28 <param name="input_bam" type="data" format="bam" label="BAM dataset" />
2c2200cecea2 Uploaded
anton
parents:
diff changeset
29 </repeat>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
30 <repeat name="conditions" title="Condition" min="1">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
31 <repeat name="filters" title="Filter" min="1">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
32 <conditional name="bam_property">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
33 <param name="bam_property_selector" type="select" label="Select BAM property to filter on">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
34 <option value="alignmentFlag"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
35 <option value="cigar"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
36 <option value="insertSize"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
37 <option value="isDuplicate"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
38 <option value="isFailedQC"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
39 <option value="isFirstMate"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
40 <option value="isMapped"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
41 <option value="isMateMapped"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
42 <option value="isMateReverseStrand"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
43 <option value="isPaired"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
44 <option value="isPrimaryAlignment"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
45 <option value="isProperPair"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
46 <option value="isReverseStrand"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
47 <option value="isSecondMate"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
48 <option selected="True" value="mapQuality"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
49 <option value="matePosition"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
50 <option value="mateReference"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
51 <option value="name"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
52 <option value="position"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
53 <option value="queryBases"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
54 <option value="reference"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
55 <option value="tag"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
56 </param>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
57 <!-- would be fanstastic to have AND and OR constructs in when statements -->
2c2200cecea2 Uploaded
anton
parents:
diff changeset
58 <when value="alignmentFlag">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
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"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
60 </when>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
61 <when value="cigar">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
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"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
63 </when>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
64 <when value="insertSize">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
65 <param name="bam_property_value" type="text" size="10" value=">=250" label="Filter on inster size" help="You can use &gt;, &lt;, =, and ! (not) in your expression. E.g., to select pairs with inster size above 250 nt use &quot;>=250&quot;">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
66 <sanitizer invalid_char="">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
67 <valid initial="string.letters,string.digits"><add value="&gt;"/><add value="&lt;"/><add value="!="/></valid>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
68 </sanitizer>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
69 </param>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
70 </when>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
71 <when value="isDuplicate">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
72 <param name="bam_property_value" type="boolean" truevalue="true" falsevalue="false" label="Select reads makwed as duplicates" help="Checked = Read IS Duplicate, Empty = Read is NOT Duplicate" />
2c2200cecea2 Uploaded
anton
parents:
diff changeset
73 </when>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
74 <when value="isFailedQC">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
75 <param name="bam_property_value" type="boolean" truevalue="true" falsevalue="false" label="Select reads failing QC" help="Checked = Failed QC, Empty = Passed QC"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
76 </when>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
77 <when value="isFirstMate">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
78 <param name="bam_property_value" type="boolean" truevalue="true" falsevalue="false" label="Select first mate in a read pair" help="Checked = is first mate, Empty = is NOT first mate"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
79 </when>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
80 <when value="isMapped">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
81 <param name="bam_property_value" type="boolean" truevalue="true" falsevalue="false" label="Selected mapped reads" help="Checked = Mapped, Empty = NOT mapped"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
82 </when>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
83 <when value="isMateMapped">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
84 <param name="bam_property_value" type="boolean" truevalue="true" falsevalue="false" label="Select reads with mapped mate" help="Checked = Mate IS mapped Empty = Mate is NOT mapped"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
85 </when>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
86 <when value="isMateReverseStrand">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
87 <param name="bam_property_value" type="boolean" truevalue="true" falsevalue="false" label="Select reads with mate on the reverse strand" help="Checked = Mate IS on reverse strand, Empty = Mate is NOT on the reverse strand"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
88 </when>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
89 <when value="isPaired">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
90 <param name="bam_property_value" type="boolean" truevalue="true" falsevalue="false" label="Select paired reads" help="Checked = Read IS paired, Empty = Read is NOT paired"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
91 </when>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
92 <when value="isPrimaryAlignment">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
93 <param name="bam_property_value" type="boolean" truevalue="true" falsevalue="false" label="Select BAM records for primary alignments" help="Checked = Alignment IS primary, Empty = Alignment is NOT primary"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
94 </when>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
95 <when value="isProperPair">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
96 <param name="bam_property_value" type="boolean" truevalue="true" falsevalue="false" label="Select properly paired reads" help="Checked = Read IS in proper pair, Empty = Read is NOT in the proper pair"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
97 </when>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
98 <when value="isReverseStrand">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
99 <param name="bam_property_value" type="boolean" truevalue="true" falsevalue="false" label="Select reads in the reverse strand only" help="Checked = Read IS on the reverse strand, Empty = Read is NOT on the reverse strand"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
100 </when>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
101 <when value="isSecondMate">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
102 <param name="bam_property_value" type="boolean" truevalue="true" falsevalue="false" label="Select second mate in a read pair" help="Checked = Read IS second mate, Empty = Read is NOT second mate"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
103 </when>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
104 <when value="mapQuality">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
105 <param name="bam_property_value" type="text" value="20" label="Filter on read mapping quality (phred scale)" help="You can use &gt;, &lt;, =, and ! (not) in your expression. E.g., to select reads with mapping quality of at least 30 use &quot;>=30&quot;">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
106 <sanitizer invalid_char="">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
107 <valid initial="string.letters,string.digits"><add value="&gt;"/><add value="&lt;"/><add value="!="/></valid>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
108 </sanitizer>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
109 </param>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
110 </when>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
111 <when value="matePosition">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
112 <param name="bam_property_value" type="text" value="1000000" label="Filter on the position of the mate" help="You can use &gt;, &lt;, =, and ! (not) in your expression. E.g., to select reads with mate (second end) mapping after position 1,000,000 use &quot;&gt;1000000&quot;">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
113 <sanitizer invalid_char="">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
114 <valid initial="string.letters,string.digits"><add value="&gt;"/><add value="&lt;"/><add value="!="/></valid>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
115 </sanitizer>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
116 </param>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
117 </when>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
118 <when value="mateReference">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
119 <param name="bam_property_value" type="text" value="chr22" label="Filter on reference name for the mate" help="You can use = and ! (not) in your expression. E.g., to select reads with mates mapping to chrM use &quot;chr22&quot;">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
120 <sanitizer invalid_char="">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
121 <valid initial="string.letters,string.digits"><add value="&gt;"/><add value="&lt;"/><add value="!="/></valid>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
122 </sanitizer>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
123 </param>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
124 </when>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
125 <when value="name">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
126 <param name="bam_property_value" type="text" label="Filter on read name" help="You can use = and ! (not) in your expression.">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
127 <sanitizer invalid_char="">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
128 <valid initial="string.letters,string.digits"><add value="&gt;"/><add value="&lt;"/><add value="!="/></valid>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
129 </sanitizer>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
130 </param>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
131 </when>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
132 <when value="position">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
133 <param name="bam_property_value" type="text" value="500000" label="Filter on the position of the read" help="You can use &gt;, &lt;, =, and ! (not) in your expression. E.g., to select reads mapping after position 5,000 use &quot;&gt;5000&quot;">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
134 <sanitizer invalid_char="">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
135 <valid initial="string.letters,string.digits"><add value="&gt;"/><add value="&lt;"/><add value="!="/></valid>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
136 </sanitizer>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
137 </param>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
138 </when>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
139 <when value="queryBases">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
140 <param name="bam_property_value" type="text" value="ttagggttagg" label="Filter on a sequence motif" help="You can use ! (not) in your expression">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
141 <sanitizer invalid_char="">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
142 <valid initial="string.letters,string.digits"><add value="&gt;"/><add value="&lt;"/><add value="!="/></valid>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
143 </sanitizer>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
144 </param>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
145 </when>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
146 <when value="reference">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
147 <param name="bam_property_value" type="text" value="chr22" label="Filter on the reference name for the read" help="You can use ! (not) in your expression">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
148 <sanitizer invalid_char="">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
149 <valid initial="string.letters,string.digits"><add value="&gt;"/><add value="&lt;"/><add value="!="/></valid>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
150 </sanitizer>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
151 </param>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
152 </when>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
153 <when value="tag">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
154 <param name="bam_property_value" type="text" value="NM:&gt;1" label="Filter on a particular tag" help="You can use &gt;, &lt;, =, and ! (not).
2c2200cecea2 Uploaded
anton
parents:
diff changeset
155 Tag name and its value must be separated by &quot;:&quot;. E.g., to obtain reads with at least one mismatch use &quot;NM:&gt;1&quot;">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
156 <sanitizer invalid_char="">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
157 <valid initial="string.letters,string.digits"><add value="&gt;"/><add value="&lt;"/><add value=":!="/></valid>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
158 </sanitizer>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
159 </param>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
160 </when>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
161 </conditional>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
162 </repeat>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
163 </repeat>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
164 <conditional name="rule_configuration">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
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." />
2c2200cecea2 Uploaded
anton
parents:
diff changeset
166 <when value="true">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
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." >
2c2200cecea2 Uploaded
anton
parents:
diff changeset
168 <sanitizer invalid_char="">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
169 <valid initial="string.printable"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
170 </sanitizer>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
171 </param>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
172 </when>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
173 </conditional>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
174 </inputs>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
175
2c2200cecea2 Uploaded
anton
parents:
diff changeset
176 <configfiles>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
177 <configfile name="script_file">
2c2200cecea2 Uploaded
anton
parents:
diff changeset
178 ##Sets up a json configfile for bamtools filter
2c2200cecea2 Uploaded
anton
parents:
diff changeset
179 ##If there is more than one condition prints brackets and "filters:"
2c2200cecea2 Uploaded
anton
parents:
diff changeset
180 #if len( $conditions ) > 1
2c2200cecea2 Uploaded
anton
parents:
diff changeset
181 {
2c2200cecea2 Uploaded
anton
parents:
diff changeset
182 "filters":
2c2200cecea2 Uploaded
anton
parents:
diff changeset
183 [
2c2200cecea2 Uploaded
anton
parents:
diff changeset
184 #end if
2c2200cecea2 Uploaded
anton
parents:
diff changeset
185 #for $i, $c in enumerate( $conditions, start=1 )
2c2200cecea2 Uploaded
anton
parents:
diff changeset
186 { "id": "$i",
2c2200cecea2 Uploaded
anton
parents:
diff changeset
187 #for $j, $s in enumerate( $c.filters, start=1 )
2c2200cecea2 Uploaded
anton
parents:
diff changeset
188 ##The if below takes care of the comma at the end of last condition within group
2c2200cecea2 Uploaded
anton
parents:
diff changeset
189 #if $j != len( $c.filters)
2c2200cecea2 Uploaded
anton
parents:
diff changeset
190 "${s.bam_property.bam_property_selector}":"${s.bam_property.bam_property_value}",
2c2200cecea2 Uploaded
anton
parents:
diff changeset
191 #else
2c2200cecea2 Uploaded
anton
parents:
diff changeset
192 "${s.bam_property.bam_property_selector}":"${s.bam_property.bam_property_value}"
2c2200cecea2 Uploaded
anton
parents:
diff changeset
193 #end if
2c2200cecea2 Uploaded
anton
parents:
diff changeset
194 #end for
2c2200cecea2 Uploaded
anton
parents:
diff changeset
195 ##The if below takes care of the comma at the end of last condition within group
2c2200cecea2 Uploaded
anton
parents:
diff changeset
196 #if $i != len( $conditions )
2c2200cecea2 Uploaded
anton
parents:
diff changeset
197 },
2c2200cecea2 Uploaded
anton
parents:
diff changeset
198 #else
2c2200cecea2 Uploaded
anton
parents:
diff changeset
199 }
2c2200cecea2 Uploaded
anton
parents:
diff changeset
200 #end if
2c2200cecea2 Uploaded
anton
parents:
diff changeset
201 #end for
2c2200cecea2 Uploaded
anton
parents:
diff changeset
202 #if len( $conditions ) > 1
2c2200cecea2 Uploaded
anton
parents:
diff changeset
203 #if str( $rule_configuration.rules_selector ) == "True":
2c2200cecea2 Uploaded
anton
parents:
diff changeset
204 ],
2c2200cecea2 Uploaded
anton
parents:
diff changeset
205 "rule" : "${rule_configuration.rules}"
2c2200cecea2 Uploaded
anton
parents:
diff changeset
206 #else
2c2200cecea2 Uploaded
anton
parents:
diff changeset
207 ]
2c2200cecea2 Uploaded
anton
parents:
diff changeset
208 #end if
2c2200cecea2 Uploaded
anton
parents:
diff changeset
209 }
2c2200cecea2 Uploaded
anton
parents:
diff changeset
210 #end if
2c2200cecea2 Uploaded
anton
parents:
diff changeset
211 </configfile>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
212 </configfiles>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
213
2c2200cecea2 Uploaded
anton
parents:
diff changeset
214 <outputs>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
215 <data format="txt" name="out_file2" />
2c2200cecea2 Uploaded
anton
parents:
diff changeset
216 <data format="bam" name="out_file1" />
2c2200cecea2 Uploaded
anton
parents:
diff changeset
217 </outputs>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
218 <tests>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
219 <test>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
220 <param name="input_bam" ftype="bam" value="bamtools-input1.bam"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
221 <param name="bam_property_selector" value="mapQuality"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
222 <param name="bam_property_value" value=">20"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
223 <output name="out_file1" file="bamtools-test1.bam" ftype="bam"/>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
224 </test>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
225 </tests>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
226 <help>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
227 **What is does**
2c2200cecea2 Uploaded
anton
parents:
diff changeset
228
2c2200cecea2 Uploaded
anton
parents:
diff changeset
229 BAMTools filter is a very powerful utility to perform complex filtering of BAM files. It is based on BAMtools suite of tools by Derek Barnett (https://github.com/pezmaster31/bamtools).
2c2200cecea2 Uploaded
anton
parents:
diff changeset
230
2c2200cecea2 Uploaded
anton
parents:
diff changeset
231 -----
2c2200cecea2 Uploaded
anton
parents:
diff changeset
232
2c2200cecea2 Uploaded
anton
parents:
diff changeset
233 **How it works**
2c2200cecea2 Uploaded
anton
parents:
diff changeset
234
2c2200cecea2 Uploaded
anton
parents:
diff changeset
235 The tool use logic relies on the three concepts: (1) input BAM, (2) groups, and (3) filters.
2c2200cecea2 Uploaded
anton
parents:
diff changeset
236
2c2200cecea2 Uploaded
anton
parents:
diff changeset
237 *Input BAM(s)*
2c2200cecea2 Uploaded
anton
parents:
diff changeset
238
2c2200cecea2 Uploaded
anton
parents:
diff changeset
239 The input BAM is self-explanatory. This is the dataset you will be filtering. The tool can accept just one or multiple BAM files. To filter on multiple BAMs just add them by clicking **Add new BAM dataset(s) to filter**
2c2200cecea2 Uploaded
anton
parents:
diff changeset
240
2c2200cecea2 Uploaded
anton
parents:
diff changeset
241 *Conditions and Filters*
2c2200cecea2 Uploaded
anton
parents:
diff changeset
242
2c2200cecea2 Uploaded
anton
parents:
diff changeset
243 Conditions for filtering BAM files can be arranged in **Groups and Filters**. While it can be confusing at first this is what gives ultimate power to this tools. So try to look at the examples we are supplying below.
2c2200cecea2 Uploaded
anton
parents:
diff changeset
244
2c2200cecea2 Uploaded
anton
parents:
diff changeset
245 -----
2c2200cecea2 Uploaded
anton
parents:
diff changeset
246
2c2200cecea2 Uploaded
anton
parents:
diff changeset
247 **Example 1. Using a single filter**
2c2200cecea2 Uploaded
anton
parents:
diff changeset
248
2c2200cecea2 Uploaded
anton
parents:
diff changeset
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).
2c2200cecea2 Uploaded
anton
parents:
diff changeset
250 For example, for retaining reads with mapping quality of at least 20 one would set the tool interface as shown below:
2c2200cecea2 Uploaded
anton
parents:
diff changeset
251
2c2200cecea2 Uploaded
anton
parents:
diff changeset
252 .. image:: ${static_path}/images/simple-filter.png
2c2200cecea2 Uploaded
anton
parents:
diff changeset
253
2c2200cecea2 Uploaded
anton
parents:
diff changeset
254 -----
2c2200cecea2 Uploaded
anton
parents:
diff changeset
255
2c2200cecea2 Uploaded
anton
parents:
diff changeset
256 **Example 2. Using multiple filters**
2c2200cecea2 Uploaded
anton
parents:
diff changeset
257
2c2200cecea2 Uploaded
anton
parents:
diff changeset
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.
2c2200cecea2 Uploaded
anton
parents:
diff changeset
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):
2c2200cecea2 Uploaded
anton
parents:
diff changeset
260
2c2200cecea2 Uploaded
anton
parents:
diff changeset
261 .. image:: ${static_path}/images/multiple-filters.png
2c2200cecea2 Uploaded
anton
parents:
diff changeset
262
2c2200cecea2 Uploaded
anton
parents:
diff changeset
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.
2c2200cecea2 Uploaded
anton
parents:
diff changeset
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.
2c2200cecea2 Uploaded
anton
parents:
diff changeset
265
2c2200cecea2 Uploaded
anton
parents:
diff changeset
266 -----
2c2200cecea2 Uploaded
anton
parents:
diff changeset
267
2c2200cecea2 Uploaded
anton
parents:
diff changeset
268 **Example 3. Complex filtering with multiple conditions**
2c2200cecea2 Uploaded
anton
parents:
diff changeset
269
2c2200cecea2 Uploaded
anton
parents:
diff changeset
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*)
2c2200cecea2 Uploaded
anton
parents:
diff changeset
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*.
2c2200cecea2 Uploaded
anton
parents:
diff changeset
272 The following screenshot expalins how this can be done:
2c2200cecea2 Uploaded
anton
parents:
diff changeset
273
2c2200cecea2 Uploaded
anton
parents:
diff changeset
274 .. image:: ${static_path}/images/complex-filters.png
2c2200cecea2 Uploaded
anton
parents:
diff changeset
275
2c2200cecea2 Uploaded
anton
parents:
diff changeset
276 -----
2c2200cecea2 Uploaded
anton
parents:
diff changeset
277
2c2200cecea2 Uploaded
anton
parents:
diff changeset
278 **Example 4. Even more complex filtering with Rules**
2c2200cecea2 Uploaded
anton
parents:
diff changeset
279
2c2200cecea2 Uploaded
anton
parents:
diff changeset
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.
2c2200cecea2 Uploaded
anton
parents:
diff changeset
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
2c2200cecea2 Uploaded
anton
parents:
diff changeset
282 filtering will look like this::
2c2200cecea2 Uploaded
anton
parents:
diff changeset
283
2c2200cecea2 Uploaded
anton
parents:
diff changeset
284 !(1) &amp; (2 | 3)
2c2200cecea2 Uploaded
anton
parents:
diff changeset
285
2c2200cecea2 Uploaded
anton
parents:
diff changeset
286 Here, numbers 1, 2, and 3 represent conditions. The following screenshot illustrates how to do this in Galaxy:
2c2200cecea2 Uploaded
anton
parents:
diff changeset
287
2c2200cecea2 Uploaded
anton
parents:
diff changeset
288 .. image:: ${static_path}/images/rule.png
2c2200cecea2 Uploaded
anton
parents:
diff changeset
289
2c2200cecea2 Uploaded
anton
parents:
diff changeset
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.
2c2200cecea2 Uploaded
anton
parents:
diff changeset
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::
2c2200cecea2 Uploaded
anton
parents:
diff changeset
292
2c2200cecea2 Uploaded
anton
parents:
diff changeset
293 NOT condition 1 AND (condition 2 OR condition 3)
2c2200cecea2 Uploaded
anton
parents:
diff changeset
294
2c2200cecea2 Uploaded
anton
parents:
diff changeset
295 -----
2c2200cecea2 Uploaded
anton
parents:
diff changeset
296
2c2200cecea2 Uploaded
anton
parents:
diff changeset
297 **JSON script file**
2c2200cecea2 Uploaded
anton
parents:
diff changeset
298
2c2200cecea2 Uploaded
anton
parents:
diff changeset
299 This tool produces two outputs. One of the them is a BAM file containing filtered reads. The other is a JSONified script. It can help you to see how your instructions are sent to BAMTools.
2c2200cecea2 Uploaded
anton
parents:
diff changeset
300 For instance, the example 4 looks like this in the JSON form::
2c2200cecea2 Uploaded
anton
parents:
diff changeset
301
2c2200cecea2 Uploaded
anton
parents:
diff changeset
302 {
2c2200cecea2 Uploaded
anton
parents:
diff changeset
303 "filters":
2c2200cecea2 Uploaded
anton
parents:
diff changeset
304 [
2c2200cecea2 Uploaded
anton
parents:
diff changeset
305 { "id": "1",
2c2200cecea2 Uploaded
anton
parents:
diff changeset
306 "tag":"NM:=0",
2c2200cecea2 Uploaded
anton
parents:
diff changeset
307 "isReverseStrand":"false"
2c2200cecea2 Uploaded
anton
parents:
diff changeset
308 },
2c2200cecea2 Uploaded
anton
parents:
diff changeset
309 { "id": "2",
2c2200cecea2 Uploaded
anton
parents:
diff changeset
310 "tag":"NM:>0",
2c2200cecea2 Uploaded
anton
parents:
diff changeset
311 "isReverseStrand":"true"
2c2200cecea2 Uploaded
anton
parents:
diff changeset
312 }
2c2200cecea2 Uploaded
anton
parents:
diff changeset
313 ]
2c2200cecea2 Uploaded
anton
parents:
diff changeset
314 }
2c2200cecea2 Uploaded
anton
parents:
diff changeset
315
2c2200cecea2 Uploaded
anton
parents:
diff changeset
316
2c2200cecea2 Uploaded
anton
parents:
diff changeset
317
2c2200cecea2 Uploaded
anton
parents:
diff changeset
318 -----
2c2200cecea2 Uploaded
anton
parents:
diff changeset
319
2c2200cecea2 Uploaded
anton
parents:
diff changeset
320 **More information**
2c2200cecea2 Uploaded
anton
parents:
diff changeset
321
2c2200cecea2 Uploaded
anton
parents:
diff changeset
322 .. class:: infomark
2c2200cecea2 Uploaded
anton
parents:
diff changeset
323
2c2200cecea2 Uploaded
anton
parents:
diff changeset
324 Additional information about BAMtools can be found at https://github.com/pezmaster31/bamtools/wiki
2c2200cecea2 Uploaded
anton
parents:
diff changeset
325
2c2200cecea2 Uploaded
anton
parents:
diff changeset
326
2c2200cecea2 Uploaded
anton
parents:
diff changeset
327 </help>
2c2200cecea2 Uploaded
anton
parents:
diff changeset
328 </tool>