Differential expression analysis using a negative binomial (mixed) model
Usage
lucida(
x,
formula,
cluster_id = NULL,
smoother = c("loess", "local_median"),
shrinkDispersion = TRUE,
shrinkPhi = TRUE,
lambda = 1e-08,
verbose = TRUE,
nthreads = parallelly::availableCores(),
nReaders = 1,
detail = 2,
chunkMemory = 1,
chunkSize = floor(chunkMemory/(ncol(x) * 8/1024^3)),
n0 = 0.1 * ncol(x),
n1 = 0.01 * ncol(x),
...
)
# S4 method for class 'SummarizedExperiment'
lucida(
x,
formula,
cluster_id = NULL,
smoother = c("loess", "local_median"),
shrinkDispersion = TRUE,
shrinkPhi = TRUE,
lambda = 1e-08,
verbose = TRUE,
nthreads = parallelly::availableCores(),
nReaders = 1,
detail = 2,
chunkMemory = 5,
chunkSize = floor(chunkMemory/(ncol(x) * 8/1024^3)),
n0 = 0.1 * ncol(x),
n1 = 0.01 * ncol(x),
...
)Arguments
- x
object storing expression data:
SingleCellExperimentorDGEList- formula
regression formula for negative binomial model
- cluster_id
string indicating column of
colData(sce)annotating the cluster ID of each cell. IfNULL, analyze all cells together- smoother
estimate dispersion trend using
"loess"(default) or"local_median", which is built into toglmGamPoi::overdispersion_shrinkage()- shrinkDispersion
shrink the negative binomial overdispersion parameter theta (default TRUE)
- shrinkPhi
shrink the residual variance parameter phi (default TRUE).
- lambda
ridge parameter. Use very small shrinkage penality to handle almost-singular design matrix
- verbose
show messages
- nthreads
number of total threads
- nReaders
number of threads used for reading data from disk
- detail
level of model detail returned, with LEAST = 0, LOW = 1, MEDIUM = 2, HIGH = 3, MOST = 4. LEAST (beta), LOW (beta, se, dispersion, rdf), MEDIUM (vcov), HIGH (pearson residuals), MOST (hatvalues)
- chunkMemory
size of chunk in memory, in Gb
- chunkSize
number of genes to process per chunk
- n0
minumum number of cells with more than 0 counts
- n1
minumum number of cells with more than 1 counts
- ...
other arguments passed to
glmFitResponses()orglmmFitResponses()
Examples
library(SingleCellExperiment)
# Load example data
data(example_sce, package="muscat")
sce <- example_sce
# Compute library size for each cell
sce$libSize <- colSums(counts(sce))
# Specify regression formula and cell annotation
form <- ~ group_id
fit <- lucida(sce, form, "cluster_id", verbose=FALSE)
#> B cells
#> CD14+ Monocytes
#> CD4 T cells
#> CD8 T cells
#> FCGR3A+ Monocytes
# Differential expression results
results(fit, "group_idstim")
#> # A tibble: 1,114 × 7
#> cluster_id ID AveExpr logFC se P.Value FDR
#> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 FCGR3A+ Monocytes ISG15 40.8 5.01 0.182 2.47e-167 2.75e-164
#> 2 CD14+ Monocytes ISG15 61.2 5.39 0.198 3.89e-163 2.17e-160
#> 3 CD14+ Monocytes ISG20 9.82 3.96 0.161 4.69e-134 1.74e-131
#> 4 CD14+ Monocytes APOBEC3A_ENSG000… 14.1 4.44 0.183 1.38e-129 3.84e-127
#> 5 B cells ISG20 5.79 2.47 0.104 1.17e-123 2.61e-121
#> 6 FCGR3A+ Monocytes ISG20 10.1 3.44 0.147 2.51e-120 4.66e-118
#> 7 CD14+ Monocytes TMSB10 8.78 1.29 0.0591 3.16e-106 5.03e-104
#> 8 CD14+ Monocytes PFN1 10.9 -0.957 0.0488 1.25e- 85 1.74e- 83
#> 9 FCGR3A+ Monocytes IFITM3 9.23 2.88 0.147 2.45e- 85 3.04e- 83
#> 10 CD14+ Monocytes DYNLT1 3.34 1.57 0.0812 1.95e- 83 2.17e- 81
#> # ℹ 1,104 more rows