[Bioperl-l] microbug in Bio::SeqIO::fasta::next_primary_seq
Karger, Amir
AKarger@CuraGen.com
Mon, 18 Jun 2001 14:43:11 -0400
Hi.
The following code is from Bio/SeqIO/fasta.pm (from bioperl 0.7.0):
-------------------
sub next_primary_seq {
my( $self, $as_next_seq ) = @_;
my $seq;
my $moltype;
local $/ = "\n>";
return unless my $entry = $self->_readline;
if ($entry eq '>') { # very first one
return unless $entry = $self->_readline;
}
my ($top,$sequence) = $entry =~ /^(.+?)\n([^>]*)/s
or $self->throw("Can't parse entry");
my ($id,$fulldesc) = $top =~ /^\s*(\S+)\s*(.*)/
or $self->throw("Can't parse fasta header");
$id =~ s/^>//;
--------------------
>From what I can tell, the very first entry will not be '>'. It will be the
entire first entry plus a '\n>'. Why? Because '>' doesn't match $/ = '\n>'.
So this condition will never be true.
It's a microbug because it doesn't actually change anything. The $id=~s/^>//
later on removes it. But I'm sure you'd appreciate the opportunity to remove
four lines from the bioperl source code :)
Amir Karger
Curagen Corporation