[BioC] SmearPlot edgeR - adding gene names to genes of interest
Christine Gläßer
c.glaesser at zmbh.uni-heidelberg.de
Mon Dec 16 09:07:40 CET 2013
Dear all,
I have used edgeR for analyzing differential expression. I also created
a smear plot visualizing DGE results (code see below). I'd now like to
highlight some genes of interest (they are significantly diff.
expressed) in this plot by labeling them; do you know if there's a way
to do so?
Kind regards, and many thanks in advance,
Christine Gläßer
###### Code ########
counts <- as.matrix(read.table(infile, header = TRUE, sep = "\t",
row.names = 1, as.is = TRUE))
cpms<-cpm(counts)
keep <- rowSums(cpms>1)>=4 ### at least 4 replicates
counts <- counts[keep,]
group <- factor(c(1,1,1,1,1,2,2,2,2,3,3,3,3))
d <- DGEList(counts=counts, group=group)
d <- calcNormFactors(d)
design <- model.matrix(~ 0+group)
colnames(design) <- cols
contrasts <- makeContrasts(con1 = CONTRAST1, con2 = CONTRAST2,
levels=design)
y <- estimateGLMCommonDisp(d,design)
y <- estimateGLMTrendedDisp(y,design)
y <- estimateGLMTagwiseDisp(y,design)
fit <- glmFit(y,design)
for (i in colnames(contrasts))
{
print (i)
outfilename <- paste(paste(outdir, i, sep="/"))
outfilename <- paste(paste(outfilename, ".txt", sep=""))
outfilesmearplot <- paste(paste(outdir, i, sep="/"))
outfilesmearplot <- paste(paste(outfilesmearplot, "_smearplot.pdf",
sep=""))
lrt <- glmLRT(fit, contrast=contrasts[,i])
tt <- topTags(lrt, n=nrow(d), adjust.method="BH")
rn <- rownames(tt$table)
deg <- rn[tt$table$FDR < 0.05]
pdf(outfilesmearplot)
###### SMEAR PLOT STARTS HERE #######
plotSmear(d, de.tags=deg)
abline(h = c(-1, 1), col = "dodgerblue")
dev.off()
write.table(tt$table, file=outfilename, sep="\t")
}
More information about the Bioconductor
mailing list