[Bioperl-l] Bioperl DB RefSeq

Chris Fields cjfields at uiuc.edu
Fri Oct 19 04:47:12 UTC 2007


Use an eval {} block, described here:

http://www.bioperl.org/wiki/HOWTO:SeqIO#Error_Handling

my $seq;
eval {
   $seq =  $seq = $seq_refseq->get_Seq_by_id("$acc");
};

print "ID does not exist!\n" if $@;

chris

On Oct 18, 2007, at 10:11 PM, Steven Mei wrote:

> Hi,
>
> I have a list of refseq accession  numbers and  wish  to get  their  
> sequences. I used Bio::DB:: RefSeq module
>
> However, if the $acc is bad (such as deleted accession), an  
> exception  would  printed out  and the script stops execution.
>
>
> ---------------EXCEPTION-------------------
> MSG: id does not exist
> ...
> ----------------------------------------------------
>
> my $seq = $seq_refseq->get_Seq_by_id("$acc");
>
>
> What I wish to happen is the script would handle the next accession  
> (bypass the bad accession) and continue until all the accessions  
> have been processed.
>
> Anyone have idea how to handle this issue? Thanks
>
> -- Mike




More information about the Bioperl-l mailing list