View source: R/run_scfeatures.R
run_Morans_I | R Documentation |
This function calculates Moran's I to measure spatial autocorrelation, which an indicattion of how strongly the feature(ie, genes/proteins) expression values in a sample cluster or disperse. A value closer to 1 indicates clustering of similar values and a value closer to -1 indicates clustering of dissimilar values. A value of 0 indicates no particular clustering structure, ie, the values are spatially distributed randomly. The function supports spatial proteomics and spatial transcriptomics.
run_Morans_I(data, type = "spatial_p", ncores = 1)
data |
A list object containing |
type |
The type of dataset, either "scrna", "spatial_t", or "spatial_p". |
ncores |
Number of cores for parallel processing. |
a dataframe of samples x features The features are in the form of protein 1, protein 2 ... etc, with the numbers representing Moran's value.
utils::data("example_scrnaseq" , package = "scFeatures")
data <- example_scrnaseq[1:50, 1:20]
celltype <- data$celltype
data <- data@assays$RNA@data
sample <- sample( c("patient1", "patient2", "patient3"), ncol(data) , replace= TRUE )
x <- sample(1:100, ncol(data) , replace = TRUE)
y <- sample(1:100, ncol(data) , replace = TRUE)
spatialCoords <- list( x , y)
alldata <- scFeatures:::formatData(data = data, sample = sample, celltype = celltype,
spatialCoords = spatialCoords )
feature_Morans_I <- run_Morans_I(alldata, type = "spatial_p", ncores = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.