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.

See also

renameGenesInSets, to easily convert the gene indices to the usual identifiers (symbols, Ensembl, etc.).

Author

Aaron Lun

Examples

first.set <- fetchGenesForSomeSets("9606", 1:5)
str(first.set)
#> List of 5
#>  $ : int [1:2] 11692 13228
#>  $ : int [1:12] 860 1492 2780 5076 5224 5318 8494 11134 11476 11798 ...
#>  $ : int [1:10] 1444 1485 1490 3051 4129 4481 6908 7044 9983 12932
#>  $ : int [1:4] 1446 1448 1449 20163
#>  $ : int 2755

# Genes in the first set:
gene.symbols <- fetchAllGenes("9606")$symbol
head(gene.symbols[first.set[[1]]])
#> [[1]]
#> [1] "PIGV"
#> 
#> [[2]]
#> [1] "ALG12"
#> 

# Identities of the requested sets.
set.info <- fetchAllSets("9606")[1:5,]
set.info
#>         name                                        description size collection
#> 1 GO:0000009             alpha-1,6-mannosyltransferase activity    2          1
#> 2 GO:0000012                         single strand break repair   12          1
#> 3 GO:0000014 single-stranded DNA endodeoxyribonuclease activity   10          1
#> 4 GO:0000015                  phosphopyruvate hydratase complex    4          1
#> 5 GO:0000016                                   lactase activity    1          1
#>   number
#> 1      1
#> 2      2
#> 3      3
#> 4      4
#> 5      5