def FastaIterator(handle, alphabet=single_letter_alphabet, title2ids=None):
 if title2ids:
  for (title, sequence) in SimpleFastaParser(handle):
   (id, name, descr) = title2ids(title)
   (yield SeqRecord(Seq(sequence, alphabet), id=id, name=name, description=descr))
 else:
  for (title, sequence) in SimpleFastaParser(handle):
   try:
    first_word = title.split(None, 1)[0]
   except IndexError:
    assert (not title), repr(title)
    first_word = ''
   (yield SeqRecord(Seq(sequence, alphabet), id=first_word, name=first_word, description=title))

def FastaIterator ( handle , alphabet = single_letter_alphabet , title2ids = None ) : if title2ids : for ( title , sequence ) in SimpleFastaParser ( handle ) : ( id , name , descr ) = title2ids ( title ) ( yield SeqRecord ( Seq ( sequence , alphabet ) , id = id , name = name , description = descr ) ) else : for ( title , sequence ) in SimpleFastaParser ( handle ) : try : first_word = title . split ( None , 1 ) [ 0 ] except IndexError : assert ( not title ) , repr ( title ) first_word = '' ( yield SeqRecord ( Seq ( sequence , alphabet ) , id = first_word , name = first_word , description = title ) )
generator function to iterate over fasta records .