Skip to contents

Forest plot

Usage

plotForest(x, gene, coef, ...)

# S4 method for dreamletResult
plotForest(x, gene, coef, assays = names(x), ylim = NULL)

# S4 method for dreamlet_mash_result
plotForest(x, gene, coef, assays = colnames(x$logFC.original), ylim = NULL)

Arguments

x

result from dreamlet

gene

gene to show results for

coef

coefficient to test with topTable

...

other arguments

assays

array of assays to plot

ylim

limits for the y axis

Value

Plot showing effect sizes

Examples

library(muscat)
library(SingleCellExperiment)

data(example_sce)

# create pseudobulk for each sample and cell cluster
pb <- aggregateToPseudoBulk(example_sce,
  assay = "counts",
  cluster_id = "cluster_id",
  sample_id = "sample_id",
  verbose = FALSE
)

# voom-style normalization
res.proc <- processAssays(pb, ~group_id)
#>   B cells...
#> 0.23 secs
#>   CD14+ Monocytes...
#> 0.36 secs
#>   CD4 T cells...
#> 0.26 secs
#>   CD8 T cells...
#> 0.15 secs
#>   FCGR3A+ Monocytes...
#> 0.31 secs

# Differential expression analysis within each assay,
# evaluated on the voom normalized data
res.dl <- dreamlet(res.proc, ~group_id)
#>   B cells...
#> 0.16 secs
#>   CD14+ Monocytes...
#> 0.21 secs
#>   CD4 T cells...
#> 0.17 secs
#>   CD8 T cells...
#> 0.11 secs
#>   FCGR3A+ Monocytes...
#> 0.26 secs

# show coefficients estimated for each cell type
coefNames(res.dl)
#> [1] "(Intercept)"  "group_idstim"

# Show estimated log fold change with in each cell type
plotForest(res.dl, gene = "ISG20", coef = "group_idstim")