[Bioperl-l] BioPerl and undefined value

Roy Chaudhuri roy.chaudhuri at gmail.com
Tue Jun 14 10:26:01 UTC 2011


I don't think that will work - as I understand it the problem is that 
$ID is not found in Genbank, not that it has an undefined value.

Flora, maybe you could try wrapping the get_sequence call in an eval 
block, something like:

for my $ID (@ID) {
   my $seq;
   eval {$seq=get_sequence('genbank',$ID)}
   next if $@;
   #do stuff with $seq here
}

Hope this helps,
Roy.

On 14/06/2011 02:33, Scott Cain wrote:
> next unless $ID;
>
>
> On Mon, Jun 13, 2011 at 5:40 PM, Flora Fan<fanx0038 at umn.edu>  wrote:
>> Hi,
>> I am trying to retrieve UTR for a list of RefSeq IDs using get_sequence.
>> However, because some of my identifiers were removed from the most current
>> DB, BioPerl stopped when it first encounters an undefined ID , and gave the
>> following error message:
>> ------------- EXCEPTION  -------------
>> MSG: acc does not exist
>> STACK Bio::DB::WebDBSeqI::get_Seq_by_acc
>> /project/ccbioinf/Software/Ensembl/ensembl_55/bioperl-live/Bio/DB/WebDBSeqI.
>> pm:177
>> STACK Bio::DB::GenBank::get_Seq_by_acc
>> /project/ccbioinf/Software/Ensembl/ensembl_55/bioperl-live/Bio/DB/GenBank.pm
>> :216
>> STACK Bio::Perl::get_sequence
>> /project/ccbioinf/Software/Ensembl/ensembl_55/bioperl-live/Bio/Perl.pm:510
>> STACK main::BEGIN test_retrieve_UTR.pl:11
>> STACK (eval) test_retrieve_UTR.pl:11
>> STACK toplevel test_retrieve_UTR.pl:11
>>
>> Does anybody know how to let the script move on to the next ID, and skip
>> those undefined values? Œif (defined get_sequence('Genbank',$ID)) {}¹
>> doesn¹t work....
>>
>> Thank you very much.
>> -Flora
>>
>> --
>> Flora Danhua Fan, Ph.D
>> Biostatistics and Bioinformatics
>> Masonic Cancer Center, University of Minnesota
>> 425 Delaware St SE MMC 806, Minneapolis, MN 55455
>> Office: 2-152 Moos Tower
>> Phone: 612-625-3648
>> http://www.cancer.umn.edu/research/cores/biostats/bioinformatics.html
>>
>>
>>
>>
>> _______________________________________________
>> Bioperl-l mailing list
>> Bioperl-l at lists.open-bio.org
>> http://lists.open-bio.org/mailman/listinfo/bioperl-l
>>
>
>
>




More information about the Bioperl-l mailing list