drisso / SingleCellExperiment

Clone of the Bioconductor repository for the SingleCellExperiment package, see https://bioconductor.org/packages/devel/bioc/html/SingleCellExperiment.html for the official development version.
65 stars 18 forks source link

Pass `delayed` and `fill` to `combineCols()` of altExps #68

Closed PeteHaitch closed 1 year ago

PeteHaitch commented 1 year ago

Following up from https://github.com/LTLA/mumosa/issues/5#issuecomment-1465296820. combineCols() did not respect delayed = FALSE for the altExps. In fixing this I saw that nor did it respect fill, so this PR fixes both.

Before

suppressPackageStartupMessages(library(scater))
sce <- mockSCE()
sce <- logNormCounts(sce)
sce <- runPCA(sce)

adt_sce <- mockSCE(ngenes=20)
adt_sce <- logNormCounts(adt_sce)
altExp(sce, "ADT") <- adt_sce

sce2 <- combineCols(sce, sce, delayed = FALSE, fill = 0)
class(logcounts(sce2))
#> [1] "matrix" "array"
class(logcounts(altExp(sce2, "ADT")))
#> [1] "DelayedMatrix"
#> attr(,"package")
#> [1] "DelayedArray"

After

suppressPackageStartupMessages(library(scater))
sce <- mockSCE()
sce <- logNormCounts(sce)
sce <- runPCA(sce)

adt_sce <- mockSCE(ngenes=20)
adt_sce <- logNormCounts(adt_sce)
altExp(sce, "ADT") <- adt_sce

sce2 <- combineCols(sce, sce, delayed = FALSE, fill = 0)
class(logcounts(sce2))
#> [1] "matrix" "array"
class(logcounts(altExp(sce2, "ADT")))
#> [1] "matrix" "array"
PeteHaitch commented 1 year ago

I think should be backported to the current release branch.