kevinblighe / EnhancedVolcano

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

Add gradient color based on padj #35

Closed DinoFer closed 4 years ago

DinoFer commented 4 years ago

Hi Kevin,

Having a lot of fun working with this tool. I'm trying to color the points based on a gradient based on padj values. I tried to use scale_color_gradient but I can't seem to work it into the variables.

Any suggestions on how to do this? Thanks! D

kevinblighe commented 4 years ago

Hey D, thanks for using this package. I just spent a few minutes trying and realise that the function is just not set up for a continuous colour gradient, although that would definitely be a useful feature. Technically, it could be done via colCustom, but that would be a long-winded approach.

I will label this as a feature request / enhancement.

kevinblighe commented 4 years ago

By the way, I have seen code posted online that also produces a ggplot2-based volcano plot and that incorporates gradient colour scale. You could feasibly use one of those functions.

kevinblighe commented 4 years ago

This is now added as an experimental feature and is available in the GitHub version. It will be available in the official Bioconductor release 'shortly', when the next Bioconductor is released. I'm unsure of it's functionality so far, but it may develop over time. New arguments are:

I will add you to the ACKs as 'DinoFer'.

DinoFer commented 4 years ago

Thank you Kevin! Look forward to trying it out

kevinblighe commented 4 years ago

Oh, you responded quick! I'll let you know when it's actually on GitHub. I will be adding a vignette entry.

kevinblighe commented 4 years ago

Hey, it's now on GitHub: https://github.com/kevinblighe/EnhancedVolcano#change-to-continuous-colour-scheme

Very basic and open to suggestions about how to develop it further. The shading is difficult to get right and is heavily dependent on the p-value distribution.

sadinoj commented 4 years ago

Hi Kevin, I was excited to see a color gradient option in an updated version. However, I can't seem to get the colGradient option to appear. I installed the developer version using devtools::install_github('kevinblighe/EnhancedVolcano') but it wont install the newer version (EnhancedVolcano_1.0.1 is listed in sessionInfo()). I tried uninstalling EnhancedVolcano then re-installing it using BioManager and devtools without luck (it's still 1.0.1). Have others been experiencing a similar issue? Any suggestions? I'd love to use the gradient option and the other more updated features!

kevinblighe commented 4 years ago

Hey, the colGradientfeature is somewhat experimental. In total, there are 4 associated parameters:

#' @param colGradient If activated, over-rides the default discrete colour scheme
#'   and replaces it with a continous scheme that shades based on nominal or 
#'   adjusted p-value specified by \code{y}. For example, c('red2', 'blue2').
#' @param colGradientBreaks Break-points for the two colours specified by
#'   colGradient.
#' @param colGradientLabels Labels for the break-points specified by
#'   colGradientBreaks.
#' @param colGradientLimits Limits of the colour scheme specified by
#'   colGradient, i.e., max and min possible p-values.

Can you show the error messages that you have received while trying to install the development version?

sadinoj commented 4 years ago

Hi, Thank you for the quick reply! I continued to play around with installing/re-installing EnhancedVolcano and its dependencies and eventually got the updated version to work. For some reason R wasn't installing the correct version of 'ps' in case anyone has a problem with this in the future: image Thanks for the response though!

kevinblighe commented 4 years ago

Oh, I have seen this error message before. It arises from a failed installation (I think). Can you try to delete the directory 00LOCK-ps and then try again? I think that relates to a failure for the ps package.

You are also using an old version of R. We are already on R 4.0.2.

sadinoj commented 4 years ago

Hi, Yes, I am aware that I am in an old version of R. I haven't wanted to update in case it conflicts with other packages I'm using which is unlikely but packages in R can be finicky enough. I was able to fix the ps problem by re-installing the package and just no compiling any CRAN packages. It seems to be working now, colGradient and all!

kevinblighe commented 4 years ago

Sounds good! Oh, I have not heard that word for a long time (finicky).