Question: Identifying The 'Summit' Coordinate Within Many Coordinates In A Wig File?
2
gravatar for Ian
7.9 years ago by
Ian5.3k
University of Manchester, UK
Ian5.3k wrote:

I have a WIG file containing read coverage data from ChIP-seq peak calling analysis.

For a given set of coordinates is there a simple fast way of determining the 'summit' coordinate, i.e the coordinate with the highest read pileup.

My own method would be slow as i would run through the (big) WIG file, extract the region of interest and find the coordinate with the highest score. But surely there must be a quicker way of doing this? If not fair enough.

The peak caller does report the summit from its own data, but i want to check out different regions.

Thanks.

wiggle • 3.3k views
ADD COMMENTlink written 7.9 years ago by Ian5.3k
3
gravatar for Brad Chapman
7.9 years ago by
Brad Chapman9.4k
Boston, MA
Brad Chapman9.4k wrote:

Convert your Wig file to BigWig with the UCSC executable wigToBigWig. This provides an indexed Wig file you can query to return regions of interest, without having to loop over the entire file each time.

bx-python provides a python BigWig interface that will help with finding your summit coordinates:

from bx.bbi.bigwig_file import BigWigFile

f = open("your_file.bw")
bw = BigWigFile(file=f)
vals = bw.get("chr3", 1, 1000)
# vals is a list of start, end, value
max_start, max_end, max_val = max(vals, key=lambda x: x[-1])

You'll want your logic to be smarter to handle multiple summits of the same size but hopefully that helps to get started.

ADD COMMENTlink written 7.9 years ago by Brad Chapman9.4k

Looks interesting! Shame its in python though as i am a Perl'ist :)

ADD REPLYlink written 7.9 years ago by Ian5.3k

You probably want Lincoln's Bio-BigFile then: http://search.cpan.org/~lds/Bio-BigFile-1.06/lib/Bio/DB/BigWig.pm

ADD REPLYlink written 7.9 years ago by Brad Chapman9.4k
3
gravatar for Pierre Lindenbaum
7.9 years ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum118k wrote:

convert your wig file to bigwig using wig2bigwig and use bigWigSummary to extract the information in a given region.

   bigWigSummary file.bigWig chrom start end dataPoints

Get summary data from bigWig for indicated region, broken into
dataPoints equal parts.  (Use dataPoints=1 for simple summary.)

options:
   -type=X where X is one of:
         mean - average value in region (default)
         min - minimum value in region
         max - maximum value in region
         std - standard deviation in region
         coverage - % of region that is covered
ADD COMMENTlink written 7.9 years ago by Pierre Lindenbaum118k

Thanks. I was aware of this, but it only returns the value, not the coordinate.

ADD REPLYlink written 7.9 years ago by Ian5.3k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2354 users visited in the last hour