docs: def cb_histogram(fastq, umi_histogram):
      ''' Counts the number of reads for each cellular barcode
  
      Expects formatted fastq files.
      '''
      annotations = detect_fastq_annotations(fastq)
      re_string = construct_transformed_regex(annotations)
      parser_re = re.compile(re_string)
  
      cb_counter = collections.Counter()
      umi_counter = collections.Counter()
  
      for read in read_fastq(fastq):
          match = parser_re.search(read).groupdict()
          cb = match['CB']
          cb_counter[cb] += 1
          if umi_histogram:
              umi = match['MB']
              umi_counter[(cb, umi)] += 1
  
      for bc, count in cb_counter.most_common():
          sys.stdout.write('{}\t{}\n'.format(bc, count))
  
      if umi_histogram:
          with open(umi_histogram, "w") as umi_handle:
              for cbumi, count in umi_counter.most_common():
                  umi_handle.write('{}\t{}\t{}\n'.format(cbumi[0], cbumi[1], count))