[Bioperl-l] Bio::DB::Fasta

Michael R Olson olsonmr at stolaf.edu
Thu Jun 26 23:00:17 EDT 2003

A couple days ago someone gave me the advice to use Bio::DB::Fasta to
locate pieces of a large sequence database.  I finally got around to
trying it and I have a frustrating problem.

I want to use the stream-based input, ie

my $seq = $db->next_seq()

because I don't know the sequence ids and can't use get_Seq_by_id(). 
So, I said:

$db = new Bio::DB::Fasta($filename);

$db->next_seq() doesn't work, because that method, although part of the
same file, is part of a different class, Bio::DB::Fasta::Stream, so I

$db = new Bio::DB::Fasta::Stream($filename);

and I get this error:

Can't call method "FIRSTKEY" without a package or object reference at
/usr/local/bio/www/cgi-bin/BPPNew/Bio/DB/Fasta.pm line 1049.

so I thought, "maybe the argument to the Bio::DB::Fasta::Stream
constructor is a Bio::DB::Fasta object!  However, that gives this error

------------- EXCEPTION  -------------
MSG: Bio::DB::Fasta=HASH(0x8b3d690): Invalid file or dirname
STACK Bio::DB::Fasta::new

As though whatever method line 472 is part of expected me to pass in a
filename, but the constructor expected an object.  Am I doing something
wrong, is this a bug, or perhaps there's another way for me to do it. 
Because when I said I don't have the ids, that's not entirely true.  I
have them, but with any punctuation stripped out.  Does get_Seq_by_id
have any kind of way to get a sequence whose id matches a certain
regular expression or something like that?

More information about the Bioperl-l mailing list