Entering edit mode
Christine Gläßer
▴
60
@christine-glaer-6291
Last seen 10.2 years ago
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")
}