[Bioperl-l] Bio::DB::GenBank get_Seq_by_acc($acc);
Mick Watson
michaelwatson@paradigm-therapeutics.co.uk
Fri, 19 Apr 2002 09:30:19 +0100
Hi Liisa
The reason you get the error is that you probably have some code like this
print $seq->desc, "\n";
However, $seq is undefined because get_Seq_by_acc is not returning a valid
$seq object. The reason for this, I fear, is that you example accession
does not exist in either GenBank or EMBL:
http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=nucleotide&cmd=search&term=AAH06375
(check out http://www.ebi.ac.uk/cgi-bin/emblfetch)
If you are not sure if your accessions are valid accession numbers or not,
then put in something like:
my $seq = $db->get_Seq_by_acc($acc);
if (defined $seq) {
#some code
}
else {
print STDERR "Not a valid accession\n";
}
Thanks
Mick
Liisa Koski wrote:
> Hi,
> I'm trying to get sequences by accession numbers using
>
> Bio::DB::GenBank
> my $seq = $db->get_Seq_by_acc($acc);
>
> This works fine for Accession numbers that begin with NP_ but when when
> I'm using an accession number like AAH06375 I get the following error:
>
> Can't call method "desc" on an undefined value at ...
>
> Any ideas?
>
> Cheers,
> Liisa
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l