This will return indices of features among the rownames
or rowData of a data.frame, matrix, or a SummarizedExperiment
object including a SingleCellExperiment.
Partial matching (i.e. grepping) can be used by setting
exactMatch = FALSE
.
featureIndex(
features,
inSCE,
by = "rownames",
exactMatch = TRUE,
removeNA = FALSE,
errorOnNoMatch = TRUE,
warningOnPartialMatch = TRUE
)
Character vector of feature names to find in the rows of
inSCE
.
A data.frame, matrix, or SingleCellExperiment object to search.
Character. Where to search for features in inSCE
. If set to
"rownames"
then the features will be searched for among
rownames(inSCE)
. If inSCE
inherits from class
SummarizedExperiment, then by
can be one of the
fields in the row annotation data.frame (i.e. one of
colnames(rowData(inSCE))
).
Boolean. Whether to only identify exact matches
or to identify partial matches using grep
.
Boolean. If set to FALSE
, features not found in
inSCE
will be given NA
and the returned vector will be the same
length as features
. If set to TRUE
, then the NA
values will be removed from the returned vector. Default FALSE
.
Boolean. If TRUE
, an error will be given if
no matches are found. If FALSE
, an empty vector will be returned if
removeNA
is set to TRUE
or a vector of NA
if
removeNA
is set to FALSE
. Default TRUE
.
Boolean. If TRUE
, a warning will be
given if some of the entries in features
were not found in
inSCE
. The warning will list the features not found.
Default TRUE
.
A vector of row indices for the matching features in inSCE
.
'retrieveFeatureInfo' from package 'scater'
and link{regex}
for how to use regular expressions when
exactMatch = FALSE
.