code: def tandem(args):
      
      p = OptionParser(tandem.__doc__)
      p.add_option("--tandem_Nmax", dest="tandem_Nmax", type="int", default=3,
                 help="merge tandem genes within distance [default: %default]")
      p.add_option("--percent_overlap", type="int", default=50,
                 help="tandem genes have >=x% aligned sequence, x=0-100 \
                 [default: %default]")
      p.set_align(evalue=.01)
      p.add_option("--not_self", default=False, action="store_true",
                   help="provided is not self blast file [default: %default]")
      p.add_option("--strip_gene_name", dest="sep", type="string", default=".",
                 help="strip alternative splicing. Use None for no stripping. \
                 [default: %default]")
      p.add_option("--genefamily", dest="genefam", action="store_true",
                   help="compile gene families based on similarity [default: %default]")
      p.set_outfile()
  
      opts, args = p.parse_args(args)
  
      if len(args) != 3:
          sys.exit(not p.print_help())
  
      blast_file, cds_file, bed_file = args
      N = opts.tandem_Nmax
      P = opts.percent_overlap
      is_self = not opts.not_self
      sep = opts.sep
      ofile = opts.outfile
  
      tandem_main(blast_file, cds_file, bed_file, N=N, P=P, is_self=is_self, \
          evalue=opts.evalue, strip_name=sep, ofile=ofile, genefam=opts.genefam)
docs: %prog tandem blast_file cds_file bed_file [options]
  
      Find tandem gene clusters that are separated by N genes, based on filtered
      blast_file by enforcing alignments between any two genes at least 50%
      (or user specified value) of either gene.
  
      pep_file can also be used in same manner.