0
|
1 <tool id="bedtools_mergebed" name="Merge BED files" version="@WRAPPER_VERSION@.0">
|
|
2 <description>(mergeBed)</description>
|
|
3 <macros>
|
|
4 <import>macros.xml</import>
|
|
5 </macros>
|
|
6 <expand macro="requirements" />
|
|
7 <expand macro="stdio" />
|
|
8 <command>
|
1
|
9 <![CDATA[
|
|
10 mergeBed
|
|
11 -i "${input}"
|
|
12 $strand
|
0
|
13 -d $distance
|
1
|
14 $header
|
|
15 > "${output}"
|
|
16 ]]>
|
0
|
17 </command>
|
|
18 <inputs>
|
1
|
19 <param name="input" format="bam,bed,gff,vcf" type="data" label="Sort the following BAM/BED/VCF/GFF file"/>
|
|
20 <param name="strand" type="select" label="Calculation based on strandedness?">
|
|
21 <option value="" selected="True">Overlaps on either strand</option>
|
|
22 <option value="-s">Force strandedness. That is, only merge features that are the same strand.</option>
|
|
23 <option value="-S +">Force merge for forward strand only.</option>
|
|
24 <option value="-S -">Force merge for reverse strand only.</option>
|
|
25 </param>
|
|
26 <param name="distance" type="integer" value="0"
|
|
27 label="Maximum distance between features allowed for features to be merged"
|
|
28 help="That is, overlapping and/or book-ended features are merged. (-d)"/>
|
|
29 <expand macro="print_header" />
|
|
30 <expand macro="choose_columns" />
|
|
31 <expand macro="choose_operations">
|
0
|
32 <expand macro="math_options" />
|
1
|
33 <expand macro="additional_math_options" />
|
|
34 </expand>
|
0
|
35 </inputs>
|
|
36 <outputs>
|
|
37 <data format="bed" name="output" metadata_source="input" label="Merged ${input.name}"/>
|
|
38 </outputs>
|
|
39 <tests>
|
|
40 <test>
|
1
|
41 <param name="input" value="mergedBed1.bed" ftype="bed" />
|
|
42 <output name="output" file="mergedBed_result1.bed" ftype="bed" />
|
0
|
43 </test>
|
|
44 <test>
|
1
|
45 <param name="input" value="mergedBed2.bed" ftype="bed" />
|
0
|
46 <param name="strandedness" value="-s" />
|
1
|
47 <output name="output" file="mergedBed_result2.bed" ftype="bed" />
|
0
|
48 </test>
|
|
49 <test>
|
1
|
50 <param name="input" value="mergedBed3.bed" ftype="bed" />
|
0
|
51 <param name="report_number" value="-n" />
|
1
|
52 <output name="output" file="mergedBed_result3.bed" ftype="bed" />
|
0
|
53 </test>
|
|
54 <test>
|
1
|
55 <param name="input" value="mergedBed4.bed" ftype="bed" />
|
0
|
56 <param name="distance" value="1000" />
|
1
|
57 <output name="output" file="mergedBed_result4.bed" ftype="bed" />
|
0
|
58 </test>
|
|
59 </tests>
|
|
60 <help>
|
1
|
61 <![CDATA[
|
0
|
62 **What it does**
|
|
63
|
|
64 bedtools merge combines overlapping or "book-ended" features in an interval file into a single feature which spans all of the combined features.
|
|
65
|
|
66
|
|
67 .. image:: $PATH_TO_IMAGES/merge-glyph.png
|
|
68
|
|
69
|
|
70 .. class:: warningmark
|
|
71
|
|
72 bedtools merge requires that you presort your data by chromosome and then by start position.
|
|
73
|
|
74
|
|
75 ==========================================================================
|
|
76 Default behavior
|
|
77 ==========================================================================
|
|
78 By default, ``bedtools merge`` combines overlapping (by at least 1 bp) and/or
|
|
79 bookended intervals into a single, "flattened" or "merged" interval.
|
|
80
|
|
81 ::
|
|
82
|
|
83 $ cat A.bed
|
|
84 chr1 100 200
|
|
85 chr1 180 250
|
|
86 chr1 250 500
|
|
87 chr1 501 1000
|
|
88
|
|
89 $ bedtools merge -i A.bed
|
|
90 chr1 100 500
|
|
91 chr1 501 1000
|
|
92
|
|
93
|
|
94 ==========================================================================
|
|
95 *-s* Enforcing "strandedness"
|
|
96 ==========================================================================
|
|
97 The ``-s`` option will only merge intervals that are overlapping/bookended
|
|
98 *and* are on the same strand.
|
|
99
|
|
100 ::
|
|
101
|
|
102 $ cat A.bed
|
|
103 chr1 100 200 a1 1 +
|
|
104 chr1 180 250 a2 2 +
|
|
105 chr1 250 500 a3 3 -
|
|
106 chr1 501 1000 a4 4 +
|
|
107
|
|
108 $ bedtools merge -i A.bed -s
|
|
109 chr1 100 250 +
|
|
110 chr1 501 1000 +
|
|
111 chr1 250 500 -
|
|
112
|
|
113
|
|
114 ==========================================================================
|
|
115 *-n* Reporting the number of features that were merged
|
|
116 ==========================================================================
|
|
117 The -n option will report the number of features that were combined from the
|
|
118 original file in order to make the newly merged feature. If a feature in the
|
|
119 original file was not merged with any other features, a "1" is reported.
|
|
120
|
|
121 ::
|
|
122
|
|
123 $ cat A.bed
|
|
124 chr1 100 200
|
|
125 chr1 180 250
|
|
126 chr1 250 500
|
|
127 chr1 501 1000
|
|
128
|
|
129 $ bedtools merge -i A.bed -n
|
|
130 chr1 100 500 3
|
|
131 chr1 501 1000 1
|
|
132
|
|
133
|
|
134 ==========================================================================
|
|
135 *-d* Controlling how close two features must be in order to merge
|
|
136 ==========================================================================
|
|
137 By default, only overlapping or book-ended features are combined into a new
|
|
138 feature. However, one can force ``merge`` to combine more distant features
|
|
139 with the ``-d`` option. For example, were one to set ``-d`` to 1000, any
|
|
140 features that overlap or are within 1000 base pairs of one another will be
|
|
141 combined.
|
|
142
|
|
143 ::
|
|
144
|
|
145 $ cat A.bed
|
|
146 chr1 100 200
|
|
147 chr1 501 1000
|
|
148
|
|
149 $ bedtools merge -i A.bed
|
|
150 chr1 100 200
|
|
151 chr1 501 1000
|
|
152
|
|
153 $ bedtools merge -i A.bed -d 1000
|
|
154 chr1 100 200 1000
|
|
155
|
|
156
|
|
157 =============================================================
|
|
158 *-nms* Reporting the names of the features that were merged
|
|
159 =============================================================
|
|
160 Occasionally, one might like to know that names of the features that were
|
|
161 merged into a new feature. The ``-nms`` option will add an extra column to the
|
|
162 ``merge`` output which lists (separated by semicolons) the names of the
|
|
163 merged features.
|
|
164
|
|
165 ::
|
|
166
|
|
167 $ cat A.bed
|
|
168 chr1 100 200 A1
|
|
169 chr1 150 300 A2
|
|
170 chr1 250 500 A3
|
|
171
|
|
172 $ bedtools merge -i A.bed -nms
|
|
173 chr1 100 500 A1,A2,A3
|
|
174
|
|
175
|
|
176 ===============================================================
|
|
177 *-scores* Reporting the scores of the features that were merged
|
|
178 ===============================================================
|
|
179 Similarly, we might like to know that scores of the features that were
|
|
180 merged into a new feature. Enter the ``-scores`` option. One can specify
|
|
181 how the scores from each overlapping interval should be reported.
|
|
182
|
|
183 ::
|
|
184
|
|
185 $ cat A.bed
|
|
186 chr1 100 200 A1 1
|
|
187 chr1 150 300 A2 2
|
|
188 chr1 250 500 A3 3
|
|
189
|
|
190 $ bedtools merge -i A.bed -scores mean
|
|
191 chr1 100 500 2
|
|
192
|
|
193 $ bedtools merge -i A.bed -scores max
|
|
194 chr1 100 500 3
|
|
195
|
|
196 $ bedtools merge -i A.bed -scores collapse
|
|
197 chr1 100 500 1,2,3
|
|
198
|
|
199 @REFERENCES@
|
1
|
200 ]]>
|
0
|
201 </help>
|
|
202 <expand macro="citations" />
|
|
203 </tool>
|