calcNhoodDistance.Rd
This function will calculate Euclidean distances between single-cells in a
neighbourhood using the same dimensionality as was used to construct the graph.
This step follows the makeNhoods
call to limit the number of distance
calculations required.
calcNhoodDistance(x, d, reduced.dim = NULL, use.assay = "logcounts")
x | A |
---|---|
d | The number of dimensions to use for computing within-neighbourhood
distances. This should be the same value used construct the |
reduced.dim | If x is an |
use.assay | A character scalar defining which |
A Milo
object with the distance slots populated.
library(SingleCellExperiment) ux <- matrix(rpois(12000, 5), ncol=200) vx <- log2(ux + 1) pca <- prcomp(t(vx)) sce <- SingleCellExperiment(assays=list(counts=ux, logcounts=vx), reducedDims=SimpleList(PCA=pca$x)) milo <- Milo(sce) milo <- buildGraph(milo, d=30, transposed=TRUE)#>milo <- calcNhoodDistance(milo, d=30) milo#> class: Milo #> dim: 60 200 #> metadata(0): #> assays(2): counts logcounts #> rownames: NULL #> rowData names(0): #> colnames: NULL #> colData names(0): #> reducedDimNames(1): PCA #> spikeNames(0): #> altExpNames(0): #> nhoods dimensions(1): 0 #> nhoodCounts dimensions(2): 1 1 #> nhoodDistances dimension(1): 0 #> graph names(1): graph #> nhoodIndex names(1): 0 #> nhoodExpression dimension(2): 1 1 #> nhoodReducedDim names(0): #> nhoodGraph names(0): #> nhoodAdjacency dimension(0):