Question: R: How to convert log2FC (Fold Change) obtained by limma's topTable() function to FC
gravatar for komal.rathi
5.6 years ago by
Children's Hospital of Philadelphia, Philadelphia, PA
komal.rathi3.5k wrote:

Hi everyone,

I have a microarray set of 26933 genes and 6 samples (3 controls and 3 mutants). I calculated differential expressed genes using limma's topTable() function. I got a result of this format:

> head(
             logFC   AveExpr         t      P.Value    adj.P.Val        B
17291881 -2.157936  9.021125 -41.49770 3.218440e-09 3.829474e-05 10.82552
17357688 -2.364349  7.160051 -41.15755 3.397181e-09 3.829474e-05 10.79753
17224251  1.820522 10.665778  37.01446 6.816679e-09 3.829474e-05 10.41426
17239845 -2.025497 10.054660 -35.87667 8.366167e-09 3.829474e-05 10.29350
17304523 -1.830077 10.117184 -35.36567 9.191590e-09 3.829474e-05 10.23680
17229782  2.716749  7.911040  35.24054 9.407763e-09 3.829474e-05 10.22267

The logFC values are log2(FC). How do I convert the values (positive and negative) to normal fold changes?

I tried this:

#take 2^(absolute(log2FoldChange))


#change the sign of FC according to log2FC


But I am not sure if I am correct. Please let me know.


limma toptable microarray R • 37k views
ADD COMMENTlink modified 3.7 years ago by Biostar ♦♦ 20 • written 5.6 years ago by komal.rathi3.5k
gravatar for Devon Ryan
5.6 years ago by
Devon Ryan93k
Freiburg, Germany
Devon Ryan93k wrote:$FC <- 2^$logFC

Negative log2 fold-changes are just less than 1.

ADD COMMENTlink written 5.6 years ago by Devon Ryan93k
gravatar for scottwilliamrobinson
4.9 years ago by
United Kingdom
scottwilliamrobinson120 wrote:

Agree with Devon Ryan's conversion assuming limma's "LogFC" is actually log2(FC), but if I remember correctly it isn't. The value they give here is actually the difference of the means of the log2-transformed values, ie:

Actual log2(FC) = log2(mean(Group1/Group2))
Limma's "Log(FC)" = mean(log2(Group1)) - mean(log2(Group2))

These will give similar values but not the same (at least in the cases I have looked at). I think the rationale is that it is more appropriate since the statistical tests are being done on the log2-transformed data.

Probably also worth saying that if you are outputting a 'TopTable' for a continuous variable in your model then Log(FC) will actually be the beta coefficient.

ADD COMMENTlink written 4.9 years ago by scottwilliamrobinson120

I'm confused. I think you're right about Limma's calculation. It seems like Limma's "Log(FC)" is actual fold change just involved log2-transformed values. In this case, how can we get the normal fold change? And how can we set the cut off value for Limma's "Log(FC)" since Log(FC)=1 doesn't mean FC=2? 


ADD REPLYlink written 4.7 years ago by henryshm1220

It seems "Actual log2(FC) = log2(mean(Group1/Group2)) " should be "Actual log2(FC) = log2( mean(Group1)/mean(Group2) ) ". And you mean limma's logFC version is more rationale? Thank you. Generally, the expression value has been logged. 

ADD REPLYlink modified 3.8 years ago • written 3.8 years ago by Zhilong Jia1.5k

The way scottwilliamrobinson presented it is how limma/DESeq2/edgeR/everything else actually do it. For count data one uses a log2 link so that the opimization isn't constrained. So what you end up with are expected values on the log2-scale, which are then subtracted to produce logFC. Realistically speaking, the difference between actual logFC and what all of the tools will produce is minor unless there are outliers. In either case, 2^logFC is still a decent representation of the actual fold change.

ADD REPLYlink written 3.8 years ago by Devon Ryan93k
gravatar for summerela
5.3 years ago by
United States
summerela120 wrote:

Here's a really easy to use function:

ADD COMMENTlink written 5.3 years ago by summerela120

Thanks a lot for this link. This is the new link to this package. Assuming that your data is loaded in "dataset", all that was needed to use it was:

dataset$FC <- logratio2foldchange(dataset$logFC, base = 2)

Doing it using formula loses the negative values of logFC. I had earlier used the formula:

dataset$FC <- 2^dataset$logFC # This line Doesn't work, don't use
ADD REPLYlink modified 22 days ago • written 22 days ago by destinationsaurabh0
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 731 users visited in the last hour