Question: Extend The Coordinates Entries Within A Bed File
2
gravatar for alon.goren
6.3 years ago by
alon.goren20
United States
alon.goren20 wrote:

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.

genome bed • 3.8k views
ADD COMMENTlink modified 6.3 years ago by Alex Reynolds27k • written 6.3 years ago by alon.goren20
9
gravatar for Istvan Albert
6.3 years ago by
Istvan Albert ♦♦ 79k
University Park, USA
Istvan Albert ♦♦ 79k wrote:

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 COMMENTlink written 6.3 years ago by Istvan Albert ♦♦ 79k
4
gravatar for Alex Reynolds
6.3 years ago by
Alex Reynolds27k
Seattle, WA USA
Alex Reynolds27k wrote:

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 COMMENTlink modified 6.3 years ago • written 6.3 years ago by Alex Reynolds27k
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: 2199 users visited in the last hour