Reference Code backup Executable files
Averaging scores in a bigWig file for the regions/intervals given in a bed file
bigWigAverageOverBed [options] in.bw in.bed out.tab
This tool is part of UCSC Genome Browser's utilities.
bigWigAverageOverBed
expects the in.bed is in either BED4 (chrom, chromStart, chromEnd, and name) or BED12 (BED4+score, strand, thickStart, thickEnd, itemRgb, blockCount, blockSizes, and blockStarts) format. If the in.bed is in BED12 format, the last three columns (blockCount, blockSizes, and blockStarts) must be:
$ bigWigAverageOverBed K562_DNase.bigWig rDHS.bed rDHS.tab $ head rDHS.tab EH38E2776520 152 152 25.7478 0.169393 0.169393 EH38E2776521 268 268 93.0052 0.347034 0.347034 EH38E2776522 161 161 15.7171 0.0976216 0.0976216 EH38E2776523 223 223 18.7438 0.0840528 0.0840528 EH38E2776524 350 350 258.306 0.738017 0.738017 EH38E2776528 246 246 202.474 0.823065 0.823065 EH38E2776529 242 242 1.03611 0.00428145 0.00428145 EH38E2776530 152 152 11.6338 0.0765383 0.0765383 EH38E2776532 228 228 190.955 0.83752 0.83752 EH38E2776534 338 338 130.477 0.386025 0.386025
By using the -bedOut option, the program makes a new bed file, which is identical to the input bed file, except that a new column with the corresponding mean values being added to the end of the file:
$ bigWigAverageOverBed -bedOut=rDHS.out.bed
K562.bigWig rDHS.bed rDHS.tab
$ head rDHS.out.bed
chr1 104896 105048 EH38E2776520 0.169393
chr1 138866 139134 EH38E2776521 0.347034
chr1 180743 180904 EH38E2776522 0.0976216
chr1 181014 181237 EH38E2776523 0.0840528
chr1 181289 181639 EH38E2776524 0.738017
chr1 267925 268171 EH38E2776528 0.823065
chr1 271226 271468 EH38E2776529 0.00428145
chr1 274329 274481 EH38E2776530 0.0765383
chr1 586036 586264 EH38E2776532 0.83752
chr1 605330 605668 EH38E2776534 0.386025
By using the -sampleAroundCenter option, the program calculates the center of all regions, extends N basepairs, and use these extended regions for generating stats.
$ bigWigAverageOverBed -sampleAroundCenter=500
K562.bigWig rDHS.bed rDHS.tab