Permalink
Browse files

can now handle phylip files with leading blank lines, which evolver p…

…roduces
  • Loading branch information...
DaveMessina committed May 27, 2010
1 parent 95025c0 commit b8ae20c06893472a271ded246506fcdeb5272d29
Showing with 13 additions and 2 deletions.
  1. +13 −2 Bio/AlignIO/phylip.pm
View
@@ -176,8 +176,18 @@ sub next_aln {
@names,$seqname,$start,$end,$count,$seq);
my $aln = Bio::SimpleAlign->new(-source => 'phylip');
$entry = $self->_readline and
($seqcount, $residuecount) = $entry =~ /\s*(\d+)\s+(\d+)/;
# skip blank lines until we see header line
# if we see a non-blank line that isn't the seqcount and residuecount line
# then bail out of next_aln (return)
HEADER: while ($entry = $self->_readline) {
next if $entry =~ /^\s?$/;
if ($entry =~ /\s*(\d+)\s+(\d+)/) {
($seqcount, $residuecount) = ($1, $2);
}
last HEADER;
}
return unless $seqcount and $residuecount;
# first alignment section
@@ -188,6 +198,7 @@ sub next_aln {
while( $entry = $self->_readline) {
last if( $entry =~ /^\s?$/ && $interleaved );
# we've hit the next entry.
if( $entry =~ /^\s+(\d+)\s+(\d+)\s*$/) {
$self->_pushback($entry);
last;

0 comments on commit b8ae20c

Please sign in to comment.