When I used the edgeR analyzed the DE genes, there are two different Contrasts:
con_RS <- makeContrasts(
(groupingNR.32.18hpi-groupingNR.MK.0hpi)-(groupingNR.26.18hpi-groupingNR.MK.0hpi),
(groupingNR.32.18hpi-groupingNR.MK.0hpi)-(groupingNS.32.18hpi-groupingNS.MK.0hpi),
(groupingNR.32.24hpi-groupingNR.MK.0hpi)-(groupingNR.26.24hpi-groupingNR.MK.0hpi),
(groupingNR.32.24hpi-groupingNR.MK.0hpi)-(groupingNS.32.24hpi-groupingNS.MK.0hpi),
(groupingNR.32.48hpi-groupingNR.MK.0hpi)-(groupingNR.26.48hpi-groupingNR.MK.0hpi),
(groupingNR.32.48hpi-groupingNR.MK.0hpi)-(groupingNS.32.48hpi-groupingNS.MK.0hpi),
(groupingNR.32.96hpi-groupingNR.MK.0hpi)-(groupingNR.26.96hpi-groupingNR.MK.0hpi),
(groupingNR.32.96hpi-groupingNR.MK.0hpi)-(groupingNS.32.96hpi-groupingNS.MK.0hpi),
(groupingNR.32.168hpi-groupingNR.MK.0hpi)-(groupingNR.26.168hpi-groupingNR.MK.0hpi),
(groupingNR.32.168hpi-groupingNR.MK.0hpi)-(groupingNS.32.168hpi-groupingNS.MK.0hpi),
levels=design)
lrt_RS <- glmLRT(f,contrast=con_RS)
levels=d_RS <- glmLRT(f,contrast=con_RS)
tt_RS <- topTags(lrt_RS, n=Inf)$table
write.table(tt_RS, file="LRT_RS.xls", row.names=FALSE, sep="\t", quote=FALSE)
con_RS_3 <- makeContrasts(
(groupingNR.32.18hpi-groupingNR.MK.0hpi)-(groupingNR.26.18hpi-groupingNR.MK.0hpi),
(groupingNR.32.18hpi-groupingNR.MK.0hpi)-(groupingNS.32.18hpi-groupingNS.MK.0hpi),
(groupingNS.32.18hpi-groupingNS.MK.0hpi)-(groupingNR.26.18hpi-groupingNR.MK.0hpi),
(groupingNR.32.24hpi-groupingNR.MK.0hpi)-(groupingNR.26.24hpi-groupingNR.MK.0hpi),
(groupingNR.32.24hpi-groupingNR.MK.0hpi)-(groupingNS.32.24hpi-groupingNS.MK.0hpi),
(groupingNS.32.24hpi-groupingNS.MK.0hpi)-(groupingNR.26.24hpi-groupingNR.MK.0hpi),
(groupingNR.32.48hpi-groupingNR.MK.0hpi)-(groupingNR.26.48hpi-groupingNR.MK.0hpi),
(groupingNR.32.48hpi-groupingNR.MK.0hpi)-(groupingNS.32.48hpi-groupingNS.MK.0hpi),
(groupingNS.32.48hpi-groupingNS.MK.0hpi)-(groupingNR.26.48hpi-groupingNR.MK.0hpi),
(groupingNR.32.96hpi-groupingNR.MK.0hpi)-(groupingNR.26.96hpi-groupingNR.MK.0hpi),
(groupingNR.32.96hpi-groupingNR.MK.0hpi)-(groupingNS.32.96hpi-groupingNS.MK.0hpi),
(groupingNS.32.96hpi-groupingNS.MK.0hpi)-(groupingNR.26.96hpi-groupingNR.MK.0hpi),
(groupingNR.32.168hpi-groupingNR.MK.0hpi)-(groupingNR.26.168hpi-groupingNR.MK.0hpi),
(groupingNR.32.168hpi-groupingNR.MK.0hpi)-(groupingNS.32.168hpi-groupingNS.MK.0hpi),
(groupingNS.32.168hpi-groupingNS.MK.0hpi)-(groupingNR.26.168hpi-groupingNR.MK.0hpi),
levels=design)
lrt_RS_3 <- glmLRT(f,contrast=con_RS_3)
tt_RS_3 <- topTags(lrt_RS_3, n=Inf)$table
write.table(tt_RS_3, file="LRT_RS_3.xls", row.names=FALSE, sep="\t", quote=FALSE)
While the file "LRT_RS.xls" and "LRT_RS_3.xls" have the same result.
The first row are both "genes logFC..groupingNR.32.18hpi...groupingNR.MK.0hpi.....groupingNR.26.18hpi...groupingNR.MK.0hpi. logFC..groupingNR.32.18hpi...groupingNR.MK.0hpi.....groupingNS.32.18hpi...groupingNS.MK.0hpi. logFC..groupingNR.32.24hpi...groupingNR.MK.0hpi.....groupingNR.26.24hpi...groupingNR.MK.0hpi. logFC..groupingNR.32.24hpi...groupingNR.MK.0hpi.....groupingNS.32.24hpi...groupingNS.MK.0hpi. logFC..groupingNR.32.48hpi...groupingNR.MK.0hpi.....groupingNR.26.48hpi...groupingNR.MK.0hpi. logFC..groupingNR.32.48hpi...groupingNR.MK.0hpi.....groupingNS.32.48hpi...groupingNS.MK.0hpi. logFC..groupingNR.32.96hpi...groupingNR.MK.0hpi.....groupingNR.26.96hpi...groupingNR.MK.0hpi. logFC..groupingNR.32.96hpi...groupingNR.MK.0hpi.....groupingNS.32.96hpi...groupingNS.MK.0hpi. logFC..groupingNR.32.168hpi...groupingNR.MK.0hpi.....groupingNR.26.168hpi...groupingNR.MK.0hpi. logFC..groupingNR.32.168hpi...groupingNR.MK.0hpi.....groupingNS.32.168hpi...groupingNS.MK.0hpi. logCPM LR PValue FDR"
the file "LRT_RS_3.xls" without the except colume "
logFC..groupingNS.32.18hpi...groupingNS.MK.0hpi.....groupingNR.26.18hpi...groupingNR.MK.0hpi. logFC..groupingNS.32.24hpi...groupingNS.MK.0hpi.....groupingNR.26.24hpi...groupingNR.MK.0hpi. logFC..groupingNS.32.48hpi...groupingNS.MK.0hpi.....groupingNR.26.48hpi...groupingNR.MK.0hpi. logFC..groupingNS.32.96hpi...groupingNS.MK.0hpi.....groupingNR.26.96hpi...groupingNR.MK.0hpi. logFC..groupingNS.32.168hpi...groupingNS.MK.0hpi.....groupingNR.26.168hpi...groupingNR.MK.0hpi."
I want to know thre are some error about my code?
counts <- read.csv("All_Fragments.exp20160520.csv")
plant = c(rep("NR",3),rep("NS",3),rep("NR",15),rep("NS",15),rep("NR",15))
fungi <- c(rep("MK",6),rep("32",30),rep("26",15))
time <- c(rep("0hpi",6),rep("18hpi",3),rep("24hpi",3),rep("48hpi",3),rep("96hpi",3),rep("168hpi",3),rep("18hpi",3),rep("24hpi",3),rep("48hpi",3),rep("96hpi",3),rep("168hpi",3),rep("18hpi",3),rep("24hpi",3),rep("48hpi",3),rep("96hpi",3),rep("168hpi",3))
batch <- c(rep(c("a","b","c"),17))
batch <- factor(batch)
grouping <- factor(paste(plant, fungi, time, sep="."))
grouping
d <- DGEList(counts = counts[,2:52], genes = counts[,1], group = grouping)
dim(d)
keep <- rowSums(cpm(d)>1)>=3
d <- d[keep,]
dim(d)
d = calcNormFactors(d)
design <- model.matrix(~ 0 + grouping + batch)
d = estimateGLMCommonDisp(d,design)
d = estimateGLMTrendedDisp(d, design)
d = estimateGLMTagwiseDisp(d, design)
f = glmFit(d, design)