| Region accessors {lisaClust} | R Documentation |
Methods to access various components of the 'SegmentedCells' object.
region(x, imageID = NULL, annot = FALSE) region(x, imageID = NULL) <- value
x |
A 'SegmentedCells' object. |
imageID |
A vector of imageIDs to specifically extract. |
annot |
Add cell annotation when selecting region information. |
value |
The relevant information used to replace. |
DataFrame or a list of DataFrames
library(spicyR)
set.seed(51773)
x <- round(c(runif(200),runif(200)+1,runif(200)+2,runif(200)+3,
runif(200)+3,runif(200)+2,runif(200)+1,runif(200)),4)*100
y <- round(c(runif(200),runif(200)+1,runif(200)+2,runif(200)+3,
runif(200),runif(200)+1,runif(200)+2,runif(200)+3),4)*100
cellType <- factor(paste('c',rep(rep(c(1:2),rep(200,2)),4),sep = ''))
imageID <- rep(c('s1', 's2'),c(800,800))
cells <- data.frame(x, y, cellType, imageID)
cellExp <- SegmentedCells(cells, cellProfiler = TRUE)
# Generate LISA
lisaCurves <- lisa(cellExp)
# Cluster the LISA curves
kM <- kmeans(lisaCurves,2)
region(cellExp) <- paste('region',kM$cluster,sep = '_')