Skip to contents

Genes can be referred to by their names, symbols, row numbers in the gene table, or a logical vector referring to the gene table rows. This function accepts all these possibilities and returns the row number in the gene table for the given genes,

Usage

ToIndex(data, gene, regex = FALSE, remove.missing = TRUE, warn = TRUE)

Arguments

data

The grandR object

gene

A vector of genes. Can be either numeric indices, gene names, gene symbols or a logical vector

regex

Treat gene as a regex and return all that match

remove.missing

if TRUE, do not return missing genes (return NA otherwise)

warn

if TRUE emit a warning if not all genes are found

Value

Numeric indices corresponding to the given genes

See also

Examples

sars <- ReadGRAND(system.file("extdata", "sars.tsv.gz", package = "grandR"),
                  design=c("Cell",Design$dur.4sU,Design$Replicate))
#> Warning: Duplicate gene symbols (n=1, e.g. MATR3) present, making unique!
ToIndex(sars,c("MYC"))
#> MYC 
#> 436 
ToIndex(sars,GeneInfo(sars)$Symbol=="MYC")
#> [1] 436