annotate bamtools-filter.xml @ 5:23a1c1f66b47 draft

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