Search for genes by converting gene 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 identifiers of any type specified in types.

types

Character vector specifying the types of gene identifiers in genes. If NULL, the available types are determined from fetchGeneTypes.

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 identifiers that match to the corresponding entry of genes.

See also

createGeneIdentifierMap, which creates the mapping used here to search for genes.

Author

Aaron Lun

Examples

mapping <- searchGenes("9606", c("SNAP25", "NEUROD6", "ENSG00000139618"))
str(mapping)
#> List of 3
#>  $ : int 4645
#>  $ : int 12799
#>  $ : int 484

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