| Title: | A Universal Enrichment Tool for Interpreting Omics Data |
|---|---|
| Description: | A universal tool for interpreting functional characteristics of omics data. It supports Over-Representation Analysis (ORA) and Gene Set Enrichment Analysis (GSEA) for both coding and non-coding genomics data of thousands of species. It provides a unified and tidy interface to access, manipulate, and visualize enrichment results. A key capability is the simultaneous analysis and comparison of datasets from multiple treatments or time points. It also provides high-level access to topology-aware enrichment workflows powered by 'enrichit', including single-network and multi-layer network enrichment for Gene Ontology and KEGG analyses. Furthermore, it integrates Large Language Model (LLM) capabilities to provide automated and insightful interpretation of enrichment results. |
| Authors: | Guangchuang Yu [aut, cre, cph] (ORCID: <https://orcid.org/0000-0002-6485-8781>), Li-Gen Wang [ctb], Giovanni Dall'Olio [ctb], Qianwen Wang [ctb], Wanqian Wei [ctb], Chun-Hui Gao [ctb] (ORCID: <https://orcid.org/0000-0002-1445-7939>) |
| Maintainer: | Guangchuang Yu <[email protected]> |
| License: | Artistic-2.0 |
| Version: | 4.21.4 |
| Built: | 2026-11-01 12:52:55 UTC |
| Source: | https://github.com/bioc/clusterProfiler |
'enrichGO()'/'gseGO()' results carry the term, its ontology and its statistics, but not how deep the term sits in the GO hierarchy. This appends that as a 'level' column (1 = ontology root), which makes it easy to keep a band of levels by filtering, e.g. 'subset(res, level >= 3 & level <= 6)'.
add_go_level(x)add_go_level(x)
x |
an 'enrichResult', 'gseaResult' or 'compareClusterResult' from a GO enrichment analysis |
The level is taken from the ontology the term itself belongs to, so an 'ont = "ALL"' (or 'compareCluster()') result is labelled correctly term by term. Terms that GO.db does not recognise get 'NA'.
'x' with a 'level' column appended to its result table
Guangchuang Yu https://yulab-smu.top
## Not run: x <- enrichGO(gene, OrgDb = "org.Hs.eg.db", ont = "BP") x <- add_go_level(x) subset(x, level >= 3 & level <= 6) ## End(Not run)## Not run: x <- enrichGO(gene, OrgDb = "org.Hs.eg.db", ont = "BP") x <- add_go_level(x) subset(x, level >= 3 & level <= 6) ## End(Not run)
add KEGG pathway category information
append_kegg_category(x)append_kegg_category(x)
x |
KEGG enrichment result |
This function appends the KEGG pathway category information to KEGG enrichment result (either output of 'enrichKEGG' or 'gseKEGG'
update KEGG enrichment result with category information
Guangchuang Yu
Biological Id TRanslator
bitr(geneID, fromType, toType, OrgDb, drop = TRUE)bitr(geneID, fromType, toType, OrgDb, drop = TRUE)
geneID |
input gene id |
fromType |
input id type |
toType |
output id type |
OrgDb |
annotation db |
drop |
drop NA or not |
data.frame
Guangchuang Yu
convert biological ID using KEGG API
bitr_kegg(geneID, fromType, toType, organism, drop = TRUE)bitr_kegg(geneID, fromType, toType, organism, drop = TRUE)
geneID |
input gene id |
fromType |
input id type, one of "Path", "Module", "ncbi-proteinid", "ncbi-geneid", "uniprot", "kegg", and "ko" |
toType |
output id type, one of "Path", "Module", "ncbi-proteinid", "ncbi-geneid", "uniprot", "kegg", and "ko" |
organism |
supported organism, can be search using search_kegg_organism function |
drop |
drop NA or not |
data.frame
Guangchuang Yu
## Not run: bitr_kegg(c("P31946", "P01308"), "uniprot", "ko", "hsa") bitr_kegg(c("K04456", "K04526"), "ko", "uniprot", "hsa") ## End(Not run)## Not run: bitr_kegg(c("P31946", "P01308"), "uniprot", "ko", "hsa") bitr_kegg(c("K04456", "K04526"), "ko", "uniprot", "hsa") ## End(Not run)
open KEGG pathway with web browser
browseKEGG(x, pathID)browseKEGG(x, pathID)
x |
an instance of enrichResult or gseaResult |
pathID |
pathway ID |
url
Guangchuang Yu
Given a list of gene set, this function will compute profiles of each gene cluster.
compareCluster( geneClusters, fun = "enrichGO", data = "", source_from = NULL, ... )compareCluster( geneClusters, fun = "enrichGO", data = "", source_from = NULL, ... )
geneClusters |
a list of entrez gene id. Alternatively, a formula of type |
fun |
One of "groupGO", "enrichGO", "enrichKEGG", "enrichDO" or "enrichPathway" . Users can also supply their own function. |
data |
if geneClusters is a formula, the data from which the clusters must be extracted. |
source_from |
If using a custom function in "fun", provide the source package as a string here. Otherwise, the function will be obtained from the global environment. |
... |
Other arguments. |
A clusterProfResult instance.
Guangchuang Yu https://yulab-smu.top
[compareClusterResult-class], [groupGO], [enrichGO], [enrichKEGG], [enrichDO][DOSE::enrichDO], [enrichPathway][ReactomePA::enrichPathway]
## Not run: data(gcSample) xx <- compareCluster(gcSample, fun="enrichKEGG", organism="hsa", pvalueCutoff=0.05) as.data.frame(xx) # plot(xx, type="dot", caption="KEGG Enrichment Comparison") dotplot(xx) ## formula interface mydf <- data.frame(Entrez=c('1', '100', '1000', '100101467', '100127206', '100128071'), logFC = c(1.1, -0.5, 5, 2.5, -3, 3), group = c('A', 'A', 'A', 'B', 'B', 'B'), othergroup = c('good', 'good', 'bad', 'bad', 'good', 'bad')) xx.formula <- compareCluster(Entrez~group, data=mydf, fun='groupGO', OrgDb='org.Hs.eg.db') as.data.frame(xx.formula) ## formula interface with more than one grouping variable xx.formula.twogroups <- compareCluster(Entrez~group+othergroup, data=mydf, fun='groupGO', OrgDb='org.Hs.eg.db') as.data.frame(xx.formula.twogroups) ## End(Not run)## Not run: data(gcSample) xx <- compareCluster(gcSample, fun="enrichKEGG", organism="hsa", pvalueCutoff=0.05) as.data.frame(xx) # plot(xx, type="dot", caption="KEGG Enrichment Comparison") dotplot(xx) ## formula interface mydf <- data.frame(Entrez=c('1', '100', '1000', '100101467', '100127206', '100128071'), logFC = c(1.1, -0.5, 5, 2.5, -3, 3), group = c('A', 'A', 'A', 'B', 'B', 'B'), othergroup = c('good', 'good', 'bad', 'bad', 'good', 'bad')) xx.formula <- compareCluster(Entrez~group, data=mydf, fun='groupGO', OrgDb='org.Hs.eg.db') as.data.frame(xx.formula) ## formula interface with more than one grouping variable xx.formula.twogroups <- compareCluster(Entrez~group+othergroup, data=mydf, fun='groupGO', OrgDb='org.Hs.eg.db') as.data.frame(xx.formula.twogroups) ## End(Not run)
Datasets gcSample contains a sample of gene clusters.
Datasets kegg_species contains kegg species information
Datasets kegg_category contains kegg pathway category information
Datasets DE_GSE8057 contains differential epxressed genes obtained from GSE8057 dataset
download the latest version of KEGG pathway/module
download_KEGG(species, keggType = "KEGG", keyType = "kegg")download_KEGG(species, keggType = "KEGG", keyType = "kegg")
species |
species |
keggType |
one of 'KEGG' or 'MKEGG' |
keyType |
supported keyType, see bitr_kegg |
list
Guangchuang Yu
drop GO term of specific level or specific terms (mostly too general).
dropGO(x, level = NULL, term = NULL)dropGO(x, level = NULL, term = NULL)
x |
an instance of 'enrichResult' or 'compareClusterResult' |
level |
GO level |
term |
GO term |
modified version of x
Guangchuang Yu
enrichment analysis by DAVID
enrichDAVID( gene, idType = "ENTREZ_GENE_ID", universe, minGSSize = 10, maxGSSize = 500, annotation = "GOTERM_BP_FAT", pvalueCutoff = 0.05, pAdjustMethod = "BH", qvalueCutoff = 0.2, species = NA, david.user )enrichDAVID( gene, idType = "ENTREZ_GENE_ID", universe, minGSSize = 10, maxGSSize = 500, annotation = "GOTERM_BP_FAT", pvalueCutoff = 0.05, pAdjustMethod = "BH", qvalueCutoff = 0.2, species = NA, david.user )
gene |
input gene |
idType |
id type |
universe |
background genes. If missing, the all genes listed in the database (eg TERM2GENE table) will be used as background. |
minGSSize |
minimal size of genes annotated for testing |
maxGSSize |
maximal size of genes annotated for testing |
annotation |
david annotation |
pvalueCutoff |
adjusted pvalue cutoff on enrichment tests to report |
pAdjustMethod |
one of "holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none" |
qvalueCutoff |
qvalue cutoff on enrichment tests to report as significant. Tests must pass i) |
species |
species |
david.user |
david user |
A enrichResult instance
Guangchuang Yu
A universal enrichment analyzer
enricher( gene, pvalueCutoff = 0.05, pAdjustMethod = "BH", universe = NULL, minGSSize = 10, maxGSSize = 500, qvalueCutoff = 0.2, gson = NULL, TERM2GENE, TERM2NAME = NA )enricher( gene, pvalueCutoff = 0.05, pAdjustMethod = "BH", universe = NULL, minGSSize = 10, maxGSSize = 500, qvalueCutoff = 0.2, gson = NULL, TERM2GENE, TERM2NAME = NA )
gene |
a vector of gene id |
pvalueCutoff |
adjusted pvalue cutoff on enrichment tests to report |
pAdjustMethod |
one of "holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none" |
universe |
background genes. If missing, the all genes listed in the database (eg TERM2GENE table) will be used as background. |
minGSSize |
minimal size of genes annotated for testing |
maxGSSize |
maximal size of genes annotated for testing |
qvalueCutoff |
qvalue cutoff on enrichment tests to report as significant. Tests must pass i) |
gson |
a GSON object, if not NULL, use it as annotation data. |
TERM2GENE |
user input annotation of TERM TO GENE mapping, a data.frame of 2 column with term and gene. Only used when gson is NULL. |
TERM2NAME |
user input of TERM TO NAME mapping, a data.frame of 2 column with term and name. Only used when gson is NULL. |
A enrichResult instance
Guangchuang Yu https://yulab-smu.top
GO Enrichment Analysis of a gene set. Given a vector of genes, this function will return the enrichment GO categories after FDR control.
enrichGO( gene, OrgDb, keyType = "ENTREZID", ont = "MF", pvalueCutoff = 0.05, pAdjustMethod = "BH", universe, qvalueCutoff = 0.2, minGSSize = 10, maxGSSize = 500, readable = FALSE, pool = FALSE, evidence = NULL )enrichGO( gene, OrgDb, keyType = "ENTREZID", ont = "MF", pvalueCutoff = 0.05, pAdjustMethod = "BH", universe, qvalueCutoff = 0.2, minGSSize = 10, maxGSSize = 500, readable = FALSE, pool = FALSE, evidence = NULL )
gene |
a vector of entrez gene id. |
OrgDb |
OrgDb |
keyType |
keytype of input gene |
ont |
One of "BP", "MF", and "CC" subontologies, or "ALL" for all three. |
pvalueCutoff |
adjusted pvalue cutoff on enrichment tests to report |
pAdjustMethod |
one of "holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none" |
universe |
background genes. If missing, the all genes listed in the database (eg TERM2GENE table) will be used as background. |
qvalueCutoff |
qvalue cutoff on enrichment tests to report as significant. Tests must pass i) |
minGSSize |
minimal size of genes annotated by Ontology term for testing. |
maxGSSize |
maximal size of genes annotated for testing |
readable |
whether mapping gene ID to gene Name |
pool |
If ont='ALL', whether pool 3 GO sub-ontologies |
evidence |
optional character vector of GO evidence codes to keep (for example 'c("IDA", "IPI", "IMP")', or '"IEA"' for electronic annotations only). When supplied, annotations carrying any other evidence code are dropped before the analysis — useful to avoid circular reasoning (dropping 'IEP' when the gene sets come from co-expression clustering) or to keep only manually reviewed annotations (dropping 'IEA'). Because the annotation changes, so does the background, so the resulting terms are not simply a subset of the unfiltered run. Filtered runs are not cached, so they rebuild the annotation each time. 'NULL' (default) uses every annotation. |
An enrichResult instance.
Guangchuang Yu https://yulab-smu.top
[enrichResult-class], [compareCluster]
## Not run: data(geneList, package = "DOSE") de <- names(geneList)[1:100] yy <- enrichGO(de, 'org.Hs.eg.db', ont="BP", pvalueCutoff=0.01) head(yy) ## End(Not run)## Not run: data(geneList, package = "DOSE") de <- names(geneList)[1:100] yy <- enrichGO(de, 'org.Hs.eg.db', ont="BP", pvalueCutoff=0.01) head(yy) ## End(Not run)
KEGG Enrichment Analysis of a gene set. Given a vector of genes, this function will return the enrichment KEGG categories with FDR control.
enrichKEGG( gene, organism = "hsa", keyType = "kegg", pvalueCutoff = 0.05, pAdjustMethod = "BH", universe, minGSSize = 10, maxGSSize = 500, qvalueCutoff = 0.2, use_internal_data = FALSE )enrichKEGG( gene, organism = "hsa", keyType = "kegg", pvalueCutoff = 0.05, pAdjustMethod = "BH", universe, minGSSize = 10, maxGSSize = 500, qvalueCutoff = 0.2, use_internal_data = FALSE )
gene |
a vector of entrez gene id. |
organism |
supported organism listed in 'https://www.genome.jp/kegg/catalog/org_list.html'; alternatively a 'GSON' object (e.g. from 'gson_KEGG()') holding the annotation, which allows the analysis to run without contacting KEGG |
keyType |
one of "kegg", 'ncbi-geneid', 'ncbi-proteinid' and 'uniprot' |
pvalueCutoff |
adjusted pvalue cutoff on enrichment tests to report |
pAdjustMethod |
one of "holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none" |
universe |
background genes. If missing, the all genes listed in the database (eg TERM2GENE table) will be used as background. |
minGSSize |
minimal size of genes annotated by Ontology term for testing. |
maxGSSize |
maximal size of genes annotated for testing |
qvalueCutoff |
qvalue cutoff on enrichment tests to report as significant. Tests must pass i) |
use_internal_data |
logical, use KEGG.db or latest online KEGG data |
A enrichResult instance.
Guangchuang Yu https://yulab-smu.top
[enrichResult-class], [compareCluster]
## Not run: data(geneList, package='DOSE') de <- names(geneList)[1:100] yy <- enrichKEGG(de, pvalueCutoff=0.01) head(yy) ## End(Not run)## Not run: data(geneList, package='DOSE') de <- names(geneList)[1:100] yy <- enrichKEGG(de, pvalueCutoff=0.01) head(yy) ## End(Not run)
As with enrichKEGG(), organism may be a species code or a
GSON object, so module enrichment can be run against a locally built
annotation (see gson_KEGG()) when KEGG is unreachable.
enrichMKEGG( gene, organism = "hsa", keyType = "kegg", pvalueCutoff = 0.05, pAdjustMethod = "BH", universe, minGSSize = 10, maxGSSize = 500, qvalueCutoff = 0.2 )enrichMKEGG( gene, organism = "hsa", keyType = "kegg", pvalueCutoff = 0.05, pAdjustMethod = "BH", universe, minGSSize = 10, maxGSSize = 500, qvalueCutoff = 0.2 )
gene |
a vector of entrez gene id. |
organism |
supported organism listed in 'https://www.genome.jp/kegg/catalog/org_list.html'; alternatively a 'GSON' object (e.g. from 'gson_KEGG()') holding the annotation, which allows the analysis to run without contacting KEGG |
keyType |
one of "kegg", 'ncbi-geneid', 'ncbi-proteinid' and 'uniprot' |
pvalueCutoff |
adjusted pvalue cutoff on enrichment tests to report |
pAdjustMethod |
one of "holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none" |
universe |
background genes. If missing, the all genes listed in the database (eg TERM2GENE table) will be used as background. |
minGSSize |
minimal size of genes annotated by Ontology term for testing. |
maxGSSize |
maximal size of genes annotated for testing |
qvalueCutoff |
qvalue cutoff on enrichment tests to report as significant. Tests must pass i) |
A enrichResult instance.
ORA analysis for Pathway Commons
enrichPC(gene, ...)enrichPC(gene, ...)
gene |
a vector of genes (either hgnc symbols or uniprot IDs) |
... |
additional parameters, see also the parameters supported by the enricher() function |
This function performs over-representation analysis using Pathway Commons
A enrichResult instance
ORA analysis for WikiPathways
enrichWP(gene, organism, ...)enrichWP(gene, organism, ...)
gene |
a vector of entrez gene id |
organism |
supported organisms, which can be accessed via the get_wp_organisms() function |
... |
additional parameters, see also the parameters supported by the enricher() function |
This function performs over-representation analysis using WikiPathways
A enrichResult instance
Guangchuang Yu
Deterministically classifies each gene symbol that an interpretation names as
observed (a member gene of the enrichment result it was given) or out_of_evidence
(a valid symbol that is not). No model is called. Use it to label hypotheses from
interpret_agent() as inferred rather than observed: unlike a second model, this check
is exact and cannot also mark grounded genes as uncertain.
evidence_status( x, enrichment, OrgDb = NULL, symbols = NULL, fields = c("overview", "key_mechanisms", "regulatory_drivers", "crosstalk", "hypothesis", "narrative", "reasoning", "network_evidence") )evidence_status( x, enrichment, OrgDb = NULL, symbols = NULL, fields = c("overview", "key_mechanisms", "regulatory_drivers", "crosstalk", "hypothesis", "narrative", "reasoning", "network_evidence") )
x |
An |
enrichment |
The |
OrgDb |
Optional |
symbols |
Optional character vector of valid gene symbols (alternative to |
fields |
Record fields to scan. |
A data.frame with columns cluster, field, gene and status.
get_ppi_network
get_ppi_network( taxID = 9606, version = "12.0", score_threshold = 400, output = "data.frame" )get_ppi_network( taxID = 9606, version = "12.0", score_threshold = 400, output = "data.frame" )
taxID |
NCBI taxon identifier (e.g., 9606 for Human). |
version |
STRING database version (default: "12.0"). |
score_threshold |
threshold of significance to include a interaction (default: 400). |
output |
one of 'data.frame' or 'igraph' |
Download and cache the full STRING PPI background network for a specific species.
a 'data.frame' or an 'igraph' object containing the background PPI network.
list supported organism of WikiPathways
get_wp_organisms()get_wp_organisms()
This function extracts information from 'https://data.wikipathways.org/current/gmt/' and lists all supported organisms
supported organism list
Guangchuang Yu
getPPI
getPPI( x, ID = 1, taxID = "auto", required_score = NULL, network_type = "functional", add_nodes = 0, show_query_node_labels = 0, output = "igraph" ) get_ppi( x, ID = 1, taxID = "auto", required_score = NULL, network_type = "functional", add_nodes = 0, show_query_node_labels = 0, output = "igraph" )getPPI( x, ID = 1, taxID = "auto", required_score = NULL, network_type = "functional", add_nodes = 0, show_query_node_labels = 0, output = "igraph" ) get_ppi( x, ID = 1, taxID = "auto", required_score = NULL, network_type = "functional", add_nodes = 0, show_query_node_labels = 0, output = "igraph" )
x |
an 'enrichResult“ object or a vector of proteins, e.g. 'c("PTCH1", "TP53", "BRCA1", "BRCA2")' |
ID |
ID or index to extract genes in the enriched term(s) if 'x' is an 'enrichResult' object |
taxID |
NCBI taxon identifiers (e.g. Human is 9606, see: [STRING organisms](https://string-db.org/cgi/input.pl?input_page_active_form=organisms). |
required_score |
threshold of significance to include a interaction, a number between 0 and 1000 (default depends on the network) |
network_type |
network type: functional (default), physical |
add_nodes |
adds a number of proteins with to the network based on their confidence score (default:1) |
show_query_node_labels |
when available use submitted names in the preferredName column when (0 or 1) (default:0) |
output |
one of 'data.frame' or 'igraph' |
[Getting the STRING network interactions](https://string-db.org/cgi/help.pl?sessionId=btsvnCeNrBk7).
a 'data.frame' or an 'igraph' object
Yonghe Xia and modified by Guangchuang Yu
Convert species scientific name to taxonomic ID
getTaxID(species)getTaxID(species)
species |
scientific name of a species |
taxonomic ID
Guangchuang Yu
Query taxonomy information from 'stringdb' or 'ensembl' web services
getTaxInfo(species, source = "stringdb")getTaxInfo(species, source = "stringdb")
species |
scientific name of a species |
source |
one of 'stringdb' or 'ensembl' |
a 'data.frame' of query information
Guangchuang Yu
read GFF file and build gene information table
Gff2GeneTable(gffFile, compress = TRUE)Gff2GeneTable(gffFile, compress = TRUE)
gffFile |
GFF file |
compress |
compress file or not |
given a GFF file, this function extracts information from it and save it in working directory
file save.
Yu Guangchuang
convert goid to ontology (BP, CC, MF)
go2ont(goid)go2ont(goid)
goid |
a vector of GO IDs |
data.frame
Guangchuang Yu
convert goid to descriptive term
go2term(goid)go2term(goid)
goid |
a vector of GO IDs |
data.frame
Guangchuang Yu
filter GO enriched result at specific level
gofilter(x, level = 4)gofilter(x, level = 4)
x |
output from enrichGO or compareCluster |
level |
GO level |
updated object
Guangchuang Yu
Functional Profile of a gene set at specific GO level. Given a vector of genes, this function will return the GO profile at a specific level.
groupGO( gene, OrgDb, keyType = "ENTREZID", ont = "CC", level = 2, readable = FALSE )groupGO( gene, OrgDb, keyType = "ENTREZID", ont = "CC", level = 2, readable = FALSE )
gene |
a vector of entrez gene id. |
OrgDb |
OrgDb |
keyType |
key type of input gene |
ont |
One of "MF", "BP", and "CC" subontologies. |
level |
Specific GO Level. |
readable |
if readable is TRUE, the gene IDs will mapping to gene symbols. |
A groupGOResult instance.
Guangchuang Yu https://yulab-smu.top
[groupGOResult-class], [compareCluster]
## Not run: data(gcSample) yy <- groupGO(gcSample[[1]], 'org.Hs.eg.db', ont="BP", level=2) head(summary(yy)) #plot(yy) ## End(Not run)## Not run: data(gcSample) yy <- groupGO(gcSample[[1]], 'org.Hs.eg.db', ont="BP", level=2) head(summary(yy)) #plot(yy) ## End(Not run)
Class "groupGOResult" This class represents the result of functional Profiles of a set of gene at specific GO level.
resultGO classification result
ontologyOntology
levelGO level
organismone of "human", "mouse" and "yeast"
geneGene IDs
readablelogical flag of gene ID in symbol or not.
Guangchuang Yu https://yulab-smu.top
[compareClusterResult], [compareCluster], [groupGO]
a universal gene set enrichment analysis tools
GSEA( geneList, exponent = 1, minGSSize = 10, maxGSSize = 500, eps = 1e-10, pvalueCutoff = 0.05, pAdjustMethod = "BH", gson = NULL, TERM2GENE, TERM2NAME = NA, verbose = TRUE, nPerm = 1000, method = "multilevel", adaptive = FALSE, minPerm = 101, maxPerm = 1e+05, pvalThreshold = 0.1, seed = FALSE, ... )GSEA( geneList, exponent = 1, minGSSize = 10, maxGSSize = 500, eps = 1e-10, pvalueCutoff = 0.05, pAdjustMethod = "BH", gson = NULL, TERM2GENE, TERM2NAME = NA, verbose = TRUE, nPerm = 1000, method = "multilevel", adaptive = FALSE, minPerm = 101, maxPerm = 1e+05, pvalThreshold = 0.1, seed = FALSE, ... )
geneList |
order ranked geneList |
exponent |
weight of each step |
minGSSize |
minimal size of each geneSet for analyzing |
maxGSSize |
maximal size of genes annotated for testing |
eps |
boundary for calculating the p value in multilevel mode |
pvalueCutoff |
p-value cutoff applied to both the raw p-value and the adjusted p-value (p.adjust), consistent with the historical clusterProfiler/DOSE behavior |
pAdjustMethod |
one of "holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none" |
gson |
a GSON object, if not NULL, use it as annotation data. |
TERM2GENE |
user input annotation of TERM TO GENE mapping, a data.frame of 2 column with term and gene. Only used when gson is NULL. |
TERM2NAME |
user input of TERM TO NAME mapping, a data.frame of 2 column with term and name. Only used when gson is NULL. |
verbose |
logical |
nPerm |
The number of permutations. |
method |
method of calculating the pvalue, one of "multilevel", "monte carlo" and "fgsea" |
adaptive |
logical, whether to use adaptive method for calculating pvalue |
minPerm |
minimal number of permutations for adaptive method |
maxPerm |
maximal number of permutations for adaptive method |
pvalThreshold |
pvalue threshold for adaptive method |
seed |
random seed for reproducibility, set to a number (or TRUE to use a
fixed default seed) to make the result reproducible, or FALSE (default) to draw
a random seed on each run, so results may vary between runs. The underlying
permutation engine uses its own RNG seeded with this value; see
|
... |
other parameters passed to |
gseaResult object
Guangchuang Yu https://yulab-smu.top
Gene Set Enrichment Analysis of Gene Ontology
gseGO( geneList, ont = "BP", OrgDb, keyType = "ENTREZID", exponent = 1, minGSSize = 10, maxGSSize = 500, eps = 1e-10, pvalueCutoff = 0.05, pAdjustMethod = "BH", verbose = TRUE, nPerm = 1000, method = "multilevel", adaptive = FALSE, minPerm = 101, maxPerm = 1e+05, pvalThreshold = 0.1, seed = FALSE, ... )gseGO( geneList, ont = "BP", OrgDb, keyType = "ENTREZID", exponent = 1, minGSSize = 10, maxGSSize = 500, eps = 1e-10, pvalueCutoff = 0.05, pAdjustMethod = "BH", verbose = TRUE, nPerm = 1000, method = "multilevel", adaptive = FALSE, minPerm = 101, maxPerm = 1e+05, pvalThreshold = 0.1, seed = FALSE, ... )
geneList |
order ranked geneList |
ont |
one of "BP", "MF", and "CC" subontologies, or "ALL" for all three. |
OrgDb |
OrgDb |
keyType |
keytype of gene |
exponent |
weight of each step |
minGSSize |
minimal size of each geneSet for analyzing |
maxGSSize |
maximal size of genes annotated for testing |
eps |
boundary for calculating the p value in multilevel mode |
pvalueCutoff |
pvalue Cutoff |
pAdjustMethod |
pvalue adjustment method |
verbose |
print message or not |
nPerm |
The number of permutations. |
method |
method of calculating the pvalue, one of "multilevel", "permute" and "sample" |
adaptive |
logical, whether to use adaptive method for calculating pvalue |
minPerm |
minimal number of permutations for adaptive method |
maxPerm |
maximal number of permutations for adaptive method |
pvalThreshold |
pvalue threshold for adaptive method |
seed |
random seed for reproducibility, set to a number (or TRUE to use a
fixed default seed) to make the result reproducible, or FALSE (default) to draw
a random seed on each run, so results may vary between runs. The underlying
permutation engine uses its own RNG seeded with this value; see
|
... |
other parameters passed to |
gseaResult object
Yu Guangchuang
Gene Set Enrichment Analysis of KEGG
gseKEGG( geneList, organism = "hsa", keyType = "kegg", exponent = 1, minGSSize = 10, maxGSSize = 500, eps = 1e-10, pvalueCutoff = 0.05, pAdjustMethod = "BH", verbose = TRUE, use_internal_data = FALSE, nPerm = 1000, method = "multilevel", adaptive = FALSE, minPerm = 101, maxPerm = 1e+05, pvalThreshold = 0.1, seed = FALSE, ... )gseKEGG( geneList, organism = "hsa", keyType = "kegg", exponent = 1, minGSSize = 10, maxGSSize = 500, eps = 1e-10, pvalueCutoff = 0.05, pAdjustMethod = "BH", verbose = TRUE, use_internal_data = FALSE, nPerm = 1000, method = "multilevel", adaptive = FALSE, minPerm = 101, maxPerm = 1e+05, pvalThreshold = 0.1, seed = FALSE, ... )
geneList |
order ranked geneList |
organism |
supported organism listed in 'https://www.genome.jp/kegg/catalog/org_list.html'; alternatively a 'GSON' object (e.g. from 'gson_KEGG()') holding the annotation, which allows the analysis to run without contacting KEGG |
keyType |
one of "kegg", 'ncbi-geneid', 'ncib-proteinid' and 'uniprot' |
exponent |
weight of each step |
minGSSize |
minimal size of each geneSet for analyzing |
maxGSSize |
maximal size of genes annotated for testing |
eps |
boundary for calculating the p value in multilevel mode |
pvalueCutoff |
pvalue Cutoff |
pAdjustMethod |
pvalue adjustment method |
verbose |
print message or not |
use_internal_data |
logical, use KEGG.db or latest online KEGG data |
nPerm |
The number of permutations. |
method |
method of calculating the pvalue, one of "multilevel", "permute" and "sample" |
adaptive |
logical, whether to use adaptive method for calculating pvalue |
minPerm |
minimal number of permutations for adaptive method |
maxPerm |
maximal number of permutations for adaptive method |
pvalThreshold |
pvalue threshold for adaptive method |
seed |
random seed for reproducibility, set to a number (or TRUE to use a
fixed default seed) to make the result reproducible, or FALSE (default) to draw
a random seed on each run, so results may vary between runs. The underlying
permutation engine uses its own RNG seeded with this value; see
|
... |
other parameters passed to |
gseaResult object
Yu Guangchuang
Gene Set Enrichment Analysis of KEGG Module
gseMKEGG( geneList, organism = "hsa", keyType = "kegg", exponent = 1, minGSSize = 10, maxGSSize = 500, eps = 1e-10, pvalueCutoff = 0.05, pAdjustMethod = "BH", verbose = TRUE, nPerm = 1000, method = "multilevel", adaptive = FALSE, minPerm = 101, maxPerm = 1e+05, pvalThreshold = 0.1, seed = FALSE, ... )gseMKEGG( geneList, organism = "hsa", keyType = "kegg", exponent = 1, minGSSize = 10, maxGSSize = 500, eps = 1e-10, pvalueCutoff = 0.05, pAdjustMethod = "BH", verbose = TRUE, nPerm = 1000, method = "multilevel", adaptive = FALSE, minPerm = 101, maxPerm = 1e+05, pvalThreshold = 0.1, seed = FALSE, ... )
geneList |
order ranked geneList |
organism |
supported organism listed in 'https://www.genome.jp/kegg/catalog/org_list.html'; alternatively a 'GSON' object (e.g. from 'gson_KEGG()') holding the annotation, which allows the analysis to run without contacting KEGG |
keyType |
one of "kegg", 'ncbi-geneid', 'ncib-proteinid' and 'uniprot' |
exponent |
weight of each step |
minGSSize |
minimal size of each geneSet for analyzing |
maxGSSize |
maximal size of genes annotated for testing |
eps |
boundary for calculating the p value in multilevel mode |
pvalueCutoff |
pvalue Cutoff |
pAdjustMethod |
pvalue adjustment method |
verbose |
print message or not |
nPerm |
The number of permutations. |
method |
method of calculating the pvalue, one of "multilevel", "permute" and "sample" |
adaptive |
logical, whether to use adaptive method for calculating pvalue |
minPerm |
minimal number of permutations for adaptive method |
maxPerm |
maximal number of permutations for adaptive method |
pvalThreshold |
pvalue threshold for adaptive method |
seed |
random seed for reproducibility, set to a number (or TRUE to use a
fixed default seed) to make the result reproducible, or FALSE (default) to draw
a random seed on each run, so results may vary between runs. The underlying
permutation engine uses its own RNG seeded with this value; see
|
... |
other parameters passed to |
gseaResult object
Yu Guangchuang
GSEA analysis for Pathway Commons
gsePC(geneList, eps = 1e-10, ...)gsePC(geneList, eps = 1e-10, ...)
geneList |
a ranked gene list |
eps |
boundary for calculating the p value in multilevel mode |
... |
additional parameters, see also the parameters supported by the GSEA() function |
This function performs GSEA using Pathway Commons
A gseaResult instance
GSEA analysis for WikiPathways
gseWP(geneList, organism, eps = 1e-10, ...)gseWP(geneList, organism, eps = 1e-10, ...)
geneList |
ranked gene list |
organism |
supported organisms, which can be accessed via the get_wp_organisms() function |
eps |
boundary for calculating the p value in multilevel mode |
... |
additional parameters, see also the parameters supported by the GSEA() function |
This function performs GSEA using WikiPathways
A gseaResult instance
Guangchuang Yu
download the latest version of KEGG pathway and stored in a 'GSON' object
gson_GO(OrgDb, keytype = "ENTREZID", ont = "BP")gson_GO(OrgDb, keytype = "ENTREZID", ont = "BP")
OrgDb |
OrgDb |
keytype |
keytype of genes. |
ont |
one of "BP", "MF", "CC", and "ALL" |
a 'GSON' object
Build a gson object that annotate Gene Ontology
gson_GO_local(data, ont = c("ALL", "BP", "CC", "MF"), species = NULL, ...)gson_GO_local(data, ont = c("ALL", "BP", "CC", "MF"), species = NULL, ...)
data |
a two-column data.frame of original GO annotation. The columns are "gene_id" and "go_id". |
ont |
type of GO annotation, which is "ALL", "BP", "MF", or "CC". default: "ALL". |
species |
name of species. Default: NULL. |
... |
pass to 'gson::gson()' constructor. |
a 'gson' instance
data = data.frame(gene_id = "gene1", go_id = c("GO:0035492", "GO:0009764", "GO:0031040", "GO:0033714", "GO:0036349")) gson_GO_local(data, species = "E. coli")data = data.frame(gene_id = "gene1", go_id = c("GO:0035492", "GO:0009764", "GO:0031040", "GO:0033714", "GO:0036349")) gson_GO_local(data, species = "E. coli")
download the latest version of KEGG pathway and stored in a 'GSON' object
gson_KEGG(species, KEGG_Type = "KEGG", keyType = "kegg")gson_KEGG(species, KEGG_Type = "KEGG", keyType = "kegg")
species |
species |
KEGG_Type |
one of "KEGG" and "MKEGG" |
keyType |
one of "kegg", 'ncbi-geneid', 'ncib-proteinid', 'uniprot', and 'ko'. |
a 'GSON' object
Guangchuang Yu
KEGG Mapper service can annotate protein sequences for novel species with KO database, and KO annotation need to be converted into Pathway or Module annotation, which can then be used in 'clusterProfiler'
gson_KEGG_mapper( file, format = c("BLAST", "Ghost", "Kofam"), type = c("pathway", "module"), species = NULL, ... )gson_KEGG_mapper( file, format = c("BLAST", "Ghost", "Kofam"), type = c("pathway", "module"), species = NULL, ... )
file |
the name of the file which comes from the KEGG Mapper service, see Details for file format |
format |
string indicate format of KEGG Mapper result |
type |
string indicate annotation database |
species |
your species, NULL if ignored |
... |
pass to gson::gson() |
File is a two-column dataset with K numbers in the second column, optionally preceded by the user's identifiers in the first column. This is consistent with the output files of automatic annotation servers, BlastKOALA, GhostKOALA, and KofamKOALA. KOALA (KEGG Orthology And Links Annotation) is KEGG's internal annotation tool for K number assignment of KEGG GENES using SSEARCH computation. BlastKOALA and GhostKOALA assign K numbers to the user's sequence data by BLAST and GHOSTX searches, respectively, against a nonredundant set of KEGG GENES. KofamKOALA is a new member of the KOALA family available at GenomeNet using the HMM profile search, rather than the sequence similarity search, for K number assignment. see https://www.kegg.jp/blastkoala/, https://www.kegg.jp/ghostkoala/ and https://www.genome.jp/tools/kofamkoala/ for more information.
a gson instance
## Not run: file = system.file('extdata', "kegg_mapper_blast.txt", package='clusterProfiler') gson_KEGG_mapper(file, format = "BLAST", type = "pathway") ## End(Not run)## Not run: file = system.file('extdata', "kegg_mapper_blast.txt", package='clusterProfiler') gson_KEGG_mapper(file, format = "BLAST", type = "pathway") ## End(Not run)
Download KEGG Orthology annotation as a GSON object
gson_KO()gson_KO()
a 'GSON' object
Download the latest version of WikiPathways data and stored in a 'GSON' object
gson_WP(organism)gson_WP(organism)
organism |
supported organism, which can be accessed via the get_wp_organisms() function. |
list ID types supported by annoDb
idType(OrgDb = "org.Hs.eg.db")idType(OrgDb = "org.Hs.eg.db")
OrgDb |
annotation db |
character vector
Guangchuang Yu
Functions for interpreting functional enrichment analysis results using Large Language Models. Supports single-call interpretation, multi-agent deep analysis, and hierarchical cluster strategies.
Built on top of aisdk's 'generate_object()' for reliable structured output, and the Agent/Session system for multi-agent pipelines.
Sends enrichment results along with optional experimental context to an LLM to generate a structured biological interpretation, hypothesis, and narrative suitable for a publication.
interpret( x, context = NULL, n_pathways = NULL, model = NULL, add_ppi = FALSE, gene_fold_change = NULL, gene_stats = NULL, max_tokens = 8192, temperature = 0.3, reduce = TRUE, reduce_threshold = NULL, reasoning = NULL, verbose = FALSE, reduce_go = NULL, go_reduction_threshold = NULL )interpret( x, context = NULL, n_pathways = NULL, model = NULL, add_ppi = FALSE, gene_fold_change = NULL, gene_stats = NULL, max_tokens = 8192, temperature = 0.3, reduce = TRUE, reduce_threshold = NULL, reasoning = NULL, verbose = FALSE, reduce_go = NULL, go_reduction_threshold = NULL )
x |
An enrichment result object ( |
context |
A string describing the experimental background (e.g., "scRNA-seq of mouse myocardial infarction at day 3"). |
n_pathways |
Maximum number of terms (per cluster) sent to the model, taken in order
of adjusted p-value after reduction. |
model |
Optional LLM model. When |
add_ppi |
Logical, whether to query STRING PPI network data. Default FALSE. |
gene_fold_change |
Named numeric vector of log fold changes for expression context.
For a |
gene_stats |
Optional data frame of per-gene statistics from the differential
analysis behind |
max_tokens |
Maximum tokens for the LLM response. Default 8192. Some models (especially reasoning models) may need much higher values (e.g., 16384 or more) to produce complete structured output. |
temperature |
Sampling temperature. Default 0.3. |
reduce |
Logical. Run |
reduce_threshold |
Similarity threshold passed to |
reasoning |
Optional reasoning/thinking configuration passed through to the
provider, e.g. |
verbose |
Logical, whether to print debug messages showing raw API
responses, token usage, and JSON parsing details. Default FALSE.
Equivalent to setting |
reduce_go, go_reduction_threshold
|
Earlier names of |
Uses generate_object() internally for reliable structured output with
automatic JSON repair, eliminating manual parsing failures.
An interpretation object (list): overview, regulatory_drivers, key_mechanisms,
crosstalk, hypothesis, narrative, refined_network and network_evidence. interpret()
interprets the enrichment result and nothing else; to combine it with the results of
other tools (a SingleR label, a TF-activity ranking, a complex enrichment) and reach a
conclusion, use interpret_agent() with prior.
## Not run: # Basic usage with a data frame df <- data.frame( ID = c("GO:0006915", "GO:0008284"), Description = c("apoptotic process", "positive regulation of proliferation"), GeneRatio = c("10/100", "20/100"), p.adjust = c(0.01, 0.02), geneID = c("TP53/BAX", "MYC/CCND1/CDK4") ) res <- interpret(df, model = "deepseek:deepseek-chat", context = "Cancer proliferation study" ) # Every significant term, one representative per theme (the default) ego <- enrichGO(gene = genes, OrgDb = org.Mm.eg.db, ont = "BP") res <- interpret(ego) # A shorter prompt for a model with a short context: merge more terms per theme res <- interpret(ego, reduce_threshold = 0.3) # Reuse aisdk's global default model # aisdk::set_model("openai:gpt-4o-mini") # res <- interpret(df, context = "Cancer proliferation study") print(res) ## End(Not run)## Not run: # Basic usage with a data frame df <- data.frame( ID = c("GO:0006915", "GO:0008284"), Description = c("apoptotic process", "positive regulation of proliferation"), GeneRatio = c("10/100", "20/100"), p.adjust = c(0.01, 0.02), geneID = c("TP53/BAX", "MYC/CCND1/CDK4") ) res <- interpret(df, model = "deepseek:deepseek-chat", context = "Cancer proliferation study" ) # Every significant term, one representative per theme (the default) ego <- enrichGO(gene = genes, OrgDb = org.Mm.eg.db, ont = "BP") res <- interpret(ego) # A shorter prompt for a model with a short context: merge more terms per theme res <- interpret(ego, reduce_threshold = 0.3) # Reuse aisdk's global default model # aisdk::set_model("openai:gpt-4o-mini") # res <- interpret(df, context = "Cancer proliferation study") print(res) ## End(Not run)
Employs specialized AI agents in sequence for rigorous interpretation, and is the entry
point that combines the enrichment evidence with the results of other tools (prior)
into a conclusion:
Agent Cleaner: Filters noise and selects relevant pathways.
Agent Detective: Identifies key regulators and functional modules.
Agent Synthesizer: Produces a coherent biological narrative.
Agent Reviewer (optional, review = TRUE): Audits the draft for
grounding, overclaiming, and experimental-label fidelity; flags issues and
returns a corrected overview.
interpret_agent( x, context = NULL, prior = NULL, n_pathways = NULL, model = NULL, add_ppi = FALSE, gene_fold_change = NULL, max_tokens = 8192, temperature = 0.3, review = FALSE, reduce = TRUE, reduce_threshold = NULL, reasoning = NULL, verbose = FALSE, reduce_go = NULL, go_reduction_threshold = NULL )interpret_agent( x, context = NULL, prior = NULL, n_pathways = NULL, model = NULL, add_ppi = FALSE, gene_fold_change = NULL, max_tokens = 8192, temperature = 0.3, review = FALSE, reduce = TRUE, reduce_threshold = NULL, reasoning = NULL, verbose = FALSE, reduce_go = NULL, go_reduction_threshold = NULL )
x |
An enrichment result object. |
context |
A string describing the experimental background. State the question the
analysis should answer here (for example "which cell type is this cluster?"); the answer
is returned as |
prior |
Optional results of other tools to be checked against the enrichment
evidence, as text: a SingleR or scGPT label, a ranked list of transcription factors from
a regulon analysis, the protein complexes enriched in the gene list, and so on. A single
string applies to every cluster; a named character vector or list supplies one entry
per cluster. The Detective and the Synthesizer see it as a claim to check, not as
evidence, and the result gains |
n_pathways |
Maximum number of terms (per cluster) the Cleaner starts from, taken in
order of adjusted p-value after reduction. |
model |
Optional LLM model. When |
add_ppi |
Logical, whether to query PPI data. Default FALSE. |
gene_fold_change |
Named numeric vector of log fold changes. When supplied, every input gene is also listed to the Detective and the Synthesizer, most up-regulated first. |
max_tokens |
Maximum tokens per agent call. Default 8192. |
temperature |
Sampling temperature. Default 0.3. |
review |
Logical, whether to run a final Reviewer agent (Agent 4) that
audits the synthesized draft against the input evidence for grounding,
overclaiming, experimental-label fidelity, and evidence sufficiency
(whether the supplied evidence classes can support a claim as specific as
the draft makes). When |
reduce |
Logical. Run |
reduce_threshold |
Similarity threshold passed to |
reasoning |
Optional reasoning/thinking configuration passed through to the
provider, e.g. |
verbose |
Logical, whether to print debug messages. Default FALSE. |
reduce_go, go_reduction_threshold
|
Earlier names of |
Uses aisdk's Agent and Session system for shared context across agents.
An interpretation object with deep analysis fields, conclusion (the answer to
the question the context poses), plus regulatory_drivers, refined_network, and
network_evidence from the detective agent. When prior is supplied, also
prior_verdict and prior_rationale. When review = TRUE, also includes review and
overview_original. The review field reports grounding separately from
resolution: abstain_recommended = "yes" flags a draft whose cited
evidence is real but which resolves to a more specific entity than that
evidence can single out, with supported_resolution giving the claim the
evidence does support.
## Not run: res <- interpret_agent(df, model = "openai:gpt-4o", context = "scRNA-seq of mouse MI day 3" ) print(res) # Check another tool's answer against the enrichment evidence res <- interpret_agent(ego_cluster3, context = "PBMC scRNA-seq; which cell type is cluster 3?", gene_fold_change = fc3, prior = "SingleR (HPCA): T_cell:CD4+_Naive" ) res$conclusion; res$prior_verdict ## End(Not run)## Not run: res <- interpret_agent(df, model = "openai:gpt-4o", context = "scRNA-seq of mouse MI day 3" ) print(res) # Check another tool's answer against the enrichment evidence res <- interpret_agent(ego_cluster3, context = "PBMC scRNA-seq; which cell type is cluster 3?", gene_fold_change = fc3, prior = "SingleR (HPCA): T_cell:CD4+_Naive" ) res$conclusion; res$prior_verdict ## End(Not run)
First interprets major clusters to establish lineage context, then interprets sub-clusters with hierarchical constraints from the major cluster annotations.
interpret_hierarchical( x_minor, x_major, mapping, model = NULL, max_tokens = 8192, temperature = 0.3, n_pathways = NULL, reduce = TRUE, reduce_threshold = NULL )interpret_hierarchical( x_minor, x_major, mapping, model = NULL, max_tokens = 8192, temperature = 0.3, n_pathways = NULL, reduce = TRUE, reduce_threshold = NULL )
x_minor |
Enrichment result for sub-clusters. |
x_major |
Enrichment result for major clusters. |
mapping |
A named vector mapping sub-cluster IDs to major cluster IDs. |
model |
Optional LLM model. When 'NULL' (default), uses the aisdk package-wide default model configured via 'aisdk::set_model()'. You can also supply a model ID in 'provider:model' format or a 'LanguageModelV1' object. Bare model names are supported with a warning. |
max_tokens |
Maximum tokens. Default 8192. |
temperature |
Sampling temperature. Default 0.3. |
n_pathways, reduce, reduce_threshold
|
Passed to both levels, as in |
An 'interpretation_list' object with a cell-type label ('cell_type', 'confidence', 'reasoning', 'markers') per sub-cluster.
convert ko ID to descriptive name
ko2name(ko)ko2name(ko)
ko |
ko ID |
data.frame
guangchuang yu
merge a list of enrichResult objects to compareClusterResult
merge_result(enrichResultList)merge_result(enrichResultList)
enrichResultList |
a list of enrichResult objects |
a compareClusterResult instance
Guangchuang Yu
Multi-layer Network-based Gene Set Enrichment Analysis of Gene Ontology
mnseGO( seed_list, networks, couplings, ont = "BP", OrgDb, keyType = "ENTREZID", mode = c("evidence", "signed"), layer_weights = NULL, collapse = c("weighted_mean", "sum", "mean", "max_abs"), target_layer = NULL, output_space = c("union", "gene"), p = 0.5, interlayer_strength = 1, specific_weight = FALSE, minGSSize = 10, maxGSSize = 500, threshold = 1e-09, maxIter = 100, verbose = TRUE, ... )mnseGO( seed_list, networks, couplings, ont = "BP", OrgDb, keyType = "ENTREZID", mode = c("evidence", "signed"), layer_weights = NULL, collapse = c("weighted_mean", "sum", "mean", "max_abs"), target_layer = NULL, output_space = c("union", "gene"), p = 0.5, interlayer_strength = 1, specific_weight = FALSE, minGSSize = 10, maxGSSize = 500, threshold = 1e-09, maxIter = 100, verbose = TRUE, ... )
seed_list |
named list of named numeric vectors, one per layer |
networks |
named list of layer-specific networks |
couplings |
data.frame of inter-layer edges |
ont |
one of "BP", "MF", and "CC" subontologies, or "ALL" for all three. |
OrgDb |
OrgDb |
keyType |
keytype of gene |
mode |
propagation mode, one of "evidence" and "signed" |
layer_weights |
optional named numeric vector of layer weights |
collapse |
one of "weighted_mean", "sum", "mean", or "max_abs" |
target_layer |
optional layer name to export scores from |
output_space |
one of "union" and "gene" |
p |
restart probability for RWR |
interlayer_strength |
global scaling factor for coupling edges |
specific_weight |
logical, whether to apply gene specificity weighting |
minGSSize |
minimal size of each geneSet for analyzing |
maxGSSize |
maximal size of genes annotated for testing |
threshold |
convergence threshold for RWR |
maxIter |
maximal number of RWR iterations |
verbose |
print message or not |
... |
other parameters passed to |
mnseaResult object
Multi-layer Network-based Gene Set Enrichment Analysis of KEGG
mnseKEGG( seed_list, networks, couplings, organism = "hsa", keyType = "kegg", mode = c("evidence", "signed"), layer_weights = NULL, collapse = c("weighted_mean", "sum", "mean", "max_abs"), target_layer = NULL, output_space = c("union", "gene"), p = 0.5, interlayer_strength = 1, specific_weight = FALSE, minGSSize = 10, maxGSSize = 500, threshold = 1e-09, maxIter = 100, verbose = TRUE, use_internal_data = FALSE, ... )mnseKEGG( seed_list, networks, couplings, organism = "hsa", keyType = "kegg", mode = c("evidence", "signed"), layer_weights = NULL, collapse = c("weighted_mean", "sum", "mean", "max_abs"), target_layer = NULL, output_space = c("union", "gene"), p = 0.5, interlayer_strength = 1, specific_weight = FALSE, minGSSize = 10, maxGSSize = 500, threshold = 1e-09, maxIter = 100, verbose = TRUE, use_internal_data = FALSE, ... )
seed_list |
named list of named numeric vectors, one per layer |
networks |
named list of layer-specific networks |
couplings |
data.frame of inter-layer edges |
organism |
supported organism listed in 'https://www.genome.jp/kegg/catalog/org_list.html', or a GSON object |
keyType |
one of "kegg", 'ncbi-geneid', 'ncbi-proteinid' and 'uniprot' |
mode |
propagation mode, one of "evidence" and "signed" |
layer_weights |
optional named numeric vector of layer weights |
collapse |
one of "weighted_mean", "sum", "mean", or "max_abs" |
target_layer |
optional layer name to export scores from |
output_space |
one of "union" and "gene" |
p |
restart probability for RWR |
interlayer_strength |
global scaling factor for coupling edges |
specific_weight |
logical, whether to apply gene specificity weighting |
minGSSize |
minimal size of each geneSet for analyzing |
maxGSSize |
maximal size of genes annotated for testing |
threshold |
convergence threshold for RWR |
maxIter |
maximal number of RWR iterations |
verbose |
print message or not |
use_internal_data |
logical, use KEGG.db or latest online KEGG data |
... |
other parameters passed to |
mnseaResult object
Multi-layer Network-based Gene Set Enrichment Analysis of KEGG Module
mnseMKEGG( seed_list, networks, couplings, organism = "hsa", keyType = "kegg", mode = c("evidence", "signed"), layer_weights = NULL, collapse = c("weighted_mean", "sum", "mean", "max_abs"), target_layer = NULL, output_space = c("union", "gene"), p = 0.5, interlayer_strength = 1, specific_weight = FALSE, minGSSize = 10, maxGSSize = 500, threshold = 1e-09, maxIter = 100, verbose = TRUE, ... )mnseMKEGG( seed_list, networks, couplings, organism = "hsa", keyType = "kegg", mode = c("evidence", "signed"), layer_weights = NULL, collapse = c("weighted_mean", "sum", "mean", "max_abs"), target_layer = NULL, output_space = c("union", "gene"), p = 0.5, interlayer_strength = 1, specific_weight = FALSE, minGSSize = 10, maxGSSize = 500, threshold = 1e-09, maxIter = 100, verbose = TRUE, ... )
seed_list |
named list of named numeric vectors, one per layer |
networks |
named list of layer-specific networks |
couplings |
data.frame of inter-layer edges |
organism |
supported organism listed in 'https://www.genome.jp/kegg/catalog/org_list.html', or a GSON object |
keyType |
one of "kegg", 'ncbi-geneid', 'ncbi-proteinid' and 'uniprot' |
mode |
propagation mode, one of "evidence" and "signed" |
layer_weights |
optional named numeric vector of layer weights |
collapse |
one of "weighted_mean", "sum", "mean", or "max_abs" |
target_layer |
optional layer name to export scores from |
output_space |
one of "union" and "gene" |
p |
restart probability for RWR |
interlayer_strength |
global scaling factor for coupling edges |
specific_weight |
logical, whether to apply gene specificity weighting |
minGSSize |
minimal size of each geneSet for analyzing |
maxGSSize |
maximal size of genes annotated for testing |
threshold |
convergence threshold for RWR |
maxIter |
maximal number of RWR iterations |
verbose |
print message or not |
... |
other parameters passed to |
mnseaResult object
Multi-layer Network-based Gene Set Enrichment Analysis of WikiPathways
mnseWP( seed_list, networks, couplings, organism, mode = c("evidence", "signed"), layer_weights = NULL, collapse = c("weighted_mean", "sum", "mean", "max_abs"), target_layer = NULL, output_space = c("union", "gene"), p = 0.5, interlayer_strength = 1, specific_weight = FALSE, minGSSize = 10, maxGSSize = 500, threshold = 1e-09, maxIter = 100, verbose = TRUE, ... )mnseWP( seed_list, networks, couplings, organism, mode = c("evidence", "signed"), layer_weights = NULL, collapse = c("weighted_mean", "sum", "mean", "max_abs"), target_layer = NULL, output_space = c("union", "gene"), p = 0.5, interlayer_strength = 1, specific_weight = FALSE, minGSSize = 10, maxGSSize = 500, threshold = 1e-09, maxIter = 100, verbose = TRUE, ... )
seed_list |
named list of named numeric vectors, one per layer |
networks |
named list of layer-specific networks |
couplings |
data.frame of inter-layer edges |
organism |
supported organisms listed by |
mode |
propagation mode, one of "evidence" and "signed" |
layer_weights |
optional named numeric vector of layer weights |
collapse |
one of "weighted_mean", "sum", "mean", or "max_abs" |
target_layer |
optional layer name to export scores from |
output_space |
one of "union" and "gene" |
p |
restart probability for RWR |
interlayer_strength |
global scaling factor for coupling edges |
specific_weight |
logical, whether to apply gene specificity weighting |
minGSSize |
minimal size of each geneSet for analyzing |
maxGSSize |
maximal size of genes annotated for testing |
threshold |
convergence threshold for RWR |
maxIter |
maximal number of RWR iterations |
verbose |
print message or not |
... |
other parameters passed to |
mnseaResult object
Network-based Gene Set Enrichment Analysis of Gene Ontology
nseGO( geneList, network, ont = "BP", OrgDb, keyType = "ENTREZID", mode = c("evidence", "signed"), p = 0.5, specific_weight = FALSE, minGSSize = 10, maxGSSize = 500, threshold = 1e-09, maxIter = 100, verbose = TRUE, ... )nseGO( geneList, network, ont = "BP", OrgDb, keyType = "ENTREZID", mode = c("evidence", "signed"), p = 0.5, specific_weight = FALSE, minGSSize = 10, maxGSSize = 500, threshold = 1e-09, maxIter = 100, verbose = TRUE, ... )
geneList |
order ranked geneList |
network |
edge list (data.frame with 2 or 3 columns) or sparse matrix |
ont |
one of "BP", "MF", and "CC" subontologies, or "ALL" for all three. |
OrgDb |
OrgDb |
keyType |
keytype of gene |
mode |
propagation mode, one of "evidence" and "signed" |
p |
restart probability for RWR |
specific_weight |
logical, whether to apply gene specificity weighting |
minGSSize |
minimal size of each geneSet for analyzing |
maxGSSize |
maximal size of genes annotated for testing |
threshold |
convergence threshold for RWR |
maxIter |
maximal number of RWR iterations |
verbose |
print message or not |
... |
other parameters passed to |
nseaResult object
Network-based Gene Set Enrichment Analysis of KEGG
nseKEGG( geneList, network, organism = "hsa", keyType = "kegg", mode = c("evidence", "signed"), p = 0.5, specific_weight = FALSE, minGSSize = 10, maxGSSize = 500, threshold = 1e-09, maxIter = 100, verbose = TRUE, use_internal_data = FALSE, ... )nseKEGG( geneList, network, organism = "hsa", keyType = "kegg", mode = c("evidence", "signed"), p = 0.5, specific_weight = FALSE, minGSSize = 10, maxGSSize = 500, threshold = 1e-09, maxIter = 100, verbose = TRUE, use_internal_data = FALSE, ... )
geneList |
order ranked geneList |
network |
edge list (data.frame with 2 or 3 columns) or sparse matrix |
organism |
supported organism listed in 'https://www.genome.jp/kegg/catalog/org_list.html', or a GSON object |
keyType |
one of "kegg", 'ncbi-geneid', 'ncbi-proteinid' and 'uniprot' |
mode |
propagation mode, one of "evidence" and "signed" |
p |
restart probability for RWR |
specific_weight |
logical, whether to apply gene specificity weighting |
minGSSize |
minimal size of each geneSet for analyzing |
maxGSSize |
maximal size of genes annotated for testing |
threshold |
convergence threshold for RWR |
maxIter |
maximal number of RWR iterations |
verbose |
print message or not |
use_internal_data |
logical, use KEGG.db or latest online KEGG data |
... |
other parameters passed to |
nseaResult object
Network-based Gene Set Enrichment Analysis of KEGG Module
nseMKEGG( geneList, network, organism = "hsa", keyType = "kegg", mode = c("evidence", "signed"), p = 0.5, specific_weight = FALSE, minGSSize = 10, maxGSSize = 500, threshold = 1e-09, maxIter = 100, verbose = TRUE, ... )nseMKEGG( geneList, network, organism = "hsa", keyType = "kegg", mode = c("evidence", "signed"), p = 0.5, specific_weight = FALSE, minGSSize = 10, maxGSSize = 500, threshold = 1e-09, maxIter = 100, verbose = TRUE, ... )
geneList |
order ranked geneList |
network |
edge list (data.frame with 2 or 3 columns) or sparse matrix |
organism |
supported organism listed in 'https://www.genome.jp/kegg/catalog/org_list.html', or a GSON object |
keyType |
one of "kegg", 'ncbi-geneid', 'ncbi-proteinid' and 'uniprot' |
mode |
propagation mode, one of "evidence" and "signed" |
p |
restart probability for RWR |
specific_weight |
logical, whether to apply gene specificity weighting |
minGSSize |
minimal size of each geneSet for analyzing |
maxGSSize |
maximal size of genes annotated for testing |
threshold |
convergence threshold for RWR |
maxIter |
maximal number of RWR iterations |
verbose |
print message or not |
... |
other parameters passed to |
nseaResult object
Network-based Gene Set Enrichment Analysis of WikiPathways
nseWP( geneList, network, organism, mode = c("evidence", "signed"), p = 0.5, specific_weight = FALSE, minGSSize = 10, maxGSSize = 500, threshold = 1e-09, maxIter = 100, verbose = TRUE, ... )nseWP( geneList, network, organism, mode = c("evidence", "signed"), p = 0.5, specific_weight = FALSE, minGSSize = 10, maxGSSize = 500, threshold = 1e-09, maxIter = 100, verbose = TRUE, ... )
geneList |
order ranked geneList |
network |
edge list (data.frame with 2 or 3 columns) or sparse matrix |
organism |
supported organisms listed by |
mode |
propagation mode, one of "evidence" and "signed" |
p |
restart probability for RWR |
specific_weight |
logical, whether to apply gene specificity weighting |
minGSSize |
minimal size of each geneSet for analyzing |
maxGSSize |
maximal size of genes annotated for testing |
threshold |
convergence threshold for RWR |
maxIter |
maximal number of RWR iterations |
verbose |
print message or not |
... |
other parameters passed to |
nseaResult object
plot
## S3 method for class 'interpretation' plot(x, layout = "nicely", ...)## S3 method for class 'interpretation' plot(x, layout = "nicely", ...)
x |
An 'interpretation' object. |
layout |
Graph layout, default is "nicely". |
... |
Additional arguments passed to 'ggplot2::ggplot'. |
plot GO graph
plotGOgraph( x, firstSigNodes = 10, useInfo = "all", sigForAll = TRUE, useFullNames = TRUE, ... )plotGOgraph( x, firstSigNodes = 10, useInfo = "all", sigForAll = TRUE, useFullNames = TRUE, ... )
x |
output of enrichGO or gseGO |
firstSigNodes |
number of significant nodes (retangle nodes in the graph) |
useInfo |
additional info |
sigForAll |
if TRUE the score/p-value of all nodes in the DAG is shown, otherwise only score will be shown |
useFullNames |
logical |
... |
additional parameter of showSigOfNodes, please refer to topGO |
GO DAG graph
Guangchuang Yu
Returns the execution record attached to a result of interpret(),
interpret_agent() or interpret_hierarchical(): the model actually addressed, the
decoding parameters requested (and whether the response confirmed them), SHA-256 digests
of the system prompt, user prompt, raw response and input evidence, token usage,
finish_reason, per-call status and package versions.
provenance(x)provenance(x)
x |
An |
A remote model is not a versionable dependency. Without this record an interpretation
cannot be reproduced, and a call that failed at the transport layer is indistinguishable
from a model that had nothing to say – both arrive as an ordinary result object. Check
provenance(x)$ok before treating any interpretation as data.
An interpret_provenance list, or NULL if the object carries no stamp.
Parse gmt file from Pathway Common
read.gmt.pc(gmtfile, output = "data.frame")read.gmt.pc(gmtfile, output = "data.frame")
gmtfile |
A gmt file |
output |
one of 'data.frame' or 'GSON' |
This function parse gmt file downloaded from Pathway common
A data.frame or A GSON object depends on the value of 'output'
Applies semantic similarity-based clustering to remove redundant GO terms before LLM interpretation. This algorithmic preprocessing complements the multi-agent interpretation layer by reducing input noise and token count.
reduce_go_redundancy( enrich_result, threshold = 0.7, orgdb = NULL, method = "Wang" )reduce_go_redundancy( enrich_result, threshold = 0.7, orgdb = NULL, method = "Wang" )
enrich_result |
An enrichResult object from enrichGO() |
threshold |
Semantic similarity threshold (0-1). Higher values are more aggressive. Default 0.7 means terms with >70% similarity are clustered. |
orgdb |
OrgDb package name (e.g., "org.Hs.eg.db"). If NULL, auto-detected from the enrichResult organism field. |
method |
Similarity measure passed to |
Implemented directly on GOSemSim, which is already an Imports dependency.
The rrvgo_* attribute names are kept for backwards compatibility with
existing ablation outputs and predate the switch away from rrvgo.
A reduced enrichResult object with redundant terms removed. The object
carries attributes recording the reduction: rrvgo_reduced, rrvgo_original_n,
rrvgo_reduced_n, rrvgo_threshold, rrvgo_method.
## Not run: ego <- enrichGO(gene = genes, OrgDb = org.Mm.eg.db, ont = "BP") ego_reduced <- reduce_go_redundancy(ego, threshold = 0.7) message(sprintf("Reduced from %d to %d terms", attr(ego_reduced, "rrvgo_original_n"), attr(ego_reduced, "rrvgo_reduced_n"))) ## End(Not run)## Not run: ego <- enrichGO(gene = genes, OrgDb = org.Mm.eg.db, ont = "BP") ego_reduced <- reduce_go_redundancy(ego, threshold = 0.7) message(sprintf("Reduced from %d to %d terms", attr(ego_reduced, "rrvgo_original_n"), attr(ego_reduced, "rrvgo_reduced_n"))) ## End(Not run)
Keeps one representative for each group of near-duplicate significant terms, so that
every significant theme of a long result can be shown to the model without repeating
its near-synonyms. GO results are grouped by Wang semantic similarity over the GO DAG
(GOSemSim); every other gene-set collection (KEGG, Reactome, WikiPathways, MSigDB,
custom TERM2GENE) by the Jaccard overlap of the member genes the result reports
(geneID, or core_enrichment for GSEA). Groups are formed greedily in order of
adjusted p-value: the most significant remaining term is kept and every remaining term
more similar to it than threshold is dropped. Only terms that pass the object's
cutoffs are considered; a compareClusterResult is reduced within each cluster, and a
GO result spanning several ontologies within each ontology. Deterministic, and makes no
model call. interpret() and interpret_agent() call it by default (reduce = TRUE).
reduce_redundancy( x, threshold = NULL, method = c("auto", "Wang", "jaccard"), semData = NULL )reduce_redundancy( x, threshold = NULL, method = c("auto", "Wang", "jaccard"), semData = NULL )
x |
An |
threshold |
Similarity above which a term joins the group of a more significant
term. |
method |
|
semData |
Optional |
x with the redundant significant terms removed. Attributes record the step:
reduced, n_original, n_reduced, reduction_method and reduction_threshold,
and the legacy rrvgo_* names read by earlier analysis scripts.
## Not run: ego <- enrichGO(gene = genes, OrgDb = org.Hs.eg.db, ont = "BP") reduce_redundancy(ego) # Wang, 0.5 kk <- enrichKEGG(gene = genes, organism = "hsa") reduce_redundancy(kk) # Jaccard on member genes, 0.5 ## End(Not run)## Not run: ego <- enrichGO(gene = genes, OrgDb = org.Hs.eg.db, ont = "BP") reduce_redundancy(ego) # Wang, 0.5 kk <- enrichKEGG(gene = genes, organism = "hsa") reduce_redundancy(kk) # Jaccard on member genes, 0.5 ## End(Not run)
search kegg organism, listed in https://www.genome.jp/kegg/catalog/org_list.html
search_kegg_organism( str, by = "scientific_name", ignore.case = FALSE, use_internal_data = TRUE )search_kegg_organism( str, by = "scientific_name", ignore.case = FALSE, use_internal_data = TRUE )
str |
string |
by |
one of 'kegg.code', 'scientific_name' and 'common_name' |
ignore.case |
TRUE or FALSE |
use_internal_data |
logical, use kegg_species.rda or latest online KEGG data |
data.frame
Guangchuang Yu
simplify output from enrichGO and gseGO by removing redundancy of enriched GO terms
simplify output from compareCluster by removing redundancy of enriched GO terms
## S4 method for signature 'enrichResult' simplify( x, cutoff = 0.7, by = "p.adjust", select_fun = min, measure = "Wang", semData = NULL ) ## S4 method for signature 'gseaResult' simplify( x, cutoff = 0.7, by = "p.adjust", select_fun = min, measure = "Wang", semData = NULL ) ## S4 method for signature 'compareClusterResult' simplify( x, cutoff = 0.7, by = "p.adjust", select_fun = min, measure = "Wang", semData = NULL )## S4 method for signature 'enrichResult' simplify( x, cutoff = 0.7, by = "p.adjust", select_fun = min, measure = "Wang", semData = NULL ) ## S4 method for signature 'gseaResult' simplify( x, cutoff = 0.7, by = "p.adjust", select_fun = min, measure = "Wang", semData = NULL ) ## S4 method for signature 'compareClusterResult' simplify( x, cutoff = 0.7, by = "p.adjust", select_fun = min, measure = "Wang", semData = NULL )
x |
output of enrichGO |
cutoff |
similarity cutoff |
by |
feature to select representative term, selected by 'select_fun' function |
select_fun |
function to select feature passed by 'by' parameter |
measure |
method to measure similarity |
semData |
GOSemSimDATA object |
updated enrichResult object
updated compareClusterResult object
Guangchuang Yu
Gwang-Jin Kim and Guangchuang Yu
issue #28 https://github.com/GuangchuangYu/clusterProfiler/issues/28
issue #162 https://github.com/GuangchuangYu/clusterProfiler/issues/162
retreve annotation data from uniprot
uniprot_get(taxID)uniprot_get(taxID)
taxID |
taxonomy ID |
gene table data frame
guangchuang yu