Ejemplo n.º 1
0
    def filter(self, bam, read):
        if read.is_unmapped:
            return False

        chrom = bam.getrname(read.tid)

        mm = 0
        snps = 0

        for op, pos, seq in read_calc_mismatches_gen(self.ref, read, chrom):
            if not self.dbsnp.is_valid_variation(chrom, op, pos, seq):
                mm += 1
            else:
                snps += 1

        if mm > self.num:
            return False

        if snps:
            read.tags = read.tags + [('ZS', snps)]

        return True
Ejemplo n.º 2
0
    def filter(self, bam, read):
        if read.is_unmapped:
            return False

        chrom = bam.getrname(read.tid)

        mm = 0
        snps = 0

        for op, pos, seq in read_calc_mismatches_gen(self.ref, read, chrom):
            if not self.dbsnp.is_valid_variation(chrom, op, pos, seq):
                mm += 1
            else:
                snps += 1

        if mm > self.num:
            return False

        if snps:
            read.tags = read.tags + [('ZS', snps)]

        return True