Fetch the identities of sets that contain some genes in the Gesel database. This can be more efficient than fetchSetsForAllGenes if only a few genes are of interest.

fetchSetsForSomeGenes(species, genes, config = NULL)

Arguments

species

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

genes

Integer vector containing gene indices. Each gene index refers to a row of the data frame returned by fetchAllGenes).

config

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

Value

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

Details

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

If fetchSetsForAllGenes is called, its cached data will be directly used by fetchSomeSets to avoid extra requests to the database. If genes is large, it may be more efficient to call fetchSetsForAllGenes to prepare the cache before calling this function.

Author

Aaron Lun

Examples

first.gene <- fetchSetsForSomeGenes("9606", 1:5)
str(first.gene)
#> List of 5
#>  $ : int [1:75] 1055 2335 2364 2509 6548 8048 12970 14052 17603 18963 ...
#>  $ : int [1:219] 584 681 1989 1990 2121 2308 2335 2364 5688 5718 ...
#>  $ : int [1:167] 1515 2308 2417 2472 3037 5075 5211 5215 19126 19197 ...
#>  $ : int [1:70] 1515 2308 2417 2472 3037 5075 5211 5215 10550 19126 ...
#>  $ : int [1:184] 1335 1990 2308 2335 2364 2365 3123 3124 5530 6227 ...

# Sets containing the first gene.
all.set.info <- fetchAllSets("9606")
head(all.set.info[first.gene[[1]],])
#>            name                                  description size collection
#> 1055 GO:0002764 immune response-regulating signaling pathway   38          1
#> 2335 GO:0005576                         extracellular region 2553          1
#> 2364 GO:0005615                          extracellular space 1774          1
#> 2509 GO:0005886                              plasma membrane 5698          1
#> 6548 GO:0031093                 platelet alpha granule lumen   67          1
#> 8048 GO:0034774                      secretory granule lumen  121          1
#>      number
#> 1055   1055
#> 2335   2335
#> 2364   2364
#> 2509   2509
#> 6548   6548
#> 8048   8048

# Identities of the requested genes.
fetchAllGenes("9606")[1:5,]
#>   entrez      ensembl   symbol
#> 1      1 ENSG0000....     A1BG
#> 2      2 ENSG0000....      A2M
#> 3      9 ENSG0000....     NAT1
#> 4     10 ENSG0000....     NAT2
#> 5     12 ENSG0000.... SERPINA3