[Bioperl-l] skip "exception"

Qunfeng qfdong at iastate.edu
Sun Sep 26 16:26:35 EDT 2004


In my case, if I simply want to ignore the exception and proceed with the 
next seq object in my input file, the following code seems to be working 
for me:

----------------------------------------------------------------------------------------------------------------
         eval{
                 $seq_object = $seqio_object->next_seq;
         };
         if($@){
                 print STDERR "EXCEPTION FOUND; SKIP THIS OBJECT\n";
                 next;
         }
---------------------------------------------------------------------------------------------------------------

However, it might be nice if I can still work on the bad object and parse 
out the good part out of it.

Qunfeng

At 01:18 PM 9/26/2004 -0400, Stefan Kirov wrote:
>Sometimes it is not reasonable to continue after an error, but Qunfeng has 
>a point. Maybe we can add to at least some parsers an option like 
>-ignore=>{number of allowed exceptions}, warn if the parser generates less 
>errors than tne number requested by the user, die if the number becomes 
>greater.
>Any thoughts on this?
>Stefan
>
>Qunfeng wrote:
>
>>Hi,
>>
>>When I try to use Bioperl to parse genbank sequence file downloaded from 
>>NCBI, I am getting the following "exception" with sequence (acc# 
>>AJ635582). It seems to be the format problem in this genbank file.
>>
>>My question is: is there any way in bioperl for users to test if there is 
>>any format problem in the sequence object and then decide by the users if 
>>they want to throw an exception or simply skips to the next object? Thanks!
>>
>>Qunfeng
>>
>>-------------------- WARNING ---------------------
>>MSG: exception while parsing location line [1163^1163] in reading 
>>EMBL/GenBank/SwissProt, ignoring feature variation (seqid=AJ6355
>>82):
>>------------- EXCEPTION  -------------
>>MSG: Only adjacent residues when location type is IN-BETWEEN. Not [1163] 
>>and [1163]
>>STACK Bio::Location::Simple::location_type 
>>/usr/lib/perl5/site_perl/5.8.0/Bio/Location/Simple.pm:280
>>STACK Bio::Location::Simple::new 
>>/usr/lib/perl5/site_perl/5.8.0/Bio/Location/Simple.pm:95
>>STACK Bio::Factory::FTLocationFactory::_parse_location 
>>/usr/lib/perl5/site_perl/5.8.0/Bio/Factory/FTLocationFactory.pm:218
>>STACK Bio::Factory::FTLocationFactory::from_string 
>>/usr/lib/perl5/site_perl/5.8.0/Bio/Factory/FTLocationFactory.pm:157
>>STACK (eval) /usr/lib/perl5/site_perl/5.8.0/Bio/SeqIO/FTHelper.pm:124
>>STACK Bio::SeqIO::FTHelper::_generic_seqfeature 
>>/usr/lib/perl5/site_perl/5.8.0/Bio/SeqIO/FTHelper.pm:123
>>STACK Bio::SeqIO::genbank::next_seq 
>>/usr/lib/perl5/site_perl/5.8.0/Bio/SeqIO/genbank.pm:501
>>
>>_______________________________________________
>>Bioperl-l mailing list
>>Bioperl-l at portal.open-bio.org
>>http://portal.open-bio.org/mailman/listinfo/bioperl-l
>
>
>--
>Stefan Kirov, Ph.D.
>University of Tennessee/Oak Ridge National Laboratory
>1060 Commerce Park, Oak Ridge
>TN 37830-8026
>USA
>tel +865 576 5120
>fax +865 241 1965
>e-mail: skirov at utk.edu
>sao at ornl.gov




More information about the Bioperl-l mailing list