I am trying to over-ride the colouring scheme in EnhancedVolcano with custom key-value pairs. Specifically, I want to color proteins with log2FC > 0.5 and log2FC < -0.5 AND with p-value < 0.05 in 2 different colors and everything else (below FC cutoff and above p-value cutoff) in grey. I was trying to use the nested ifelse statements to include both log2FC and p-value cutoffs, but I am unable to color the proteins with p-value > 0.05 in grey. Is there something wrong with my ifelse statements?
keyvals.colour <- ifelse(
(data$log2FC < -0.5 & data$p.value < 0.5),'royalblue',
ifelse((data$log2FC > 0.5 & data$p.value < 0.5),'gold',
'grey50'))
Your p-value is 0.5. You said that you wanted to use 0.05.
Kevin
Ah, that was it. Thanks so much, it works now! I feel dumb (I am still fairly new to R), but glad I asked. Thanks so much for the package Kevin, I love it.
Please don't add an answer unless you're answering the top level question. Use
Add Comment
orAdd Reply
instead. I've moved your post to a comment this time, but please be more careful in the future.