def PhdIterator(handle):
 phd_records = Phd.parse(handle)
 for phd_record in phd_records:
  name = phd_record.file_name.split(None, 1)[0]
  seq_record = SeqRecord(phd_record.seq, id=name, name=name, description=phd_record.file_name)
  seq_record.annotations = phd_record.comments
  seq_record.letter_annotations['phred_quality'] = [int(site[1]) for site in phd_record.sites]
  try:
   seq_record.letter_annotations['peak_location'] = [int(site[2]) for site in phd_record.sites]
  except IndexError:
   pass
  (yield seq_record)

def PhdIterator ( handle ) : phd_records = Phd . parse ( handle ) for phd_record in phd_records : name = phd_record . file_name . split ( None , 1 ) [ 0 ] seq_record = SeqRecord ( phd_record . seq , id = name , name = name , description = phd_record . file_name ) seq_record . annotations = phd_record . comments seq_record . letter_annotations [ 'phred_quality' ] = [ int ( site [ 1 ] ) for site in phd_record . sites ] try : seq_record . letter_annotations [ 'peak_location' ] = [ int ( site [ 2 ] ) for site in phd_record . sites ] except IndexError : pass ( yield seq_record )
returns seqrecord objects from a phd file .