Entering edit mode
5.6 years ago
cilgaiscan
▴
60
this is my code to draw volcano plot. but i need to give green dots color for genes in up; red ones for genes in down. how can i do?
down<- intersect(down_our$hgnc_symbol,down_pre$Gene)
up<-intersect(up_our$hgnc_symbol,up_pre$Gene)
res <- read.table(file = "path for csv", header=TRUE, sep = ",")
png("diffexpr-volcanoplot-mm-ourpipeline1.png", 1200, 1000, pointsize=20)
# Make a basic volcano plot
with(res, plot(log2FoldChange, -log10(pvalue), pch=20, main="Volcano plot", xlim=c(-2.5,2)))
# Add colored points: red if padj<0.05&log2FC<1, green if padj<0.05&log2FC>1
with(subset(res , padj<.05), points(log2FoldChange, -log10(pvalue), pch=20,col="black"))
with(subset(res, (log2FoldChange)>1), points(log2FoldChange, -log10(pvalue), pch=20, col="green"))
with(subset(res, padj<.05 & (log2FoldChange)<1), points(log2FoldChange, -log10(pvalue), pch=20, col="red"))
dev.off()
You can just use this: EnhancedVolcano: Publication-ready volcano plots with enhanced colouring and labeling
The
col
argument allows you to change colours as you please.Kevin
i will look for this link. and i am already using the col argument in my code but the problem the things i would like to color is in different dataframe..
No, the
col
argument of my EnhancedVolcano function. It accepts 4 colours: https://bioconductor.org/packages/devel/bioc/vignettes/EnhancedVolcano/inst/doc/EnhancedVolcano.html#adjust-colour-and-alpha-for-point-shading.Hang on