def filter(self, bam, read): if read.is_unmapped: return False chrom = bam.getrname(read.tid) if read_calc_mismatches_ref(self.ref, read, chrom) > self.num: return False return True