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
.
retrieveFeatureIndex( features, x, by = "rownames", exactMatch = TRUE, removeNA = FALSE )
features | Character vector of feature names to find in the rows of
|
---|---|
x | A data.frame, matrix, or SingleCellExperiment object to search. |
by | Character. Where to search for features in |
exactMatch | Boolean. Whether to only identify exact matches
or to identify partial matches using |
removeNA | Boolean. If set to |
A vector of row indices for the matching features in x
.
'retrieveFeatureInfo' from package 'scater'
and link{regex}
for how to use regular expressions when
exactMatch = FALSE
.
Yusuke Koga, Joshua Campbell
#> [1] 1 5#> Warning: Feature 'Gene_1' matched multiple items in 'rownames': Gene_1,Gene_10,Gene_11,Gene_12,Gene_13,Gene_14,Gene_15,Gene_16,Gene_17,Gene_18,Gene_19,Gene_100. Only the first match will be selected.#> Warning: Feature 'Gene_5' matched multiple items in 'rownames': Gene_5,Gene_50,Gene_51,Gene_52,Gene_53,Gene_54,Gene_55,Gene_56,Gene_57,Gene_58,Gene_59. Only the first match will be selected.#> [1] 1 5