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