def getAlignable(self, aligned_positions, ratio=None): assert ratio is None, "already 2-branched" children = self.pair.children # alignables leaves = [c.leaf for c in children] aligned_positions = [posn for (bin, posn) in aligned_positions] pog = self.pair.getPOG(aligned_positions) edge = LikelihoodTreeEdge(leaves, 'parent', pog.getAlignedPositions()) (plhs, gapscores) = self.makePartialLikelihoods(use_cost_function=False) plh = self.pair.edge2plh(edge, plhs) assert len(plh) == 1, ('bins!', len(plh)) leaf = edge.asLeaf(plh[0]) # like profile return AlignablePOG(leaf, pog, children)
def recursive_lht_build(edge, leaves): if edge.istip(): lhe = leaves[edge.Name] else: lht_children = [] for child in edge.Children: lht = recursive_lht_build(child, leaves) lht_children.append(lht) lhe = LikelihoodTreeEdge(lht_children, edge_name=edge.Name) return lhe