Question: How to extract bigWig signal for a given bed file?
1
gravatar for Bioradical
20 months ago by
Bioradical50
United States
Bioradical50 wrote:

I'm looking for a program to extract signal values from a bigWig file for a given set of coordinates.

Python, R or command line is fine (my programming is rudimentary at best). Thank you!

bigwig • 1.5k views
ADD COMMENTlink modified 20 months ago by dariober9.2k • written 20 months ago by Bioradical50
4
gravatar for Devon Ryan
20 months ago by
Devon Ryan80k
Freiburg, Germany
Devon Ryan80k wrote:

In python:

import pyBigWig
bw = pyBigWig.open("some_file.bw")
for line in open("foo.bed"):
    cols = line.strip().split()
    vals = bw.values(cols[0], int(cols[1]), int(cols[2]))
    # Do something with the values...
bw.close()
ADD COMMENTlink written 20 months ago by Devon Ryan80k

Smooth as hell :) Great work Devon!

ADD REPLYlink written 20 months ago by John12k
1

Are you done with the thesis?

ADD REPLYlink modified 20 months ago • written 20 months ago by genomax49k
1

I was going to yell that just now when I saw him walk into a talk :)

ADD REPLYlink written 20 months ago by Devon Ryan80k
1

Looks like @John wants to stay a student .. forever.

Not smooth, @John :)

ADD REPLYlink modified 20 months ago • written 20 months ago by genomax49k

Hehehe, hasn't there been enough bioinformatician-abuse for one day? :P

For the record, my answer would have been "uhhh..."

ADD REPLYlink modified 20 months ago • written 20 months ago by John12k
1

You're a grad student, there's never enough grad student abuse :)

ADD REPLYlink written 20 months ago by Devon Ryan80k

cool library... does this also takes care about negative and positive strands from bed file?

ADD REPLYlink written 4 months ago by kashifalikhan00740

There's nothing special about the minus strand, it has the same values in a bigWig file.

ADD REPLYlink written 4 months ago by Devon Ryan80k

I think it will be helpful if one is plotting the nucleosome signal around TSS or TTS. As some genes has reverse orientation (negative strands in gff file), there data needs to be reversed accordingly before plotting. Correct me if I am wrong.

ADD REPLYlink written 3 months ago by kashifalikhan00740

Tools like computeMatrix in deepTools handle such things automatically (deepTools uses the pyBigWig library under the hood).

ADD REPLYlink written 3 months ago by Devon Ryan80k

Ohh... thanks I have used it, but completely forgotten.

ADD REPLYlink written 3 months ago by kashifalikhan00740
2
gravatar for dariober
20 months ago by
dariober9.2k
Glasgow - UK
dariober9.2k wrote:

Altrenatively, use bigWigToBedGraph from UCSC genome browser at http://hgdownload.soe.ucsc.edu/admin/exe/, just pick the compiled version that suites you. Usage:

bigWigToBedGraph - Convert from bigWig to bedGraph format.
usage:
   bigWigToBedGraph in.bigWig out.bedGraph
options:
   -chrom=chr1 - if set restrict output to given chromosome
   -start=N - if set, restrict output to only that over start
   -end=N - if set, restict output to only that under end
   -udcDir=/dir/to/cache - place to put cache for remote bigBed/bigWigs
ADD COMMENTlink written 20 months ago by dariober9.2k

In bedgraph format, the fourth column is == to the signal?

ADD REPLYlink written 20 months ago by Bioradical50

Yes, it's whatever signal is stored in the bigWig file.

ADD REPLYlink written 20 months ago by Devon Ryan80k
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: 851 users visited in the last hour