funcEnrich.Fisher: Gene Set Enrichment Analysis by Fisher's Exact Test

View source: R/pipeline_functions.R

funcEnrich.FisherR Documentation

Gene Set Enrichment Analysis by Fisher's Exact Test

Description

funcEnrich.Fisher performs gene set enrichment analysis to the input gene list, by using the Fisher's Exact Test. Background gene list is accepeted.

Usage

funcEnrich.Fisher(
  input_list = NULL,
  bg_list = NULL,
  use_gs = NULL,
  gs2gene = NULL,
  min_gs_size = 5,
  max_gs_size = 500,
  Pv_adj = "fdr",
  Pv_thre = 0.1
)

Arguments

input_list

a vector of characters, a vector of gene symbols. If gene symbols are not available, users can call get_IDtransfer and get_name_transfertab for ID conversion.

bg_list

a vector of characters, a vector of background gene symbols. If NULL, genes in gs2gene will be used as background. Default is NULL.

use_gs

a vector of characters, the names of gene sets. If gs2gene is NULL, all_gs2gene will be used. The use_gs must be the subset of names(all_gs2gene). If "all", all the gene sets in gs2gene will be used. If user input his own gs2gene list, use_gs will be set to "all" as default. Default is c("H", "CP:BIOCARTA", "CP:REACTOME", "CP:KEGG").

gs2gene

list, a list contains elements of gene sets. The name of the element is gene set, each element contains a vector of genes in that gene set. If NULL, will use all_gs2gene, which is created by function gs.preload. Default is NULL.

min_gs_size

numeric, the minimum size of gene set to analysis. Default is 5.

max_gs_size

numeric, the maximum size of gene set to analysis. Default is 500.

Pv_adj

character, method to adjust P-value. Default is "fdr". For details, please check p.adjust.methods.

Pv_thre

numeric, threshold for the adjusted P-values. Default is 0.1.

Value

Return a data.frame, contains gene sets with significant enrichment statistics. Column details are as follows,

#Name

Name of the enriched gene set

Total_item

Background size

Num_item

Number of genes in the gene set (filtered by the background list)

Num_list

Number of input genes for testing (filtered by the background list)

Num_list_item

Number of input genes annotated by the gene set (filtered by the background list)

Ori_P

Original P-value from Fisher's Exact Test

Adj_P

Adjusted P-value

Odds_Ratio

Odds ratio from the 2*2 matrix used for Fisher's Exact Test

Intersected_items

A vector of the intersected genes, collapsed by ';'. Number is equal to Num_list_item

Examples

analysis.par <- list()
analysis.par$out.dir.DATA <- system.file('demo1','driver/DATA/',package = "NetBID2")
NetBID.loadRData(analysis.par=analysis.par,step='ms-tab')
ms_tab <- analysis.par$final_ms_tab
sig_driver <- draw.volcanoPlot(dat=ms_tab,label_col='gene_label',
                               logFC_col='logFC.G4.Vs.others_DA',
                               Pv_col='P.Value.G4.Vs.others_DA',
                               logFC_thre=0.4,
                               Pv_thre=1e-7,
                               main='Volcano Plot for G4.Vs.others_DA',
                               show_label=FALSE,
                               label_type = 'origin',
                               label_cex = 0.5)
gs.preload(use_spe='Homo sapiens',update=FALSE)
res1 <- funcEnrich.Fisher(input_list=ms_tab[rownames(sig_driver),'geneSymbol'],
                               bg_list=ms_tab[,'geneSymbol'],
                               use_gs=c('H','C5'),
                               Pv_thre=0.1,Pv_adj = 'none')
## Not run: 


jyyulab/NetBID documentation built on Dec. 23, 2024, 6:34 a.m.