Query gene sets based on overlaps with genes of interest or matches to keyboards in their names/descriptions.

querySets(
  species,
  genes = NULL,
  text = NULL,
  types = NULL,
  counts.only = TRUE,
  config = NULL
)

Arguments

species

String specifying the taxonomy ID of the species of interest.

genes

Character vector of gene identifiers of any supported type. These are typically Ensembl/Entrez identifiers or gene symbols. If not NULL, this function will search for gene sets that overlap any of the supplied genes.

text

String containing one or more keywords to search on, see the query= argument in searchSetText. If not NULL, this function will search for gene sets that contain the (tokenized) keywords in their names or descriptions.

types

Character vector specifying the types of gene identifiers to consider for genes. This can contain one or more of any type listed in fetchGeneTypes. If NULL, it defaults to all available types in fetchGeneTypes.

counts.only

Boolean indicating whether to return a list of the overlapping genes in each set. Only used if genes is provided.

config

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

Value

A data frame containing one row per set that matches the query conditions. This contains the following columns:

  • name, string containing the name of the gene set.

  • description, string containing a description of the gene set.

  • size, integer specifying the number of genes in this gene set.

  • collection, the name of the collection that contains this gene set.

  • set, integer specifying the Gesel set index that can be used in other gesel functions, e.g., fetchGenesForSomeSets.

If genes is provided, the data frame will additionally contain:

  • count, an integer column containing the number of overlaps between the genes in the set and those in genes.

  • genes, a nested list where each entry is a character vector containing the genes in genes that are present in each set. Only reported if counts.only = FALSE.

  • pvalue column, a numeric column containing the hypergeometric p-value for overrepresentation of genes in the set. Rows will be sorted by this column if it is present.

Details

This is a user-friendly wrapper for quick and convenient searching of the Gesel database. Developers may prefer to use the lower-level gesel functions for more customization and flexibility.

See also

searchGenes, to convert gene identifiers into internal Gesel indices.

searchOverlappingSets, to find the sets that overlap the genes of interest.

searchSetText, to find sets based on keywords in their names/descriptions.

fetchSomeSets, to get the details for each set.

fetchSomeCollections, to get the details for each collection.

Author

Aaron Lun

Examples

out <- querySets(
    species = "9606",
    genes = c("tead1", "tead2", "tead3", "tead4"),
    text = "transcription"
)
head(out)
#>                                                       name
#> 1     REACTOME_RUNX3_REGULATES_YAP1_MEDIATED_TRANSCRIPTION
#> 2 WP_TRANSCRIPTION_COFACTORS_SKI_AND_SKIL_PROTEIN_PARTNERS
#> 3         REACTOME_REGULATION_OF_PD_L1_CD274_TRANSCRIPTION
#> 4                                               GO:0005667
#> 5                                               GO:0003700
#> 6                                               GO:0045944
#>                                                                                                      description
#> 1     https://www.gsea-msigdb.org/gsea/msigdb/human/geneset/REACTOME_RUNX3_REGULATES_YAP1_MEDIATED_TRANSCRIPTION
#> 2 https://www.gsea-msigdb.org/gsea/msigdb/human/geneset/WP_TRANSCRIPTION_COFACTORS_SKI_AND_SKIL_PROTEIN_PARTNERS
#> 3         https://www.gsea-msigdb.org/gsea/msigdb/human/geneset/REACTOME_REGULATION_OF_PD_L1_CD274_TRANSCRIPTION
#> 4                                                                                transcription regulator complex
#> 5                                                                      DNA-binding transcription factor activity
#> 6                                                      positive regulation of transcription by RNA polymerase II
#>   size
#> 1    8
#> 2   18
#> 3  101
#> 4  247
#> 5  714
#> 6 1210
#>                                                                  collection
#> 1     MSigDB C2: curated gene sets, CP: Canonical pathways, Reactome subset
#> 2 MSigDB C2: curated gene sets, CP: Canonical pathways, WikiPathways subset
#> 3     MSigDB C2: curated gene sets, CP: Canonical pathways, Reactome subset
#> 4                                                             Gene ontology
#> 5                                                             Gene ontology
#> 6                                                             Gene ontology
#>     set count       pvalue
#> 1 24342     4 4.692585e-16
#> 2 25623     4 2.051330e-14
#> 3 24208     4 2.737068e-11
#> 4  2384     4 1.014591e-09
#> 5  1348     4 7.198470e-08
#> 6 10165     4 5.957839e-07

out2 <- querySets(
    species = "9606",
    genes = c("SNAP25", "neurod4", "neurod6"),
    text = "neuro*",
    counts.only = FALSE
)
head(out2)
#>                                                    name
#> 1                        MANNO_MIDBRAIN_NEUROTYPES_HNBM
#> 2               ZHONG_PFC_MAJOR_TYPES_EXCITATORY_NEURON
#> 3          REACTOME_NEUROTOXICITY_OF_CLOSTRIDIUM_TOXINS
#> 4                                            GO:0001504
#> 5                                            GO:0097475
#> 6 REACTOME_ACETYLCHOLINE_NEUROTRANSMITTER_RELEASE_CYCLE
#>                                                                                                   description
#> 1                        https://www.gsea-msigdb.org/gsea/msigdb/human/geneset/MANNO_MIDBRAIN_NEUROTYPES_HNBM
#> 2               https://www.gsea-msigdb.org/gsea/msigdb/human/geneset/ZHONG_PFC_MAJOR_TYPES_EXCITATORY_NEURON
#> 3          https://www.gsea-msigdb.org/gsea/msigdb/human/geneset/REACTOME_NEUROTOXICITY_OF_CLOSTRIDIUM_TOXINS
#> 4                                                                                     neurotransmitter uptake
#> 5                                                                                      motor neuron migration
#> 6 https://www.gsea-msigdb.org/gsea/msigdb/human/geneset/REACTOME_ACETYLCHOLINE_NEUROTRANSMITTER_RELEASE_CYCLE
#>   size                                                            collection
#> 1  295                              MSigDB C8: cell type signature gene sets
#> 2    8                              MSigDB C8: cell type signature gene sets
#> 3   10 MSigDB C2: curated gene sets, CP: Canonical pathways, Reactome subset
#> 4   11                                                         Gene ontology
#> 5   11                                                         Gene ontology
#> 6   17 MSigDB C2: curated gene sets, CP: Canonical pathways, Reactome subset
#>     set count        genes       pvalue
#> 1 42295     3 SNAP25, .... 3.087444e-07
#> 2 42464     1      neurod6 5.516354e-04
#> 3 23899     1       SNAP25 6.895125e-04
#> 4   354     1       SNAP25 7.584463e-04
#> 5 14755     1      neurod4 7.584463e-04
#> 6 22929     1       SNAP25 1.171983e-03