log2FC calculation in EdgeR
1
0
Entering edit mode
@matteobuti-22205
Last seen 5.2 years ago

Hello! I'm an EdgeR user, and I would like to know how this program calculates the log2FC for 2 sets of samples (treated vs. control).

For one gene, I would calculate its log2FC as the logarithm(2) of the ratio between the mean of normalized counts in treated samples and the mean of normalized counts in control samples.

But, if I do this operation manually, the result is not the same as the EdgeR one. Any reason behind this difference?

edger log2FC • 2.9k views
ADD COMMENT
0
Entering edit mode

Command lines used for DE analysis:

> fit <- glmFit(y, design)
> lrt.Ctol <- glmLRT(fit, contrast=c(-1,1))
ADD REPLY
1
Entering edit mode
@james-w-macdonald-5106
Last seen 17 hours ago
United States

If you post a followup to your question, use ADD COMMENT, not Add answer. There's a helpful bit of text right over the Add answer box that says:

If you want to provide a solution to the original question, click Add Answer. Use the ADD COMMENT or ADD REPLY buttons to ask for clarifications, request more details, or respond to a previous answer or comment.

Which is intended to keep you from answering your own question, which makes it look like, well, it's been answered, which presumably was not your intent.

In addition, if you post code, highlight the code and then click on the icon above the text box with all the 101010 in it, so the code is formatted correctly.

Now, as to your question, you cannot directly compute the log fold change, as there is no closed form of the coefficients for a generalized linear model. The log fold change is computed internally, using an iterative function, and helpfully extracted for you. So the reason there is a difference is that what you are calculating isn't how the log fold change is calculated.

ADD COMMENT

Login before adding your answer.

Traffic: 453 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