gtdblib.tree package

Submodules

gtdblib.tree.bootstrap_merge module

gtdblib.tree.bootstrap_merge.bootstrap_merge_replicates(input_tree: Path, output_tree: Path, replicate_trees: Collection[Path], cpus: int = 1)

Calculates non-parametric bootstraps for monophyletic groups and transposes them to the input tree.

Parameters:
  • input_tree – The tree to merge the bootstraps to.

  • output_tree – The path to write the tree to.

  • replicate_trees – The trees to calculate the bootstraps from.

  • cpus – The number of processes to use.

gtdblib.tree.convert_accession module

gtdblib.tree.convert_accession.convert_tree_accessions_to_canonical(input_path: Path, output_path: Path)

Convert all accessions a tree to their canonical form.

gtdblib.tree.get_node_depth module

gtdblib.tree.get_node_depth.get_tree_node_depth(tree: Tree) Dict[int, Set[Node]]

Calculate the depth of all nodes in the tree.

Parameters:

tree – The dendropy tree object to calculate the depths for.

Returns:

A dictionary of depths to nodes at that depth.

gtdblib.tree.get_node_to_desc_taxa module

gtdblib.tree.get_node_to_desc_taxa.get_tree_node_to_desc_taxa(tree: Tree) Dict[Node, FrozenSet[str]]

Get each node and the taxa that are descendants of this node.

Parameters:

tree – The dendropy tree object to calculate the depths for.

Returns:

A dictionary of nodes and their descendant taxa.

gtdblib.tree.get_unique_mrca_for_internal_nodes module

gtdblib.tree.get_unique_mrca_for_internal_nodes.get_tree_unique_mrca_for_internal_nodes(tree: Tree) Dict[Node, Tuple[str, str]]

Calculate a unique MRCA for each internal node, i.e. using these taxa will always yield the same internal node.

Parameters:

tree – The dendropy tree object to calculate the depths for.

Returns:

A dictionary of nodes and a tuple of each taxon that identifies the node.

gtdblib.tree.polytomy module

gtdblib.tree.polytomy.collapse_polytomy(path_in: Path, path_out: Path, support: float)

Collapse nodes with low bootstrap support.

Parameters:
  • path_in – Tree to collapse.

  • path_out – The path to write the tree to.

  • support – Collapse nodes that have a support less than this value.

gtdblib.tree.polytomy.collapse_polytomy_tree(tree: Tree, support: float)

Collapse nodes with low bootstrap support, works on the Tree object.

Parameters:
  • tree – Tree to collapse.

  • support – Collapse nodes that have a support less than this value.

Module contents