Bio::SeqIO is a handler module for the formats in the SeqIO set (eg,Bio::SeqIO::fasta). It is the officially sanctioned way of getting atthe format objects, which most people should use.The Bio::SeqIO system can be thought of like biological file handles.They are attached to filehandles with smart formatting rules (eg,genbank format, or EMBL format, or binary trace file format) andcan either read or write sequence objects (Bio::Seq objects, ormore correctly, Bio::SeqI implementing objects, of which Bio::Seq isone such object). If you want to know what to do with a Bio::Seqobject, read Bio::Seq.The idea is that you request a stream object for a particular format.All the stream objects have a notion of an internal file that is readfrom or written to. A particular SeqIO object instance is configuredfor either input or output. A specific example of a stream object isthe Bio::SeqIO::fasta object.Each stream object has functions

$stream->next_seq();

and

$stream->write_seq($seq);

As an added bonus, you can recover a filehandle that is tied to theSeqIO object, allowing you to use the standard <> and printoperations to read and write sequence objects:

Title : next_seq Usage : $seq = stream->next_seq Function: Reads the next sequence object from the stream and returns it.
Certain driver modules may encounter entries in the stream
that are either misformatted or that use syntax not yet
understood by the driver. If such an incident is
recoverable, e.g., by dismissing a feature of a feature
table or some other non-mandatory part of an entry, the
driver will issue a warning. In the case of a
non-recoverable situation an exception will be thrown. Do
not assume that you can resume parsing the same stream
after catching the exception. Note that you can always turn
recoverable errors into exceptions by calling
$stream->verbose(2).
Returns : a Bio::Seq sequence object, or nothing if no more sequences
are available
Args : none

Title : _concatenate_lines Usage : $s = _concatenate_lines($line, $continuation_line) Function: Private. Concatenates two strings assuming that the second stems from a continuation line of the first. Adds a space between both unless the first ends with a dash.
Takes care of either arg being empty.
Example :
Returns : A string.
Args :

Title : sequence_builder Usage : $seqio->sequence_builder($seqfactory) Function: Get/Set the Bio::Factory::ObjectBuilderI used to build sequence objects. This applies to rich sequence formats only, e.g. genbank but not fasta.
If you do not set the sequence object builder yourself, it
will in fact be an instance of Bio::Seq::SeqBuilder, and you may use all methods documented there to configure it.
Returns : a Bio::Factory::ObjectBuilderI compliant object
Args : [optional] a Bio::Factory::ObjectBuilderI compliant object

The new() class method constructs a new Bio::SeqIO object. Thereturned object can be used to retrieve or print Seq objects. new()accepts the following parameters:

-file

A file path to be opened for reading or writing. The usual Perlconventions apply:

'file' # open file for reading '>file' # open file for writing '>>file' # open file for appending '+<file' # open file read/write 'command |' # open a pipe from the command '| command' # open a pipe to the command

-fh

You may provide new() with a previously-opened filehandle. Forexample, to read from STDIN:

$seqIO = Bio::SeqIO->new(-fh => \*STDIN);

Note that you must pass filehandles as references to globs. If neither a filehandle nor a filename is specified, then the modulewill read from the @ARGV array or STDIN, using the familiar <>semantics. A string filehandle is handy if you want to modify the output in thememory, before printing it out. The following program reads in EMBLformatted entries from a file and prints them out in fasta format withsome HTML tags:

Specify the format of the file. Supported formats include fasta,genbank, embl, swiss (SwissProt), Entrez Gene and tracefile formatssuch as abi (ABI) and scf. There are many more, for a complete listingsee the SeqIO HOWTO (http://bioperl.open-bio.org/wiki/HOWTO:SeqIO). If no format is specified and a filename is given then the module willattempt to deduce the format from the filename suffix. If there is nosuffix that Bioperl understands then it will attempt to guess theformat based on file content. If this is unsuccessful then SeqIO will throw a fatal error. The format name is case-insensitive: 'FASTA', 'Fasta' and 'fasta' areall valid. Currently, the tracefile formats (except for SCF) require installationof the external Staden "io_lib" package, as well as theBio::SeqIO::staden::read package available from the bioperl-extrepository.

-alphabet

Sets the alphabet ('dna', 'rna', or 'protein'). When the alphabet isset then Bioperl will not attempt to guess what the alphabet is. Thismay be important because Bioperl does not always guess correctly.

-flush

By default, all files (or filehandles) opened for writing sequenceswill be flushed after each write_seq() (making the file immediatelyusable). If you do not need this facility and would like to marginallyimprove the efficiency of writing multiple sequences to the same file(or filehandle), pass the -flush option '0' or any other value thatevaluates as defined but false:

This constructor behaves like new(), but returns a tied filehandlerather than a Bio::SeqIO object. You can read sequences from thisobject using the familiar <> operator, and write to it usingprint(). The usual array and $_ semantics work. For example, you canread all sequence objects into an array like this:

@sequences = <$fh>;

Other operations, such as read(), sysread(), write(), close(), andprintf() are not supported.

User feedback is an integral part of the evolution of this and otherBioperl modules. Send your comments and suggestions preferably to oneof the Bioperl mailing lists.Your participation is much appreciated.

rather than to the module maintainer directly. Many experienced and responsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible.