[Bioperl-l] How to check the validity of an accession number ?

Heikki Lehvaslaiho heikki at nildram.co.uk
Sat Nov 8 04:10:53 EST 2003


Damien,

The change is in the bioperl code. It was put in almost 11 months ago
for the 1.2 release. As the error message indicates, line 177 in
Bio::DB::WebDBSeqI now throws an error. You can catch it with eval
statement, e.g:

  eval {
      $seq = $stream -> get_Seq_by_acc($an);
  }
  if ($@) {
      print STDERR "Not a valid accession [$an]\n";
      next;
  }


The Web interface to the bioperl CVS repository can help you track 
whys, whens and hows of code changes:

http://cvs.bioperl.org/cgi-bin/viewcvs/viewcvs.cgi/bioperl-live/Bio/DB/WebDBSeqI.pm?cvsroot=bioperl

Yours,

-Heikki


On Sat, 2003-11-08 at 05:02, Damien Marsic wrote:
> Hello,
> 
> I hope someone will be able to help. I wrote a program that does the
> following:
> 
> - opens a file containing sequences named with their Genbank accession
> number if it exists (and an arbitrary name if the sequence is not in
> Genbank)
> 
> - reads each sequence name, looks in Genbank if it is an accession number,
> and if it is, retrieves the organism name and other information. If the name
> is not recognized as an accession number, the program says it and proposes
> to continue with the next sequences.
> 
> My programs worked perfectly during the last 2 years or so. But for the last
> few months it does not work anymore, although I did not make any change to
> it. What is happening now is that when there is a sequence name that is not
> an accession number, the program crashes.
> 
> The problem lies with this line:
> 
>    $seq = $stream -> get_Seq_by_acc($an);
> 
> When $an was an invalid accession number, $seq used to be "undefined" and
> the program could go on (the program checks whether &seq in defined or
> undefined and then goes to the appropriate step).
> 
> But now, when $an is an invalid accession number, the program just crashes
> with the following message:
> 
>  ------------- EXCEPTION  -------------
>  MSG: acc does not exist
>  STACK Bio::DB::WebDBSeqI::get_Seq_by_acc
>  /usr/lib/perl5/site_perl/5.6.1/Bio/DB/WebDBSeqI.pm:177
>  STACK Bio::DB::GenBank::get_Seq_by_acc
>  /usr/lib/perl5/site_perl/5.6.1/Bio/DB/GenBank.pm:216
>  STACK toplevel phylplus.pl:90
>  --------------------------------------
> 
> Can someone helps me understand what is happening ? Were there some changes
> at Genbank that could explain why my program behaves differently ? Is there
> anything I can do to make it behave like it did before ?
> 
> Is there any other way than "get_Seq_by_acc" to check if an accession number
> exists or not ?
> 
> Thanks in advance for the replies.
> 
> Damien
> 
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l



More information about the Bioperl-l mailing list