kevinblighe / EnhancedVolcano

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

duplicate rownames error #83

Closed Anto007 closed 3 years ago

Anto007 commented 3 years ago

I'm new to R and I'm trying to run R package EnhancedVolcano for generating a plot. My input csv file is a list of differentially expressed genes from DESeq2. The first column contains gene names that do not occur uniquely and so it continues to give duplicate rownames error. I hope there's a way to avoid this? My input csv file is available on Dropbox

The code I tried is the below.

library(EnhancedVolcano)
results <- read.csv("Volcano_DEGlist_Age12_vs_Age0.csv", row.names=1, header=T)
toptable <- as.data.frame(results)
EnhancedVolcano(toptable, lab=rownames(toptable),x="log2FoldChange",y="padj")

Any help here would be highly appreciated!

kevinblighe commented 3 years ago

Hi @Anto007 , I find this error strange. If you run the as.data.frame() function, and assuming that there are duplicate rownames, the error should be thrown at that step, not after you run EnhancedVolcano(). Can you confirm?

Anto007 commented 3 years ago

Apologies for not making this clear; the error indeed came up at the read.csv step. I got around the issue by going for read_csvfunction instead from tidyverse also by introducing a new header 'name' to column 1. I then used the following code to make EnhanceVolcano work:

EnhancedVolcano(df, lab=df$name, x="log2FoldChange", y="padj")

Thank you for your response!