Mercurial > repos > iuc > bedtools
comparison mergeBed.xml @ 0:4fb5ea02b441 draft
Uploaded
| author | iuc |
|---|---|
| date | Tue, 15 Jul 2014 14:42:23 -0400 |
| parents | |
| children | 7511823bdea1 |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:4fb5ea02b441 |
|---|---|
| 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> | |
| 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 > $output | |
| 19 </command> | |
| 20 <inputs> | |
| 21 <param name="input" format="bed,gff,vcf" type="data" label="Sort the following BED/VCF/GFF 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" selected="True">Do not report at all</option> | |
| 33 <option value="sum">Sum</option> | |
| 34 <expand macro="math_options" /> | |
| 35 </param> | |
| 36 </inputs> | |
| 37 <outputs> | |
| 38 <data format="bed" name="output" metadata_source="input" label="Merged ${input.name}"/> | |
| 39 </outputs> | |
| 40 <tests> | |
| 41 <test> | |
| 42 <param name="input" value="0.bed" ftype="bed" /> | |
| 43 <output name="output" file="0_result.bed" ftype="bed" /> | |
| 44 </test> | |
| 45 <test> | |
| 46 <param name="input" value="1.bed" ftype="bed" /> | |
| 47 <param name="strandedness" value="-s" /> | |
| 48 <output name="output" file="1_result.bed" ftype="bed" /> | |
| 49 </test> | |
| 50 <test> | |
| 51 <param name="input" value="2.bed" ftype="bed" /> | |
| 52 <param name="report_number" value="-n" /> | |
| 53 <output name="output" file="2_result.bed" ftype="bed" /> | |
| 54 </test> | |
| 55 <test> | |
| 56 <param name="input" value="3.bed" ftype="bed" /> | |
| 57 <param name="distance" value="1000" /> | |
| 58 <output name="output" file="3_result.bed" ftype="bed" /> | |
| 59 </test> | |
| 60 </tests> | |
| 61 <help> | |
| 62 | |
| 63 **What it does** | |
| 64 | |
| 65 bedtools merge combines overlapping or "book-ended" features in an interval file into a single feature which spans all of the combined features. | |
| 66 | |
| 67 | |
| 68 .. image:: $PATH_TO_IMAGES/merge-glyph.png | |
| 69 | |
| 70 | |
| 71 .. class:: warningmark | |
| 72 | |
| 73 bedtools merge requires that you presort your data by chromosome and then by start position. | |
| 74 | |
| 75 | |
| 76 ========================================================================== | |
| 77 Default behavior | |
| 78 ========================================================================== | |
| 79 By default, ``bedtools merge`` combines overlapping (by at least 1 bp) and/or | |
| 80 bookended intervals into a single, "flattened" or "merged" interval. | |
| 81 | |
| 82 :: | |
| 83 | |
| 84 $ cat A.bed | |
| 85 chr1 100 200 | |
| 86 chr1 180 250 | |
| 87 chr1 250 500 | |
| 88 chr1 501 1000 | |
| 89 | |
| 90 $ bedtools merge -i A.bed | |
| 91 chr1 100 500 | |
| 92 chr1 501 1000 | |
| 93 | |
| 94 | |
| 95 ========================================================================== | |
| 96 *-s* Enforcing "strandedness" | |
| 97 ========================================================================== | |
| 98 The ``-s`` option will only merge intervals that are overlapping/bookended | |
| 99 *and* are on the same strand. | |
| 100 | |
| 101 :: | |
| 102 | |
| 103 $ cat A.bed | |
| 104 chr1 100 200 a1 1 + | |
| 105 chr1 180 250 a2 2 + | |
| 106 chr1 250 500 a3 3 - | |
| 107 chr1 501 1000 a4 4 + | |
| 108 | |
| 109 $ bedtools merge -i A.bed -s | |
| 110 chr1 100 250 + | |
| 111 chr1 501 1000 + | |
| 112 chr1 250 500 - | |
| 113 | |
| 114 | |
| 115 ========================================================================== | |
| 116 *-n* Reporting the number of features that were merged | |
| 117 ========================================================================== | |
| 118 The -n option will report the number of features that were combined from the | |
| 119 original file in order to make the newly merged feature. If a feature in the | |
| 120 original file was not merged with any other features, a "1" is reported. | |
| 121 | |
| 122 :: | |
| 123 | |
| 124 $ cat A.bed | |
| 125 chr1 100 200 | |
| 126 chr1 180 250 | |
| 127 chr1 250 500 | |
| 128 chr1 501 1000 | |
| 129 | |
| 130 $ bedtools merge -i A.bed -n | |
| 131 chr1 100 500 3 | |
| 132 chr1 501 1000 1 | |
| 133 | |
| 134 | |
| 135 ========================================================================== | |
| 136 *-d* Controlling how close two features must be in order to merge | |
| 137 ========================================================================== | |
| 138 By default, only overlapping or book-ended features are combined into a new | |
| 139 feature. However, one can force ``merge`` to combine more distant features | |
| 140 with the ``-d`` option. For example, were one to set ``-d`` to 1000, any | |
| 141 features that overlap or are within 1000 base pairs of one another will be | |
| 142 combined. | |
| 143 | |
| 144 :: | |
| 145 | |
| 146 $ cat A.bed | |
| 147 chr1 100 200 | |
| 148 chr1 501 1000 | |
| 149 | |
| 150 $ bedtools merge -i A.bed | |
| 151 chr1 100 200 | |
| 152 chr1 501 1000 | |
| 153 | |
| 154 $ bedtools merge -i A.bed -d 1000 | |
| 155 chr1 100 200 1000 | |
| 156 | |
| 157 | |
| 158 ============================================================= | |
| 159 *-nms* Reporting the names of the features that were merged | |
| 160 ============================================================= | |
| 161 Occasionally, one might like to know that names of the features that were | |
| 162 merged into a new feature. The ``-nms`` option will add an extra column to the | |
| 163 ``merge`` output which lists (separated by semicolons) the names of the | |
| 164 merged features. | |
| 165 | |
| 166 :: | |
| 167 | |
| 168 $ cat A.bed | |
| 169 chr1 100 200 A1 | |
| 170 chr1 150 300 A2 | |
| 171 chr1 250 500 A3 | |
| 172 | |
| 173 $ bedtools merge -i A.bed -nms | |
| 174 chr1 100 500 A1,A2,A3 | |
| 175 | |
| 176 | |
| 177 =============================================================== | |
| 178 *-scores* Reporting the scores of the features that were merged | |
| 179 =============================================================== | |
| 180 Similarly, we might like to know that scores of the features that were | |
| 181 merged into a new feature. Enter the ``-scores`` option. One can specify | |
| 182 how the scores from each overlapping interval should be reported. | |
| 183 | |
| 184 :: | |
| 185 | |
| 186 $ cat A.bed | |
| 187 chr1 100 200 A1 1 | |
| 188 chr1 150 300 A2 2 | |
| 189 chr1 250 500 A3 3 | |
| 190 | |
| 191 $ bedtools merge -i A.bed -scores mean | |
| 192 chr1 100 500 2 | |
| 193 | |
| 194 $ bedtools merge -i A.bed -scores max | |
| 195 chr1 100 500 3 | |
| 196 | |
| 197 $ bedtools merge -i A.bed -scores collapse | |
| 198 chr1 100 500 1,2,3 | |
| 199 | |
| 200 | |
| 201 @REFERENCES@ | |
| 202 </help> | |
| 203 </tool> |
