Skip to contents

Get list of expressed genes for each assay using same filters as processAssays().

Usage

getExprGeneNames(
  sceObj,
  assays = assayNames(sceObj),
  min.cells = 5,
  min.count = 5,
  min.samples = 4,
  min.prop = 0.4,
  min.total.count = 15,
  normalize.method = "TMM"
)

Arguments

sceObj

SingleCellExperiment object

assays

array of assay names to include in analysis. Defaults to assayNames(sceObj)

min.cells

minimum number of observed cells for a sample to be included in the analysis

min.count

minimum number of reads for a gene to be considered expressed in a sample. Passed to edgeR::filterByExpr

min.samples

minimum number of samples passing cutoffs for cell cluster to be retained

min.prop

minimum proportion of retained samples with non-zero counts for a gene to be retained

min.total.count

minimum total count required per gene for inclusion

normalize.method

normalization method to be used by calcNormFactors

Examples

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
)
#> Processing: B cells
#>   Computing library sizes...
#>   Processing samples...
#> Processing: CD14+ Monocytes
#>   Computing library sizes...
#>   Processing samples...
#> Processing: CD4 T cells
#>   Computing library sizes...
#>   Processing samples...
#> Processing: CD8 T cells
#>   Computing library sizes...
#>   Processing samples...
#> Processing: FCGR3A+ Monocytes
#>   Computing library sizes...
#>   Processing samples...

# voom-style normalization using initial weights
res.proc <- processAssays(pb, ~group_id, weightsList = weightsList)
#>   B cells...
#> 0.27 secs
#>   CD14+ Monocytes...
#> 0.37 secs
#>   CD4 T cells...
#> 0.32 secs
#>   CD8 T cells...
#> 0.17 secs
#>   FCGR3A+ Monocytes...
#> 0.4 secs