biopython v1.71.0 Bio.SeqIO.FastaIO.FastaWriter

Class to write Fasta format files.

Link to this section Summary


Create a Fasta writer

Write a single Fasta record to the file

Link to this section Functions

Create a Fasta writer.


  • handle - Handle to an output file, e.g. as returned by open(filename, “w”)
  • wrap - Optional line length used to wrap sequence lines. Defaults to wrapping the sequence at 60 characters Use zero (or None) for no wrapping, giving a single long line for the sequence.
  • record2title - Optional function to return the text to be used for the title line of each record. By default a combination of the and record.description is used. If the record.description starts with the, then just the record.description is used.

You can either use::

handle = open(filename, "w")
writer = FastaWriter(handle)

Or, follow the sequential file writer system, for example::

handle = open(filename, "w")
writer = FastaWriter(handle)
Multiple writer.write_record() and/or writer.write_records() calls

Write a single Fasta record to the file.