Question: How to extend bed intervals to a uniform size?
0
gravatar for bsb4390
2.1 years 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.3k views
ADD COMMENTlink modified 15 months ago by Biostar ♦♦ 20 • written 2.1 years 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 2.1 years ago by WouterDeCoster40k
2
gravatar for James Ashmore
2.1 years ago by
James Ashmore2.7k
UK/Edinburgh/MRC Centre for Regenerative Medicine
James Ashmore2.7k 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 2.1 years ago by James Ashmore2.7k
1
gravatar for boczniak767
2.1 years ago by
boczniak767640
Poland
boczniak767640 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 2.1 years ago by boczniak767640
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: 1507 users visited in the last hour