How to create a new bigwig file defined by a subset of bed file?
1
0
Entering edit mode
7.1 years ago
xiaoyonf ▴ 60

Hello, I have a ChIP-seq bigwig file and a bed file that is a subset of the binding peaks defined from the bigwig file. I want to create a new (sub) bigwig file to use the subset of bed file. How can I do it? Many thanks! Xiaoyong

ChIP-Seq • 4.0k views
ADD COMMENT
8
Entering edit mode
7.1 years ago

Convert from bigwig to wiggle:

$ bigWigToWig data.bw data.wig

Convert from wiggle to bed:

$ wig2bed < data.wig > data.bed

Filter the bed file based on your peak subset, and make a bedgraph file from the subset:

$ sort-bed peak_subset.unsorted.bed > peak_subset.bed
$ bedops --element-of 1 data.bed peak_subset.bed | awk 'BEGIN{ OFS="\t"; }{ print $1, $2, $3, $5 }' > data_subset.bedgraph

Convert the bedgraph file to a bigwig file, e.g. for reference genome hg19:

$ fetchChromSizes hg19 > hg19.sizes
$ bedGraphToBigWig data_subset.bedgraph hg19.sizes data_subset.bw
ADD COMMENT
0
Entering edit mode

Sounds cool. I will definitely try. Thank you, Alex! Xiaoyong

ADD REPLY

Login before adding your answer.

Traffic: 2955 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6