code: def location(args):
      
      from jcvi.formats.bed import BedLine
      from jcvi.graphics.histogram import stem_leaf_plot
  
      p = OptionParser(location.__doc__)
      p.add_option("--dist", default=100, type="int",
                   help="Distance cutoff to call 5` and 3` [default: %default]")
      opts, args = p.parse_args(args)
  
      if len(args) != 2:
          sys.exit(not p.print_help())
  
      bedfile, fastafile = args
      dist = opts.dist
      sizes = Sizes(fastafile).mapping
      fp = open(bedfile)
      fiveprime = threeprime = total = 0
      percentages = []
      for row in fp:
          b = BedLine(row)
          pos = b.start
          size = sizes[b.seqid]
          if pos < dist:
              fiveprime += 1
          if size - pos < dist:
              threeprime += 1
          total += 1
          percentages.append(100 * pos / size)
  
      m = "Five prime (within {0}bp of start codon): {1}\n".format(dist, fiveprime)
      m += "Three prime (within {0}bp of stop codon): {1}\n".format(dist, threeprime)
      m += "Total: {0}".format(total)
      print(m, file=sys.stderr)
  
      bins = 10
      title = "Locations within the gene [0=Five-prime, 100=Three-prime]"
      stem_leaf_plot(percentages, 0, 100, bins, title=title)
docs: %prog location bedfile fastafile
  
      Given SNP locations, summarize the locations in the sequences. For example,
      find out if there are more 3`-SNPs than 5`-SNPs.