def update(self, snp):
        '''update with snp.'''

        junctions = list(self.mJunctions.get(snp.chromosome,
                                             snp.pos,
                                             snp.pos + 1))

        self.mResults = []

        reference_base = snp.reference_base

        if junctions:
            for start, end, data in junctions:
                strand, intron_start, intron_end, gene_id, transcript_id = data
                snp_pos = snp.pos

                if strand == "-":
                    lcontig = self.mFasta.getLength(snp.chromosome)
                    intron_start, intron_end = lcontig - \
                        intron_end, intron_start - lcontig
                    snp_pos = lcontig - snp_pos - 1

                seq5 = self.mFasta.getSequence(
                    snp.chromosome, strand, intron_start, intron_start + self.mSize).upper()
                seq3 = self.mFasta.getSequence(
                    snp.chromosome, strand, intron_end - self.mSize, intron_end).upper()

                splice_name, prime5, prime3 = self.hasSpliceMotif(seq5, seq3)
                if splice_name:
                    if intron_start <= snp_pos < intron_start + len(prime5):
                        has_overlap = "5"
                    elif intron_end - len(prime3) <= snp_pos < intron_end:
                        has_overlap = "3"
                    else:
                        has_overlap = ""
                else:
                    has_overlap = ""

                E.debug("building a splice site for %s:%s:%i, splice=%i:%i:%s (snp=%i), splice_name=%s, has_overlap=%s" %
                        (snp.chromosome, strand, snp.pos,
                         intron_start, intron_end, strand, snp_pos,
                         str(splice_name),
                         str(has_overlap)))

                if intron_start <= snp_pos < intron_start + self.mSize:
                    is_homozygous, new_seq5 = self.buildSequenceVariants(
                        seq5, strand, snp_pos - intron_start, snp)
                    new_seqs = [(x, seq3) for x in new_seq5]
                    distance = snp_pos - intron_start
                elif intron_end - self.mSize <= snp_pos < intron_end:
                    is_homozygous, new_seq3 = self.buildSequenceVariants(
                        seq3, strand, self.mSize - (intron_end - snp_pos), snp)
                    new_seqs = [(seq5, x) for x in new_seq3]
                    distance = intron_end - snp_pos - 1
                else:
                    raise ValueError("no overlap?")

                E.debug("building a splice site for %s:%s:%i, splice=%i:%i:%s, splice_name=%s, distance=%i, has_overlap=%s, is_homozygous=%s, new_seqs=%s" %
                        (snp.chromosome, strand, snp.pos,
                         intron_start, intron_end, strand,
                         str(splice_name),
                         distance,
                         str(has_overlap),
                         str(is_homozygous),
                         str(new_seqs)))

                # indels at the end of size are out-of-range - ignore
                if new_seqs == []:
                    continue

                for new_seq5, new_seq3 in new_seqs:
                    new_splice_name, new_prime5, new_prime3 = self.hasSpliceMotif(
                        new_seq5, new_seq3)

                    if splice_name is None and new_splice_name is None:
                        code = "U"
                    elif new_splice_name is None:
                        code = "D"
                    elif splice_name is None:
                        code = "C"
                    elif splice_name == new_splice_name:
                        code = "S"
                    elif splice_name != new_splice_name:
                        code = "N"

                    if is_homozygous:
                        is_homozygous = "1"
                    else:
                        is_homozygous = "0"
                    if not splice_name:
                        splice_name = ""
                    if not new_splice_name:
                        new_splice_name = ""
                    self.mResults.append((transcript_id, gene_id, has_overlap, is_homozygous,
                                          splice_name, new_splice_name, str(distance), code))
dataset/ETHPy150Open CGATOxford/cgat/scripts/snp2table.py/BaseAnnotatorSpliceSites.update/swapped operands of `-`