[Bioperl-l] problem with Bio::Seq objects

Jason Stajich jason@cgt.mc.duke.edu
Thu, 25 Jul 2002 00:20:21 -0400 (EDT)


This is due to the nature of getting a sequence through NCBI's web
interface.  It doesn't really guarantee anything and esp since you are in
.au, requests will get dropped (by that I mean it is far enough away that
you have a greater chance for network latency to cause NCBI to drop the
requestion not that they purposely drop .au requests ...;-).

You should test your $seq before calling $seq->seq()... i.e. my $seq =
$db->get_Seq_by_id('MUSIGHBA1'); if( defined $seq ) { }

I realize you're probably using the example script which doesn't do this -
so we should fix that -- although it is an example script meant to show
how to use the toolkit not necessarily a killer app!

You can also look at the Bio::DB::FileCache object which will cache
sequences locally that have been retrieved through Bioperl Seq DB Handle
(Those that implement the Bio::DB::SeqI in case you're wondering).

This means that as long as you get the sequence properly from NCBI at
least one time you can fetch from your cache w/o worrying about the
network.

-jason

On Thu, 25 Jul 2002, Dan Kortschak wrote:

> I have just started using BioPerl (and OO perl in general though have been
> using perl for a couple of years) and I find that I am unable to
> consistently call methods to Bio::Seq objects (see example from the dist's
> example directory below - the same problem occurs in my own scripts).
> The situation is that either the call doesn't work at all, or it works
> once and then fails the second time.
>
> Can anyone help or explain what is going on?
>
> BioPerl on my box is installed as the debian package from woody - though
> the following problem also occurs with the CPAN installation of BioPerl
> 1.0.2.
>
> thanks
> Dan Kortschak
>
> [/usr/share/doc/bioperl/examples:628]
> # perl -w getGenBank.pl
> >MUSIGHBA1 Mouse Ig active H-chain V-region from MOPC21, subgroup VH-II, mRNA.
> AGGCTCAATTTAGTTTTCCTTGTCCTTATTTTAAAAGGTGTCCAGTGTGATGTGCAGCTG
> GTGGAGTCTGGGGGAGGCTTAGTGCAGCCTGGAGGGTCCCGGAAACTCTCCTGTGCAGCC
> TCTGGATTCACTTTCAGTAGCTTTGGAATGCACTGGGTTCGTCAGGCTCCAGAGAAGGGG
> CTGGAGTGGGTCGCATACATTAGTAGTGGCAGTAGTACCCTCCACTATGCAGACACAGTG
> AAGGGCCGATTCACCATCTCAAGAGACAATCCCAAGAACACCCTGTTCCTGCAAATGACC
> AGTCTAAGGTCTGAGGACACGGCCATGTATTACTGTGCAAGATGGGGTAACTACCCTTAC
> TATGCTATGGACTACTGGGGTCAAGGAACCTCAGTCACCGTCTCCTCA
> Can't call method "seq" on an undefined value at /usr/share/perl5/Bio/SeqIO/fasta.pm line 166.
>
>
>

-- 
Jason Stajich
Duke University
jason at cgt.mc.duke.edu