How to extend bed intervals to a uniform size?
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
• 4,981 views
•
link
2 answers
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")
• 0 views
•
link
You could also check very good one-liner solution provided in this message Grow/shrink ranges in bed file to a specified length
• 0 views
•
link
Log in to answer this question.
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.