countCells.Rd
This function quantifies the number of cells in each neighbourhood according to an input experimental design. This forms the basis for the differential neighbourhood abundance testing.
countCells(x, samples, meta.data = NULL)
x | A |
---|---|
samples | Either a string specifying which column of |
meta.data | A cell X variable |
A Milo
object containing a counts matrix in the
nhoodCounts
slot.
This function generates a counts matrix of nhoods
X samples,
and populates the nhoodCounts
slot of the input
Milo
object. This matrix is used down-stream for
differential abundance testing.
library(igraph)#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#> #>#>#>#> Warning: Rownames not set on reducedDims - setting to row indicescond <- rep("A", nrow(m)) cond.a <- sample(1:nrow(m), size=floor(nrow(m)*0.25)) cond.b <- setdiff(1:nrow(m), cond.a) cond[cond.b] <- "B" meta.df <- data.frame(Condition=cond, Replicate=c(rep("R1", 330), rep("R2", 330), rep("R3", 340))) meta.df$SampID <- paste(meta.df$Condition, meta.df$Replicate, sep="_") milo <- countCells(milo, meta.data=meta.df, samples="SampID")#>#>#>milo#> class: Milo #> dim: 1000 100 #> metadata(0): #> assays(1): logcounts #> rownames: NULL #> rowData names(0): #> colnames: NULL #> colData names(0): #> reducedDimNames(1): PCA #> spikeNames(0): #> altExpNames(0): #> nhoods dimensions(1): 12 #> nhoodCounts dimensions(2): 12 6 #> nhoodDistances dimension(1): 0 #> graph names(1): graph #> nhoodIndex names(1): 12 #> nhoodExpression dimension(2): 1 1 #> nhoodReducedDim names(0): #> nhoodGraph names(0): #> nhoodAdjacency dimension(0):