enrichplot icon indicating copy to clipboard operation
enrichplot copied to clipboard

converting p.adjust in enrichResult

Open olechnwin opened this issue 4 years ago • 0 comments

Apologize if this is asked before, I tried to search but cannot find similar issue.

Is there a way to convert the p.adjust in enrichResult to -log10(p.adjust)? I am trying to plot the log10 p.adjust using dotplot. I tried the following but it doesn't work:

library(DOSE)
data(geneList)
de <- names(geneList)[abs(geneList) > 2]
edo <- enrichDGN(de)
edo$p.adjust = -log10(edo$p.adjust)
Error in `$<-`(`*tmp*`, p.adjust, value = c(6.80458428978122, 5.51727026405766,  :
  no method for assigning subsets of this S4 class

I was able to convert to log10 and named it log10.p.adjust using mutate but then I wasn't able to do dotplot:

edo <- mutate(edo, log10.p.adjust = -log10(as.numeric(p.adjust)))
dotplot(edo,color=log10.p.adjust)
Error in match.arg(color, c("pvalue", "p.adjust", "qvalue")) :
  'arg' should be one of “pvalue”, “p.adjust”, “qvalue”

Thank you in advance for your help

olechnwin avatar Jul 01 '21 15:07 olechnwin