Closed LTLA closed 3 years ago
To motivate this from the linked issues:
library(TENxPBMCData)
library(scater)
library(scran)
original <- TENxPBMCData('pbmc8k')
current <- original
system.time({
is.mito <- grep("MT", rowData(current)$Symbol_TENx)
stats <- perCellQCMetrics(current, subsets=list(Mito=is.mito))
high.mito <- isOutlier(stats$subsets_Mito_percent, type="higher")
current <- current[,!high.mito]
current <- logNormCounts(current)
dec <- modelGeneVar(current)
hvgs <- getTopHVGs(dec, prop=0.1)
set.seed(0)
library(batchelor)
out <- fastMNN(current, batch=rep(1:2, c(4000, ncol(current) - 4000)),
subset.row=hvgs, BSPARAM=BiocSingular::RandomParam(deferred=TRUE))
})
## user system elapsed
## 78.098 7.413 85.509
current <- original
counts(current)@seed@seed@as_sparse <- TRUE # could be neater, but whatever.
system.time({
is.mito <- grep("MT", rowData(current)$Symbol_TENx)
stats <- perCellQCMetrics(current, subsets=list(Mito=is.mito))
high.mito <- isOutlier(stats$subsets_Mito_percent, type="higher")
current <- current[,!high.mito]
current <- logNormCounts(current)
dec <- modelGeneVar(current)
hvgs <- getTopHVGs(dec, prop=0.1)
set.seed(0)
library(batchelor)
out2 <- fastMNN(current, batch=rep(1:2, c(4000, ncol(current) - 4000)),
subset.row=hvgs, BSPARAM=BiocSingular::RandomParam(deferred=TRUE))
})
## user system elapsed
## 43.996 0.400 44.394
Looks good. Thx @LTLA!
Thanks. Do you want me to put in some tests, or do you want to do those yourself?
Closes #73:
If this looks good, happy to throw in some tests.