Skip to contents

RunHypergeometricTest - run a hypergeometric test on results returned by GetContrastResults or GetContrastResultsRaw

Usage

RunHypergeometricTest(
  result_list,
  TERM2GENE_dataframe,
  pval_threshold = 0.05,
  logFC_threshold = 0.5,
  usefdr_threshold = FALSE
)

Arguments

result_list

results returned by by GetContrastResults or GetContrastResultsRaw

TERM2GENE_dataframe

see clusterprofiler, these objects are automatically loaded in the scglmmr package one of term_df_btm, term_df_kegg, term_df_reactome etc.

pval_threshold

p threshold for genes to consider in hypergeometric distribution

logFC_threshold

logFC threshold for genes to consider in hypergeometric distribution

usefdr_threshold

use the FDR adjusted p values for ranking genes-this is a strict filter for single cell data, recommended to set FALSE

Value

tidy hypergeometric test results dataframe

Examples

if (FALSE) {
load(termdf) # this term2gene dataframe is included in the package see clusterProfiler
hyp = scglmmr::RunHypergeometricTest(result_list = fit_res,
                                     TERM2GENE_dataframe = termdf,
                                     pval_threshold = 0.1,
                                     logFC_threshold = 0,
                                     usefdr_threshold = FALSE)
# plot results
scglmmr::PlotHypergeometric(hyperg_result = hyp,
                            p.adjust.filter = 0.1,
                            genenumber_filter = 2,
                            savepath = figpath,
                            savename = "name",
                            title = "title")
 }