Question: Generating a bedgraph from a scored bed file
2
gravatar for Matt Corley
3.9 years ago by
Matt Corley40
United States
Matt Corley40 wrote:

Bedtools has a function, genomecov, that will output a bedgraph from a BAM file:

I have a slightly different use case, where I'd like to generate a bedgraph file from a scored bed file.  That is, instead of each interval representing a count of '1', each interval can represent an arbitrary count.  In the case of overlapping intervals, I'd like to report the mean in the bedgraph output.  Graphically:

Does anybody know a way to accomplish this using bedtools?  I'll also accept non-bedtools solutions, provided they can be implemented in Python (e.g., other tools with a Python API or fully implemented in Python).

ADD COMMENTlink modified 3.9 years ago by Alex Reynolds27k • written 3.9 years ago by Matt Corley40
1
gravatar for Matt Shirley
3.9 years ago by
Matt Shirley8.8k
Cambridge, MA
Matt Shirley8.8k wrote:

I think what you want to do can be accomplished using bedtools map: http://bedtools.readthedocs.org/en/latest/content/tools/map.html

 

ADD COMMENTlink written 3.9 years ago by Matt Shirley8.8k
1
gravatar for Devon Ryan
3.9 years ago by
Devon Ryan88k
Freiburg, Germany
Devon Ryan88k wrote:

You could either use bedops --partition followed by bedtools map, or simply use bedtools unionbedg and post-process its output. If you're using pybedtools, the latter option is probably easiest. There may also be a way to do all of this with bedops.

ADD COMMENTlink written 3.9 years ago by Devon Ryan88k
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: 796 users visited in the last hour