6.3 years ago by
Seattle, WA USA
bedops tool in the BEDOPS suite does this, as well, with the use of the
--range operator, specifying
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.