Created
August 12, 2009 21:05
-
-
Save cjfields/166764 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my $gs = ${$self->symbols}{GAP}; | |
# map gaps prior and post start/end | |
my ($newst, $newend) = ($start, $end); | |
while ($rawseq =~ m{([$gs]+)}g) { | |
my $len = CORE::length($1); | |
my $current = pos($rawseq) - $len; | |
# optimization : bail if current gap is past the end | |
last if $current >= $newend; | |
$newst += $len if $current <= $newst; | |
$newend += $len if $current <= $newend; | |
} | |
$seqstr = substr($rawseq, $newst, $newend -$newst + 1); | |
$seqstr =~ s/[$gs]//g unless $gaps; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment