def _GetCDR3SHMs(self, src_id, dst_id): cdr3_src = self.full_length_lineage.Dataset().GetCDR3BySeqName(src_id) cdr3_dst = self.full_length_lineage.Dataset().GetCDR3BySeqName(dst_id) cdr3_shms = [] for i in range(len(cdr3_src)): if cdr3_src[i] != cdr3_dst[i]: cdr3_shms.append(dataset.SHM(i, -1, cdr3_src[i], cdr3_dst[i])) return cdr3_shms
def _InitSHMs(self): self.shms = TreeSHMs(self.clonal_tree.FullLengthLineage(), self.aa_dict) for e in self.aa_edges: src_aa = self.aa_dict.GetAAByIndex(e[0]) dst_aa = self.aa_dict.GetAAByIndex(e[1]) for i in range(len(src_aa)): if src_aa[i] == dst_aa[i]: continue shm = dataset.SHM(i, -1, src_aa[i], dst_aa[i]) self.shms.AddSHM(e, shm)
def GetReverseSHM(self, shm): return dataset.SHM(shm.pos, -1, shm.dst_n, shm.src_n)
def SHMHasReverse(self, shm): reverse_shm = dataset.SHM(shm.pos, -1, shm.dst_n, shm.src_n) return self.ContainsSHM(reverse_shm)
def SHMIsNeutral(self, shm): reverse_shm = dataset.SHM(shm.pos, -1, shm.dst_n, shm.src_n) return reverse_shm in self.shm_edge_map