[Bioperl-l] SeqIO STDOUT changed?
Jason Stajich
jason at bioperl.org
Tue Apr 12 01:15:33 UTC 2011
I noticed I am now getting errors with this code:
my $out = Bio::SeqIO->new(-format => 'fasta');
that previously would have defaulted to STDOUT when write_seq was used.
This causes errors in existing scripts (e.g. bp_sreformat and others).
$ bp_sreformat.pl -if fasta -of genbank -i multifa.seq
Unknown sequence format to bioperl genbank:
------------- EXCEPTION: Bio::Root::Exception -------------
MSG: No file, fh, or string argument provided
STACK: Error::throw
STACK: Bio::Root::Root::throw /usr/local/lib/perl5/Bio/Root/Root.pm:472
STACK: Bio::SeqIO::new /usr/local/lib/perl5/Bio/SeqIO.pm:369
STACK: /usr/local/bin/bp_sreformat.pl:124
-----------------------------------------------------------
Was this an intentional API change or something else gone wrong? This
would be my proposed fix back --
core (master)]$ git diff
diff --git a/Bio/SeqIO.pm b/Bio/SeqIO.pm
index 83bab58..9b2ba02 100644
--- a/Bio/SeqIO.pm
+++ b/Bio/SeqIO.pm
@@ -363,11 +363,14 @@ sub new {
my %param = @args;
@param{ map { lc $_ } keys %param } = values %param; #
lowercase keys
- $class->throw("file argument provided, but with an undefined
value") if exists($param{'-file'});
- $class->throw("fh argument provided, but with an undefined
value") if (exists($param{'-fh'}));
- $class->throw("No file, fh, or string argument provided"); #
neither defined
- }
+ $class->throw("file argument provided, but with an
undefined value") if exists($param{'-file'});
+ $class->throw("fh argument provided, but with an
undefined value") if (exists($param{'-fh'}));
+ $class->throw("string argument provided, but with an
undefined value") if (exists($param{'-string'}));
+ # $class->throw("No file, fh, or string argument
provided"); # neither defined
+ }
my $format = $param{'-format'} ||
$class->_guess_format( $param{-file} || $ARGV[0] );
-jason
--
Jason Stajich
jason at bioperl.org
http://bioperl.org
More information about the Bioperl-l
mailing list