code: def bed(args):
      
      p = OptionParser(bed.__doc__)
      p.add_option("--query", default=False, action="store_true",
              help="print out query intervals rather than ref [default: %default]")
      p.add_option("--pctid", default=False, action="store_true",
              help="use pctid in score [default: %default]")
      p.add_option("--cutoff", dest="cutoff", default=0, type="float",
              help="get all the alignments with quality above threshold " +\
                   "[default: %default]")
  
      opts, args = p.parse_args(args)
      if len(args) != 1:
          sys.exit(p.print_help())
  
      coordsfile, = args
      query = opts.query
      pctid = opts.pctid
      quality_cutoff = opts.cutoff
  
      coords = Coords(coordsfile)
  
      for c in coords:
          if c.quality < quality_cutoff:
              continue
          line = c.qbedline(pctid=pctid) if query else c.bedline(pctid=pctid)
          print(line)
docs: %prog bed coordsfile
  
      will produce a bed list of mapped position and orientation (needs to
      be beyond quality cutoff, say 50) in bed format