Sort variance partition statistics
Arguments
- x
object returned by
fitVarPart()
- FUN
function giving summary statistic to sort by. Defaults to sum
- decreasing
logical. Should the sorting be increasing or decreasing?
- last
columns to be placed on the right, regardless of values in these columns
- ...
other arguments to sort
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.2 secs
#> CD14+ Monocytes...
#> 0.3 secs
#> CD4 T cells...
#> 0.24 secs
#> CD8 T cells...
#> 0.13 secs
#> FCGR3A+ Monocytes...
#> 0.27 secs
# variance partitioning analysis
vp <- fitVarPart(res.proc, ~group_id)
#> B cells...
#> 1.9 secs
#> CD14+ Monocytes...
#> 2.5 secs
#> CD4 T cells...
#> 2 secs
#> CD8 T cells...
#> 1.2 secs
#> FCGR3A+ Monocytes...
#> 2.4 secs
#>
# Summarize variance fractions genome-wide for each cell type
plotVarPart(sortCols(vp))
#> Warning: Ignoring unknown aesthetics: outlier.colour