Fetch the gene membership of some sets in the Gesel database. This can be more efficient than fetchGenesForAllSets if only a few sets are of interest.

fetchGenesForSomeSets(species, sets, config = NULL)

Arguments

species

String containing the NCBI taxonomy ID of the species of interest.

sets

Integer vector containing set indices. Each set index refers to a row in the data frame returned by fetchAllSets.

config

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

Value

List of integer vectors. Each vector corresponds to a set in sets and contains the identities of its member genes. Each gene is defined by its gene index, which refers to a row of the data frame returned by fetchAllGenes.

Details

Every time this function is called, information from the requested sets will be added to an in-memory cache. Subsequent calls to this function will re-use as many of the cached sets as possible before making new requests to the Gesel database.

If fetchGenesForAllSets was previously called, its cached data will be directly used by fetchGenesForSomeSets to avoid performing extra requests to the database. If sets is large, it may be more efficient to call fetchGenesForAllSets to prepare the cache before calling this function.

Author

Aaron Lun

Examples

first.set <- fetchGenesForSomeSets("9606", 1:5)
str(first.set)
#> List of 5
#>  $ : int [1:11] 205 1357 2947 3050 3397 6394 6929 11392 13719 14489 ...
#>  $ : int [1:4] 1913 1914 5760 19145
#>  $ : int [1:2] 11662 13197
#>  $ : int [1:2] 8599 12196
#>  $ : int [1:10] 860 1493 2781 5067 5309 8469 11104 11768 17822 24686

# Genes in the first set:
gene.symbols <- fetchAllGenes("9606")$symbol
head(gene.symbols[first.set[[1]]])
#> [[1]]
#> [1] "SLC25A4"
#> 
#> [[2]]
#> [1] "TYMP"
#> 
#> [[3]]
#> [1] "MEF2A"
#> 
#> [[4]]
#> [1] "MPV17"
#> 
#> [[5]]
#> [1] "OPA1"
#> 
#> [[6]]
#> [1] "LONP1"
#> 

# Identities of the requested sets.
set.info <- fetchAllSets("9606")[1:5,]
set.info
#>         name                               description size collection number
#> 1 GO:0000002          mitochondrial genome maintenance   11          1      1
#> 2 GO:0000003                              reproduction    4          1      2
#> 3 GO:0000009    alpha-1,6-mannosyltransferase activity    2          1      3
#> 4 GO:0000010 trans-hexaprenyltranstransferase activity    2          1      4
#> 5 GO:0000012                single strand break repair   10          1      5