Used to peform subsetting of a
SingleCellExperiment object using a variety of methods that
indicate the correct columns to keep. The various methods,
index
, bool
, and colData
, can be used in conjunction
with one another.
subsetSCECols(inSCE, index = NULL, bool = NULL, colData = NULL)
Input SingleCellExperiment object.
Integer vector. Vector of indicies indicating which columns
to keep. If NULL
, this will not be used for subsetting.
Default NULL
.
Boolean vector. Vector of TRUE
or FALSE
indicating which columns should be kept. Needs to be the same length as the
number of columns in inSCE
. If NULL
, this will not be used
for subsetting. Default NULL
.
Character. An expression that will identify a subset of
columns using variables found in the colData
of inSCE
.
For example, if x
is a numeric vector in colData
,
then "x < 5"
will return all columns with x less than 5.
Single quotes should be used for character strings. For example,
"y == 'yes'"
will return all columns where y is "yes".
Multiple expressions can be evaluated by placing them in a vector.
For example c("x < 5", "y =='yes'")
will apply both operations for
subsetting. If NULL
, this will not be used for subsetting.
Default NULL
.
A SingleCellExperiment object that has been subsetted by colData.
data(scExample)
sce <- subsetSCECols(sce, colData = "type != 'EmptyDroplet'")