The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Bio::SeqIO::fasta - fasta sequence input/output stream


Do not use this module directly. Use it via the Bio::SeqIO class.


This object can transform Bio::Seq objects to and from fasta flat file databases.


Mailing Lists

User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to one of the Bioperl mailing lists. Your participation is much appreciated.                  - General discussion  - About the mailing lists


Please direct usage questions or support issues to the mailing list:

rather than to the module maintainer directly. Many experienced and reponsive 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.

Reporting Bugs

Report bugs to the Bioperl bug tracking system to help us keep track the bugs and their resolution. Bug reports can be submitted via the web:

AUTHORS - Ewan Birney & Lincoln Stein



Jason Stajich,


The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _


 Title   : next_seq
 Usage   : $seq = $stream->next_seq()
 Function: returns the next sequence in the stream
 Returns : Bio::Seq object, or nothing if no more available
 Args    : NONE


 Title   : next_seq_fast
 Usage   : $seq = $stream->next_seq_fast()
 Function: returns the next sequence in the stream
           Favors speed over perfection.
 Returns : Bio::Seq object, or nothing if no more available
 Args    : NONE


 Title   : write_seq
 Usage   : $stream->write_seq(@seq)
 Function: Writes the $seq object into the stream
 Returns : 1 for success and 0 for error
 Args    : Array of 1 or more Bio::PrimarySeqI objects


 Title   : width
 Usage   : $obj->width($newval)
 Function: Get/Set the line width for FASTA output (not counting whitespace).
 Returns : value of width
 Args    : newvalue (optional)


 Title   : block
 Usage   : $obj->block($newval)
 Function: Get/Set the length of each block for FASTA output. Sequence blocks
           will be split with a space. Configuring block, to a value of 10 for
           example, allows one to easily identify a position in a sequence by eye.
 Default : same value used for width.
 Returns : value of block
 Args    : newvalue (optional)


 Title   : preferred_id_type
 Usage   : $obj->preferred_id_type('accession')
 Function: Get/Set the preferred type of identifier to use in the ">ID" position
           for FASTA output.
 Returns : string, one of values defined in @Bio::SeqIO::fasta::SEQ_ID_TYPES.
 Default : display
 Args    : string when setting. This must be one of values defined in
           @Bio::SeqIO::fasta::SEQ_ID_TYPES. Allowable values:
           accession, accession.version, display, primary
 Throws  : fatal exception if the supplied id type is not in @SEQ_ID_TYPES.