EnhancedVolcano selectLab issue
1
0
Entering edit mode
3.7 years ago
renhaol ▴ 80

Hi everyone,

I am trying to use EnhancedVolcano in R to plot the results from my rna-seq analysis. However, when I want to use selectLab to label some genes that I want, I only got a weird number labeled on the final plot rather than the gene name...

Here is my code,

raw_data <- read.csv('Directory to raw data .csv file')

mydata <- data.frame(gene = raw_data$gene_name,
             log2_fold_change = raw_data$log2FoldChange,
             adj_p = raw_data$padj) 

EnhancedVolcano(mydata, 
            lab = mydata$gene,
            x = "log2_fold_change",
            y = "adj_p",
            xlim = c(-6,6),
            ylim = c(0,20),
            pointSize = 1,
            selectLab = c('NOX4'))

Here is the what it looks like in the final plot: https://drive.google.com/file/d/17Txw4QEIo1KSgZHJsa-Mn8OLO7ZZ4-Gp/view?usp=sharing

Here is a snippet of the head in my data file: https://drive.google.com/file/d/1yE9ffhmNg98X6wZmOVQZayEVLPKb6i0B/view?usp=sharing.

I tried grepl("NOX4", mydata$gene), and it returned TRUE on the "NOX4" index and FALSE elsewhere.

My code gives me correct results without using the selectLab argument...

Any comments would be helpful.

Thanks in advance

EnhancedVolcano • 2.9k views
ADD COMMENT
0
Entering edit mode

fyi the file you are sharing is locked.

okay got access to the file but it's just a plot... can you post a snippet of your data?

ADD REPLY
0
Entering edit mode

thanks for pointing that out. It should be fixed!

ADD REPLY
0
Entering edit mode

can you post a snippet of your data?

ADD REPLY
0
Entering edit mode

Yes, I posted a new screenshot, and added the code to read the file and generate a data frame.

ADD REPLY
0
Entering edit mode

ok, I added a new screenshot.

ADD REPLY
0
Entering edit mode

For future reference when sharing images use: How to add images to a Biostars post

ADD REPLY
0
Entering edit mode

Thank you, I will follow these in the future.

ADD REPLY
3
Entering edit mode
3.7 years ago
renhaol ▴ 80

ok, problem solved.

For future reference, after I constructed the data frame, the gene name column became "integer" rather than "character" (use typeof() to check. I know, it doesn't look like integers at all...).

I changed my code to the following and it worked as expected.

EnhancedVolcano(mydata, 
        lab = as.character(mydata$gene),
        x = "log2_fold_change",
        y = "adj_p",
        xlim = c(-6,6),
        ylim = c(0,20),
        pointSize = 1,
        selectLab = c('NOX4'))

Helpfully this will help someone else.

ADD COMMENT
2
Entering edit mode

thanks for posting the answer! good job on solving it :)

ADD REPLY
2
Entering edit mode

Thanks - I developed this package and, indeed, it should be a character vector.

ADD REPLY
1
Entering edit mode

Thanks! It just did not look obvious to me that my data is not a character vector. I assume it would be some issues from the previous analysis...

ADD REPLY

Login before adding your answer.

Traffic: 1801 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6