Debian Codegraph @

docs/content/tools/multiinter.rst

raw
1 .. _multiinter:
2
3 ###############
4 *multiinter*
5 ###############
6
7 |
8
9 .. image:: ../images/tool-glyphs/multiinter-glyph.png
10 :width: 600pt
11
12 |
13
14 ``bedtools multiinter`` identifies common intervals among multiple (and subsets thereof)
15 sorted BED/GFF/VCF files.
16
17 .. note::
18
19 1. All files must be sorted in the same mmanner (e.g., ``sort -k 1,1 -k2,2n in.bed > in.sorted.bed``)
20
21
22
23 ===============================
24 Usage and option summary
25 ===============================
26 **Usage**:
27 ::
28
29 bedtools multiinter [OPTIONS] -i FILE1 FILE2 .. FILEn
30
31 **(or)**:
32 ::
33
34 multiIntersect [OPTIONS] -i FILE1 FILE2 .. FILEn
35
36
37
38 =========================== ===============================================================================================================================================================================================================
39 Option Description
40 =========================== ===============================================================================================================================================================================================================
41 **-header** Print a header line (chrom/start/end + names of each file).
42 **-names** A list of names (one/file) to describe each file in -i.
43 These names will be printed in the header line.
44 **-g** Use genome file to calculate empty regions.
45 **-empty** | Report empty regions (i.e., start/end intervals w/o
46 | values in all files). Requires the '-g FILE' parameter.
47 **-filler TEXT** | Use TEXT when representing intervals having no value.
48 | Default is '0', but you can use 'N/A' or any text.
49 **-examples** Show usage examples on the command line.
50 =========================== ===============================================================================================================================================================================================================
51
52
53
54
55 ==========================================================================
56 Default behavior
57 ==========================================================================
58 By default, ``bedtools multiinter`` will inspect all of the intervals in each input file and
59 report the sub-intervals that are overlapped by 0, 1, 2, ... N files.
60 The default output format is as follows:
61
62 1. chromosome (or entire genome)
63 2. 0-based start coordinate of the sub-interval.
64 3. 1-based end coordinate of the sub-interval.
65 4. The number of files whose intervals overlap this sub interval at least once.
66 5. The list of file numbers (by order on the command line) whose intervals overlap this sub interval at least once.
67 6. Columns reflecting whether each file had (1) or did not have (0) 1 or more intervals overlapping this sub interval.
68
69 For example:
70
71 .. code-block:: bash
72
73 $ cat a.bed
74 chr1 6 12
75 chr1 10 20
76 chr1 22 27
77 chr1 24 30
78
79 cat b.bed
80 chr1 12 32
81 chr1 14 30
82
83 $ cat c.bed
84 chr1 8 15
85 chr1 10 14
86 chr1 32 34
87
88 $ cat sizes.txt
89 chr1 5000
90
91 $ bedtools multiinter -i a.bed b.bed c.bed
92 chr1 6 8 1 1 1 0 0
93 chr1 8 12 2 1,3 1 0 1
94 chr1 12 15 3 1,2,3 1 1 1
95 chr1 15 20 2 1,2 1 1 0
96 chr1 20 22 1 2 0 1 0
97 chr1 22 30 2 1,2 1 1 0
98 chr1 30 32 1 2 0 1 0
99 chr1 32 34 1 3 0 0 1
100
101
102 ==========================================================================
103 ``-header`` Add a header with columns names
104 ==========================================================================
105 For example:
106
107 .. code-block:: bash
108
109 $ bedtools multiinter -header -i a.bed b.bed c.bed
110 chrom start end num list a.bed b.bed c.bed
111 chr1 6 8 1 1 1 0 0
112 chr1 8 12 2 1,3 1 0 1
113 chr1 12 15 3 1,2,3 1 1 1
114 chr1 15 20 2 1,2 1 1 0
115 chr1 20 22 1 2 0 1 0
116 chr1 22 30 2 1,2 1 1 0
117 chr1 30 32 1 2 0 1 0
118 chr1 32 34 1 3 0 0 1
119
120 ==========================================================================
121 ``-names`` Add custom labels for each file in the header
122 ==========================================================================
123
124 For example:
125
126 .. code-block:: bash
127
128 $ bedtools multiinter -header -names A B C -i a.bed b.bed c.bed
129 chrom start end num list A B C
130 chr1 6 8 1 1 1 0 0
131 chr1 8 12 2 1,3 1 0 1
132 chr1 12 15 3 1,2,3 1 1 1
133 chr1 15 20 2 1,2 1 1 0
134 chr1 20 22 1 2 0 1 0
135 chr1 22 30 2 1,2 1 1 0
136 chr1 30 32 1 2 0 1 0
137 chr1 32 34 1 3 0 0 1
138
139 ==========================================================================
140 ``-empty`` Report the sub intervals not covered by any file
141 ==========================================================================
142 Note that this option requires a ``-g`` file so that it knows the full
143 range of each chromosome or contig.
144
145
146 For example:
147
148 .. code-block:: bash
149
150 $ bedtools multiinter -header -names A B C -i a.bed b.bed c.bed -empty -g sizes.txt
151 chrom start end num list A B C
152 chr1 0 6 0 none 0 0 0
153 chr1 6 8 1 A 1 0 0
154 chr1 8 12 2 A,C 1 0 1
155 chr1 12 15 3 A,B,C 1 1 1
156 chr1 15 20 2 A,B 1 1 0
157 chr1 20 22 1 B 0 1 0
158 chr1 22 30 2 A,B 1 1 0
159 chr1 30 32 1 B 0 1 0
160 chr1 32 34 1 C 0 0 1
161 chr1 34 5000 0 none 0 0 0