#!/usr/bin/env perl use strict; use warnings; if(@ARGV < 1) { die "perl $0 bed.file addlen\n"; } my($line) = ""; my(@cols) = (); my($outfile) = ""; my($file) = ""; my($len_diff) = 0; my($counter) = 0; my($shift) = 0; my($len) = $ARGV[1]; if(exists($ARGV[0])) { $file = $ARGV[0]; } else { die "$ARGV[0] not found\n"; } open(IN, $file) or die "$file not found\n"; while($line = ) { $line =~ s/^\s+|\s+$//g; @cols = split(/\t/, $line); $shift = $ARGV[1] - ($cols[2] - $cols[1]); if($cols[5] eq "+") { $cols[2] += $ARGV[1]; } else { $cols[1] -= $ARGV[1]; } $line = join("\t", @cols); print "$line\n"; } close IN;