Entering edit mode
4.9 years ago
Sib
▴
60
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
What have you tried? Have you looked into the
fit
object and thelmFit
method and figured out why the object does not have p values? Is it supposed to have p values?I 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:
object tT will have logFC, P.value and adj.p.values. Try to plot logfc against p.value/adj.p.value. @ maryammomeni23
thanks for answering. I will be appreciated more if you write the codes that I should use for doing this.
Please explore that on your own. cpad has already given you the exact location of the p values that you need.
thanks. 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?
you 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
or you can use enhanced volcano plot package by Kevin @ Sib
Did you look at the p values in fit object for coefficient 1?
In fit object, there are no p-values