cassiopeia.data.compute_phylogenetic_weight_matrix#

cassiopeia.data.compute_phylogenetic_weight_matrix(tree, inverse=False, inverse_fn=<function <lambda>>)[source]#

Computes the phylogenetic weight matrix.

Computes the distances between all leaves in a tree. The user has the option to return the inverse matrix, (i.e., transform distances to proximities) and specify an appropriate inverse function.

This function computes the phylogenetic weight matrix in O(n^2 logn) time.

An NxN weight matrix is returned.

Parameters:
tree <module 'cassiopeia.data.CassiopeiaTree' from '/home/docs/checkouts/readthedocs.org/user_builds/cassiopeia-lineage/checkouts/testdeployment/cassiopeia/data/CassiopeiaTree.py'>

CassiopeiaTree

inverse bool (default: False)

Convert distances to proximities

inverse_fn (int | float) → floatCallable[[Union[int, float]], float] (default: <function <lambda> at 0x7ff0919d5820>)

Inverse function (default = 1 / x)

Return type:

DataFrame

Returns:

An NxN phylogenetic weight matrix