code: def uniq(args):
      
  
      p = OptionParser(uniq.__doc__)
      p.set_outfile()
      opts, args = p.parse_args(args)
  
      if len(args) != 2:
          sys.exit(not p.print_help())
  
      gffile, cdsfasta = args
      gff = Gff(gffile)
      sizes = Sizes(cdsfasta).mapping
      gene_register = {}
      for g in gff:
          if g.type != "mRNA":
              continue
          aed = float(g.attributes["_AED"][0])
          gene_register[g.parent] = (1 - aed) * sizes[g.accn]
  
      allgenes = import_feats(gffile)
      g = get_piles(allgenes)
  
      bestids = set()
      for group in g:
          ranges = [to_range(x, score=gene_register[x.accn], id=x.accn) \
                      for x in group]
          selected_chain, score = range_chain(ranges)
          bestids |= set(x.id for x in selected_chain)
  
      removed = set(x.accn for x in allgenes) - bestids
      fw = open("removed.ids", "w")
      print("\n".join(sorted(removed)), file=fw)
      fw.close()
      populate_children(opts.outfile, bestids, gffile, "gene")
docs: %prog uniq gffile cdsfasta
  
      Remove overlapping gene models. Similar to formats.gff.uniq(), overlapping
      'piles' are processed, one by one.
  
      Here, we use a different algorithm, that retains the best non-overlapping
      subset witin each pile, rather than single best model. Scoring function is
      also different, rather than based on score or span, we optimize for the
      subset that show the best combined score. Score is defined by:
  
      score = (1 - AED) * length