Question: Error in volcano plot drawing with R.

0

Sib •

**20**wrote:I want to draw a volcano plot. I don't know where I make a mistake that I get an error. These are the codes:

```
library(Biobase)
library(GEOquery)
library(ggplot2)
library(pheatmap)
library(limma)
library(plyr)
gset<-getGEO("GSE116959",GSEMatrix = TRUE,AnnotGPL = TRUE,destdir ="data/")
gset<-gset[[1]]
gr<-c(rep("Tumor",3),("Normal"),rep("Tumor",7),("Normal"),rep("Tumor",21),rep("Normal",4)
,rep("Tumor",5),("Normal"),rep("Tumor",17),rep("Normal",2),("Tumor"),("Normal"),rep("Tumor",2),("Normal"),("Tumor"))
gr<-as.factor(gr)
gset$description<-gr
design<-model.matrix(~description+0,gset)
colnames(design)<-levels(gr)
fit<-lmFit(gset,design)
contmatrix<-makeContrasts(Tumor-Normal,levels = design)
fit2<-contrasts.fit(fit,contmatrix)
fit2<-eBayes(fit2,0.01)
tT <- topTable(fit2, adjust="fdr", sort.by="B", number=Inf)
volcanoplot(fit, coef = 1, style = "p-value", highlight = 0, hl.col="blue",
xlab = "Log2 Fold Change", ylab = NULL, pch=16, cex=0.35)
Error in volcanoplot(fit, coef = 1, style = "p-value", highlight = 0, :
No p-values found in linear model fit object
```

ADD COMMENT
• link
•
modified 4 months ago
by
Gordon Smyth •

**2.3k**• written 14 months ago by Sib •**20**
What have you tried? Have you looked into the

`fit`

object and the`lmFit`

method and figured out why the object does not have p values? Is it supposed to have p values?32kI am new to this analysis and I don't know whether It should have p-value or not But when I call fit, the results are these:

20object tT will have logFC, P.value and adj.p.values. Try to plot logfc against p.value/adj.p.value. @ maryammomeni23

15kthanks for answering. I will be appreciated more if you write the codes that I should use for doing this.

20Please explore that on your own. cpad has already given you

the exact locationof the p values that you need.32kthanks. I plotted a volcano plot by ggplot2 . the codes are as below:

Now, I want to change the colors of genes with |logFC|>2 and adj-P-Val<0.05. And I want to show their gene-symbols. What codes I should add to ggplots codes?

20you need to create a subset of data for plotting points with different colors and labels. Refer to example code in ggplot2 section in https://digibio.blogspot.com/2018/05/volcano-plot-with-ggplot2-and-basic.html

15kor you can use enhanced volcano plot package by Kevin @ Sib

15kDid you look at the p values in fit object for coefficient 1?

15kIn fit object, there are no p-values

20