Search for genes by converting gene names/identifiers to gene indices.

searchGenes(species, genes, types = NULL, ignore.case = TRUE, config = NULL)

Arguments

species

String specifying the taxonomy ID of the species of interest.

genes

Character vector of gene names/identifiers of any type specified in types.

types

Character vector specifying the types of gene names/identifiers to return. This is typically one or more of "symbol", "entrez", and "ensembl".

ignore.case

Boolean indicating whether case should be ignored.

config

Configuration list, typically created by newConfig. If NULL, the default configuration is used.

Value

List of length equal to genes. Each entry is an integer vector of gene indices that refer to rows of the data frame returned by fetchAllGenes; these rows represent the genes with names/identifiers that match to the corresponding entry of genes.

Author

Aaron Lun

Examples

mapping <- searchGenes("9606", c("SNAP25", "NEUROD6", "ENSG00000139618"))
str(mapping)
#> List of 3
#>  $ : int 4640
#>  $ : int 12768
#>  $ : int 485

# Checking that our genes were correctly identified:
ref <- fetchAllGenes("9606")
ref[mapping[[1]],]
#>      symbol entrez      ensembl
#> 4640 SNAP25   6616 ENSG0000....
ref[mapping[[2]],]
#>        symbol entrez      ensembl
#> 12768 NEUROD6  63974 ENSG0000....
ref[mapping[[3]],]
#>     symbol entrez      ensembl
#> 485  BRCA2    675 ENSG0000....