Mercurial > repos > iuc > bedtools
comparison intersectBed.xml @ 32:4f7a5ccd2ae9 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bedtools commit fc3616bd1463afef9681cd7c431ac29f79e37e74
author | iuc |
---|---|
date | Tue, 11 Dec 2018 14:01:26 -0500 |
parents | 6283d16e40ed |
children | dde39ba9c031 |
comparison
equal
deleted
inserted
replaced
31:e19bebe96cd2 | 32:4f7a5ccd2ae9 |
---|---|
1 <tool id="bedtools_intersectbed" name="Intersect intervals" version="@WRAPPER_VERSION@.2"> | 1 <tool id="bedtools_intersectbed" name="bedtools Intersect intervals" version="@WRAPPER_VERSION@"> |
2 <description>find overlapping intervals in various ways</description> | 2 <description>find overlapping intervals in various ways</description> |
3 <macros> | 3 <macros> |
4 <import>macros.xml</import> | 4 <import>macros.xml</import> |
5 </macros> | 5 </macros> |
6 <expand macro="requirements" /> | 6 <expand macro="requirements"> |
7 <requirement type="package" version="@SAMTOOLS_VERSION@">samtools</requirement> | |
8 </expand> | |
7 <expand macro="stdio" /> | 9 <expand macro="stdio" /> |
8 <command> | 10 <command><![CDATA[ |
9 <![CDATA[ | 11 #import re |
10 #set modes = ' '.join( str($overlap_mode).split(',') ) | 12 #set modes = ' '.join( str($overlap_mode).split(',') ) |
11 | 13 |
12 #if $modes == "None": | 14 #if $modes == "None": |
13 #set modes = '' | 15 #set modes = '' |
14 #end if | 16 #end if |
15 | 17 |
16 bedtools intersect | 18 bedtools intersect |
17 #if $inputA.is_of_type('bam'): | 19 #if $inputA.is_of_type('bam'): |
18 -abam '${inputA}' | 20 -abam '${inputA}' |
19 #else: | 21 #else: |
20 -a '${inputA}' | 22 -a '${inputA}' |
23 #end if | |
24 | |
25 #if str($reduce_or_iterate.reduce_or_iterate_selector) == 'iterate': | |
26 -b '$reduce_or_iterate.inputB' | |
27 #else: | |
28 #set inputBs = "' '".join([str($file) for $file in $reduce_or_iterate.inputB]) | |
29 -b '$inputBs' | |
30 #if $reduce_or_iterate.names: | |
31 #set namesB = "' '".join([re.sub('[^\s\w\-]', '_', str($file.element_identifier)) for $file in $reduce_or_iterate.inputB]) | |
32 -names '$namesB' | |
21 #end if | 33 #end if |
22 | 34 #end if |
23 #if str($reduce_or_iterate.reduce_or_iterate_selector) == 'iterate': | 35 $split |
24 -b '$reduce_or_iterate.inputB' | 36 $strand |
25 #else: | 37 #if $fraction_cond.fraction_select == "specify": |
26 #set inputBs = "' '".join([str($file) for $file in $reduce_or_iterate.inputB]) | 38 -f '${fraction_cond.overlap}' |
27 -b '$inputBs' | 39 $fraction_cond.reciprocal_cond.reciprocal |
40 #if str($fraction_cond.reciprocal_cond.reciprocal) == '': | |
41 -F '${fraction_cond.reciprocal_cond.overlapB}' | |
42 $fraction_cond.reciprocal_cond.disjoint | |
28 #end if | 43 #end if |
29 $split | 44 #end if |
30 $strand | 45 $invert |
31 #if str($fraction) != "None" and str($fraction): | 46 $once |
32 -f '${fraction}' | 47 $header |
48 $modes | |
49 $sorted | |
50 #if str($sorted) != '': | |
51 #if str($reduce_or_iterate.reduce_or_iterate_selector) == 'iterate' and $reduce_or_iterate.inputB.is_of_type('bam'): | |
52 -g <(samtools view -H $reduce_or_iterate.inputB | tr ':' '\t' | grep SN | cut -f 3,5) | |
53 #else if str($reduce_or_iterate.reduce_or_iterate_selector) == 'reduce' and str($reduce_or_iterate.inputB) != 'None' and $reduce_or_iterate.inputB[0].is_of_type('bam'): | |
54 -g <(samtools view -H $reduce_or_iterate.inputB[0] | tr ':' '\t' | grep SN | cut -f 3,5) | |
33 #end if | 55 #end if |
34 $reciprocal | 56 #end if |
35 $invert | 57 $bed |
36 $once | 58 $count |
37 $header | 59 > '${output}' |
38 $modes | |
39 $count | |
40 > '${output}' | |
41 ]]> | 60 ]]> |
42 </command> | 61 </command> |
43 <inputs> | 62 <inputs> |
44 <param format="bam,@STD_BEDTOOLS_INPUTS@" name="inputA" type="data" label="File A to intersect with B" help="BAM/@STD_BEDTOOLS_INPUT_LABEL@ format" /> | 63 <param format="bam,@STD_BEDTOOLS_INPUTS@" name="inputA" type="data" label="File A to intersect with B" help="BAM/@STD_BEDTOOLS_INPUT_LABEL@ format" /> |
45 <conditional name="reduce_or_iterate"> | 64 <conditional name="reduce_or_iterate"> |
52 label="File(s) B to intersect with A" help="BAM/@STD_BEDTOOLS_INPUT_LABEL@ format"/> | 71 label="File(s) B to intersect with A" help="BAM/@STD_BEDTOOLS_INPUT_LABEL@ format"/> |
53 </when> | 72 </when> |
54 <when value='reduce'> | 73 <when value='reduce'> |
55 <param format="bam,@STD_BEDTOOLS_INPUTS@" name="inputB" type="data" multiple="true" | 74 <param format="bam,@STD_BEDTOOLS_INPUTS@" name="inputB" type="data" multiple="true" |
56 label="File(s) B to intersect with A" help="BAM/@STD_BEDTOOLS_INPUT_LABEL@ format"/> | 75 label="File(s) B to intersect with A" help="BAM/@STD_BEDTOOLS_INPUT_LABEL@ format"/> |
76 <param argument="names" type="boolean" truevalue="yes" falsevalue="no" label="add data set names instead of indices" help=""/> | |
57 </when> | 77 </when> |
58 </conditional> | 78 </conditional> |
59 <expand macro="strand2" /> | 79 <expand macro="strand2" /> |
60 <param name="overlap_mode" type="select" multiple="True" label="What should be written to the output file?"> | 80 <param name="overlap_mode" type="select" multiple="True" label="What should be written to the output file?"> |
61 <option value="-wa" selected="True">Write the original entry in A for each overlap (-wa)</option> | 81 <option value="-wa">Write the original entry in A for each overlap (-wa)</option> |
62 <option value="-wb">Write the original entry in B for each overlap. Useful for knowing what A overlaps. Restricted by the fraction- and reciprocal option (-wb)</option> | 82 <option value="-wb">Write the original entry in B for each overlap. Useful for knowing what A overlaps. Restricted by the fraction- and reciprocal option (-wb)</option> |
63 <option value="-wo">Write the original A and B entries plus the number of base pairs of overlap between the two features. Only A features with overlap are reported. Restricted by the fraction- and reciprocal option (-wo)</option> | 83 <option value="-wo">Write the original A and B entries plus the number of base pairs of overlap between the two features. Only A features with overlap are reported. Restricted by the fraction- and reciprocal option (-wo)</option> |
64 <option value="-wao">Write the original A and B entries plus the number of base pairs of overlap between the two features. However, A features w/o overlap are also reported with a NULL B feature and overlap = 0. Restricted by the fraction- and reciprocal option (-wao)</option> | 84 <option value="-wao">Write the original A and B entries plus the number of base pairs of overlap between the two features. However, A features w/o overlap are also reported with a NULL B feature and overlap = 0. Restricted by the fraction- and reciprocal option (-wao)</option> |
65 <option value="-loj">Perform a "left outer join". That is, for each feature in A report each overlap with B. If no overlaps are found, report a NULL feature for B (-loj)</option> | 85 <option value="-loj">Perform a "left outer join". That is, for each feature in A report each overlap with B. If no overlaps are found, report a NULL feature for B (-loj)</option> |
66 </param> | 86 </param> |
67 | 87 |
68 <expand macro="split" /> | 88 <expand macro="split" /> |
69 <!-- -f --> | 89 <conditional name="fraction_cond"> |
70 <param name="fraction" type="text" | 90 <param name='fraction_select' type='select' label='Required overlap'> |
71 label="Minimum overlap required as a fraction of the BAM alignment" | 91 <option value='default' selected='true'>Default: 1bp</option> |
72 help="Alignments are only retained if the overlap with the an interval in the BED file comprises at least this fraction of the BAM alignment's length. For example, to require that the overlap affects 50% of the BAM alignment, use 0.50. (-f)"/> | 92 <option value='specify'>Specify minimum overlap(s)</option> |
73 <!-- -r --> | 93 </param> |
74 <expand macro="reciprocal" /> | 94 <when value="default"/> |
95 <when value='specify'> | |
96 <expand macro="overlap" /> | |
97 <conditional name="reciprocal_cond"> | |
98 <expand macro="reciprocal" /> | |
99 <when value="-r"/> | |
100 <when value=""> | |
101 <expand macro="overlapB" /> | |
102 <param name="disjoint" argument="-e" type="boolean" checked="false" truevalue="-e" falsevalue="" | |
103 label="Require that the fraction of overlap is fulfilled for A OR B." help="If enabled, then for -f 0.90 and -F 0.10 this requires that either 90% of A is covered OR 10% of B is covered, otherwise, both fractions would have to be satisfied."/> | |
104 </when> | |
105 </conditional> | |
106 </when> | |
107 </conditional> | |
75 <!-- -v --> | 108 <!-- -v --> |
76 <param name="invert" type="boolean" checked="false" truevalue="-v" falsevalue="" | 109 <param name="invert" type="boolean" checked="false" truevalue="-v" falsevalue="" |
77 label="Report only those alignments that **do not** overlap with file(s) B" | 110 label="Report only those alignments that **do not** overlap with file(s) B" |
78 help="(-v)"/> | 111 help="(-v)"/> |
79 <!-- -u --> | 112 <!-- -u --> |
82 help="Just report the fact >=1 hit was found. (-u)" /> | 115 help="Just report the fact >=1 hit was found. (-u)" /> |
83 <!-- -c --> | 116 <!-- -c --> |
84 <param name="count" type="boolean" checked="false" truevalue="-c" falsevalue="" | 117 <param name="count" type="boolean" checked="false" truevalue="-c" falsevalue="" |
85 label="For each entry in A, report the number of overlaps with B." | 118 label="For each entry in A, report the number of overlaps with B." |
86 help="Reports 0 for A entries that have no overlap with B. (-c)" /> | 119 help="Reports 0 for A entries that have no overlap with B. (-c)" /> |
120 <!-- -bed --> | |
121 <param argument="-bed" type="boolean" checked="false" truevalue="-bed" falsevalue="" | |
122 label="When using BAM input (-abam), write output as BED instead of BAM." /> | |
123 <!-- -sorted -g --> | |
124 <param argument="-sorted" type="boolean" checked="false" truevalue="-sorted" falsevalue="" | |
125 label="For coordinate sorted input file the more efficient sweeping algorithm is enabled." /> | |
87 <expand macro="print_header" /> | 126 <expand macro="print_header" /> |
88 </inputs> | 127 </inputs> |
89 <outputs> | 128 <outputs> |
90 <data format_source="inputA" name="output" metadata_source="inputA"/> | 129 <data format_source="inputA" name="output" metadata_source="inputA"> |
130 <change_format> | |
131 <when input="bed" value="-bed" format="bed" /> | |
132 </change_format> | |
133 </data> | |
91 </outputs> | 134 </outputs> |
92 <tests> | 135 <tests> |
136 <!-- test adapted from the tutorial https://bedtools.readthedocs.io/en/latest/content/tools/intersect.html --> | |
137 <test> | |
138 <param name="inputA" value="intersect-A.bed" ftype="bed" /> | |
139 <conditional name="reduce_or_iterate"> | |
140 <param name='reduce_or_iterate_selector' value="iterate" /> | |
141 <param name="inputB" value="intersect-B.bed" ftype="bed" /> | |
142 </conditional> | |
143 <output name="output" file="intersect-default.bed" ftype="bed" /> | |
144 </test> | |
145 <test> | |
146 <param name="inputA" value="intersect-query.bed" ftype="bed" /> | |
147 <conditional name="reduce_or_iterate"> | |
148 <param name='reduce_or_iterate_selector' value="reduce" /> | |
149 <param name="inputB" value="intersect-d1.bed,intersect-d2.bed,intersect-d3.bed" ftype="bed" /> | |
150 </conditional> | |
151 <output name="output" file="intersect-multiple.bed" ftype="bed" /> | |
152 </test> | |
153 <test> | |
154 <param name="inputA" value="intersect-query.bed" ftype="bed" /> | |
155 <conditional name="reduce_or_iterate"> | |
156 <param name='reduce_or_iterate_selector' value="reduce" /> | |
157 <param name="inputB" value="intersect-d1.bed,intersect-d2.bed,intersect-d3.bed" ftype="bed" /> | |
158 </conditional> | |
159 <param name="overlap_mode" value="-wa,-wb" /> | |
160 <param name="sorted" value="-sorted" /> | |
161 <output name="output" file="intersect-multiple-wa-wb.bed" ftype="bed" /> | |
162 </test> | |
163 <test> | |
164 <param name="inputB" value="intersect-d1.bed,intersect-d2.bed,intersect-d3.bed" ftype="bed" /> | |
165 <param name="inputA" value="intersect-query.bed" ftype="bed" /> | |
166 <conditional name="reduce_or_iterate"> | |
167 <param name='reduce_or_iterate_selector' value="reduce" /> | |
168 <param name="inputB" value="intersect-d1.bed,intersect-d2.bed,intersect-d3.bed" ftype="bed" /> | |
169 <param name="names" value="yes" /> | |
170 </conditional> | |
171 <param name="overlap_mode" value="-wa,-wb" /> | |
172 <param name="sorted" value="-sorted" /> | |
173 <output name="output" file="intersect-multiple-wa-wb-wnames.bed" ftype="bed" /> | |
174 </test> | |
175 <test> | |
176 <param name="inputA" value="intersect-query.bed" ftype="bed" /> | |
177 <conditional name="reduce_or_iterate"> | |
178 <param name='reduce_or_iterate_selector' value="reduce" /> | |
179 <param name="inputB" value="intersect-d1.bed,intersect-d2.bed,intersect-d3.bed" ftype="bed" /> | |
180 </conditional> | |
181 <param name="invert" value="-v" /> | |
182 <param name="sorted" value="-sorted" /> | |
183 <output name="output" file="intersect-multiple-invert.bed" ftype="bed" /> | |
184 </test> | |
185 <test> | |
186 <param name="inputA" value="intersect-query.bed" ftype="bed" /> | |
187 <conditional name="reduce_or_iterate"> | |
188 <param name='reduce_or_iterate_selector' value="reduce" /> | |
189 <param name="inputB" value="intersect-d1.bed,intersect-d2.bed,intersect-d3.bed" ftype="bed" /> | |
190 </conditional> | |
191 <param name="overlap_mode" value="-wa,-wb" /> | |
192 <conditional name="fraction_cond"> | |
193 <param name='fraction_select' value='specify'/> | |
194 <param name="overlap" value="1.0" /> | |
195 </conditional> | |
196 <param name="sorted" value="-sorted" /> | |
197 <output name="output" file="intersect-multiple-fracA.bed" ftype="bed" /> | |
198 </test> | |
199 <test> | |
200 <param name="inputA" value="intersect-A.bed" ftype="bed" /> | |
201 <conditional name="reduce_or_iterate"> | |
202 <param name='reduce_or_iterate_selector' value="iterate" /> | |
203 <param name="inputB" value="intersect-B.bed" ftype="bed" /> | |
204 </conditional> | |
205 <param name="overlap_mode" value="-wa" /> | |
206 <output name="output" file="intersect-wa.bed" ftype="bed" /> | |
207 </test> | |
208 <test> | |
209 <param name="inputA" value="intersect-A.bed" ftype="bed" /> | |
210 <conditional name="reduce_or_iterate"> | |
211 <param name='reduce_or_iterate_selector' value="iterate" /> | |
212 <param name="inputB" value="intersect-B.bed" ftype="bed" /> | |
213 </conditional> | |
214 <param name="overlap_mode" value="-wb" /> | |
215 <output name="output" file="intersect-wb.bed" ftype="bed" /> | |
216 </test> | |
217 <test> | |
218 <param name="inputA" value="intersect-A.bed" ftype="bed" /> | |
219 <conditional name="reduce_or_iterate"> | |
220 <param name='reduce_or_iterate_selector' value="iterate" /> | |
221 <param name="inputB" value="intersect-B.bed" ftype="bed" /> | |
222 </conditional> | |
223 <param name="overlap_mode" value="-wa,-wb" /> | |
224 <output name="output" file="intersect-wa-wb.bed" ftype="bed" /> | |
225 </test> | |
226 <test> | |
227 <param name="inputA" value="intersect-A.bed" ftype="bed" /> | |
228 <conditional name="reduce_or_iterate"> | |
229 <param name='reduce_or_iterate_selector' value="iterate" /> | |
230 <param name="inputB" value="intersect-B.bed" ftype="bed" /> | |
231 </conditional> | |
232 <param name="overlap_mode" value="-loj" /> | |
233 <output name="output" file="intersect-loj.bed" ftype="bed" /> | |
234 </test> | |
235 <test> | |
236 <param name="inputA" value="intersect-A.bed" ftype="bed" /> | |
237 <conditional name="reduce_or_iterate"> | |
238 <param name='reduce_or_iterate_selector' value="iterate" /> | |
239 <param name="inputB" value="intersect-B.bed" ftype="bed" /> | |
240 </conditional> | |
241 <param name="overlap_mode" value="-wo" /> | |
242 <output name="output" file="intersect-wo.bed" ftype="bed" /> | |
243 </test> | |
244 <test> | |
245 <param name="inputA" value="intersect-A.bed" ftype="bed" /> | |
246 <conditional name="reduce_or_iterate"> | |
247 <param name='reduce_or_iterate_selector' value="iterate" /> | |
248 <param name="inputB" value="intersect-B.bed" ftype="bed" /> | |
249 </conditional> | |
250 <param name="overlap_mode" value="-wao" /> | |
251 <output name="output" file="intersect-wao.bed" ftype="bed" /> | |
252 </test> | |
253 <test> | |
254 <param name="inputA" value="intersect-A.bed" ftype="bed" /> | |
255 <conditional name="reduce_or_iterate"> | |
256 <param name='reduce_or_iterate_selector' value="iterate" /> | |
257 <param name="inputB" value="intersect-B.bed" ftype="bed" /> | |
258 </conditional> | |
259 <param name="once" value="-u" /> | |
260 <output name="output" file="intersect-unique.bed" ftype="bed" /> | |
261 </test> | |
262 <test> | |
263 <param name="inputA" value="intersect-A.bed" ftype="bed" /> | |
264 <conditional name="reduce_or_iterate"> | |
265 <param name='reduce_or_iterate_selector' value="iterate" /> | |
266 <param name="inputB" value="intersect-B.bed" ftype="bed" /> | |
267 </conditional> | |
268 <param name="count" value="-c"/> | |
269 <output name="output" file="intersect-count.bed" ftype="bed" /> | |
270 </test> | |
271 <test> | |
272 <param name="inputA" value="intersect-A.bed" ftype="bed" /> | |
273 <conditional name="reduce_or_iterate"> | |
274 <param name='reduce_or_iterate_selector' value="iterate" /> | |
275 <param name="inputB" value="intersect-B.bed" ftype="bed" /> | |
276 </conditional> | |
277 <param name="invert" value="-v"/> | |
278 <output name="output" file="intersect-invert.bed" ftype="bed" /> | |
279 </test> | |
280 <test> | |
281 <param name="inputA" value="intersect-A2.bed" ftype="bed" /> | |
282 <conditional name="reduce_or_iterate"> | |
283 <param name='reduce_or_iterate_selector' value="iterate" /> | |
284 <param name="inputB" value="intersect-B2.bed" ftype="bed" /> | |
285 </conditional> | |
286 <param name="overlap_mode" value="-wa,-wb" /> | |
287 <conditional name="fraction_cond"> | |
288 <param name='fraction_select' value='specify'/> | |
289 <param name="overlap" value="0.5" /> | |
290 </conditional> | |
291 <output name="output" file="intersect-fracA.bed" ftype="bed" /> | |
292 </test> | |
293 <test> | |
294 <param name="inputA" value="intersect-A2.bed" ftype="bed" /> | |
295 <conditional name="reduce_or_iterate"> | |
296 <param name='reduce_or_iterate_selector' value="iterate" /> | |
297 <param name="inputB" value="intersect-B2.bed" ftype="bed" /> | |
298 </conditional> | |
299 <param name="overlap_mode" value="-wa,-wb" /> | |
300 <conditional name="fraction_cond"> | |
301 <param name='fraction_select' value='specify'/> | |
302 <param name="overlap" value="0.5" /> | |
303 <conditional name="reciprocal_cond"> | |
304 <param name="reciprocal" value="-r" /> | |
305 </conditional> | |
306 </conditional> | |
307 <output name="output" file="intersect-fracA-rec.bed" ftype="bed" /> | |
308 </test> | |
309 <test> | |
310 <param name="inputA" value="intersect-A2.bed" ftype="bed" /> | |
311 <conditional name="reduce_or_iterate"> | |
312 <param name='reduce_or_iterate_selector' value="iterate" /> | |
313 <param name="inputB" value="intersect-B2.bed" ftype="bed" /> | |
314 </conditional> | |
315 <param name="overlap_mode" value="-wa,-wb" /> | |
316 <conditional name="fraction_cond"> | |
317 <param name='fraction_select' value='specify'/> | |
318 <param name="overlap" value="0.5" /> | |
319 <conditional name="reciprocal_cond"> | |
320 <param name="overlapB" value="0.5" /> | |
321 </conditional> | |
322 </conditional> | |
323 <output name="output" file="intersect-fracA-rec.bed" ftype="bed" /> | |
324 </test> | |
325 <test> | |
326 <param name="inputA" value="intersect-A2.bed" ftype="bed" /> | |
327 <conditional name="reduce_or_iterate"> | |
328 <param name='reduce_or_iterate_selector' value="iterate" /> | |
329 <param name="inputB" value="intersect-B2.bed" ftype="bed" /> | |
330 </conditional> | |
331 <param name="overlap_mode" value="-wa,-wb" /> | |
332 <conditional name="fraction_cond"> | |
333 <param name='fraction_select' value='specify'/> | |
334 <param name="overlap" value="0.5" /> | |
335 <conditional name="reciprocal_cond"> | |
336 <param name="overlapB" value="0.5" /> | |
337 <param name="disjoint" value="-e" /> | |
338 </conditional> | |
339 </conditional> | |
340 <output name="output" file="intersect-fracA.bed" ftype="bed" /> | |
341 </test> | |
342 <!-- old tests --> | |
93 <test> | 343 <test> |
94 <param name="inputA" value="intersectBed1.bed" ftype="bed" /> | 344 <param name="inputA" value="intersectBed1.bed" ftype="bed" /> |
95 <param name="inputB" value="intersectBed2.bed" ftype="bed" /> | 345 <param name="inputB" value="intersectBed2.bed" ftype="bed" /> |
96 <param name="overlap_mode" value="-wa" /> | 346 <param name="overlap_mode" value="-wa" /> |
97 <param name="split" value="False" /> | 347 <param name="split" value="False" /> |