Node.py
def attach_clade(self, helper, tree, clade):
        "Remove every node already in clade"
        root = self.get_tree_root()
        nodes_list = root.get_cached_content()
        # clade.fix_for_losses(helper, tree, delete_only=True)
        clade_nodes = clade.get_cached_content()
        clade_to_attach = self
        for cln in clade_nodes:
            removed = []
            if cln.loss:
                if clade_to_attach.is_mutation_already_lost(cln.mutation_id):
                    cln.delete(prevent_nondicotomic=False)
                else:
                    tree.losses_list.append(cln)
                    tree.k_losses_list[cln.mutation_id] += 1
            else:
                for n in nodes_list:
                    if n.mutation_id != -1 and cln.mutation_id == n.mutation_id and not n.loss:
                        # moving up
                        if clade_to_attach == n:
                            clade_to_attach = n.up
                        
                        n.delete(prevent_nondicotomic=False)
                        removed.append(n)
            for r in removed:
                nodes_list.pop(r)
        clade_to_attach.add_child(clade)
Remove every node already in clade
Remove every node already in clade
Remove every node already in clade
def attach_clade(self, helper, tree, clade):
        root = self.get_tree_root()
        nodes_list = root.get_cached_content()
        clade_nodes = clade.get_cached_content()
        clade_to_attach = self
        for cln in clade_nodes:
            removed = []
            if cln.loss:
                if clade_to_attach.is_mutation_already_lost(cln.mutation_id):
                    cln.delete(prevent_nondicotomic=False)
                else:
                    tree.losses_list.append(cln)
                    tree.k_losses_list[cln.mutation_id] += 1
            else:
                for n in nodes_list:
                    if n.mutation_id != -1 and cln.mutation_id == n.mutation_id and not n.loss:
                        if clade_to_attach == n:
                            clade_to_attach = n.up
                        n.delete(prevent_nondicotomic=False)
                        removed.append(n)
            for r in removed:
                nodes_list.pop(r)
        clade_to_attach.add_child(clade)
def attach_clade ( self , helper , tree , clade ) : root = self . get_tree_root ( ) nodes_list = root . get_cached_content ( ) clade_nodes = clade . get_cached_content ( ) clade_to_attach = self for cln in clade_nodes : removed = [ ] if cln . loss : if clade_to_attach . is_mutation_already_lost ( cln . mutation_id ) : cln . delete ( prevent_nondicotomic = False ) else : tree . losses_list . append ( cln ) tree . k_losses_list [ cln . mutation_id ] += 1 else : for n in nodes_list : if n . mutation_id != - 1 and cln . mutation_id == n . mutation_id and not n . loss : if clade_to_attach == n : clade_to_attach = n . up n . delete ( prevent_nondicotomic = False ) removed . append ( n ) for r in removed : nodes_list . pop ( r ) clade_to_attach . add_child ( clade )
Remove every node already in clade
Remove every node already in clade
"Remove every node already in clade" # clade.fix_for_losses(helper, tree, delete_only=True) # moving up
self
helper
tree
clade