Originally written in retrieveFeatureIndex. Modified for also retrieving cell indices and only working for SingleCellExperiment object. This will return indices of features among the rowData/colData. Partial matching (i.e. grepping) can be used.

retrieveSCEIndex(
  inSCE,
  IDs,
  axis,
  by = NULL,
  exactMatch = TRUE,
  firstMatch = TRUE
)

Arguments

inSCE

Input SingleCellExperiment object. Required

IDs

Character vector of identifiers for features or cells to find in rowData or colData of inSCE

axis

A character scalar to specify whether to search for features or cells. Use "row", "feature" or "gene" for features; "col" or "cell" for cells.

by

Character. In which column to search for features/cells in rowData/colData. Default NULL for search the rownames/colnames

exactMatch

A logical scalar. Whether to only identify exact matches or to identify partial matches using grep. Default TRUE

firstMatch

A logical scalar. Whether to only identify the first matches or to return all plausible matches. Default TRUE

Value

A unique, non-NA numeric vector of indices for the matching features/cells in inSCE.

Author

Yusuke Koga, Joshua Campbell, Yichen Wang

Examples

data(scExample, package = "singleCellTK")
retrieveSCEIndex(inSCE = sce, IDs = "ENSG00000205542",
 axis = "row")
#> [1] 2