code: def anchor(args):
      
      from jcvi.formats.blast import bed
  
      p = OptionParser(anchor.__doc__)
      opts, args = p.parse_args(args)
  
      if len(args) != 2:
          sys.exit(not p.print_help())
  
      mapbed, blastfile = args
      bedfile = bed([blastfile])
      markersbed = Bed(bedfile)
      markers = markersbed.order
  
      mapbed = Bed(mapbed, sorted=False)
      for b in mapbed:
          m = b.accn
          if m not in markers:
              continue
  
          i, mb = markers[m]
          new_accn = "{0}:{1}-{2}".format(mb.seqid, mb.start, mb.end)
          b.accn = new_accn
          print(b)
docs: %prog anchor map.bed markers.blast > anchored.bed
  
      Anchor scaffolds based on map.