This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Error: Aesthetics must be either length 1 or the same as the data (): colour ( EnhancedVolcano )

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

Hello gaom001!

We believe that this post does not fit the main topic of this site.

Please ask on https://support.bioconductor.org/

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Cheers!

0 answers

No answers yet.

Log in to answer this question.