View source: R/initialPrecisionWeights.R
pbWeights | R Documentation |
Compute precision weights for pseudobulk using the delta method to approximate the variance of the log2 counts per million considering variation in the number of cells and gene expression variance across cells within each sample. By default, used number of cells; if specified use delta method. Note that processAssays()
uses number of cells as weights when no weights are specificed
pbWeights(
sce,
sample_id,
cluster_id,
geneList = NULL,
method = c("delta", "ncells"),
shrink = TRUE,
prior.count = 0.5,
maxRatio = 20,
h5adBlockSizes = 1e+09,
details = FALSE,
verbose = TRUE
)
sce |
|
sample_id |
character string specifying which variable to use as sample id |
cluster_id |
character string specifying which variable to use as cluster id |
geneList |
list of genes to be included for each cell type |
method |
select method to compute precision weights. |
shrink |
Defaults to |
prior.count |
Defaults to |
maxRatio |
When computing precision as the reciprocal of variance |
h5adBlockSizes |
set the automatic block size block size (in bytes) for DelayedArray to read an H5AD file. Larger values use more memory but are faster. |
details |
include |
verbose |
Show messages, defaults to TRUE |
library(muscat)
data(example_sce)
# create pseudobulk for each sample and cell cluster
pb <- aggregateToPseudoBulk(example_sce,
assay = "counts",
sample_id = "sample_id",
cluster_id = "cluster_id",
verbose = FALSE
)
# Gene expressed genes for each cell type
geneList = getExprGeneNames(pb)
# Create precision weights for pseudobulk
# By default, weights are set to cell count,
# which is the default in processAssays()
# even when no weights are specified
weightsList <- pbWeights(example_sce,
sample_id = "sample_id",
cluster_id = "cluster_id",
geneList = geneList
)
# voom-style normalization using initial weights
res.proc <- processAssays(pb, ~group_id, weightsList = weightsList)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.