R/stabMapSE.R
stabMapSE.Rd
stabMapSE performs StabMap with SummarizedExperiment type (SingleCellExperiment, SpatialExperiment) objects as input.
stabMapSE(..., assays = "logcounts", args = list())
Set of SummarizedExperiment, SingleCellExperiment, SpatialExperiment, etc that should be named.
Named character vector of assays to be extracted from the objects.
List of arguments to be passed on to `stabMap`
matrix containing common embedding with rows corresponding to cells, and columns corresponding to PCs or LDs for reference dataset(s).
set.seed(2021)
library(SingleCellExperiment)
sce_1 = SingleCellExperiment(assays = list(logcounts = mockMosaicData(names = "D1", ncells = 1000, ngenes = list(1:500))[[1]]))
sce_2 = SingleCellExperiment(assays = list(logcounts = mockMosaicData(names = "D2", ncells = 1000, ngenes = list(251:750))[[1]]))
sce_3 = SingleCellExperiment(assays = list(counts = mockMosaicData(names = "D3", ncells = 1000, ngenes = list(500:750))[[1]]))
out = stabMapSE(D1 = sce_1, D2 = sce_2)
#> treating "D1" as reference
#> generating embedding for path with reference "D1": "D1"
#> generating embedding for path with reference "D1": "D2" -> "D1"
#> treating "D2" as reference
#> generating embedding for path with reference "D2": "D2"
#> generating embedding for path with reference "D2": "D1" -> "D2"
# pass on additional parameters to stabMap()
# e.g. change number of components of reference
out = stabMapSE(D1 = sce_1, D2 = sce_2, args = list(ncomponentsReference = 20))
#> treating "D1" as reference
#> generating embedding for path with reference "D1": "D1"
#> generating embedding for path with reference "D1": "D2" -> "D1"
#> treating "D2" as reference
#> generating embedding for path with reference "D2": "D2"
#> generating embedding for path with reference "D2": "D1" -> "D2"
dim(out)
#> [1] 2000 40
# pull out different assay names:
out = stabMapSE(D2 = sce_2, D3 = sce_3, assays = c("D2" = "logcounts", "D3" = "counts"))
#> treating "D2" as reference
#> generating embedding for path with reference "D2": "D2"
#> generating embedding for path with reference "D2": "D3" -> "D2"
#> treating "D3" as reference
#> generating embedding for path with reference "D3": "D3"
#> generating embedding for path with reference "D3": "D2" -> "D3"