diffEnrich: diffEnrich

View source: R/diffEnrich.R

diffEnrichR Documentation

diffEnrich

Description

This function takes the objects generated from pathEnrich. If performing a dfferential enrichment analysis, the user will have 2 objects. There will be one for the genes of interest in gene list 1 and one for the genes of interest in gene list 2 (see example for pathEnrich). This function then uses a Fisher's Exact test to identify differentially enriched pathways between the terms enriched in the gene-of-interest lists. diffEnrich will remove KEGG pathways that do not contain any genes from either gene list as these cannot be tested, and will print a warning message telling the user how many pathways were removed. diffEnrich returns a dataframe containing differentially enriched pathways with their associated estimated odds ratio, unadjusted p-value, and fdr adjusted p-value. S3 generic functions for print and summary are provided. The print function prints the results table as a tibble, and the summary function returns the number of pathways that reached statistical significance as well as their descriptions, the number of genes used from the KEGG data base, the KEGG species, the number of pathways that were shared (and therefore tested) between the gene lists and the method used for multiple testing correction.

Usage

diffEnrich(list1_pe, list2_pe, method = "BH", cutoff = 0.05)

## S3 method for class 'diffEnrich'
print(x, ...)

## S3 method for class 'diffEnrich'
summary(object, ...)

Arguments

list1_pe

object of class pathEnrich generated from pathEnrich. See example for pathEnrich.

list2_pe

object of class pathEnrich generated from pathEnrich. See example for pathEnrich.

method

character. Character string telling diffEnrich which method to use for multiple testing correction. Available methods are thos provided by p.adjust, and the default is "BH", or False Discovery Rate (FDR).

cutoff

Numeric. The p-value threshold to be used as the cutoff when determining statistical significance, and used to filter list of significant pathways.

x

object of class diffEnrich

...

Unused

object

object of class diffEnrich

Value

A list object of class diffEnrich that contains 5 items:

species

The species used in enrichment

padj

The method used to correct for multiple testing for the differential enrichment

sig_paths

The KEGG pathways the reached statistical significance after multiple testing correction.

path_intersect

the number of pathways that were shared (and therefore tested) between the gene lists.

de_table

A data frame that summarizes the results of the differential enrichment analysis and contains the following variables:

KEGG_PATHWAY_ID

KEGG Pathway Identifier

KEGG_PATHWAY_description

Description of KEGG Pathway (provided by KEGG)

KEGG_PATHWAY_cnt

Number of Genes in KEGG Pathway

KEGG_DATABASE_cnt

Number of Genes in KEGG Database

KEGG_PATHWAY_in_list1

Number of Genes from gene list 1 in KEGG Pathway

KEGG_DATABASE_in_list1

Number of Genes from gene list 1 in KEGG Database

expected_list1

Expected number of genes from list 1 to be in KEGG pathway by chance (i.e., not enriched)

enrich_p_list1

P-value for enrichment of list 1 genes related to KEGG pathway

p_adj_list1

Multiple testing adjustment of enrich_p_list1 (default = False Discovery Rate (Benjamini and Hochberg))

fold_enrichment_list1

KEGG_PATHWAY_in_list1/expected_list1

KEGG_PATHWAY_in_list2

Number of Genes from gene list 2 in KEGG Pathway

KEGG_DATABASE_in_list2

Number of Genes from gene list 2 in KEGG Database

expected_list2

Expected number of genes from list 2 to be in KEGG pathway by chance (i.e., not enriched)

enrich_p_list2

P-value for enrichment of list 2 genes related to KEGG pathway

p_adj_list2

Multiple testing adjustment of enrich_p_list2 (default = False Discovery Rate (Benjamini and Hochberg))

fold_enrichment_list2

KEGG_PATHWAY_in_list2/expected_list2

odd_ratio

Odds of a gene from list 2 being from this KEGG pathway / Odds of a gene from list 1 being from this KEGG pathway

diff_enrich_p

P-value for differential enrichment of this KEGG pathway between list 1 and list 2

diff_enrich_adjusted

Multiple testing adjustment of diff_enrich_p (default = False Discovery Rate (Benjamini and Hochberg))

Examples

## Generate individual enrichment reults
list1_pe <- pathEnrich(gk_obj = kegg, gene_list = geneLists$list1)
list2_pe <- pathEnrich(gk_obj = kegg, gene_list = geneLists$list2)

## Perform differential enrichment
dif_enrich <- diffEnrich(list1_pe = list1_pe, list2_pe = list2_pe, method = 'none', cutoff = 0.05)


diffEnrich documentation built on June 28, 2022, 1:08 a.m.