Im using this code to make based on log2foldchange and padj value ,im getting the plot but i want those value for my reference how do i extract the same .
alpha <- 0.05 # Threshold on the adjusted p-value
cols <- densCols(res$log2FoldChange, -log10(res$pvalue))
plot(res$log2FoldChange, -log10(res$padj), col=cols, panel.first=grid(),
main="Volcano plot", xlab="Effect size: log2(fold-change)", ylab="-log10(adjusted p-value)",
pch=20, cex=0.6)
abline(v=0)
abline(v=c(-1,1), col="brown")
abline(h=-log10(alpha), col="brown")
gn.selected <- abs(res$log2FoldChange) > 2.5 & res$padj < alpha
text(res$log2FoldChange[gn.selected],
-log10(res$padj)[gn.selected],
lab=rownames(res)[gn.selected ], cex=0.4)
when i view gn.selected i get only logical value that is true or false
Any help or suggestion would be highly appreciated
Update I'm doing this
> DF <- DF[DF$log2FoldChange > 1.5 & DF$padj < 0.05,]
is that suffice and am i doing it correctly ?
@Kevin wow the author himself ...yes i took the code from this site code
Glad to have helped. Note the particular use of the
bquote()
function in order to get super- and sub-script. These are small modifications but can make a plot feel more professional.bquote()
also works with ggplot2 (here I've used it with base functions).@Kevin i have some issues Im not able to get the following with the code which you have given as im trying to include
so this is my condition
its like all the data points are getting overlapped with same color no distinction
Can you paste your code so that I can put this in context?
okay here is the code im using
Yes, the last two lines contradict each other, specifically
padj<0.05 & abs(lfc)>=0.58)
andpadj<0.05 & abs(lfc)>=-0.59)
.I think that you want to colour positive fold-change genes as red, and negative as green? Try this:
"I think that you want to colour positive fold-change genes as red, and negative as green? Try this:" yes thats what i need to show
Yep, take a look at the code that I pasted (above). You just needed to remove the
abs()
function call, and switch the 'greater than' sign to a 'less than' sign on the last lineHi Kevin,
I am wondering if you have rscript showing the upreguted and down regulated? Can you share them?
Yes, please take a look here: https://github.com/kevinblighe/EnhancedVolcano
In which program did you conduct differential expression?
Thanks for the quick reply.
I used edgeR in getting my DE. Once I got them, I pre-filtered my DE list in excel. I only extract FDR<1e-5 which is my significant. Then from those list, my up-reg is log2FC>0 while my down is log2FC<0. I wanted to plot my FDR against log2FC.
Can you embed the script here? Thank you very much!
@Kevin
I have this data not row data to do DESeq2 myself
I don't know how to feed this into your tutorial for volcano plot instead of a top table you have from DESeq2
Can you help me please?
Thank you
Hey, you seem to have all columns that you need
Using Q values is not the typical approach for volcanos, but it is no major issue.
Thanks a lot worked well
Sorry @Kevin I am wondering if I want to put a horizontal line for the threshold used for the q-value (0.05) and two vertical lines (0.6 and -0.6 log2 fold change) for the thresholds used for fold change. The points that represent proteins with q<0.05 and log2FC>0.6 (up-regulated proteins) be red whereas the points with q<0.05 and log2FC<-0.6t (down-regulated proteins) be blue. In your tutorial I am seeing vertical line but how would be with horizontal line?
Oh, sure, you can add any number of lines with the following parameters:
For vertical lines, they are:
You can add any number of lines.
Then, there are also the main cut-off lines:
...and the standard ggplot2 engine lines:
[source: https://github.com/kevinblighe/EnhancedVolcano#adjust-cut-off-lines-and-add-extra-threshold-lines]
Sorry Kevin
With
I finished with
But this is far from what I need to put a horizontal line for q-value < 0.05 and two vertical lines for 0.6 and -0.6 log2 fold change
I don't know how to do that can you help please?
Hey F, as you are plotting Q values, you will have to change the y-axis label by adding:
ylab = bquote(~-Log[10] ~ italic(Q))
Also, the cut-off lines are not appearing because you have
cutoffLineType = 'blank'
Take a look (using a different dataset)
cutoffLineType = 'blank'
cutoffLineType = 'solid'
Another issue in your code is that the values passed to
hline
are too low. You could tryhline = c(0.10, 0.15, 0.2, 0.25)
, i.e., in this case, extra cut-offs for Q-values 0.1, 0.15, 0.2, and 0.25To avail of most recent functionality, you should also install the current dev version:
Thank you so much
I finished with this
Again vertical line is far from and also plot seems a bit crowded that would be nice to show a list of genes instead of all
There are a few ways to further manage the gene labels:
drawConnectors = TRUE
selectLab = c('TGM1', 'EPCAM', 'CLDN3')
labSize = 5.0
Sorry Kevin I want
But this
Gives this How I can get blue in left side and red in right side while here I am getting red in both side
i see. In the default colour scheme, there can only be 4 colours. If you need to use 5 colours, you will have to customise it. There is more information here: https://github.com/kevinblighe/EnhancedVolcano#over-ride-colouring-scheme-with-custom-key-value-pairs
Do you think that you can follow that?
Thank you so much
I did like below but after running R never finished with that I think I am doing something wrong
Hey, here is a reproducible example using the data mentioned on the vignette.
Remember, and assuming that you are using the same data as before, you need to change the ylab parameter to
ylab = bquote(~-Log[10] ~ italic(Q))
, as you are plotting q-values (adjusted p-values). Also, when deriving the key-value pairs, you need to specify the correct columns, so, for example:Please adapt (modify) the code to suit your data.
Thank you so much to be this much helpful
I used
Worked well, but when I want a box around the genes I got error
boxedLabels
was only added in a recent version. You can update to the very latest version with:Sorry I updated that right now but the same error
Also today I am getting error about labSize argument too
Is this because of
colCustom = keyvals
?I am sorry, but you are therefore not using the latest version. I have just confirmed on my computer that
boxedLabels
andlabSize
are functioning correctly.Please restart your R session, install the development version of EnhancedVolcano, and then confirm (via
sessionInfo()
) that you are using v1.3.4Please do not post again until you debug these problems some more.
Thank you! :)
Sorry you were right, problem was the update
Sorry to be too silly
No problem, Angel.
Sorry Kevin
By these lines I plotted the volcano
But I don't know how to reduce the length of x and particularly y axis
I mean I am seeking for a more shrunk plot
Can you help me please?
Hi all, who did you go from ensemble names to gene names?
See: https://bioinformatics.stackexchange.com/questions/5229/converting-gene-symbol-to-ensembl-id-in-r
but I got an dds or res list from DeSeq2
......and what is the problem? - you implied that you have Ensembl IDs. These will be either rownames or the first column of your results object.
the code for using the biomart in the posted link to change the ensemble ID o gene names as far as I understand is for matrix. enchancedVolcano uses the dds from Deseq2 OR there is something that I do not understand? Sorry for my ignorance edit: will this fit better A: ensembl id to gene symbol
I developed EnhancedVolcano - it will accept any data coming from any source. At minimum, you just need 2 vectors:
There does not exist any annotation conversion tool that will accept an entire matrix. They will all accept a vector of gene names that you want to convert. The other tasks (editing the old names and replacing them in your matrix) is your role.
Got it, thought it was only taking a list of sorts. thank you for the clarification. and love the script. saves time from manually writing the code.