biopython v1.71.0 Bio.SeqIO.FastaIO.FastaWriter
Class to write Fasta format files.
Link to this section Summary
Link to this section Functions
Link to this function __init__()
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 record.id and record.description is used. If the record.description starts with the record.id, then just the record.description is used.
You can either use::
handle = open(filename, "w") writer = FastaWriter(handle) writer.write_file(myRecords) handle.close()
Or, follow the sequential file writer system, for example::
handle = open(filename, "w") writer = FastaWriter(handle) writer.write_header() ... Multiple writer.write_record() and/or writer.write_records() calls ... writer.write_footer() handle.close()
Link to this function write_record()
Write a single Fasta record to the file.