code: def beagle(args):
      
      p = OptionParser(beagle.__doc__)
      p.set_home("beagle")
      p.set_ref()
      p.set_cpus()
      opts, args = p.parse_args(args)
  
      if len(args) != 2:
          sys.exit(not p.print_help())
  
      vcffile, chr = args
      pf = vcffile.rsplit(".", 1)[0]
      outpf = pf + ".beagle"
      outfile = outpf + ".vcf.gz"
  
      mm = MakeManager()
      beagle_cmd = opts.beagle_home
      kg = op.join(opts.ref, "1000GP_Phase3")
      cmd = beagle_cmd + " gt={0}".format(vcffile)
      cmd += " ref={0}/chr{1}.1kg.phase3.v5a.bref".format(kg, chr)
      cmd += " map={0}/plink.chr{1}.GRCh37.map".format(kg, chr)
      cmd += " out={0}".format(outpf)
      cmd += " nthreads=16 gprobs=true"
      mm.add(vcffile, outfile, cmd)
  
      mm.write()
docs: %prog beagle input.vcf 1
  
      Use BEAGLE4.1 to impute vcf on chromosome 1.