Extend The Coordinates Entries Within A Bed File
2
2
Entering edit mode
8.9 years ago
alon.goren ▴ 20

Hi,

I want to extend the coordinates entries within a bed file.

I tried using BedextendRanges, but it extends only on one end, and requires strand information.

Using awk is problematic, as it doesn't take into account the genome size...

Is there a tool for such?

Thanks!

Alon.

bed genome • 5.7k views
ADD COMMENT
9
Entering edit mode
8.9 years ago

You can use the slop utility in bedtools or the range option in the bedops suite:

 $ bedtools slop

Tool:    bedtools slop (aka slopBed)
Version: v2.16.2
Summary: Add requested base pairs of "slop" to each feature.

Usage:   bedtools slop [OPTIONS] -i <bed/gff/vcf> -g <genome> [-b <int> or (-l and -r)]

Options: 
    -bIncrease the BED/GFF/VCF entry -b base pairs in each direction.
        - (Integer) or (Float, e.g. 0.1) if used with -pct.

...
ADD COMMENT
4
Entering edit mode
8.9 years ago

The bedops tool in the BEDOPS suite does this, as well, with the use of the --range operator, specifying L and R as left and right shifts. You can specify negative values in either direction to "shrink" or shift elements (the latter useful for indexing changes). Zero-length elements, where found, are left out of results, and left padding will extend elements to the zero-th position:

bedops --range L:R --everything foo.bed > adjustedFoo.bed

One more option, perhaps. BEDOPS is deliberately agnostic about genomes, so this won't limit coordinates on the right bound, but that's easily addressed with awk and end boundary values specific to your genome and chromosomes.

ADD COMMENT

Login before adding your answer.

Traffic: 2453 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