Question: How to change colour of points in volcano plot by common genes?
0
gravatar for cilgaiscan
16 months ago by
cilgaiscan50
Turkey
cilgaiscan50 wrote:

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()
ADD COMMENTlink modified 16 months ago by Kevin Blighe53k • written 16 months ago by cilgaiscan50

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

ADD REPLYlink written 16 months ago by Kevin Blighe53k

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..

ADD REPLYlink modified 16 months ago • written 16 months ago by cilgaiscan50

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.

ADD REPLYlink written 16 months ago by Kevin Blighe53k

Hang on

ADD REPLYlink written 16 months ago by Kevin Blighe53k
1
gravatar for Kevin Blighe
16 months ago by
Kevin Blighe53k
Kevin Blighe53k wrote:
library(airway)
library(magrittr)
data("airway")
airway$dex %<>% relevel("untrt")

library("DESeq2")
dds <- DESeqDataSet(airway, design = ~cell + dex)
dds <- DESeq(dds, betaPrior = FALSE)
res <- results(dds, contrast = c("dex", "trt", "untrt"))

first way

with(res, plot(log2FoldChange, -log10(pvalue), pch=20, main="Volcano plot"))

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*-1)), points(log2FoldChange, -log10(pvalue), pch=20, col="red"))

h

-----------------------------------------------

second way

up <- rownames(res)[which(res$log2FoldChange>1)]
down <- rownames(res)[which(res$log2FoldChange<(1*-1))]

with(res, plot(log2FoldChange, -log10(pvalue), pch=20, main="Volcano plot"))

with(subset(res , padj<.05), points(log2FoldChange, -log10(pvalue), pch=20,col="black"))
with(res[which(rownames(res) %in% up),], points(log2FoldChange, -log10(pvalue), pch=20, col="green"))
with(res[which(rownames(res) %in% down),], points(log2FoldChange, -log10(pvalue), pch=20, col="red"))

5

Kevin

ADD COMMENTlink written 16 months ago by Kevin Blighe53k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1655 users visited in the last hour