code: def mcluster(args):
      
      p = OptionParser(mcluster.__doc__)
      add_consensus_options(p)
      p.set_cpus()
      opts, args = p.parse_args(args)
  
      if len(args) < 1:
          sys.exit(not p.print_help())
  
      consensusfiles = args
      minlength = opts.minlength
      cpus = opts.cpus
      pf = opts.prefix
      pctid = find_pctid(consensusfiles)
  
      pf += ".P{0}".format(pctid)
      consensusfile = pf + ".consensus.fasta"
      if need_update(consensusfiles, consensusfile):
          fw_cons = must_open(consensusfile, "w")
          totalseqs = 0
          for cf in consensusfiles:
              nseqs = 0
              s = op.basename(cf).split(".")[0]
              for name, seq in parse_fasta(cf):
                  name = '.'.join((s, name))
                  print(">{0}\n{1}".format(name, seq), file=fw_cons)
                  nseqs += 1
              logging.debug("Read `{0}`: {1} seqs".format(cf, nseqs))
              totalseqs += nseqs
          logging.debug("Total: {0} seqs".format(totalseqs))
          fw_cons.close()
  
      userfile = pf + ".u"
      notmatchedfile = pf + ".notmatched"
      if need_update(consensusfile, userfile):
          cluster_smallmem(consensusfile, userfile, notmatchedfile,
                           minlength, pctid, cpus)
  
      clustfile = pf + ".clust"
      if need_update((consensusfile, userfile, notmatchedfile), clustfile):
          makeclust(consensusfile, userfile, notmatchedfile, clustfile)
  
      clustSfile = pf + ".clustS"
      if need_update(clustfile, clustSfile):
          parallel_musclewrap(clustfile, cpus, minsamp=opts.minsamp)
docs: %prog mcluster *.consensus
  
      Cluster across samples using consensus sequences.