Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiplicity correction for pathway enrichment not working in enrich function for hypergeometric analysis #16

Closed
billy-s-lab opened this issue Oct 30, 2020 · 1 comment

Comments

@billy-s-lab
Copy link

Hello,

Is it to possible to adjust the p-values from hypergeometric analysis for multiple testing?
I see on page 8 of the package documentation (https://bioconductor.org/packages/release/bioc/manuals/FELLA/man/FELLA.pdf) that there is a p.adjust argument for the enrich function. However, when I pass different options to the p.adjust argument (fdr, bonferroni, etc), it does not change the p-values for pathway enrichment. Should I calculate adjusted pvalues manually on the hypergeometric results table?
Code I am running is below.
Thank you.

analysis.hypergeometric <- enrich(
compounds = cpd.kegg.id,
data = fella.data,
method = "hypergeom",
p.adjust = "fdr",
approx = "normality")

table.hypergeometric <- generateResultsTable( #FELLA github issue 14 - try to identify CompoundHits for each pathway: #14
object = analysis.hypergeometric,
plimit = 30, threshold = 0.05,
data = fella.data,
method = "hypergeom",
NamesAsLabels = TRUE)

table.hypergeometric$p.adjust <- p.adjust(table.hypergeometric$p.value, method="BH")

table.hypergeometric$p.adjust <- p.adjust(table.hypergeometric$p.value, method="bonferroni")

@SergiPicart
Copy link
Contributor

Hi, the p-values are fdr-adjusted by default. The ellipsis in enrich() only passes on its arguments to runDiffusion() and runPagerank(). You can still use runHypergeom() with your preferred adjustment. Below is an example. We can check for the future if it is possible to make enrich() pass on arguments to runHypergeom().

# example on how to change p-value adjustment in hypergeom
library(FELLA)
library(magrittr)

data("FELLA.sample")
data("input.sample")

# enrich does not pass the p.adjust argument to runHypergeom
# see ?enrich (only passes ellipsis along to runDiffusion, runPagerank)
myAnalysis <- enrich(
  compounds = input.sample, 
  method = "hypergeom", 
  data = FELLA.sample)

df.default <- generateResultsTable(
  method = "hypergeom", 
  object = myAnalysis, 
  data = FELLA.sample, 
  threshold = 1) 

df.fdr <- defineCompounds(compounds = input.sample, data = FELLA.sample) %>%
  runHypergeom(data = FELLA.sample, p.adjust = "fdr") %>%
  generateResultsTable(
    object = .,
    method = "hypergeom", 
    data = FELLA.sample, 
    threshold = 1) 

df.none <- defineCompounds(compounds = input.sample, data = FELLA.sample) %>%
  runHypergeom(data = FELLA.sample, p.adjust = "none") %>%
  generateResultsTable(
    object = .,
    method = "hypergeom", 
    data = FELLA.sample, 
    threshold = 1) 

# default is fdr 
df.default$p.value

# same as manually setting fdr
df.fdr$p.value

# or manually adjusting "none"
p.adjust(df.none$p.value, method = "fdr")

# unadjusted p-values
df.none$p.value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants