code: def synfind(args):
      
      p = OptionParser(synfind.__doc__)
      opts, args = p.parse_args(args)
  
      if len(args) < 2:
          sys.exit(not p.print_help())
  
      lastfile = args[0]
      bedfiles = args[1:]
      fp = open(lastfile)
      filteredlast = lastfile + ".filtered"
      fw = open(filteredlast, "w")
      for row in fp:
          b = BlastLine(row)
          if b.query == b.subject:
              continue
          print(b, file=fw)
      fw.close()
      logging.debug("Filtered LAST file written to `{0}`".format(filteredlast))
  
      allbed = "all.bed"
      fw = open(allbed, "w")
      for i, bedfile in enumerate(bedfiles):
          prefix = chr(ord('A') + i)
          bed = Bed(bedfile)
          for b in bed:
              b.seqid = prefix + b.seqid
              print(b, file=fw)
      fw.close()
      logging.debug("Bed file written to `{0}`".format(allbed))
docs: %prog synfind all.last *.bed
  
      Prepare input for SynFind.