Question: EdgeR mistake- dispersion
0
4 months ago by
trumbia0
trumbia0 wrote:

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)

edger • 156 views
modified 4 months ago by Gordon Smyth39k • written 4 months ago by trumbia0
0
4 months ago by
Gordon Smyth39k
Walter and Eliza Hall Institute of Medical Research, Melbourne, Australia
Gordon Smyth39k wrote:

You are making a mistake in the way that you define factors. Rather than my simply correcting your code, I will try to help you understand the issue by asking you question:

Do you have two groups or four groups? If there are only two groups, why you do define four different group names: Blue, Blue1, Normal and Normal1?

When you print out design, did you see two columns or four columns? (I know the answer to this question, I just want you to think about it.)

If you look at any edgeR or limma examples, you will see see the right way to do it.

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.

             group lib.size norm.factors lane
LMNOPRSTU1    Blue   783363            1  LB1
LMNOPRSTU2   Blue1   797764            1  LB1
LMNOPRSTU3  Normal  1511586            1  Ln1
LMNOPRSTU4 Normal1   709481            1  Ln1


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

Content
Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.