printEnrichR: Export results from Enrichr to tsv

View source: R/func_markers.R

printEnrichRR Documentation

Export results from Enrichr to tsv

Description

This function takes a list of list of DataFrames containing Enrichr results returned by runEnrichR() and save all the results in the list object to individual text files.

Usage

printEnrichR(
  object,
  prefix = "enrichr",
  showTerms = NULL,
  columns = c(1:9),
  dir_path = NULL
)

Arguments

object

A named list of list of DataFrames storing outputs returned by runEnrichR(), each of which contains results for the corresponding group of comparison.

prefix

A string indicating the prefix of output file. Default is "enrichr".

showTerms

An integer scalar indicating the number of terms to save to file. All terms are saved when showTerms = NULL. Default is NULL.

columns

An integer vector indicating the columns from each entry of data to save to file. All columns are saved when columns = c(1:9). Default is c(1:9). 1-"Term", 2-"Overlap", 3-"P.value", 4-"Adjusted.P.value", 5-"Old.P.value", 6-"Old.Adjusted.P.value", 7-"Odds.Ratio", 8-"Combined.Score", 9-"Combined.Score".

dir_path

The directory path for exported TSV. The files are exported to the current working directory when file_path = NULL. Default is NULL.

Details

We are not using printEnrich() in the enrichR package to print results due to a bug not yet fixed in the current verion in CRAN at the time of writing (v3.0).

Author(s)

I-Hsuan Lin

See Also

runEnrichR()

Examples

## Not run: 
# Load demo dataset
data(res_deseq2)

# We construct a list of 3 DataFrames using the same DESeq2 output (`res_deseq2`)
# to mimic having a list containing results from multiple sets of comparisons.
res.de <- list(A_B = res_deseq2, A_C = res_deseq2, B_C = res_deseq2)

# Select gene-set libraries
dbs <- c("GO_Molecular_Function_2018", "GO_Biological_Process_2018")

# Run enrichR using the D. melanogaster specific modEnrichr site, and
# specify the gene symbols are stored in the 'external_gene_name' column
res.ora <- runEnrichR(res.de,
  dbs = dbs, site = "FlyEnrichr",
  column_by = "external_gene_name"
)

# Save results to TSV files in the per-session temporary directory
printEnrichR(res.ora, prefix = "Enrichr", dir_path = tempdir())

## End(Not run)

ycl6/scRUtils documentation built on Feb. 18, 2025, 6:14 a.m.