code: def merge(args):
      
      p = OptionParser(merge.__doc__)
      p.set_outfile()
      opts, args = p.parse_args(args)
  
      if len(args) < 1:
          sys.exit(not p.print_help())
  
      bedfiles = args
      fw = must_open(opts.outfile, "w")
      for bedfile in bedfiles:
          bed = Bed(bedfile)
          pf = op.basename(bedfile).split(".")[0]
          for b in bed:
              b.seqid = "_".join((pf, b.seqid))
              print(b, file=fw)
docs: %prog merge bedfiles > newbedfile
  
      Concatenate bed files together. Performing seqid and name changes to avoid
      conflicts in the new bed file.