def add(self, read):
        if self.tag in ['LENGTH', 'LEN']:
            val = len(read.seq)

        elif self.tag == 'MAPQ':
            val = read.mapq

        elif self.tag == 'MISMATCH':
            val = read_calc_mismatches(read)

        else:
            try:
                val = read.opt(self.tag)
            except __HOLE__:
                self.missing += 1
                return

        if not val in self.bins:
            self.bins[val] = 0
            self._keys.append(val)

        self.bins[val] += 1
        if not self._min or self._min > val:
            self._min = val
        if not self._max or self._max < val:
            self._max = val
dataset/ETHPy150Open ngsutils/ngsutils/ngsutils/bam/stats.py/FeatureBin.add