code: def bed(args):
      
      p = OptionParser(bed.__doc__)
      opts, args = p.parse_args(args)
  
      if len(args) != 1:
          sys.exit(not p.print_help())
  
      frgscffile, = args
      bedfile = frgscffile.rsplit(".", 1)[0] + ".bed"
      fw = open(bedfile, "w")
  
      fp = open(frgscffile)
      for row in fp:
          f = FrgScfLine(row)
          print(f.bedline, file=fw)
  
      logging.debug("File written to `{0}`.".format(bedfile))
  
      return bedfile
docs: %prog bed frgscffile
  
      Convert the frgscf posmap file to bed format.