[Bioperl-l] Should be simple accession number script, but it's not.

Agrin, Nathan Nathan.Agrin@umassmed.edu
Fri, 13 Dec 2002 15:23:41 -0500

I'm writing a simple script:
1) I want it to take a list of accession numbers in a .txt file,
2) pull out the entries from GenBank,
3) and output the names and sequences to a new .txt file.

The problem is that when I write something like;

$seq = $db->get_Seq_by_acc($accession);
print $seq->seq();

I get an error saying cannot preform command on an undefined variable.
Anyone had similar problems?  What's really wierd is that it seems to work some of the time.  Below is the code so far:


use Bio::DB::GenBank;

open SEQ, "<accession.txt";
@anum = "<SEQ>";

my $db = new Bio::DB::GenBank;

foreach my $accession ( @anum ) {
	# just get things by accession number
	my $seq = $db->get_Seq_by_acc($accession);
	print $seq->seq();