retain_informative_genes: retain_informative_genes

View source: R/retain_informative_genes.R

retain_informative_genesR Documentation

retain_informative_genes

Description

Function selects variable genes and retains them to represent counts matrix for downstream analysis. This is essentially a wrapper for scran::getTopHVGs + simple check for mt-genes.

Usage

retain_informative_genes(
  sce,
  n = NULL,
  var.thresh = 0,
  select.hvgs = TRUE,
  discard.mt = TRUE
)

Arguments

sce

SingleCellExperiment object containing gene counts matrix (stored in 'logcounts' assay).

n

Scalar (or NULL, if not applied) specifying number of top HVGs to be return. Default=NULL.

var.thresh

Scalar (float) specifying threshold for variation to filter HVGs. Default=0.

select.hvgs

Boolean specifying if we want to discard not HVGs. Default=TRUE.

discard.mt

Boolean specifying if mitochondrial genes should be discarded. Default=TRUE.

Value

Reduced sce with prefiltered set of genes.

Examples

require(SingleCellExperiment)
n_row = 1000
n_col = 100
sce = SingleCellExperiment(assays = list(logcounts = matrix(rnorm(n_row*n_col), ncol=n_col)))
rownames(sce) = as.factor(1:n_row)
colnames(sce) = c(1:n_col)
sce$cell = colnames(sce)
out = retain_informative_genes(sce)


MarioniLab/geneBasisR documentation built on June 30, 2023, 2:04 p.m.