commot.tl.communication_spatial_autocorrelation

commot.tl.communication_spatial_autocorrelation(adata, keys=None, method='Moran', normalize_vf=False, summary='sender', weight_bandwidth=None, weight_k=10, weight_function='triangular', weight_row_standardize=False, n_permutations=999)

Spatial autocorrelation of communication directions.

Parameters
  • adata (AnnData) – The data matrix with the communication vector fields info stored in adata.ubsm.

  • keys (Optional[list]) – A list of keys for the analyzed communication connections as tuples (database_name, ligand, receptor).

  • method (str) – The method to use. Currently, only Moran’s I [Liu2015] for vectors is implemented.

  • normalize_vf (bool) – Whether to normalize the vector field so that the autocorrelation only reflects directions.

  • 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.

  • weight_bandwidth (Optional[float]) – The bandwidth for the kernel to assign knn graph weights. If given, weight_k is ignored.

  • weight_k (int) – The number of nearest neighbors for the knn graph.

  • weight_function (str) – Kernel functions for assigning weight. Choices: ‘triangular’,’uniform’,’quadratic’,’quartic’,’gaussian’. See libpysal.weights.Kernel of the libpysal package for details.

  • weight_row_standardize (bool) – Whether to standardize the weights so that the heterogeneity in local cell/position density does not affect the results.

  • n_permutations (int) – Number of permutations for computing p-values.

Returns

  • keys (list) – The list of keys for the analyzed communication connections as tuples (pathway_name, ligand, receptor).

  • moranI (np.ndarray) – A vector of moran’s I statistics for corresponding to each key in keys.

  • p_value (np.ndarray) – The p-values.

References

Liu2015

Liu, Y., Tong, D., & Liu, X. (2015). Measuring spatial autocorrelation of vectors. Geographical Analysis, 47(3), 300-319.