scviva.tools.vision.compute_knn_weights_from_tree_anndata#

scviva.tools.vision.compute_knn_weights_from_tree_anndata(adata, newick, K=None, obsp_key='weights')[source]#

Compute tree-based KNN weights and store in adata.obsp[obsp_key].

Parameters:
adata AnnData

Annotated data matrix. adata.obs_names must match leaf labels in the Newick tree.

newick str

Newick-format tree string.

K int | None

Number of neighbors. Defaults to round(sqrt(n_cells)).

obsp_key str

Destination key in adata.obsp, by default "weights".

Return type:

AnnData

Returns:

AnnData (modified in-place)