log2FC calculation in EdgeR
0
Entering edit mode
@matteobuti-22205
Last seen 16 months 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 • 294 views
0
Entering edit mode

Command lines used for DE analysis:

> fit <- glmFit(y, design)
> lrt.Ctol <- glmLRT(fit, contrast=c(-1,1))

1
Entering edit mode
@james-w-macdonald-5106
Last seen 2 hours ago
United States

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.