Mac binaries
[jabaws.git] / website / archive / binaries / mac / src / globplot / biopython-1.50 / Bio / writers / SeqRecord / fasta.py
1 """Part of an old unused and undocumented sequence writing framework (DEPRECATED)."""
2 from Bio import Writer
3
4 class WriteFasta(Writer.Writer):
5     def __init__(self, outfile, seqwidth = 72):
6         Writer.Writer.__init__(self, outfile)
7         assert seqwidth > 0, seqwidth
8         self.seqwidth = seqwidth
9         
10     def write(self, record):
11         self.outfile.write(">%s %s\n" % (record.id, record.description))
12         seq = record.seq
13         assert seq.alphabet.size == 1, "cannot handle alphabet of size %d" % \
14                seq.alphabet.size
15         seq = seq.data
16         seqwidth = self.seqwidth
17         for i in range(0, len(seq), seqwidth):
18             self.outfile.write(seq[i:i+seqwidth])
19             self.outfile.write("\n")
20
21 make_writer = WriteFasta