Hi everyone,
I just downloaded the EnhancedVolcano package and I was trying to create my custom color scheme. The default color scheme makes DEGs that are above and below the FCCutoff the same color (e.g. red). However, I would like the upregulated and downregulated DEGs to be different colors, so I followed the manual example to create a new vector:
test <- read_csv("DEG.csv") %>% as.data.frame() ## My table contains gene symbol, log2FoldChange, pvalue and padj
keyvals <- ifelse(test$log2FoldChange <= -1 & test$padj<0.01, 'royalblue', ifelse(test$log2FoldChange >=1 & test$padj<0.01, 'red2', 'black'))
I checked that my 'keyvals' vector is the same length as my 'test' table and there is a color value in every row (no 'NA'). Then when I run this
EnhancedVolcano(test, lab=test$mgi_symbol, x='log2FoldChange',y='padj', xlim=c(-10,10), pCutoff=10e-3, colCustom=keyvals)
I get the following error:
Error: Aesthetics must be either length 1 or the same as the data (20326): colour
I'm quite new to R so I'm not sure what went wrong. Any help (@ Kevin Blighe) will be much appreciated!
rna-seq
volcano plot