Skip to contents

Differential Expression Analysis

Usage

lucida(
  x,
  formula,
  cluster_id = NULL,
  smoother = c("loess", "local_median"),
  shrinkDispersion = TRUE,
  shrinkPhi = TRUE,
  lambda = 1e-08,
  verbose = TRUE,
  nthreads = parallelly::availableCores(),
  detail = 2,
  chunkSize = 1000,
  ...
)

# 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(),
  detail = 2,
  chunkSize = 1000,
  ...
)

Arguments

x

object storing expression data: SingleCellExperiment or DGEList

formula

regression formula for negative binomial model

cluster_id

string indicating column of colData(sce) annotating the cluster ID of each cell. If NULL, analyze all cells together

smoother

estimate dispersion trend using "loess" (default) or "local_median", which is built into to glmGamPoi::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 threads

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)

chunkSize

number of genes to process per chunk

...

other arguments passed to glmFitResponses() or glmmFitResponses()

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: 4,841 × 7
#>    cluster_id        ID                AveExpr  logFC     se   P.Value       FDR
#>    <chr>             <chr>               <dbl>  <dbl>  <dbl>     <dbl>     <dbl>
#>  1 FCGR3A+ Monocytes ISG15               40.8   5.02  0.182  2.69e-166 1.30e-162
#>  2 CD14+ Monocytes   ISG15               61.2   5.39  0.197  3.17e-165 7.67e-162
#>  3 CD14+ Monocytes   ISG20                9.82  3.96  0.160  5.84e-135 9.43e-132
#>  4 CD14+ Monocytes   APOBEC3A_ENSG000…   14.1   4.44  0.184  1.70e-128 2.06e-125
#>  5 FCGR3A+ Monocytes ISG20               10.1   3.44  0.154  9.96e-110 9.64e-107
#>  6 CD14+ Monocytes   TMSB10               8.79  1.29  0.0581 1.25e-109 1.01e-106
#>  7 FCGR3A+ Monocytes IFITM3               9.23  2.88  0.147  3.04e- 85 2.10e- 82
#>  8 B cells           ISG20                5.79  2.47  0.127  5.55e- 84 3.36e- 81
#>  9 CD14+ Monocytes   DYNLT1               3.34  1.57  0.0816 1.14e- 82 6.11e- 80
#> 10 CD14+ Monocytes   PFN1                10.9  -0.957 0.0506 1.26e- 79 6.10e- 77
#> # ℹ 4,831 more rows