phylo2vec.utils.vector.reroot

Contents

phylo2vec.utils.vector.reroot#

phylo2vec.utils.vector.reroot(vector_or_matrix, node) ndarray[source]#

Reroot a tree in phylo2vec format at a given node

Parameters:
  • vector_or_matrix (numpy.ndarray) – Phylo2Vec vector (ndim == 1)/matrix (ndim == 2)

  • node (int) –

    A node to reroot the tree at

    Must be a valid node in the tree, i.e., in the range [0, 2 * n_leaves - 1]

    Cannot be the current root node, i.e., 2 * n_leaves

Returns:

rerooted vector

Return type:

numpy.ndarray