[Bioperl-l] Bio::SeqIO::new possible wierdness

Brian Osborne brian_osborne at cognia.com
Wed Jan 28 11:31:17 EST 2004


Peter,

-format argument: if the sequence file doesn't correspond to the given
format, some parsers give an error (e.g. EMBL), while others do not
(GenBank), instead silently give wrong results.

This sounds much like Bug #1508, you might want to take a look:

http://bugzilla.bioperl.org/show_bug.cgi?id=1508


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 Peter van Heusden
Sent: Wednesday, January 28, 2004 10:01 AM
To: bioperl-l at bioperl.org
Subject: [Bioperl-l] Bio::SeqIO::new possible wierdness

My review of the Bio::SeqIO::new method shows the following behaviour:

Missing both -file and -fh arguments: falls back to using $ARGV[0] (the
first command line argument) as sequence filename. If this fails, gives
an exception about 'Unknown format'.
-file argument (without -fh argument):
· given, but file unreadable: throws exception
· undefined: reads $ARGV[0], as above.
-fh argument (without -file argument):
· given, but not a filehandle: gives exception
· given, but an invalid filehandle (not open): gives exception
· undefined: reads $ARGV[0], as above.
-format argument: if the sequence file doesn't correspond to the given
format, some parsers give an error (e.g. EMBL), while others do not
(GenBank), instead silently give wrong results.
-format argument without -file argument: Silently creates a SeqIO object
which writes to STDOUT.

I don't think that this $ARGV[0] shortcut should be in there - it causes
unnecessary potential confusion. Imagine a situation where -fh or -file
is specified (using a variable), but that variable somehow does not get
defined. In that case, the $ARGV[0] fallback behaviour would be used,
which might lead to a non-obvious error behaviour.

I'd like to propose that either -file or -fh should be specified,
otherwise an exception is thrown. While I'm about it, I'm thinking of
migrating the exceptions to the new 'typed exceptions' that BioPerl now
provides - is there any consensus on exception type names?

Peter
_______________________________________________
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