[Bioperl-l] SeqIO STDOUT changed?
Chris Fields
cjfields at illinois.edu
Mon Apr 11 22:12:07 EDT 2011
Jason,
That would be unintentional. I'm wondering (from a consistency standpoint) whether we should be doing this check within Bio::SeqIO or in Bio::Root::IO, though; the latter would at least be consistent between all the various *IO implementations, just not sure how easy it would be to implement.
chris
On Apr 11, 2011, at 8:15 PM, Jason Stajich wrote:
> 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
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
More information about the Bioperl-l
mailing list