kevinblighe / EnhancedVolcano

Publication-ready volcano plots with enhanced colouring and labeling
399 stars 81 forks source link

Adjusted P-Value Cut Off Problem #80

Closed eseffar closed 3 years ago

eseffar commented 3 years ago

Hi, I started to use Enhanced Volcano Plot package (R) recently. It's a wonderful tool but I got a problem with the adjusted p-value cut off. In fact, when I specify the adjusted p-value column (as in the documentation) with the code below, the cutoff disappear.

EnhancedVolcano(data,
  lab = rownames(data),
  x = 'Log2.fold.change',
  y = 'P.value',
  pCutoffCol = 'BY.p.value',
  cutoffLineWidth = 0.5,
  cutoffLineCol = 'black',
  #selectLab = rownames(data)[which(names(keyvals) %in% c('UP', 'DOWN'))],
  selectLab = "",
  xlab = bquote(~Log[2]~ 'fold change'),
  title = 'DEG Analysis - Volcano Plot',
  subtitle = "Subtitle",
  pCutoff = 0.0001,
  caption = bquote(~Log[2]~ "fold change cutoff, 2; adjusted p-value cutoff, 10e-4"),
  FCcutoff = 2,
  pointSize = 4,
  ylim = c(0, -log10(10e-9)),
  labSize = 4,
  colCustom = keyvals,
  colAlpha = 1,
  boxedLabels = TRUE,
  legendPosition = 'bottom',
  legendLabSize = 15,
  legendIconSize = 5.0,
  drawConnectors = TRUE,
  widthConnectors = 0.5,
  colConnectors = 'black',
  gridlines.major = FALSE,
  gridlines.minor = FALSE,
  border = 'partial',
  borderWidth = 1.5,
  borderColour = 'black') + 
  ggplot2::scale_x_continuous(
    breaks=seq(-14,14, 2))

I obtain the following plot : https://zupimages.net/up/21/24/wyjt.png

I tried with different p-value as cutoff : 0.05 / 0.01 / 0.001 / 0.0001 and the problem persists.

When I delete the following code line : pCutoffCol = 'BY.p.value', It works again but not like I want.
https://zupimages.net/up/21/24/8fua.png

Do you have an idea to resolve this ?

Thank you in advance, Evan

kevinblighe commented 3 years ago

Hi, I wonder could you show the output of:

str(data) ?

lindsaynhayes commented 3 years ago

I think I am having the same problem, but I can't see the linked images from @Evan-SF. I followed the vignette and I am using results from DEseq2 analysis. It plots if I remove the pCutoffCol='padj'

EnhancedVolcano(group, lab = group$symbol, x = 'log2FoldChange', y = 'pvalue',
+     title = 'Group_EXP_vs_CON', subtitle = "", 
+     pCutoff = 0.05, FCcutoff = 0.5,
+     pointSize = 2.0, labSize = 3, pCutoffCol=`padj`)
Error in EnhancedVolcano(group, lab = group$symbol, x = "log2FoldChange",  : 
  unused argument (pCutoffCol = padj)

class(group)
[1] "DESeqResults"
attr(,"package")
[1] "DESeq2"

head(group, n=2)
log2 fold change (MAP): Group EXP vs CON 
Wald test p-value: Group EXP vs CON 
DataFrame with 2 rows and 6 columns
                       baseMean log2FoldChange     lfcSE      pvalue      padj      symbol
                      <numeric>      <numeric> <numeric>   <numeric> <numeric> <character>
ENSMUSG00000000001.4  3321.2089     -0.0632567 0.0596994 0.115262705 0.5479586       Gnai3
ENSMUSG00000000028.15   50.6586      0.6834223 0.1983465 0.000023498 0.0108854       Cdc45
kevinblighe commented 3 years ago

Hey @lindsaynhayes, thanks for posting. In your case, is it related to the fact that pCutoffCol is using what appear to be back-ticks around padj? I have not, unfortunately, heard back from the other user. This package functionality using pCutoffCol does seem to work, though, as evidenced by this code chunk in the weekly-generated vignette: https://bioconductor.org/packages/release/bioc/vignettes/EnhancedVolcano/inst/doc/EnhancedVolcano.html#adjust-p-value-cut-off

lindsaynhayes commented 3 years ago

I tried all versions of ticks and copy and pasted the text directly from the vignette (and the Rscript), but all give the same error. Let me try the development version. Maybe it is a dependence issue. -- nope same error.

could it be my R4.0?

sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16

[1] EnhancedVolcano_1.9.13 

Update: ok so a hard reboot fixed everything and it is plotting. :) When in doubt restart...

kevinblighe commented 3 years ago

Thanks for the update! I'm not sure why a restart made it work - perhaps a caching issue. Hopefully the other user found the same solution. Thanks again, @lindsaynhayes

lindsaynhayes commented 3 years ago

Thanks. The plots look great. It is a nice tool!

eseffar commented 3 years ago

Hi, sorry for the delay, I have good news too. After many tests, it seems it finally works for me too. I reinstalled the packages with DevTools and there's no problem anymore. I tried with many datasets to be sure it works and everything is correct.

Thank you again for this must-have package I close the issue.