Calculation of logFC in edgeR
1
1
Entering edit mode
H ▴ 20
@H-24669
Last seen 3.7 years ago

I am so new in using R and edgeR. I calculated the logFC in edgeR using the following code:

targets <- read.delim("cell_line_M.txt", stringsAsFactors = FALSE)

d <- readDGE(targets)
colnames(d) <- c("MG1","MG2", "MN1","MN2")
d <- estimateCommonDisp(d, verbose=TRUE)
d <- estimateTagwiseDisp(d, trend="none")

et <- exactTest(d,pair=c("MN","MG"))
print(et)

this is what I obtained :

          logFC   logCPM       PValue
A1CF  0.20103589 4.718215 0.8603790511

my problem is how the logFC is calculated. the main file is

gene   MG1  MG2  MN1 MN2
A1CF    8   7    7   4

I expect that the logFc should be calculated from the strategy suggested in here like:

FC=sqrt(87)/ sqrt(74) --> logFC=log2(FC) = 0.49

but edgeR suggest logFC=0.2

Can anyone guide me if in a wrong way I am or i missed anythong?

edgeR logfc • 3.4k views
ADD COMMENT
0
Entering edit mode

Linking to duplicate post: Calculation of logCPM in edgeR

ADD REPLY
2
Entering edit mode
Yunshun Chen ▴ 890
@yunshun-chen-5451
Last seen 1 day ago
Australia

The logFCs are calculated in a much more sophisticated way. It requires fitting a NB generalized linear model and then estimating the coefficients. You can't simply use the raw counts for computing logFCs without taking into account other factors such as the library sizes, the dispersion estimates, etc.

ADD COMMENT
0
Entering edit mode

Yunshun Chen Thank you very much. Is there a link or pdf file containing how logFC is calculated?

ADD REPLY
0
Entering edit mode

I don't recall there is a link to it. However, all the source code of edgeR is publicly available. If you want to know exactly how the logFC is calculated, I guess the best way would be to dig into the code.

ADD REPLY

Login before adding your answer.

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