Volcano plot - select additional gene
0
0
Entering edit mode
camillab. ▴ 10
@camillab-23642
Last seen 5 months ago
London

Hi,

I would like to know if and how is possible to have a volcano plot (potentially with EnhancedVolcano) with highlighted not only significant up/down regulated genes but also those genes that have normalised reads (FPKM) higher than a specific value without having to manually specific each gene with selectLab or if there is any other plot I could you to achieve the same goal:

pvalue < 0.05 + log2FC >1 + FPKM >6

pvalue < 0.05 + log2FC < -1 + FPKM >6

Thank you in advance!

Camilla

EnhancedVolcano RNASeqR R volcanoplot • 2.0k views
ADD COMMENT
0
Entering edit mode

Yes, it would be easy enough to highlight such genes. Could you provide the code you have already tested to be able to help you.

ADD REPLY
0
Entering edit mode

well I have total of 480 genes FPKM >6. AT the moment I don't have a specific solution because I must have done something worng which I am not able to figure out yet using selectLab (and it should be a really stupid error). but anyway here is my code (in case you can help with one of my problem! :) )

 # load libraries ####
    library(ggplot2)
    library(ggrepel)
    library(EnhancedVolcano)

#tidy dataset
res <- test[,-(4:11)]# remove all columns and keep only ID and p value and FC
res <- res[,-(1:2)] #keep only gene symbol column

keyvals <- ifelse(
  res$log2FC <= -1 & res$p_value <= 0.05, '#0000FF',
  ifelse(res$log2FC >= 1 &res$p_value <= 0.05 , '#FF0000', '#A9A9A9'))
keyvals[is.na(keyvals)] <- '#A9A9A9' 
names(keyvals)[keyvals == '#FF0000'] <- 'UP'
names(keyvals)[keyvals == '#A9A9A9'] <- 'NS'
names(keyvals)[keyvals == '#0000FF'] <- 'DOWN'

#select gene you want to highlight
celltype1 <- c("GAS5")

z <- EnhancedVolcano(res,
                lab = "",
                x = 'log2FC',
                y = 'p_value',
                title = "DEGs", 
                subtitle = " ",
                caption = " ",
                xlim = c(-12, 12),
                ylim = c(-0, 5),
                axisLabSize = 15, #font axes
                pCutoff = 0.05,
                FCcutoff = 1,
                pointSize = 2,
                labSize = 2,
                colCustom = keyvals,
                selectLab = celltype1,
                colAlpha = 1,
                #shape= 8,
                legendPosition = 'bottom',
                legendLabSize = 15, #font legend
                legendIconSize = 6.0,
                drawConnectors = TRUE,
                gridlines.major = TRUE,
                gridlines.minor = TRUE)
z
ADD REPLY
2
Entering edit mode

It is possible via EnhancedVolcano. The selectLab approach would work via compound conditional statements to identify those genes of interest. The other way to do it would be via colCustom, like you are already trying. You would just need an extra factor and colour in your current code that identifies those genes that also have FPKM>6. Often the order in which you piece together these multiple ifelse() statements is important.

ADD REPLY
0
Entering edit mode

Thanks Kevin!

I am trying to do it but I am able to assign a different color to a subpopulation of genes FPKM >6 but I am not able to have 3 colours at the same time (NS = grey, log2fc+pvalue = either blue or red depending on the trend, log2fc+pvalue+FPKM= green):

At the moment I am trying to add another color only for upregulated genes so I would like to have red point (log2FC >1, pvalue<0.05) and within those green point that are also FPKM>6.

I got is all grey points except for green point (FPKM>6, log2FC >1, pvalue<0.05) but I am not able have in red those that are log2FC>1 + pvalue <0.05.

Here my code (only for the first part):

keyvals <- ifelse(
  res$log2FC <= -1 & res$p_value <= 0.05, '#0000FF',
  ifelse(res$log2FC >= 1 & res$p_value <= 0.05 & res$`hu-c_lab13` >=6 & res$`hu-c_lab15` >=6 & res$`hu-c_lab17` >=6 & res$`hu-gent_lab14` >=6 & res$`hu-gent_lab16` >=6 & res$`hu-gent_lab18` >=6, 'green','#FF0000'))

keyvals[is.na(keyvals)] <- '#A9A9A9' 
names(keyvals)[keyvals == '#FF0000'] <- 'UP'
names(keyvals)[keyvals == '#A9A9A9'] <- 'NS'
names(keyvals)[keyvals == '#0000FF'] <- 'DOWN'
names(keyvals)[keyvals == 'green'] <- 'FPKM'

Also, I have noticed that those green points (total of 5) are "underneath" all the other and only 2 are clearly visible (not sure if it makes sense). Is there any way I can give those 5 points the "priority" ?

ADD REPLY
1
Entering edit mode

Yes, to give priority to certain points / genes, you have to move them to the final positions (rows) in your input object. This will ensure that they are plot in the last place, above (on top of) anything else. This is obviously not desirable for most users, as it involves some extra coding. However, there is no other solution for now.

Regarding the general issue of colouring, basically you should first assign the colours in the order:

  1. grey
  2. blue
  3. red
  4. green

, i.e., increasing order of specifity.

That should give you what you want.

ADD REPLY

Login before adding your answer.

Traffic: 579 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