commot.tl.group_communication_direction
- commot.tl.group_communication_direction(adata, keys=None, summary='sender', knn_smoothing=- 1, normalize_vf='quantile', normalize_quantile=0.99, dissimilarity_method='dot_product', leiden_k=5, leiden_resolution=1.0, leiden_random_seed=1, leiden_n_iterations=- 1)
Idenfitify groups of communication directions with similar pattern.
- Parameters
adata (
AnnData
) – The data matrix with the communication direction info stored inadata.obsm
, e.g. adata.obsm[‘commot_sender_vf-pathway-lig-rec’].keys (
Optional
[list
]) – A list of keys for the analyzed communication connections as tuples (database_name, ligand, receptor).summary (
str
) – If ‘sender’, use the vector field describing to which direction the signals are sent. If ‘receiver’, use the vector field describing from which direction the signals are from.knn_smoothing (
int
) – The number of neighbors to smooth the communication direction. If -1, no smoothing is performed.normalize_vf (
str
) – If ‘quantile’, divide all values by the length given by the normalize_quantile parameter. If ‘unit_norm’, normalize each individual vector into unit norm. If None, original unit is used.normalize_quantile (
float
) – The quantile parameter to use if normalize_vf is set to ‘quantile’.dissimilarity_method (
str
) – Currently, only dot_product is implemented.leiden_k (
int
) – Number of neighbors for the knn-graph to be fed to leiden clustering algorithm.leiden_resolution (
float
) – The resolution parameter for the leiden clustering algorithm.leiden_random_seed (
int
) – The random seed for the leiden clustering algorithm.leiden_n_iterations (
int
) – The maximum number of iterations for the leiden algorithm. The algorithm will run until convergence if set to -1.
- Returns
keys (list) – The list of keys for the analyzed communication connections as tuples (pathway_name, ligand, receptor).
direction_clusterid (np.ndarray) – The group id of the communication directions.
D (np.ndarray) – The dissimilarity matrix for the communication directions.