code: def ids(args):
      
      p = OptionParser(ids.__doc__)
      p.add_option("--prefix", type="int",
                   help="Find rep id for prefix of len [default: %default]")
      opts, args = p.parse_args(args)
  
      if len(args) != 1:
          sys.exit(not p.print_help())
  
      clstrfile, = args
      cf = ClstrFile(clstrfile)
      prefix = opts.prefix
      if prefix:
          reads = list(cf.iter_reps_prefix(prefix=prefix))
      else:
          reads = list(cf.iter_reps())
  
      nreads = len(reads)
      idsfile = clstrfile.replace(".clstr", ".ids")
      fw = open(idsfile, "w")
      for i, name in reads:
          print("\t".join(str(x) for x in (i, name)), file=fw)
  
      logging.debug("A total of {0} unique reads written to `{1}`.".\
              format(nreads, idsfile))
      fw.close()
  
      return idsfile
docs: %prog ids cdhit.clstr
  
      Get the representative ids from clstr file.