Question: R: How to convert log2FC (Fold Change) obtained by limma's topTable() function to FC
gravatar for komal.rathi
6.5 years ago by
Children's Hospital of Philadelphia, Philadelphia, PA
komal.rathi3.7k 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 • 41k views
ADD COMMENTlink modified 4.6 years ago by Biostar ♦♦ 20 • written 6.5 years ago by komal.rathi3.7k
gravatar for Devon Ryan
6.5 years ago by
Devon Ryan97k
Freiburg, Germany
Devon Ryan97k wrote:$FC <- 2^$logFC

Negative log2 fold-changes are just less than 1.

ADD COMMENTlink written 6.5 years ago by Devon Ryan97k
gravatar for scottwilliamrobinson
5.8 years ago by
United Kingdom
scottwilliamrobinson130 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 5.8 years ago by scottwilliamrobinson130

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 5.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 4.8 years ago • written 4.8 years ago by Zhilong Jia1.6k

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 4.8 years ago by Devon Ryan97k
gravatar for summerela
6.2 years ago by
United States
summerela140 wrote:

Here's a really easy to use function:

ADD COMMENTlink written 6.2 years ago by summerela140

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 12 months ago • written 12 months ago by destinationsaurabh10

Using the above function I converted logFC to normal FC values for three groups(MC,SC,OC). I'd like to compare the normal FC values among these groups, how do I say this particular gene has expressed more in this particular group ?

Logfc = 0.58     2^(0.58) = 1.5 Foldchange

I got very few differential expressed genes, with 1.5 Foldchange very few, can I consider 1.41 foldchange is this is acceptable ? suggestions please.

ENTREZID    MC_Logfc    SC_Logfc    OC_Logfc    MC_fc   SC_fc   OC_fc
117745510   -0.345358121903771  -0.390669621589111  -0.298242833208864  -1.27046631276177   -1.31100175930202   -1.2296458227815
117732005   0.503184463959419   0.461384143283782   NA  1.41733860679182    1.37686216689327    NA
100141358   -0.162915578083457  -0.169819228636319  NA  -1.11954737439258   -1.12491752238597   NA
561451  -0.173655153138899  -0.189375674192084  NA  -1.12791250072506   -1.14027015754414   NA
568683  -0.205355041002986  -0.222153592332505  NA  -1.15297005282589   -1.16647354839269   NA
556251  -0.215741217780107  -0.197657258925047  NA  -1.16130040595023   -1.14683453836773   NA
394248  -0.271801277739071  -0.309251754996919  NA  -1.20731428000618   -1.23906489979156   NA
117751129   -0.274070525500782  -0.319897730321468  NA  -1.20921478631169   -1.24824206045781   NA
553162  -0.300926692227094  -0.314099924594071  NA  -1.23193547342435   -1.24323577547847   NA
571208  -0.345216578871688  -0.439604253983156  NA  -1.27034167323096   -1.35623224802966   NA
406820  -0.35767778501432   -0.360950373464393  NA  -1.2813617097886    -1.28427163122058   NA
ADD REPLYlink modified 4 weeks ago • written 4 weeks ago by sunnykevin97140
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: 1683 users visited in the last hour