comparison bamtools-filter.xml @ 4:3213c223678c draft

planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/bamtools/bamtools_filter commit ddee21fa767f3234a4e5a9acfeeabdded32e7d01
author devteam
date Wed, 18 Jan 2017 11:47:29 -0500
parents 29ba2103739c
children bd735cae4ce6
comparison
equal deleted inserted replaced
3:29ba2103739c 4:3213c223678c
1 <tool id="bamFilter" name="Filter" version="0.0.2"> 1 <tool id="bamFilter" name="Filter" version="2.4.0">
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.4.0">bamtools</requirement>
5 </requirements> 5 </requirements>
6 <command> 6 <command>
7 cat $script_file > $out_file2; 7 <![CDATA[
8 8 cat $script_file > $out_file2;
9 #for $bam_count, $input_bam in enumerate( $input_bams ): 9 #for $bam_count, $input_bam in enumerate( $input_bams ):
10 ln -s "${input_bam}" "localbam_${bam_count}.bam" &amp;&amp; 10 ln -s "${input_bam}" "localbam_${bam_count}.bam" &&
11 ln -s "${input_bam.metadata.bam_index}" "localbam_${bam_count}.bam.bai" &amp;&amp; 11 ln -s "${input_bam.metadata.bam_index}" "localbam_${bam_count}.bam.bai" &&
12 #end for 12 #end for
13 13 bamtools
14 bamtools 14 filter
15 filter 15 -script $script_file
16 -script $script_file 16 #for $bam_count, $input_bam in enumerate( $input_bams ):
17 17 -in "localbam_${bam_count}.bam"
18 #for $bam_count, $input_bam in enumerate( $input_bams ): 18 #end for
19 -in "localbam_${bam_count}.bam" 19 -out $out_file1
20 #end for 20 ]]>
21 -out $out_file1 21 </command>
22 </command> 22 <configfiles>
23 <inputs> 23 <configfile name="script_file">
24 <param name="input_bams" type="data" format="bam" label="BAM dataset(s) to filter" min="1" multiple="True"/> 24 ##Sets up a json configfile for bamtools filter
25 <repeat name="conditions" title="Condition" min="1"> 25 ##If there is more than one condition prints brackets and "filters:"
26 <repeat name="filters" title="Filter" min="1"> 26 #if len( $conditions ) > 1
27 <conditional name="bam_property"> 27 {
28 <param name="bam_property_selector" type="select" label="Select BAM property to filter on"> 28 "filters":
29 <option value="alignmentFlag"/> 29 [
30 <option value="cigar"/> 30 #end if
31 <option value="insertSize"/> 31 #for $i, $c in enumerate( $conditions, start=1 )
32 <option value="isDuplicate"/> 32 { "id": "$i",
33 <option value="isFailedQC"/> 33 #for $j, $s in enumerate( $c.filters, start=1 )
34 <option value="isFirstMate"/> 34 ##The if below takes care of the comma at the end of last condition within group
35 <option value="isMapped"/> 35 #if $j != len( $c.filters)
36 <option value="isMateMapped"/> 36 "${s.bam_property.bam_property_selector}":"${s.bam_property.bam_property_value}",
37 <option value="isMateReverseStrand"/> 37 #else
38 <option value="isPaired"/> 38 "${s.bam_property.bam_property_selector}":"${s.bam_property.bam_property_value}"
39 <option value="isPrimaryAlignment"/> 39 #end if
40 <option value="isProperPair"/> 40 #end for
41 <option value="isReverseStrand"/> 41 ##The if below takes care of the comma at the end of last condition within group
42 <option value="isSecondMate"/> 42 #if $i != len( $conditions )
43 <option selected="True" value="mapQuality"/> 43 },
44 <option value="matePosition"/> 44 #else
45 <option value="mateReference"/> 45 }
46 <option value="name"/> 46 #end if
47 <option value="position"/> 47 #end for
48 <option value="queryBases"/> 48 #if len( $conditions ) > 1
49 <option value="reference"/> 49 #if str( $rule_configuration.rules_selector ) == "True":
50 <option value="tag"/> 50 ],
51 </param> 51 "rule" : "${rule_configuration.rules}"
52 <!-- would be fanstastic to have AND and OR constructs in when statements --> 52 #else
53 <when value="alignmentFlag"> 53 ]
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"/> 54 #end if
55 </when> 55 }
56 <when value="cigar"> 56 #end if
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"/> 57 </configfile>
58 </when> 58 </configfiles>
59 <when value="insertSize"> 59 <inputs>
60 <param name="bam_property_value" type="text" value=">=250" label="Filter on insert size" help="You can use &gt;, &lt;, =, and ! (not) in your expression. E.g., to select pairs with insert size above 250 nt use &quot;>=250&quot;"> 60 <param name="input_bams" type="data" format="bam" label="BAM dataset(s) to filter" min="1" multiple="True"/>
61 <sanitizer invalid_char=""> 61 <repeat name="conditions" title="Condition" min="1">
62 <valid initial="string.letters,string.digits"><add value="&gt;"/><add value="&lt;"/><add value="!="/><add value="-"/></valid> 62 <repeat name="filters" title="Filter" min="1">
63 </sanitizer> 63 <conditional name="bam_property">
64 </param> 64 <param name="bam_property_selector" type="select" label="Select BAM property to filter on">
65 </when> 65 <option value="alignmentFlag"/>
66 <when value="isDuplicate"> 66 <option value="cigar"/>
67 <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" /> 67 <option value="insertSize"/>
68 </when> 68 <option value="isDuplicate"/>
69 <when value="isFailedQC"> 69 <option value="isFailedQC"/>
70 <param name="bam_property_value" type="boolean" truevalue="true" falsevalue="false" label="Select reads failing QC" help="Checked = Failed QC, Empty = Passed QC"/> 70 <option value="isFirstMate"/>
71 </when> 71 <option value="isMapped"/>
72 <when value="isFirstMate"> 72 <option value="isMateMapped"/>
73 <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"/> 73 <option value="isMateReverseStrand"/>
74 </when> 74 <option value="isPaired"/>
75 <when value="isMapped"> 75 <option value="isPrimaryAlignment"/>
76 <param name="bam_property_value" type="boolean" truevalue="true" falsevalue="false" label="Selected mapped reads" help="Checked = Mapped, Empty = NOT mapped"/> 76 <option value="isProperPair"/>
77 </when> 77 <option value="isReverseStrand"/>
78 <when value="isMateMapped"> 78 <option value="isSecondMate"/>
79 <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"/> 79 <option selected="True" value="mapQuality"/>
80 </when> 80 <option value="matePosition"/>
81 <when value="isMateReverseStrand"> 81 <option value="mateReference"/>
82 <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"/> 82 <option value="name"/>
83 </when> 83 <option value="position"/>
84 <when value="isPaired"> 84 <option value="queryBases"/>
85 <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"/> 85 <option value="reference"/>
86 </when> 86 <option value="tag"/>
87 <when value="isPrimaryAlignment"> 87 </param>
88 <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"/> 88 <!-- would be fanstastic to have AND and OR constructs in when statements -->
89 </when> 89 <when value="alignmentFlag">
90 <when value="isProperPair"> 90 <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"/>
91 <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"/> 91 </when>
92 </when> 92 <when value="cigar">
93 <when value="isReverseStrand"> 93 <param name="bam_property_value" type="text" value="101M" label="Filter on this CIGAR string" help="Default (101M) is for 101 continuously matched bases"/>
94 <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"/> 94 </when>
95 </when> 95 <when value="insertSize">
96 <when value="isSecondMate"> 96 <param name="bam_property_value" type="text" value=">=250" label="Filter on insert size" help="You can use &gt;, &lt;, =, and ! (not) in your expression. E.g., to select pairs with insert size above 250 nt use &quot;>=250&quot;">
97 <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"/> 97 <sanitizer invalid_char="">
98 </when> 98 <valid initial="string.letters,string.digits"><add value="&gt;"/><add value="&lt;"/><add value="!="/><add value="-"/></valid>
99 <when value="mapQuality"> 99 </sanitizer>
100 <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;"> 100 </param>
101 <sanitizer invalid_char=""> 101 </when>
102 <valid initial="string.letters,string.digits"><add value="&gt;"/><add value="&lt;"/><add value="!="/></valid> 102 <when value="isDuplicate">
103 </sanitizer> 103 <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" />
104 </param> 104 </when>
105 </when> 105 <when value="isFailedQC">
106 <when value="matePosition"> 106 <param name="bam_property_value" type="boolean" truevalue="true" falsevalue="false" label="Select reads failing QC" help="Checked = Failed QC, Empty = Passed QC"/>
107 <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;"> 107 </when>
108 <sanitizer invalid_char=""> 108 <when value="isFirstMate">
109 <valid initial="string.letters,string.digits"><add value="&gt;"/><add value="&lt;"/><add value="!="/></valid> 109 <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"/>
110 </sanitizer> 110 </when>
111 </param> 111 <when value="isMapped">
112 </when> 112 <param name="bam_property_value" type="boolean" truevalue="true" falsevalue="false" label="Selected mapped reads" help="Checked = Mapped, Empty = NOT mapped"/>
113 <when value="mateReference"> 113 </when>
114 <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;"> 114 <when value="isMateMapped">
115 <sanitizer invalid_char=""> 115 <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"/>
116 <valid initial="string.letters,string.digits"><add value="&gt;"/><add value="&lt;"/><add value="!="/></valid> 116 </when>
117 </sanitizer> 117 <when value="isMateReverseStrand">
118 </param> 118 <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"/>
119 </when> 119 </when>
120 <when value="name"> 120 <when value="isPaired">
121 <param name="bam_property_value" type="text" label="Filter on read name" help="You can use = and ! (not) in your expression."> 121 <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"/>
122 <sanitizer invalid_char=""> 122 </when>
123 <valid initial="string.letters,string.digits"><add value="&gt;"/><add value="&lt;"/><add value="!="/></valid> 123 <when value="isPrimaryAlignment">
124 </sanitizer> 124 <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"/>
125 </param> 125 </when>
126 </when> 126 <when value="isProperPair">
127 <when value="position"> 127 <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"/>
128 <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;"> 128 </when>
129 <sanitizer invalid_char=""> 129 <when value="isReverseStrand">
130 <valid initial="string.letters,string.digits"><add value="&gt;"/><add value="&lt;"/><add value="!="/></valid> 130 <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"/>
131 </sanitizer> 131 </when>
132 </param> 132 <when value="isSecondMate">
133 </when> 133 <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"/>
134 <when value="queryBases"> 134 </when>
135 <param name="bam_property_value" type="text" value="ttagggttagg" label="Filter on a sequence motif" help="You can use ! (not) in your expression"> 135 <when value="mapQuality">
136 <sanitizer invalid_char=""> 136 <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;">
137 <valid initial="string.letters,string.digits"><add value="&gt;"/><add value="&lt;"/><add value="!="/></valid> 137 <sanitizer invalid_char="">
138 </sanitizer> 138 <valid initial="string.letters,string.digits"><add value="&gt;"/><add value="&lt;"/><add value="!="/></valid>
139 </param> 139 </sanitizer>
140 </when> 140 </param>
141 <when value="reference"> 141 </when>
142 <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"> 142 <when value="matePosition">
143 <sanitizer invalid_char=""> 143 <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;">
144 <valid initial="string.letters,string.digits"><add value="&gt;"/><add value="&lt;"/><add value="!="/></valid> 144 <sanitizer invalid_char="">
145 </sanitizer> 145 <valid initial="string.letters,string.digits"><add value="&gt;"/><add value="&lt;"/><add value="!="/></valid>
146 </param> 146 </sanitizer>
147 </when> 147 </param>
148 <when value="tag"> 148 </when>
149 <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). 149 <when value="mateReference">
150 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;"> 150 <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;">
151 <sanitizer invalid_char=""> 151 <sanitizer invalid_char="">
152 <valid initial="string.letters,string.digits"><add value="&gt;"/><add value="&lt;"/><add value=":!="/></valid> 152 <valid initial="string.letters,string.digits"><add value="&gt;"/><add value="&lt;"/><add value="!="/></valid>
153 </sanitizer> 153 </sanitizer>
154 </param> 154 </param>
155 </when> 155 </when>
156 <when value="name">
157 <param name="bam_property_value" type="text" label="Filter on read name" help="You can use = and ! (not) in your expression.">
158 <sanitizer invalid_char="">
159 <valid initial="string.letters,string.digits"><add value="&gt;"/><add value="&lt;"/><add value="!="/></valid>
160 </sanitizer>
161 </param>
162 </when>
163 <when value="position">
164 <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;">
165 <sanitizer invalid_char="">
166 <valid initial="string.letters,string.digits"><add value="&gt;"/><add value="&lt;"/><add value="!="/></valid>
167 </sanitizer>
168 </param>
169 </when>
170 <when value="queryBases">
171 <param name="bam_property_value" type="text" value="ttagggttagg" label="Filter on a sequence motif" help="You can use ! (not) in your expression">
172 <sanitizer invalid_char="">
173 <valid initial="string.letters,string.digits"><add value="&gt;"/><add value="&lt;"/><add value="!="/></valid>
174 </sanitizer>
175 </param>
176 </when>
177 <when value="reference">
178 <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">
179 <sanitizer invalid_char="">
180 <valid initial="string.letters,string.digits"><add value="&gt;"/><add value="&lt;"/><add value="!="/></valid>
181 </sanitizer>
182 </param>
183 </when>
184 <when value="tag">
185 <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). 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;">
186 <sanitizer invalid_char="">
187 <valid initial="string.letters,string.digits"><add value="&gt;"/><add value="&lt;"/><add value=":!="/></valid>
188 </sanitizer>
189 </param>
190 </when>
191 </conditional>
192 </repeat>
193 </repeat>
194 <conditional name="rule_configuration">
195 <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." />
196 <when value="false"/>
197 <when value="true">
198 <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." >
199 <sanitizer invalid_char="">
200 <valid initial="string.printable"/>
201 </sanitizer>
202 </param>
203 </when>
156 </conditional> 204 </conditional>
157 </repeat> 205 </inputs>
158 </repeat> 206 <outputs>
159 <conditional name="rule_configuration"> 207 <data format="txt" name="out_file2" />
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." /> 208 <data format="bam" name="out_file1" />
161 <when value="true"> 209 </outputs>
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." >
163 <sanitizer invalid_char="">
164 <valid initial="string.printable"/>
165 </sanitizer>
166 </param>
167 </when>
168 </conditional>
169 </inputs>
170
171 <configfiles>
172 <configfile name="script_file">
173 ##Sets up a json configfile for bamtools filter
174 ##If there is more than one condition prints brackets and "filters:"
175 #if len( $conditions ) > 1
176 {
177 "filters":
178 [
179 #end if
180 #for $i, $c in enumerate( $conditions, start=1 )
181 { "id": "$i",
182 #for $j, $s in enumerate( $c.filters, start=1 )
183 ##The if below takes care of the comma at the end of last condition within group
184 #if $j != len( $c.filters)
185 "${s.bam_property.bam_property_selector}":"${s.bam_property.bam_property_value}",
186 #else
187 "${s.bam_property.bam_property_selector}":"${s.bam_property.bam_property_value}"
188 #end if
189 #end for
190 ##The if below takes care of the comma at the end of last condition within group
191 #if $i != len( $conditions )
192 },
193 #else
194 }
195 #end if
196 #end for
197 #if len( $conditions ) > 1
198 #if str( $rule_configuration.rules_selector ) == "True":
199 ],
200 "rule" : "${rule_configuration.rules}"
201 #else
202 ]
203 #end if
204 }
205 #end if
206 </configfile>
207 </configfiles>
208
209 <outputs>
210 <data format="txt" name="out_file2" />
211 <data format="bam" name="out_file1" />
212 </outputs>
213 <tests> 210 <tests>
214 <test> 211 <test>
215 <param name="input_bams" ftype="bam" value="bamtools-input1.bam"/> 212 <param name="input_bams" ftype="bam" value="bamtools-input1.bam"/>
216 <param name="bam_property_selector" value="mapQuality"/> 213 <param name="bam_property_selector" value="mapQuality"/>
217 <param name="bam_property_value" value=">20"/> 214 <param name="bam_property_value" value=">20"/>
218 <output name="out_file1" file="bamtools-test1.bam" ftype="bam"/> 215 <output name="out_file1" file="bamtools-test1.bam" ftype="bam"/>
219 </test> 216 </test>
220 </tests> 217 </tests>
221 <help> 218 <help>
222 **What is does** 219 **What is does**
223 220
224 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). 221 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).
225 222
226 ----- 223 -----
316 .. class:: infomark 313 .. class:: infomark
317 314
318 Additional information about BAMtools can be found at https://github.com/pezmaster31/bamtools/wiki 315 Additional information about BAMtools can be found at https://github.com/pezmaster31/bamtools/wiki
319 316
320 317
321 </help> 318 </help>
322 <citations> 319 <citations>
323 <citation type="doi">10.1093/bioinformatics/btr174</citation> 320 <citation type="doi">10.1093/bioinformatics/btr174</citation>
324 </citations> 321 </citations>
325 </tool> 322 </tool>