Off topic:Error: Aesthetics must be either length 1 or the same as the data (): colour ( EnhancedVolcano )
0
0
Entering edit mode
7 months ago
gaom001 ▴ 10

Hi, I have DEGs file (DEAdf) with log2FC and padjust. I am trying to look at significant dowreguated and upregulated genes in enhanced volcano plot according to my cutoff. To visulize the up and down regulated genes, I customized them into different colors (keyvals.colour), but somehow it came out with the error like the title (Error: Aesthetics must be either length 1 or the same as the data (): colour ) Can anyone help with the solution? many thanks. ( normally, the enhanced volcano plot like this)

enter image description here

library(EnhancedVolcano) mypval=0.05 myfc=2 mypadj=0.05 mylog2fc=log2(myfc)

keyvals.colour <- ifelse( DEAdf$log2FC < -1 & DEAdf$padjust<0.05, 'royalblue', ifelse(DEAdf$log2FC > 1 & DEAdf$padjust<0.05,'red2', ifelse(DEAdf$log2FC<=1 & DEAdf$log2FC >= -1 & DEAdf$padjust >= 0.05,"forestgreen", ifelse(DEAdf$log2FC<=1 & DEAdf$log2FC >=-1 & DEAdf$padjust < 0.05,"yellow", 'grey30'))))

EnhancedVolcano(DEAdf, lab = DEAdf, x = 'log2FC', y = 'padjust', xlim = c(min(DEAdf$log2FC, na.rm=TRUE), max(DEAdf$log2FC, na.rm=TRUE)), ylim=c(0, max(-log10(DEAdf$padjust), na.rm=TRUE) + 1), title="samples", pCutoff=mypadj, FCcutoff=mylog2fc, pointSize = 2.0, labSize = 3.0, colCustom = keyvals.colour, colAlpha = 1, xlab = bquote(~Log[2]~ 'fold change'), ylab = bquote(~-Log[10]~adjusted~italic(P)), legend=c('No significant','Log2FC','Adjusted p-value', 'Adjusted p-value & Log2FC<-1','Adjusted p-value & Log2FC>1'), col=c("grey30", "forestgreen", "Yellow", "royalblue","red2"), legendPosition = 'top', legendLabSize = 10, legendIconSize = 5.0, widthConnectors = 0.2, colConnectors = 'grey30') dev.off()

RNA-Seq • 725 views
ADD COMMENT
This thread is not open. No new answers may be added
Traffic: 1169 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