code: def numDomtblout(domtblout, numHits, evalueT, bitT, sort):
      
      if sort is True:
          for hit in numDomtblout_sort(domtblout, numHits, evalueT, bitT):
              yield hit
          return
      header = ['#target name', 'target accession', 'tlen',
                'query name', 'query accession', 'qlen',
                'full E-value', 'full score', 'full bias',
                'domain #', '# domains',
                'domain c-Evalue', 'domain i-Evalue', 'domain score', 'domain bias',
                'hmm from', 'hmm to', 'seq from', 'seq to', 'env from', 'env to',
                'acc', 'target description']
      yield header
      prev, hits = None, []
      for line in domtblout:
          if line.startswith('#'):
              continue
          # parse line and get description
          line = line.strip().split()
          desc = ' '.join(line[18:])
          line = line[0:18]
          line.append(desc)
          # create ID based on query name and domain number
          ID = line[0] + line[9]
          # domain c-Evalue and domain score thresholds
          line[11], line[13] = float(line[11]), float(line[13])
          evalue, bitscore = line[11], line[13]
          line[11], line[13] = evalue, bitscore
          if ID != prev:
              if len(hits) > 0:
                  for hit in top_hits(hits, numHits, 13, True):
                      yield hit
              hits = []
          if evalueT == False and bitT == False:
              hits.append(line)
          elif evalue <= evalueT and bitT == False:
              hits.append(line)
          elif evalue <= evalueT and bit >= bitT:
              hits.append(line)
          elif evalueT == False and bit >= bitT:
              hits.append(line)
          prev = ID
      for hit in top_hits(hits, numHits, 13, True):
          yield hit
docs: parse hmm domain table output
      this version is faster but does not work unless the table is sorted