code: def generate_coverage(seqinfo):
      
      for acc, protinfo in seqinfo.items():
          coverage_aa_indices = set()
          seq = protinfo['seq']
          for psmseq in protinfo['psms']:
              psmseq = tsvreader.strip_modifications(psmseq)
              # FIXME try block is for problems with coverage, see if it is
              # needed
              try:
                  start = seq.index(psmseq)
              except:
                  print('CANNOT FIND PSM seq {0} in seq {1} '
                        'for acc {2}'.format(psmseq, seq, acc))
              coverage_aa_indices.update(range(start, start + len(psmseq)))
          yield (acc, len(coverage_aa_indices) / len(seq))
docs: From a dict containing protein accessions and sequences/PSM sequences,
      this function returns a generator that calculates coverages for each
      protein and returns the accession and coverage percentage.
      Coverage is done by finding peptides in the protein seq using seq.index
      and marking the range. May be slow.