Search for pathways in the GO or Reactome database using a gene name, pathway ID (SetID), or pathway name (SetName).

SearchDatabase(
  item,
  type = c("gene", "SetID", "SetName"),
  database = c("GO", "Reactome"),
  spe = getOption("spe"),
  export.to.data.frame = F,
  n.min = 1,
  n.max = Inf,
  only.end.terms = F,
  return = c("all", "ID", "genelist")
)

Arguments

item

A gene name, pathway ID, or pathway name.

type

Types of search criteria. Can be one or a combination of "gene", "SetID", "SetName". Default: c("gene", "SetID", "SetName").

database

The database to search in: "GO", "Reactome", or both. Default: c("GO", "Reactome").

spe

Species, either 'human' or 'mouse'. Default: getOption("spe").

export.to.data.frame

If TRUE, the results will be returned as a data frame, which can be easily exported to csv or xlsx formats. Default: FALSE.

n.min

Minimum number of genes required in the gene set. Default: 1.

n.max

Maximum number of genes allowed in the gene set. Default: Inf.

only.end.terms

If TRUE, only the end-level pathways or gene sets will be returned. Default: FALSE.

return

Specifies the format of the result. If set to "all" (default), the result will include all information (pathway ID, pathway name, genes). If set to "ID", it will only return a vector of pathway IDs. If set to "genelist", it will return a list where the names are pathway IDs and the contents are the corresponding genes.

Value

Depending on the specified parameters, the function returns:

  • A full list (with pathway ID, pathway name, and genes) if return = "all".

  • A vector of pathway IDs if return = "ID".

  • A named list of genes with pathway IDs as the list names if return = "genelist".

  • A data frame if export.to.data.frame = TRUE.

Details

Further details and usage can be seen in the provided examples.

Examples

library(SeuratExtend)
library(dplyr)
options(max.print = 10)

# Set the default database search to 'human'
options(spe = "human")

# The 'item' parameter can be anything like a gene, pathway ID, or pathway name.
# For example, search in the GO/Reactome database for pathways that contain the "CD3D" gene
# or pathway names that include "metabolic".
result <- SearchDatabase(c("CD3D","metabolic"))
names(result)
glimpse(head(result, 5))

# If you only want to search based on gene names, you can specify this in the 'type' parameter.
result <- SearchDatabase("CD3D", type = "gene")
names(result)

# If you want to search in a specific database, you can specify it using the 'database' parameter.
result <- SearchDatabase("CD3D", database = "Reactome")
names(result)

# You can specify the database to be either 'human' or 'mouse' using the 'spe' parameter.
result <- SearchDatabase("Cd3d", spe = "mouse")
glimpse(head(result, 5))

# If you only want the result to be a list of pathway IDs, which could be useful for subsequent analysis,
# you can set the 'return' parameter accordingly.
result <- SearchDatabase("CD3D", return = "ID")
result

# If you want the output as a gene list, with the IDs as names, suitable for inputs like GeneSetAnalysis,
# you can adjust the 'return' parameter.
result <- SearchDatabase("CD3D", return = "genelist")
glimpse(head(result, 5))

# If you prefer the output to be a data frame, which is suitable for exporting to Excel or CSV formats,
# you can set 'export.to.data.frame' to TRUE.
result <- SearchDatabase("CD3D", export.to.data.frame = TRUE)
glimpse(result)