This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Enhanced Volcano not working on ANY data. Coerces everything to NaN

I was trying to get EnhancedVolcano to work on my own data but soon found out it doesn't work on any data. This was reproducible on multiple computers.

test <- data.frame(log2fc = c(2,2.5,2.1),
                   log10pval = c(-2,-3,-2))
rownames(test) <- c("A","B","C")

EnhancedVolcano(test,
                x = "log2fc",
                y = "log10pval",
                lab = rownames(test))

-----------------------------------------------------------------
Warning in EnhancedVolcano(test, x = "log2fc", y = "log10pval", lab = rownames(test)) :
  NaNs produced
Warning in max(-log10(toptable[[y]]), na.rm = TRUE) :
  no non-missing arguments to max; returning -Inf
Warning in FUN(X[[i]], ...) : NaNs produced
Warning in FUN(X[[i]], ...) : NaNs produced
Warning: Removed 1 row containing missing values or values outside the scale range
(`geom_vline()`).
Warning: Removed 1 row containing missing values or values outside the scale range
(`geom_hline()`).

All I see is a completely empty plot and no traceback to help diagnose.

sessionInfo()
R version 4.4.0 (2024-04-24 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 22631)

Matrix products: default


locale:
[1] LC_COLLATE=English_United States.utf8  LC_CTYPE=English_United States.utf8
[3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8

time zone: America/Denver
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base

other attached packages:
 [1] EnhancedVolcano_1.20.0 ggrepel_0.9.5          data.table_1.16.0
 [4] lubridate_1.9.3        forcats_1.0.0          stringr_1.5.1
 [7] dplyr_1.1.4            purrr_1.0.2            readr_2.1.5
[10] tidyr_1.3.1            tibble_3.2.1           ggplot2_3.5.1
[13] tidyverse_2.0.0
bioconductor enhancedvolcano

2 answers

EnhancedVolcano is expecting the following input:

EnhancedVolcano(res,
  lab = rownames(res),
  x = 'log2FoldChange',
  y = 'pvalue')   # Notice: all y values must be between 0 and 1 (i.e. pvalue/qvalue/padj)

Let the program works out the -log10(y)

Also, if there are NAs present in the data (common with deseq2), just convert those NAs to 0.999

res$pvalue[is.na(res$pvalue)] = 0.999

You need to provide log2FC and padjor pval instead not log10(padj) or log10(pval).

test <- data.frame(log2FC = c(2,2.5,2.1), padj = c(0.01,0.03,0.01))
rownames(test) <- c("A","B","C")

EnhancedVolcano(test, x = "log2FC", y = "padj", lab = rownames(test))

enter image description here

Log in to answer this question.