treetime/treeanc.py
def _calc_dist2root(self):
        """
        For each node in the tree, set its root-to-node distance as dist2root
        attribute
        """
        self.tree.root.dist2root = 0.0
        for clade in self.tree.get_nonterminals(order='preorder'): # parents first
            for c in clade.clades:
                if not hasattr(c, 'mutation_length'):
                    c.mutation_length=c.branch_length
                c.dist2root = c.up.dist2root + c.mutation_length
def _calc_dist2root(self):
        """
        For each node in the tree, set its root-to-node distance as dist2root
        attribute
        """
        self.tree.root.dist2root = 0.0
        for clade in self.tree.get_nonterminals(order='preorder'): # parents first
            for c in clade.clades:
                if not hasattr(c, 'mutation_length'):
                    c.mutation_length=c.branch_length
                c.dist2root = c.up.dist2root + c.mutation_length
def _calc_dist2root ( self ) : self . tree . root . dist2root = 0.0 for clade in self . tree . get_nonterminals ( order = 'preorder' ) : # parents first for c in clade . clades : if not hasattr ( c , 'mutation_length' ) : c . mutation_length = c . branch_length c . dist2root = c . up . dist2root + c . mutation_length
For each node in the tree, set its root-to-node distance as dist2root
        attribute
For each node in the tree set its root - to - node distance as dist2root attribute