Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

More POD clarifications

  • Loading branch information...
commit 91fc1d4e0a08d56b6ffd0551ba24e0b52036debe 1 parent a60ea78
@fangly fangly authored
Showing with 19 additions and 13 deletions.
  1. +19 −13 Bio/
32 Bio/
@@ -133,8 +133,13 @@ This makes the simplest ever reformatter
$seqIO = Bio::SeqIO->new(-format => $format);
The new() class method constructs a new Bio::SeqIO object. The
-returned object can be used to retrieve or print Seq objects. new()
-accepts the following parameters:
+returned object can be used to retrieve or print Seq objects.
+If neither a -file, a -fh, nor -string are specified, then the module will take
+the filename from the @ARGV array if possible. If not, it will read from STDIN,
+using the familiar E<lt>E<gt> semantics.
+new() accepts the following parameters:
=over 5
@@ -152,17 +157,11 @@ conventions apply:
=item -fh
-You may provide new() with a previously-opened filehandle. For
+You may use new() with a opened filehandle, provided as a glob reference. For
example, to read from STDIN:
my $seqIO = Bio::SeqIO->new(-fh => \*STDIN);
-Note that you must pass filehandles as references to globs.
-If neither a filehandle nor a filename nor a string is specified, then the module
-will read from the @ARGV array or STDIN, using the familiar E<lt>E<gt>
A string filehandle is handy if you want to modify the output in the
memory, before printing it out. The following program reads in EMBL
formatted entries from a file and prints them out in fasta format with
@@ -397,19 +396,26 @@ sub new {
# $class->throw("No file, fh, or string argument provided"); # neither defined
- my $format = $param{'-format'} ||
- $class->_guess_format( $param{-file} || $ARGV[0] );
+ # Determine sequence format
+ my $format = $param{'-format'};
+ if (! $format) {
+ # Guess from filename extension
+ $format = $class->_guess_format( $param{-file} || $ARGV[0] );
+ }
- if( ! $format ) {
+ if (! $format ) {
+ # Guess from content
if ($param{-file}) {
$format = Bio::Tools::GuessSeqFormat->new(-file => $param{-file}||$ARGV[0] )->guess;
} elsif ($param{-fh}) {
$format = Bio::Tools::GuessSeqFormat->new(-fh => $param{-fh}||$ARGV[0] )->guess;
# changed 1-3-11; no need to print out an empty string (only way this
# exception is triggered) - cjfields
- $class->throw("Could not guess format from file/fh") unless $format;
+ $class->throw("Could not guess format from file, filehandle or string")
+ if not $format;
$format = "\L$format"; # normalize capitalization to lower case
if ($format =~ /-/) {

0 comments on commit 91fc1d4

Please sign in to comment.
Something went wrong with that request. Please try again.