src/newick.py
def prune(self, leaves, inverse=False):
        """
        Remove all those nodes in the specified list, or if inverse=True,
        remove all those nodes not in the specified list.  The specified nodes
        must be leaves and distinct from the root node.

        :param nodes: A list of Node objects
        :param inverse: Specifies whether to remove nodes in the list or not\
                in the list.
        """
        self.visit(
            lambda n: n.ancestor.descendants.remove(n),
            # We won't prune the root node, even if it is a leave and requested to
            # be pruned!
            lambda n: ((not inverse and n in leaves) or
                       (inverse and n.is_leaf and n not in leaves)) and n.ancestor,
            mode="postorder")
def prune(self, leaves, inverse=False):
        self.visit(
            lambda n: n.ancestor.descendants.remove(n),
            # We won't prune the root node, even if it is a leave and requested to
            # be pruned!
            lambda n: ((not inverse and n in leaves) or
                       (inverse and n.is_leaf and n not in leaves)) and n.ancestor,
            mode="postorder")
def prune ( self , leaves , inverse = False ) : self . visit ( lambda n : n . ancestor . descendants . remove ( n ) , # We won't prune the root node, even if it is a leave and requested to # be pruned! lambda n : ( ( not inverse and n in leaves ) or ( inverse and n . is_leaf and n not in leaves ) ) and n . ancestor , mode = "postorder" )
Remove all those nodes in the specified list, or if inverse=True,
        remove all those nodes not in the specified list.  The specified nodes
        must be leaves and distinct from the root node.

        :param nodes: A list of Node objects
        :param inverse: Specifies whether to remove nodes in the list or not\
                in the list.
Remove all those nodes in the specified list or if inverse = True remove all those nodes not in the specified list . The specified nodes must be leaves and distinct from the root node .