Question: How to extend bed intervals to a uniform size?
0
gravatar for bsb4390
20 months ago by
bsb43900
bsb43900 wrote:

Is there a method similar to bedtools slop that allows extension of bed intervals to a set size?
My bed intervals are all different lengths and while I know slop can extend each by a set size, is there a method that can extend all to a uniform length?

Thanks

genome bed bedtools • 1.1k views
ADD COMMENTlink modified 10 months ago by Biostar ♦♦ 20 • written 20 months ago by bsb43900

I'm not aware of a tool to do this (but it's very well possible this exists).
If you know a bit of scripting this job is quite trivial (I can help with Python or R).

The only thing you have to decide is in which direction you want to extend the intervals.

ADD REPLYlink written 20 months ago by WouterDeCoster37k
2
gravatar for James Ashmore
20 months ago by
James Ashmore2.6k
UK/Edinburgh/MRC Centre for Regenerative Medicine
James Ashmore2.6k wrote:

Read your file into R using the rtracklayer package and use the GenomicRanges package to resize your ranges to a fixed width:

library("rtracklayer")
userRanges <- import.bed("userFile.bed")

library("GenomicRanges")
resizeRanges <- resize(userRanges, width = 250)

export.bed(resizeRanges, "resizeFile.bed")
ADD COMMENTlink written 20 months ago by James Ashmore2.6k
1
gravatar for boczniak767
20 months ago by
boczniak767630
Poland
boczniak767630 wrote:

You could also check very good one-liner solution provided in this message Grow/shrink ranges in bed file to a specified length

ADD COMMENTlink written 20 months ago by boczniak767630
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: 2517 users visited in the last hour