code: def bed(args):
      
      p = OptionParser(bed.__doc__)
      opts, args = p.parse_args(args)
  
      if len(args) != 1:
          sys.exit(not p.print_help())
  
      idsfile, = args
      ids = set(x.strip() for x in open(idsfile))
      data = get_bed_from_phytozome(list(ids))
  
      pf = idsfile.rsplit(".", 1)[0]
      bedfile = pf + ".bed"
      fw = open(bedfile, "w")
      for i, row in enumerate(data):
          row = row.strip()
          if row == "":
              continue
  
          print(row, file=fw)
  
      logging.debug("A total of {0} records written to `{1}`.".format(i + 1, bedfile))
docs: %prog bed genes.ids
  
      Get gene bed from phytozome. `genes.ids` contains the list of gene you want
      to pull from Phytozome. Write output to .bed file.