Retrieve coordinate for maximum value in a region using a bigwig file
1
0
Entering edit mode
4.0 years ago
am2622 • 0

Hello,

I have a bed file with a series of regions and a signal bigwig file. I want to look for each region in the bed file what is the maximum value in the bigwig file, and then obtain the genomic coordinated for the maxima. I have seen ways to get the maximum, but not how to get a coordinate position. Any leads?

Thanks!

bigwig peak summit • 1.3k views
ADD COMMENT
0
Entering edit mode

What if there are ties?

ADD REPLY
1
Entering edit mode
4.0 years ago

A one-liner (not tested)

 echo -e "chr1\t1014511\t1023256\nchr1\t1014570\t1014600" | while read CHROM START END ; do echo -en "${CHROM}\t${START}\t${END}\t" &&  bigWigToBedGraph -chrom=${CHROM} -start=${START} -end=${END}path/to/file.bigWig stdout  | sort -t $'\t' -k4,4gr | head -n 1 |tr -d "\n" && echo ; done
ADD COMMENT

Login before adding your answer.

Traffic: 1585 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