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.
The spatial autocorrelation helps to detect spatial regions within which the CCC directions are similar. The cell-cell communication should have been computed by the function
commot.tl.spatial_communication(). The cell-cell communication direction should have been computed by the functioncommot.tl.communication_direction().- Parameters
adata (
AnnData) – The data matrix with the communication vector fields info stored inadata.ubsm.keys (
Optional[list]) – A list of keys for the analyzed communication connections as strings. For example, the string'databaseX-pathwayX'represents the CCC of signaling pathway “pathwayX” computed with the LR database “databaseX”. For another example, the string'databaseX-ligA-recA'represents the CCC of the LR pair “ligA-recA” computed with the LR database “databaseX”. The computed CCC direction corresponding to the above examples (summarized as ‘sent to’ or ‘received from’ directions) should be available in.obsm['commot_sender_vf-databaseX-pathwayX],.obsm['commot_receiver_vf-databaseX-pathwayX]``and ``.obsm['commot_sender_vf-databaseX-ligA-recA'],.obsm['commot_receiver_vf-databaseX-ligA-recA'].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 thelibpysalpackage 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
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.