How to extend bed intervals to a uniform size?
2
0
Entering edit mode
7.3 years ago
bsb4390 • 0

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

bedtools bed genome • 4.1k views
ADD COMMENT
0
Entering edit mode

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 REPLY
4
Entering edit mode
7.3 years ago
James Ashmore ★ 3.5k

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 COMMENT
1
Entering edit mode
7.3 years ago
boczniak767 ▴ 870

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

ADD COMMENT

Login before adding your answer.

Traffic: 2877 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6