EnhancedVolcano custom color variables by log2FC and p-value
1
0
Entering edit mode
3.4 years ago
jkhudyakov ▴ 10

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'))
EnhancedVolcano • 1.4k views
ADD COMMENT
2
Entering edit mode

Your p-value is 0.5. You said that you wanted to use 0.05.

Kevin

ADD REPLY
1
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

Please don't add an answer unless you're answering the top level question. Use Add Comment or Add Reply instead. I've moved your post to a comment this time, but please be more careful in the future.

ADD REPLY
3
Entering edit mode
3.4 years ago

I never used the package myself. If you want to highlight those below or above a p-value of 0.05, should you try to set that value - 0.05 - instead of 0.5 in data$p.value?

keyvals.colour <- ifelse(
(data$log2FC < -0.5 & data$p.value < 0.05),'royalblue',
  ifelse((data$log2FC > 0.5 & data$p.value < 0.05),'gold',
         'grey50'))
ADD COMMENT
0
Entering edit mode

Sorry, não vi que já havia respondido.

ADD REPLY
1
Entering edit mode

Não tem problema @Kevin!

ADD REPLY

Login before adding your answer.

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