getTopHVG Extracts the top variable genes from an input SingleCellExperiment object. Note that the variability metrics must be computed using the `runFeatureSelection` method before extracting the feature names of the top variable features. If `altExp` parameter is a character value, this function will return the input SingleCellExperiment object with the subset containing only the top variable features stored as an altExp slot in returned object. However, if this parameter is set to NULL, only the names of the top variable features will be returned as a character vector.

getTopHVG(inSCE, method, n = 2000, altExp = NULL)

Arguments

inSCE

Input SingleCellExperiment object

method

Specify which method to use for variable gene extraction from either Seurat "vst", "mean.var.plot", "dispersion" or Scran "modelGeneVar".

n

Specify the number of top variable genes to extract.

altExp

A character value that specifies the name of the altExp slot that should be created to store the subset SingleCellExperiment object containing only the top `n` variable features. Default value is NULL, which will not store the subset SingleCellExperiment object and instead will only return the names of the top `n` variable features.

Value

A character vector of the top variable feature names or the input SingleCellExperiment object with subset of variable features stored as an altExp in the object.

Author

Irzam Sarfraz

Examples

data(sce_chcl, package = "scds")
sce_chcl <- scranModelGeneVar(sce_chcl, "counts")
#> Warning: collapsing to unique 'x' values
# return top 10 variable genes
topGenes <- getTopHVG(sce_chcl, "modelGeneVar", 10)
#> Warning: cannot xtfrm data frames