Container definition for (phylogenetic) bifurcating or multifurcating trees defined using Newick strings, collections of them, and for splits of these trees.
Bases: object
A tree bipartition. Requires a tree topology. Using the term borrowed from nomenclature of a bipartite graph, a bipartition for a phylogenetic tree coincides with the definition of two disjoint sets U and V . A branch in a phylogenetic tree defines a single bipartition that divides the tree into two disjoint sets U and V . The set U comprises all of the children leaf of the subtree associated with that branch. The set V contains the rest of the leaves or taxa in the tree.
Construct a bipartition from a branch in a topology.
| Parameters: |
|
|---|
Acquire all component elements from a string representation of a bipartition.
| Parameters: | st – A string representation from a tree.bipartition object. |
|---|
Get branch corresponding to this bipartition.
| Returns: | newick.branch |
|---|
Return an index of the branch with respect to a post order traversal of the topology.
| Returns: | an integer |
|---|
Get the tuple of lists of branches that represent this bipartition.
Given a landscape, return all possible scores, not actively performing scoring if not done.
Get the mapping of symbols from taxa names for the shorter string representation.
Bases: object
Represents a single (phylogenetic) tree by Newick string; can possess other metadata. For manipulation of tree structure, such as rerooting and unrooting, convert this object to a topology.
If enabled, “check” will force the structure to reroot the given Newick string tree to a lowest-order leaf in order to ensure a consistent Newick string among any duplicate topologies. If a structure is provided and check is disabled, all parsing routines are bypassed and the Newick and Structure fields of this tree are overriden by the appropriate arguments.
| Parameters: |
|
|---|
Gets the “origin” of this tree, or where this tree was acquired or constructed from. Usually set by other code or an interface.
| Returns: | string or None |
|---|
Returns the tree’s “structure”, a Newick string without any branch lengths.
| Returns: | a string |
|---|
Gets the score(s) (objective function) for this tree if it/they has/have been defined.
| Returns: | a tuple of floats or integers |
|---|
Return a Newick string with all taxa name replaced with successive integers.
| Returns: | a string |
|---|
Returns the tree’s “structure”, a Newick string without any branch lengths.
| Returns: | a string |
|---|
Sets the name of this tree (object).
| Parameters: | n (a string) – a string indicating this tree’s name |
|---|
Set the “origin” or specification of where this tree was acquired or constructed from.
| Parameters: | o (string or None) – a string indicating where the tree came from |
|---|
Sets the score(s) for this tree. Should be performed by a scorer (see scoring functions in the appropriate module).
| Parameters: | s (a tuple of floats or integers) – a set of objective function scores. |
|---|
Convert the tree object to a DendroPy tree object. Requires DendroPy to be installed on the system.
| Returns: | a DendroPy Tree object or None if DendroPy not on system |
|---|
Return a topology object instance for this tree to allow for rearrangement of the actual structure of the tree.
| Returns: | a rearrangement.topology object |
|---|
Update the contained Newick string only as long as the structure obtained (after rerooting, which is an optional parameter) is identical to the contained structure.
| Parameters: |
|
|---|
Bases: _abcoll.Sized, _abcoll.Iterable
Represents an ordered, disorganized collection of trees that do not necessarily comprise a combinatorial space.
Add a tree object to the collection.
| Parameters: | tr (tree.tree) – A tree object. |
|---|
Add a tree to the structure by Newick string.
| Parameters: | newick (a string) – A New Hampshire or Newick string. |
|---|
Acquire a file where newlines separate Newick strings, and create an instance of treeSet from those trees.
Acquire the index in this collection of a tree object. Returns -1 if not found.
| Parameters: | tr (tree.tree) – A tree object. |
|---|---|
| Returns: | an integer [-1,length of collection) |