Extracts or select 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. getTopHVG
only returns a character vector of the HVG selection, while with
setTopHVG, a logical vector of the selection will be saved in the
rowData, and optionally, a subset object for the HVGs can be stored
in the altExps slot at the same time.
getTopHVG(
inSCE,
method = c("vst", "dispersion", "mean.var.plot", "modelGeneVar"),
hvgNumber = 2000,
useFeatureSubset = NULL,
featureDisplay = metadata(inSCE)$featureDisplay
)
setTopHVG(
inSCE,
method = c("vst", "dispersion", "mean.var.plot", "modelGeneVar"),
hvgNumber = 2000,
featureSubsetName = NULL,
genes = NULL,
genesBy = NULL,
altExp = FALSE
)Input SingleCellExperiment object
Specify which method to use for variable gene extraction
from Seurat "vst", "mean.var.plot", "dispersion" or
Scran "modelGeneVar". Default "vst"
Specify the number of top variable genes to extract.
Get the feature names in the HVG list set by
setTopHVG. Will ignore method and hvgNumber if not
NULL. Default NULL.
A character string for the rowData variable name
to indicate what type of feature ID should be displayed. If set by
setSCTKDisplayRow, will by default use it. If NULL, will
use rownames(inSCE).
A character string for the rowData variable
name to store a logical index of selected features. Default NULL, will
be determined basing on other parameters.
A customized character vector of gene list to be set as a
rowData variable. Will ignore method and hvgNumber if
set. Default NULL.
If setting customized genes, where should it be found
in rowData? Leave NULL for matching rownames. Default
NULL.
TRUE for also creating a subset inSCE object with
the selected HVGs and store this subset in the altExps slot, named by
hvgListName. Default FALSE.
A character vector of the top hvgNumber variable
feature names
The input inSCE object with the logical vector of
HVG selection updated in rowData, and related parameter updated in
metadata. If altExp is TRUE, an altExp is also
added
data("scExample", package = "singleCellTK")
sce <- runSeuratFindHVG(sce)
hvgs <- getTopHVG(sce, hvgNumber = 10)
sce <- setTopHVG(sce, method = "vst", hvgNumber = 5)
#> Tue Jun 28 22:03:11 2022 ... Feature subset variable 'HVG_vst5' created.