This function identifies highly variable genes from each dataset and combines these gene sets (either by union or intersection) for use in downstream analysis. Assuming that gene expression approximately follows a Poisson distribution, this function identifies genes with gene expression variance above a given variance threshold (relative to mean gene expression). Alternatively, we allow selecting a desired number of genes for each dataset by ranking the relative variance, and then take the combination.
selectGenes(object, thresh = 0.1, nGenes = NULL, alpha = 0.99, ...)# S3 method for liger
selectGenes(
object,
thresh = 0.1,
nGenes = NULL,
alpha = 0.99,
useDatasets = NULL,
useUnsharedDatasets = NULL,
unsharedThresh = 0.1,
combine = c("union", "intersection"),
chunk = 1000,
verbose = getOption("ligerVerbose", TRUE),
var.thresh = thresh,
alpha.thresh = alpha,
num.genes = nGenes,
datasets.use = useDatasets,
unshared.datasets = useUnsharedDatasets,
unshared.thresh = unsharedThresh,
tol = NULL,
do.plot = NULL,
cex.use = NULL,
unshared = NULL,
...
)
# S3 method for Seurat
selectGenes(
object,
thresh = 0.1,
nGenes = NULL,
alpha = 0.99,
useDatasets = NULL,
layer = "ligerNormData",
assay = NULL,
datasetVar = "orig.ident",
combine = c("union", "intersection"),
verbose = getOption("ligerVerbose", TRUE),
...
)
Updated object
liger method - Each involved dataset stored in
ligerDataset is updated with its featureMeta
slot and varUnsharedFeatures
slot (if requested with
useUnsharedDatasets
), while varFeatures(object)
will be
updated with the final combined gene set.
Seurat method - Final selection will be updated at
Seurat::VariableFeatures(object)
. Per-dataset information is
stored in the meta.features
slot of the chosen Assay.
A liger, ligerDataset or
Seurat
object, with normalized data available (no scale factor
multipled nor log transformed).
Variance threshold used to identify variable genes. Higher
threshold results in fewer selected genes. Liger and Seurat S3 methods accept
a single value or a vector with specific threshold for each dataset in
useDatasets
.* Default 0.1
.
Number of genes to find for each dataset. By setting this,
we optimize the threshold used for each dataset so that we get nGenes
selected features for each dataset. Accepts single value or a vector for
dataset specific setting matching useDataset
.* Default NULL
does not optimize.
Alpha threshold. Controls upper bound for expected mean gene
expression. Lower threshold means higher upper bound. Default 0.99
.
Arguments passed to other methods.
A character vector of the names, a numeric or logical
vector of the index of the datasets to use for shared variable feature
selection. Default NULL
uses all datasets.
A character vector of the names, a numeric or
logical vector of the index of the datasets to use for finding unshared
variable features. Default NULL
does not attempt to find unshared
features.
The same thing as thresh
that is applied to test
unshared features. A single value for all datasets in
useUnsharedDatasets
or a vector for dataset-specific setting.* Default
0.1
.
How to combine variable genes selected from all datasets.
Choose from "union"
or "intersection"
. Default "union"
.
Integer. Number of maximum number of cells in each chunk, when
gene selection is applied to any HDF5 based dataset. Default 1000
.
Logical. Whether to show information of the progress. Default
getOption("ligerVerbose")
or TRUE
if users have not set.
Deprecated. These arguments are renamed and will be removed in the future. Please see function usage for replacement.
Deprecated. Gene variability
metric is now visualized with separated function
plotVarFeatures
. Users can now set none-NULL
useUnsharedDatasets
to select unshared genes, instead of having to
switch unshared
on.
Where the input normalized counts should be from. Default
"ligerNormData"
. For older Seurat, always retrieve from data
slot.
Name of assay to use. Default NULL
uses current active
assay.
Metadata variable name that stores the dataset source
annotation. Default "orig.ident"
.
pbmc <- normalize(pbmc)
# Select basing on thresholding the relative variance
pbmc <- selectGenes(pbmc, thresh = .1)
# Select specified number for each dataset
pbmc <- selectGenes(pbmc, nGenes = c(60, 60))
Run the code above in your browser using DataLab