Plot trend of variance fractions for a specified component versus count magnitude for each gene and cell cluster
Usage
plotTrendVP(fit, vp, component, ...)
# S4 method for class 'lucida,data.frame'
plotTrendVP(fit, vp, component, ...)Arguments
- fit
object returned by
lucida()- vp
data.framefromfitVarPart()- component
variance component to extract from
vp- ...
additional arguments
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 + (1|sample_id)
fit <- lucida(sce, form, "cluster_id", verbose=FALSE)
#> B cells
#> CD14+ Monocytes
#> CD4 T cells
#> CD8 T cells
#> FCGR3A+ Monocytes
# Model with only intercept and random effect
form <- ~ (1|sample_id)
fit.null <- lucida(sce, form, "cluster_id", verbose=FALSE)
#> B cells
#> CD14+ Monocytes
#> CD4 T cells
#> CD8 T cells
#> FCGR3A+ Monocytes
# Variance partitioning analysis
vp <- fitVarPart(fit, fit.null)
plotTrendVP(fit, vp, "CountNoise")
#> Warning: Removed 41 rows containing missing values or values outside the scale range
#> (`geom_smooth()`).