[Bioperl-l] Re: BPbl2seq.pm

Charles Tilford charles.tilford@bms.com
Fri, 29 Mar 2002 09:02:02 -0500


Juerg,

I have not used the blast parser in BioPerl. However, you can probably
get around your problem by wrapping the call in an eval statement:

#----------------------------------------
my $factory = Bio::Tools::Run::StandAloneBlast->new( @paramArray );
my $report = undef;
eval {
  $report = $factory->bl2seq($querySeq, $subjectSeq );
};

unless ($report) {
  # notify user of empty report here then carry on
}
# alternatively:
if ($@) {
  warn "Error message '$@' thrown in eval\n"; # ... and then carry on
}
#----------------------------------------

Don't forget the semicolon at the end of the eval, I forget it about
50% of the time I use eval and it causes odd program faults...

-Charles

> > >
> > > I wonder whether I can ask you a question about BioPerl. Please, don't
> > > spend time if you don't want to be bothered.
> > >
> > > I am doing something like this as part of a loop:
> > >
> > > my $factory = Bio::Tools::Run::StandAloneBlast->new( @paramArray );
> > > my $report = $factory->bl2seq($querySeq, $subjectSeq );
> > >
> > > If bl2seq can't generate an alignment the report is empty and bl2seq throws
> > > an error and stops the program.
> > >
> > > I don't want to stop the program, but just print a message and continue
> > > with the next query alignment.
> > >
> > > How do I do that?
> > >
> > > Kind regards and thank you,
> > > Juerg

-- 
Charles Tilford, Bioinformatics-Applied Genomics
Bristol-Myers Squibb PRI, Hopewell 3A039
P.O. Box 5400, Princeton, NJ 08543-5400, (609) 818-3213
charles.tilford@bms.com