| Title: | R Client for the 'ChEA3' Transcription Factor Enrichment API |
|---|---|
| Description: | Interface to the 'ChEA3' transcription factor enrichment API. 'ChEA3' integrates evidence from ChIP-seq, co-expression, and literature resources to prioritize transcription factors regulating a given set of genes. This package provides convenient R functions to query the API, retrieve ranked results across collections (including integrated scores), and standardize output for downstream analysis in R/Bioconductor workflows. See <https://maayanlab.cloud/chea3/> or Keenan (2019) <doi:10.1093/nar/gkz446> for further details. |
| Authors: | Christophe Tav [aut, cre] (ORCID: <https://orcid.org/0000-0001-8808-9617>) |
| Maintainer: | Christophe Tav <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.0.1 |
| Built: | 2026-05-28 08:25:28 UTC |
| Source: | https://github.com/ckntav/rchea3 |
Example gene set of downregulated (repressed) genes in A549 cells after dexamethasone treatment. To keep the dataset small and suitable for examples and tests, only the first 15 downregulated gene symbols are included here.
a549_dex_downrega549_dex_downreg
A character vector of length 15, containing HGNC gene symbols.
The full list of differentially expressed genes (activated and repressed) is provided as Supplementary Table S3 in Tav et al. (2023). The raw Excel file can be downloaded directly from Frontiers in Genetics: https://www.frontiersin.org/api/v4/articles/1237092/file/Table_3.XLSX/1237092_supplementary-materials_tables_3_xlsx/1.
In this package, we subset the data to only the first 15 repressed genes,
which are stored in the object a549_dex_downreg.
Supplementary Table S3 from Tav et al. (2023).
Tav C, Fournier É, Fournier M, Khadangi F, Baguette A, Côté MC, Silveira MAD, Bérubé-Simard F-A, Bourque G, Droit A, Bilodeau S (2023). "Glucocorticoid stimulation induces regionalized gene responses within topologically associating domains." Frontiers in Genetics. doi:10.3389/fgene.2023.1237092
# Load dataset data(a549_dex_downreg) a549_dex_downreg# Load dataset data(a549_dex_downreg) a549_dex_downreg
Print the top-n rows for each ChEA3 collection
displayTopN( results, n = 10, columns = c("Rank", "TF", "Scaled Rank", "Set_name", "Intersect", "Score", "FET p-value", "FDR", "Odds Ratio") )displayTopN( results, n = 10, columns = c("Rank", "TF", "Scaled Rank", "Set_name", "Intersect", "Score", "FET p-value", "FDR", "Odds Ratio") )
results |
A named list of data frames (the output of |
n |
Number of rows to show per table (default: 10). |
columns |
Optional character vector of column names to display (keeps intersection with what's present in each data frame). |
(Invisibly) a named list of data frames, each truncated to the first
n rows (and columns if provided).
genes <- c("TP53", "MYC", "STAT3", "FOXO1", "BRCA1") results <- queryChEA3(genes, verbose = FALSE) # Display top 10 TFs from each collection displayTopN(results) # Display only top 5 with specific columns displayTopN(results, n = 5, columns = c("Rank", "TF", "Score", "FDR"))genes <- c("TP53", "MYC", "STAT3", "FOXO1", "BRCA1") results <- queryChEA3(genes, verbose = FALSE) # Display top 10 TFs from each collection displayTopN(results) # Display only top 5 with specific columns displayTopN(results, n = 5, columns = c("Rank", "TF", "Score", "FDR"))
Write a rChEA3 results object (named list of data frames, one per collection) to an Excel workbook, with one sheet per collection.
exportResults( results, output_dir, output_file = "rChEA3_results", with_date = TRUE, verbose = TRUE )exportResults( results, output_dir, output_file = "rChEA3_results", with_date = TRUE, verbose = TRUE )
results |
A named list of data frames (e.g., the return of
|
output_dir |
A string specifying the output directory. This parameter is required and has no default. |
output_file |
Base file name (without extension). Default: |
with_date |
Logical; if |
verbose |
Logical; if |
(Invisibly) the full path to the saved .xlsx file.
data(a549_dex_downreg) results <- queryChEA3(genes = a549_dex_downreg, query_name = "test_a549_dex_downreg") exportResults(results, output_dir = tempdir(), output_file = "rChEA3_results_a549_dex_downreg.xlsx")data(a549_dex_downreg) results <- queryChEA3(genes = a549_dex_downreg, query_name = "test_a549_dex_downreg") exportResults(results, output_dir = tempdir(), output_file = "rChEA3_results_a549_dex_downreg.xlsx")
#' Sends a gene list to the ChEA3 web service to identify enriched transcription factors using multiple evidence sources. The gene list should consist of HGNC-approved gene symbols.
queryChEA3( genes, query_name = "rChEA3_query", verbose = TRUE, url = "https://maayanlab.cloud/chea3/api/enrich/" )queryChEA3( genes, query_name = "rChEA3_query", verbose = TRUE, url = "https://maayanlab.cloud/chea3/api/enrich/" )
genes |
Character vector of HGNC gene symbols. |
query_name |
Optional query name (default: "rChEA3_query"). |
verbose |
Logical; if TRUE, print a grouped summary of available result collections (default: TRUE). |
url |
Character; full URL of the ChEA3 enrichment endpoint.
Defaults to the public API at
|
A named list of data frames. Each element corresponds to a ChEA3 collection and contains an enrichment table with transcription factors and their statistics. The expected names are: c("Integrated–meanRank", "Integrated–topRank", "GTEx–Coexpression", "ARCHS4–Coexpression", "ENCODE–ChIP-seq", "ReMap–ChIP-seq", "Literature–ChIP-seq", "Enrichr–Queries").
results <- queryChEA3(c("SMAD9","FOXO1","MYC","STAT1","STAT3","SMAD3")) names(results) head(results[["Integrated--meanRank"]]) # Querying a local ChEA3 server # results <- queryChEA3( # c("SMAD9","FOXO1","MYC"), # url = "http://localhost:8080/chea3/api/enrich/" # )results <- queryChEA3(c("SMAD9","FOXO1","MYC","STAT1","STAT3","SMAD3")) names(results) head(results[["Integrated--meanRank"]]) # Querying a local ChEA3 server # results <- queryChEA3( # c("SMAD9","FOXO1","MYC"), # url = "http://localhost:8080/chea3/api/enrich/" # )
This function saves a visualization object to a file in the specified
format and directory. It supports visualizations generated by
chea3_visualizeRank(), ggplot2, or any other plot object that
can be rendered using print() inside a graphics device. Optionally,
the current date (stored in the today variable) can be prepended to
the filename.
saveViz( viz, output_dir, output_file = "figure_rChEA3", format = "pdf", with_date = TRUE, width = 8, height = 5, resolution = 300, verbose = TRUE )saveViz( viz, output_dir, output_file = "figure_rChEA3", format = "pdf", with_date = TRUE, width = 8, height = 5, resolution = 300, verbose = TRUE )
viz |
A visualization object typically created by
|
output_dir |
A string specifying the output directory. This parameter is required and has no default. |
output_file |
A string specifying the base filename (without
extension). Defaults to |
format |
Output format. One of |
with_date |
Logical (default |
width |
Width of the output file in inches. Default is 8. |
height |
Height of the output file in inches. Default is 5. |
resolution |
Resolution in DPI (only used for PNG). Default is 300. |
verbose |
Logical. If |
The visualization is saved to a file on disk. Invisibly returns the full path to the saved file.
genes <- c("TP53", "MYC", "STAT3") results <- queryChEA3(genes, verbose = FALSE) meanRank_res <- results[["Integrated--meanRank"]] # Create visualization viz <- visualizeRank(meanRank_res) # Save as PDF saveViz(viz, output_dir = tempdir(), output_file = "chea3_results") # Save as PNG with custom dimensions saveViz(viz, output_dir = tempdir(), output_file = "chea3_results", format = "png", width = 10, height = 6)genes <- c("TP53", "MYC", "STAT3") results <- queryChEA3(genes, verbose = FALSE) meanRank_res <- results[["Integrated--meanRank"]] # Create visualization viz <- visualizeRank(meanRank_res) # Save as PDF saveViz(viz, output_dir = tempdir(), output_file = "chea3_results") # Save as PNG with custom dimensions saveViz(viz, output_dir = tempdir(), output_file = "chea3_results", format = "png", width = 10, height = 6)
This variable stores the current date (in "yyyymmdd" format) at the time the
package is loaded. It is useful for reproducible filenames (e.g., in
saveViz()), and is automatically set when the package is attached.
todaytoday
A character string (e.g., "20250908").
# Print the date stored at package load library(rChEA3) today # Use it in a filename paste0(today, "_rCHEA3_plot_meanRank.pdf")# Print the date stored at package load library(rChEA3) today # Use it in a filename paste0(today, "_rCHEA3_plot_meanRank.pdf")
Create a bar plot of the most significant transcription factors from a
ChEA3 result table. The y-axis can be based on FDR, FET p-value,
or Score (for integrated results). Bars are ordered by rank (Rank = 1
at the top).
visualizeRank( df_result, y_metric = c("auto", "FDR", "FET p-value", "Score"), fdr_threshold = 0.05, p_threshold = 0.05, query_name = "myGeneList", title_plot = "rChEA3 results (transcription factor enrichment analysis)", top_n = 10, fill_color = "#7AAACE" )visualizeRank( df_result, y_metric = c("auto", "FDR", "FET p-value", "Score"), fdr_threshold = 0.05, p_threshold = 0.05, query_name = "myGeneList", title_plot = "rChEA3 results (transcription factor enrichment analysis)", top_n = 10, fill_color = "#7AAACE" )
df_result |
A ChEA3 result data frame. Must contain at least columns:
|
y_metric |
Character; which metric to use on the y-axis. One of:
|
fdr_threshold |
Numeric; FDR cutoff for significance (default |
p_threshold |
Numeric; p-value cutoff for significance (default |
query_name |
Character; name of the input gene set, shown in the subtitle (default |
title_plot |
Character; main plot title (default |
top_n |
Integer; number of TFs to display (default |
fill_color |
Character; fill color of the bars (default |
The plot subtitle automatically reports the number of significant TFs
(after filtering by fdr_threshold or p_threshold when applicable),
while top_n controls how many of those TFs are displayed. For
integrated collections (Mean Rank and Top Rank), the subtitle shows
a descriptive label instead of individual library names.
A ggplot object.
# Example with integrated meanRank results genes <- c("STAT3", "RELA", "MYC", "FOXO1", "TP53") results <- queryChEA3(genes, verbose = FALSE) meanRank_res <- results[["Integrated--meanRank"]] visualizeRank(meanRank_res, y_metric = "Score", top_n = 15) # Example with ChIP-seq results (FET p-value-based) chip_res <- results[["ENCODE--ChIP-seq"]] visualizeRank(chip_res, y_metric = "FET p-value")# Example with integrated meanRank results genes <- c("STAT3", "RELA", "MYC", "FOXO1", "TP53") results <- queryChEA3(genes, verbose = FALSE) meanRank_res <- results[["Integrated--meanRank"]] visualizeRank(meanRank_res, y_metric = "Score", top_n = 15) # Example with ChIP-seq results (FET p-value-based) chip_res <- results[["ENCODE--ChIP-seq"]] visualizeRank(chip_res, y_metric = "FET p-value")