biopython v1.71.0 Bio.Phylo.BaseTree
Base classes for Bio.Phylo objects.
All object representations for phylogenetic trees should derive from these base classes in order to use the common methods defined on them.
Link to this section Summary
Functions
Match a node by specified attribute values
Match a node if it’s an instance of the given class
Convert [targets]
or *targets
arguments to a single iterable
Merge target specifications with keyword arguments
Safer attribute lookup — returns False instead of raising an error
Match a node to the target object by identity
Traverse a tree in breadth-first (level) order
Retrieve a matcher function by passing an arbitrary object
Traverse a tree in depth-first post-order (children before parent)
Traverse a tree in depth-first pre-order (parent before children)
Get a flat list of elem’s attributes, sorted for consistency
Encode string to UTF-8
Link to this section Functions
Match a node by specified attribute values.
terminal
is a special case: True restricts the search to external (leaf)
nodes, False restricts to internal nodes, and None allows all tree elements
to be searched, including phyloXML annotations.
Otherwise, for a tree element to match the specification (i.e. for the
function produced by _attribute_matcher
to return True when given a tree
element), it must have each of the attributes specified by the keys and
match each of the corresponding values — think ‘and’, not ‘or’, for
multiple keys.
Match a node if it’s an instance of the given class.
Convert [targets]
or *targets
arguments to a single iterable.
This helps other functions work like the built-in functions max
and
min
.
Merge target specifications with keyword arguments.
Dispatch the components to the various matcher functions, then merge into a single boolean function.
Safer attribute lookup — returns False instead of raising an error.
Match a node to the target object by identity.
Traverse a tree in breadth-first (level) order.
Retrieve a matcher function by passing an arbitrary object.
i.e. passing a TreeElement
such as a Clade
or Tree
instance returns an
identity matcher, passing a type such as the PhyloXML.Taxonomy
class
returns a class matcher, and passing a dictionary returns an attribute
matcher.
The resulting ‘match’ function returns True when given an object matching the specification (identity, type or attribute values), otherwise False. This is useful for writing functions that search the tree, and probably shouldn’t be used directly by the end user.
Traverse a tree in depth-first post-order (children before parent).
Traverse a tree in depth-first pre-order (parent before children).
Get a flat list of elem’s attributes, sorted for consistency.
Encode string to UTF-8.