dynamo.tl.moran_i¶
- dynamo.tl.moran_i(adata, X_data=None, genes=None, layer=None, weighted=True, assumption='permutation', local_moran=False)[source]¶
Identify genes with strong spatial autocorrelation with Moran’s I test. This can be used to identify genes that are potentially related to critical dynamic process. Moran’s I test is first introduced in single cell genomics analysis in (Cao, et al, 2019). Note that moran_i supports performing spatial autocorrelation analysis for any layer or normalized data in your adata object. That is you can either use the total, new, unspliced or velocity, etc. for the Moran’s I analysis.
Global Moran’s I test is based on pysal. More details can be found at: http://geodacenter.github.io/workbook/5a_global_auto/lab5a.html#morans-i
- Parameters
adata (
AnnData
) – an Annodata objectX_data (np.ndarray (default: None)) – The user supplied data that will be used for Moran’s I calculation directly.
genes (list or None (default: None)) – The list of genes that will be used to subset the data for dimension reduction and clustering. If None, all genes will be used.
layer (str or None (default: None)) – The layer that will be used to retrieve data for dimension reduction and clustering. If None, .X is used.
weighted (bool (default: True)) – Whether to consider edge weights in the spatial weights graph.
assumption (str (default: permutation)) – Assumption of the Moran’s I test, can be one of {‘permutation’, ‘normality’, ‘randomization’}. Inference for Moran’s I is based on a null hypothesis of spatial randomness. The distribution of the statistic under the null can be derived using either an assumption of normality (independent normal random variates), or so-called randomization (i.e., each value is equally likely to occur at any location). An alternative to an analytical derivation is a computational approach based on permutation. This calculates a reference distribution for the statistic under the null hypothesis of spatial randomness by randomly permuting the observed values over the locations. The statistic is computed for each of these randomly reshuffled data sets, which yields a reference distribution.
local_moran (bool (default: False)) – Whether to also calculate local Moran’s I.
- Returns
Returns an updated ~anndata.AnnData with a new key ‘Moran_’ + type in the .uns attribute, storing the Moran’ I
test results.