Permalink
Browse files

Slight SeqIO::guess code flow change

  • Loading branch information...
fangly committed Feb 19, 2014
1 parent f4ff43f commit b77eb5d10c0067edd6427d05e1fdbd12dddf01e9
Showing with 12 additions and 13 deletions.
  1. +12 −13 Bio/SeqIO.pm
View
@@ -390,20 +390,19 @@ sub new {
# $class->throw("No file, fh, or string argument provided"); # neither defined
}
- # Determine sequence format
- my $format = $param{'-format'};
- if (! $format) {
- # Guess from filename extension
- $format = $class->_guess_format( $param{-file} );
- }
+ # Determine or guess sequence format and variant
+ my $format = $params{'-format'};
if (! $format ) {
- # Guess from content
- if ($param{-file}) {
- $format = Bio::Tools::GuessSeqFormat->new(-file => $param{-file} )->guess;
- } elsif ($param{-fh}) {
- $format = Bio::Tools::GuessSeqFormat->new(-fh => $param{-fh} )->guess;
- } elsif ($param{-string}) {
- $format = Bio::Tools::GuessSeqFormat->new(-text => $param{-string})->guess;
+ if ($params{-file}) {
+ # Guess from filename extension, and then from file content
+ $format = $class->_guess_format( $params{-file} ) ||
+ Bio::Tools::GuessSeqFormat->new(-file => $params{-file} )->guess;
+ } elsif ($params{-fh}) {
+ # Guess from filehandle content
+ $format = Bio::Tools::GuessSeqFormat->new(-fh => $params{-fh} )->guess;
+ } elsif ($params{-string}) {
+ # Guess from string content
+ $format = Bio::Tools::GuessSeqFormat->new(-text => $params{-string})->guess;
}
}

0 comments on commit b77eb5d

Please sign in to comment.