This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Get coverage per base from a bigwig file

Can we get base coverage at each position from a bigwig file using bx-python? How?

I have a bigwig file for ChIP-seq data, and I want to get coverage at each base position. I am currently using bx-python to extract data from .bw file.

Example:

Get base coverage from chr15: 60136205 to 60137200 at each position. Expected output (something like this):
60136205, coverage
60136206, coverage
60136207, coverage
60136208, coverage
.............
60137199, coverage

Here is what I did using bx-python:

import bx.bbi.bigwig_file

file1bw = bx.bbi.bigwig_file.BigWigFile(open("file1.bw", "rb"))

get_coverage = file1bw.get("chr15", 60136205, 60137200)

print get_coverage

It gives coverage only at a few positions. Please help me understand why this is.

[(60136207, 60136208, 2.0), (60136239, 60136240, 5.0), (60136271, 60136272, 5.0), (60136303, 60136304, 6.0), (60136335, 60136336, 5.0), (60136367, 60136368, 4.0), (60136399, 60136400, 2.0), (60136431, 60136432, 2.0), (60136463, 60136464, 4.0), (60136495, 60136496, 4.0), (60136527, 60136528, 5.0), (60136559, 60136560, 4.0), .......(60137167, 60137168, 6.0), (60137199, 60137200, 6.0)]

chip-seq

0 answers

No answers yet.

Log in to answer this question.