code: def mismatches(args):
      
      from jcvi.utils.cbook import percentage
      from jcvi.graphics.histogram import stem_leaf_plot
  
      p = OptionParser(mismatches.__doc__)
  
      opts, args = p.parse_args(args)
  
      if len(args) != 1:
          sys.exit(not p.print_help())
  
      blastfile, = args
  
      data = []
      matches = 0
      b = Blast(blastfile)
      for query, bline in b.iter_best_hit():
          mm = bline.nmismatch + bline.ngaps
          data.append(mm)
  
      nonzeros = [x for x in data if x != 0]
      title = "Polymorphic sites: {0}".\
              format(percentage(len(nonzeros), len(data)))
      stem_leaf_plot(data, 0, 20, 20, title=title)
docs: %prog mismatches blastfile
  
      Print out histogram of mismatches of HSPs, usually for evaluating SNP level.