import pprint

from Bio.Sequencing import Phd

fn = '/home/sb/bt/biopython-1.50/Tests/Phd/phd1'
fh = open(fn)
rp = Phd.RecordParser()
# Create an iterator
it = Phd.Iterator(fh,rp)
for r in it:
    # All the comments are in a dictionary
    pprint.pprint(r.comments)
    # Sequence information
    print('Sequence: %s' % r.seq)
    # Quality information for each base
    print('Quality: %s' % r.sites)
fh.close()

This code is part of the book "Python for Bioinformatics", by Sebastian Bassi (sbassi@genesdigitales.com). Return to home page.