Debian Codegraph @

docs/content/tools/unionbedg.rst

raw
1 .. _unionbedg:
2
3 ###############
4 *unionbedg*
5 ###############
6 **bedtools unionbedg** combines multiple BEDGRAPH files into a single file such that one can directly
7 compare coverage (and other text-values such as genotypes) across multiple sample
8
9
10 ==========================================================================
11 Usage and option summary
12 ==========================================================================
13 Usage:
14
15 ::
16
17 bedtools unionbedg [OPTIONS] -i FILE1 FILE2 FILE3 ... FILEn
18
19 =========================== ===============================================================================================================================================================================================================
20 Option Description
21
22 =========================== ===============================================================================================================================================================================================================
23 **-header** Print a header line, consisting of chrom, start, end followed by the names of each input BEDGRAPH file.
24 **-names** A list of names (one per file) to describe each file in -i. These names will be printed in the header line.
25 **-empty** Report empty regions (i.e., start/end intervals w/o values in all files). *Requires the '-g FILE' parameter (see below)*.
26 **-g** The genome file to be used to calculate empty regions.
27 **-filler TEXT** Use TEXT when representing intervals having no value. Default is '0', but you can use 'N/A' or any other text.
28 **-examples** Show detailed usage examples.
29 =========================== ===============================================================================================================================================================================================================
30
31
32
33
34 ==========================================================================
35 Default behavior
36 ==========================================================================
37
38 ::
39
40 cat 1.bg
41 chr1 1000 1500 10
42 chr1 2000 2100 20
43
44 cat 2.bg
45 chr1 900 1600 60
46 chr1 1700 2050 50
47
48 cat 3.bg
49 chr1 1980 2070 80
50 chr1 2090 2100 20
51
52 cat sizes.txt
53 chr1 5000
54
55 bedtools unionbedg -i 1.bg 2.bg 3.bg
56 chr1 900 1000 0 60 0
57 chr1 1000 1500 10 60 0
58 chr1 1500 1600 0 60 0
59 chr1 1700 1980 0 50 0
60 chr1 1980 2000 0 50 80
61 chr1 2000 2050 20 50 80
62 chr1 2050 2070 20 0 80
63 chr1 2070 2090 20 0 0
64 chr1 2090 2100 20 0 20
65
66 ==========================================================================
67 ``-header`` Add a header line to the output
68 ==========================================================================
69
70 ::
71
72 bedtools unionbedg -i 1.bg 2.bg 3.bg -header
73 chrom start end 1 2 3
74 chr1 900 1000 0 60 0
75 chr1 1000 1500 10 60 0
76 chr1 1500 1600 0 60 0
77 chr1 1700 1980 0 50 0
78 chr1 1980 2000 0 50 80
79 chr1 2000 2050 20 50 80
80 chr1 2050 2070 20 0 80
81 chr1 2070 2090 20 0 0
82 chr1 2090 2100 20 0 20
83
84
85 ==========================================================================
86 ``-names`` Add a header line with custom file names to the output
87 ==========================================================================
88
89 ::
90
91 bedtools unionbedg -i 1.bg 2.bg 3.bg -header -names WT-1 WT-2 KO-1
92 chrom start end WT-1 WT-2 KO-1
93 chr1 900 1000 0 60 0
94 chr1 1000 1500 10 60 0
95 chr1 1500 1600 0 60 0
96 chr1 1700 1980 0 50 0
97 chr1 1980 2000 0 50 80
98 chr1 2000 2050 20 50 80
99 chr1 2050 2070 20 0 80
100 chr1 2070 2090 20 0 0
101 chr1 2090 2100 20 0 20
102
103
104
105
106 ==========================================================================
107 ``-empty`` Include regions that have zero coverage in all BEDGRAPH files.
108 ==========================================================================
109
110 ::
111
112 bedtools unionbedg -i 1.bg 2.bg 3.bg -empty -g sizes.txt -header
113 chrom start end WT-1 WT-2 KO-1
114 chrom start end 1 2 3
115 chr1 0 900 0 0 0
116 chr1 900 1000 0 60 0
117 chr1 1000 1500 10 60 0
118 chr1 1500 1600 0 60 0
119 chr1 1600 1700 0 0 0
120 chr1 1700 1980 0 50 0
121 chr1 1980 2000 0 50 80
122 chr1 2000 2050 20 50 80
123 chr1 2050 2070 20 0 80
124 chr1 2070 2090 20 0 0
125 chr1 2090 2100 20 0 20
126 chr1 2100 5000 0 0 0
127
128
129 ==========================================================================
130 ``-filler`` Use a custom value for missing values.
131 ==========================================================================
132
133 ::
134
135 bedtools unionbedg -i 1.bg 2.bg 3.bg -empty -g sizes.txt -header -filler N/A
136 chrom start end WT-1 WT-2 KO-1
137 chrom start end 1 2 3
138 chr1 0 900 N/A N/A N/A
139 chr1 900 1000 N/A 60 N/A
140 chr1 1000 1500 10 60 N/A
141 chr1 1500 1600 N/A 60 N/A
142 chr1 1600 1700 N/A N/A N/A
143 chr1 1700 1980 N/A 50 N/A
144 chr1 1980 2000 N/A 50 80
145 chr1 2000 2050 20 50 80
146 chr1 2050 2070 20 N/A 80
147 chr1 2070 2090 20 N/A N/A
148 chr1 2090 2100 20 N/A 20
149 chr1 2100 5000 N/A N/A N/A
150
151
152 ==========================================================================
153 Use BEDGRAPH files with non-numeric values.
154 ==========================================================================
155
156 ::
157
158 cat 1.snp.bg
159 chr1 0 1 A/G
160 chr1 5 6 C/T
161
162 cat 2.snp.bg
163 chr1 0 1 C/C
164 chr1 7 8 T/T
165
166 cat 3.snp.bg
167 chr1 0 1 A/G
168 chr1 5 6 C/T
169
170 bedtools unionbedg -i 1.snp.bg 2.snp.bg 3.snp.bg -filler -/-
171 chr1 0 1 A/G C/C A/G
172 chr1 5 6 C/T -/- C/T
173 chr1 7 8 -/- T/T -/-