phylo2vec.utils.vector.get_common_ancestor#
- phylo2vec.utils.vector.get_common_ancestor(vector_or_matrix, node1, node2)[source]#
Get the most recent common ancestor between two nodes in a Phylo2Vec tree.
node1 and node2 can be leaf nodes (0 to n_leaves) or internal nodes (n_leaves to 2*(n_leaves-1)).
Similar to get_common_ancestor in ETE, but for Phylo2Vec vectors/matrices.
Note: The MRCA is purely topological, so for matrices, only the vector component (column 0) is used.
- Parameters:
vector_or_matrix (numpy.ndarray) – Phylo2Vec vector (ndim == 1) or matrix (ndim == 2)
node1 (int) – A node in the tree
node2 (int) – A node in the tree
- Returns:
mrca – Most recent common ancestor node between node1 and node2
- Return type:
int