View source: R/calcNhoodDistance.R
calcNhoodDistance | R Documentation |
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.
Mike Morgan, Emma Dann
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 <- makeNhoods(milo)
milo <- calcNhoodDistance(milo, d=30)
milo
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.