I am trying to conduct edgeR and Iam facing with 'Warning message: In estimateDisp.default(y = y$counts, design = design, group = group, : No residual df: setting dispersion to NA' mistake and my code is
files <- c("ABCDEFGHIJKLMNOPRSTU1.txt", "ABCDEFGHIJKLMNOPRSTU2.txt",
"ABCDEFGHIJKLMNOPRSTU3.txt", "ABCDEFGHIJKLMNOPRSTU4.txt" )
read.delim(files[1])
library(limma)
library(edgeR)
x <- readDGE(files, columns=c(1,3))
class(x)
dim(x)
samplenames <- substring(colnames(x), 12, nchar(colnames(x)))
samplenames
colnames(x) <- samplenames
group <- as.factor(c("Blue", "Blue1", "Normal", "Normal1"))
x$samples$group <- group
lane <- as.factor(rep(c("LB1","Ln1"), c(2,2)))
x$samples$lane <- lane
design <- model.matrix(~0+group)
colnames(design) <- levels(group)
design
keep <- filterByExpr(x, design)
table(keep)
x <- calcNormFactors(x)
x$samples
AveLogCPM <- aveLogCPM(x)
hist(AveLogCPM)
x <- calcNormFactors(x)
x$samples
pch <- c(0,1,2,15,16,17)
colors <- rep(c("darkgreen", "red", "blue"), 2)
plotMDS(y, col=colors[group], pch=pch[group])
legend("topleft", legend=levels(group), pch=pch, col=colors, ncol=2)
plotMD(y, column=1)
abline(h=0, col="red", lty=2, lwd=2)
x
x <- estimateDisp(x, design, robust=TRUE)# I got the mistake here
fit <- glmQLFit(x, design, robust=TRUE)
B.LvsP <- makeContrasts(Blue-Normal, levels=design)
res <- glmQLFTest(fit, contrast=B.LvsP)
I have 2 different replica for group example also I wanted to see if there is a difference between those group. That s why I consider them Blue1 and blue.
This is desing matrix with 4 colums
No, that isn't the design matrix. I'm going to make the same suggestion that Mike Love gave you, which is that you would be well advised to consult a bioinformatician or statistician at your own university or institution for help.
I am not a university student at all. I was curious about this data and wanted to analyse it. If I had option to ask someone I knew, I d do this . Could you explain me how should I correct this? Thanks