[Bioperl-l] SeqIO: Validate File-Format

Brian Osborne brian_osborne at cognia.com
Wed Sep 3 13:44:51 EDT 2003


Johnny,

You can put the code that might normally throw the fatal error into an
eval{} block, like this:

~>perl -e 'use Bio::SeqIO; $io = Bio::SeqIO->new(-file => "test.fa", -format
=>
"swiss" ); eval { $seq = $io->next_seq; }; print $@ if $@;'

In this situation there's no fatal error and the error message will be found
in $@.

Brian O.

-----Original Message-----
From: bioperl-l-bounces at portal.open-bio.org
[mailto:bioperl-l-bounces at portal.open-bio.org]On Behalf Of Johnny Amos
Sent: Wednesday, September 03, 2003 1:14 PM
To: bioperl-l at bioperl.org
Subject: [Bioperl-l] SeqIO: Validate File-Format

Hello,

I am using SeqIO as part of a web-application.  I want to verify that files
are input in FASTA format, but if they are not, I would like to catch the
error and present an error page.  SeqIO dies if given a bad file-format: is
there anyway to get it to warn with a return code, instead?  Or is there
another way I should be approaching this problem?

TIA,
Johnny

_________________________________________________________________
Get MSN 8 and enjoy automatic e-mail virus protection.
http://join.msn.com/?page=features/virus

_______________________________________________
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