comparison mergeBed.xml @ 5:b78d20957e7f draft

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