Differential expression analysis error
2
0
Entering edit mode
Mary • 0
@mary-19686
Last seen 5.2 years ago

Hi

I'm not familiar with R codes.I use edger with no replicate methods for differential expression analysis. This method works well for some of my samples, and for some others i get this error:

library (edgeR)
x <- read.delim ("quant.txt",row.names="Name")
group<-factor (c("T","C"))
design <- model.matrix(~group)
y <- DGEList (counts=x,group=group)
y <- calcNormFactors(y)
keep <- rowSums(cpm(y)>0.1) >= 2
y <- y[keep, , keep.lib.sizes=FALSE]
y1 <- y
y1$samples$group <- 1
y0 <- estimateCommonDisp(y1[2,], trend="none", tagwise=FALSE)

There were 50 or more warnings (use warnings() to see the first 50)
Warning messages:
1: In condLogLikDerSize(y, r, der = 0L) : value out of range in 'lgamma'
2: In condLogLikDerSize(y, r, der = 0L) : value out of range in 'lgamma'
3: In condLogLikDerSize(y, r, der = 0L) : value out of range in 'lgamma'
edger • 1.1k views
ADD COMMENT
0
Entering edit mode
ADD REPLY
1
Entering edit mode
@james-w-macdonald-5106
Last seen 1 hour ago
United States

That's not an error - it's a warning. An error is when the function stops, whereas a warning is where the function continues, but is letting you know that there was at least one problem that you should be aware of. In this case the problem is that you are trying to estimate dispersions when you have no replicates, which isn't possible. If you want to do that sort of thing, you should read the edgeR User's Guide, particularly section 2.11.

ADD COMMENT
0
Entering edit mode

The lack of replicates isn't actually the problem here as OP has created a replicate by fitting a single group model to the two libraries. The problem is that OP has used only one row as well as only two columns

ADD REPLY
1
Entering edit mode
@gordon-smyth
Last seen 1 hour ago
WEHI, Melbourne, Australia

The basic problem is that you have asked estimateCommonDisp to estimate the negative binomial dispersion from just one gene, by passing just the 2nd row of data y1[2,] instead of the whole data object. Why would you do that?

Since y1 has only 2 columns, you are asking estimateCommonDisp to estimate the negative binomial dispersion from a single row of two numbers. That's a lot to ask.

Even that would usually run ok without any warnings or errors, so I am guessing that the 2nd row of y1 contains two counts that add up to be less than or equal to 5. By default, estimateCommonDisp filters out genes with total count less than or equal to 5. So estimateCommonDisp has filtered out the one row of data that was input, meaning that it has tried to estimate the dispersion from a matrix with zero rows, and that has lead to the warning you see. I have added a check to the function so that this problem will in future generate a more informative error message.

In summary, there are several errors in your code:

  1. You've subsetted y1 for no reason, throwing away almost all the data.
  2. Your gene filtering with rowSums and cpm is not stringent enough, keeping genes for which all the counts are too small to do any reasonable inference with. Please use the edgeR function filterByExpr instead.
  3. The estimateCommonDisp function doesn't have arguments trend or tagwise.

More correct code for what you are trying to do is given here: https://support.bioconductor.org/p/117407/#117418

Please don't cross-post the same question at the same time to multiple lists. I've had to answer your question twice, once here and again on Biostars.

ADD COMMENT
0
Entering edit mode

Hi Gordon

Thanks Gordon.My data is no replicate. So i used these codes based on edgeR User's Guide, section 2.11. At first, I mapped and counted the reads and then made the matrix and finally i used the Edger. My problem was solved. I did the below change, but i did not see any change in my results.

y0 <- estimateCommonDisp convert to y0 <- estimateDisp

I apologize to all my friends for cross-post.

ADD REPLY
0
Entering edit mode

I take it from your comments that the problem is now solved and you no longer have the error message.

I did not advise you to use estimateDisp.

ADD REPLY

Login before adding your answer.

Traffic: 774 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

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

Powered by the version 2.3.6