Question: limma: logFC column in topTable
gravatar for elenichri
5.0 years ago by
elenichri10 wrote:

Hello everyone,

I am using limma for the detection of differentially expressed genes between two conditions. I have always been selecting the up- and down- regulated genes based on the logFC column of the topTable. However, today this column totally disappeared from the topTable output. Here is an example:

            ID                coef1                  coef2                  coef3    AveExpr      F      P.Value    adj.P.Val
13910     NTSR1             -4.490258             -3.2078144             -3.7724694  9.746352 2577.270 3.960188e-30 6.338903e-26
8233       IL1B             -2.650783             -5.7227167             -3.9875837 10.498109 2486.918 6.057530e-30 6.338903e-26
3360    COL13A1             -4.064761             -4.4417430             -3.2679355  9.823130 2345.764 1.214728e-29 8.474348e-26
10643 LOC643031              6.430895             -0.7497487              0.6393873 12.625948 1884.199 1.648177e-28 8.623672e-25
16631    S100A9             -4.186606             -3.5585657             -2.9390909 12.327986 1647.862 8.113864e-28 3.396301e-24
8232       IL1A             -2.294970             -3.6533448             -4.0192784  9.810856 1493.671 2.608230e-27 9.097940e-24

I tried using the and arguments of topTable, trying to 'push' it display the logFC. But still, logFC was not there.

Has anyone encountered this before? I cannot get what has happened!


Thank you very much!

R software error • 2.6k views
ADD COMMENTlink modified 9 months ago by Gordon Smyth1.9k • written 5.0 years ago by elenichri10

It would be helpful if you posted (A) the output of sessionInfo() and (B) the exact topTable command you used.

ADD REPLYlink written 5.0 years ago by Devon Ryan96k

Hi Ryan,

Yes, sure. Here is the output of sessionInfo():

R version 3.2.1 (2015-06-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

attached base packages:
[1] stats4    parallel  stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] annotate_1.46.1      XML_3.98-1.3         AnnotationDbi_1.30.1 GenomeInfoDb_1.4.2   IRanges_2.2.7        S4Vectors_0.6.3     
 [7] limma_3.24.15        gplots_2.17.0        lumi_2.20.2          Biobase_2.28.0       BiocGenerics_0.14.0 

loaded via a namespace (and not attached):
 [1] nor1mix_1.2-1           splines_3.2.1           foreach_1.4.2           gtools_3.5.0            bumphunter_1.8.0       
 [6] affy_1.46.1             doRNG_1.6               Rsamtools_1.20.4        methylumi_2.14.0        minfi_1.14.0           
[11] RSQLite_1.0.0           lattice_0.20-33         quadprog_1.5-5          digest_0.6.8            GenomicRanges_1.20.6   
[16] RColorBrewer_1.1-2      XVector_0.8.0           colorspace_1.2-6        preprocessCore_1.30.0   Matrix_1.2-2           
[21] plyr_1.8.3              GEOquery_2.34.0         siggenes_1.42.0         biomaRt_2.24.0          genefilter_1.50.0      
[26] zlibbioc_1.14.0         xtable_1.7-4            gdata_2.17.0            affyio_1.36.0           BiocParallel_1.2.21    
[31] nleqslv_2.8             beanplot_1.2            mgcv_1.8-7              pkgmaker_0.22           GenomicFeatures_1.20.4 
[36] survival_2.38-3         magrittr_1.5            mclust_5.0.2            nlme_3.1-122            MASS_7.3-44            
[41] BiocInstaller_1.18.4    tools_3.2.1             registry_0.3            matrixStats_0.14.2      stringr_1.0.0          
[46] locfit_1.5-9.1          rngtools_1.2.4          lambda.r_1.1.7          Biostrings_2.36.4       base64_1.1             
[51] caTools_1.17.1          futile.logger_1.4.1     grid_3.2.1              RCurl_1.95-4.7          iterators_1.0.7        
[56] bitops_1.0-6            codetools_0.2-14        multtest_2.24.0         DBI_0.3.1               reshape_0.8.5          
[61] illuminaio_0.10.0       GenomicAlignments_1.4.1 rtracklayer_1.28.10     futile.options_1.0.0    KernSmooth_2.23-15     
[66] stringi_0.5-5           Rcpp_0.12.0            


And here is the command that I used:

tops <- topTable(contr.fit_parental.gefr,"logFC", adjust="fdr",number = Inf, p.value=0.01, lfc=1)


Thanks a lot for any feedback!

ADD REPLYlink written 5.0 years ago by elenichri10

...Actually, when I use toptable, I don't have this problem. I can see the logFC column. But I don't prefer using it because:

a) It is deprecated and

b) I cannot make a calculation for all the coefficients of my contrast matrix simultaneously (as I can for topTable - default option for coef). I need to specify every time which coefficient I want to calculate and to combine each toptable's  findings manually at the end...


ADD REPLYlink written 5.0 years ago by elenichri10

Then post whatever command you are using, I just asked for topTable because that's what you originally wrote was being used.

ADD REPLYlink written 5.0 years ago by Devon Ryan96k

I want to use topTable...Yes, please, answer to me regarding topTable. I would like to know why I cannot see the logFC column there. I just mentioned that when I use toptable I can see case this is somehow informative about the source of the problem.

Thanks again.

ADD REPLYlink written 5.0 years ago by elenichri10

topTable and toptable produce different output, this is expected. See help(topTable) for more information. Note that with more than one coefficient that topTable just runs topTableF, which produces the coefficients rather than lfc between any particular coefficients (well, obviously these are the fold changes versus the intercept...).

ADD REPLYlink written 5.0 years ago by Devon Ryan96k

Thank you, this is understandable. My worry is though why until some time ago, using exactly the same topTable command, I could see a logFC column and now I cannot. Any clues on that? I suspect I may have overwritten the original topTable function. If this is the case, I don't know how to fix it..If this is not the case, what else could it be?

Thank you very much!

ADD REPLYlink written 5.0 years ago by elenichri10

Presumably you were using smaller models. topTable itself hasn't changed to my knowledge.

ADD REPLYlink written 5.0 years ago by Devon Ryan96k

I was applying the topTable function on the same exact data, I was using exactly the same command. Maybe I accidentally did something wrong and overwritten it...I don't know how to convert it back so I see me switching to the use of toptable instead.  Anyway, thank you for your time and help!

ADD REPLYlink written 5.0 years ago by elenichri10
gravatar for Gordon Smyth
9 months ago by
Gordon Smyth1.9k
Gordon Smyth1.9k wrote:

This is standard well-documented behaviour of topTable that has remained essentially unchanged for more than 13 years.

  1. If you use topTable to rank genes by one coefficient (coef = 2 for example) then the output will include a logFC column, which is simply the estimated value of that coefficient.

  2. If you use topTable to rank genes by several coefficients (coef = 1:3 for example), then genes will be ranked by F-statistic instead of t-statistic. In this case, the output includes the values of all the coefficients specified. Obviously the coefficients can't all be called "logFC", so the coefficients keep their original names.

  3. If you use topTable without specifying the coef argument, then topTable will use all coefficients available (excuding the coefficient labelled "Intercept" if it exists).

In your case, it would appear that you have simply forgotten to specify the coef argument this time, so the genes are now ranked by three coefficients (coef1, coef2 and coef3) instead of just one. This made clear, not just by the coef columns but by the column called "F". limma never gives an F-statistic column and a logFC column at the same time -- they just don't go together!

Your claim that the topTable behaviour has changed for the same command and same data is untrue. The behaviour of topTable has been consistent for the past 13 years.

The behaviour of toptable is slightly different to topTable simply because the default value for coef is different. You could see this for yourself by reading the help page ?topTable or ?toptable. The old toptable function is retained just for backward compatibility and, after 15 years, I might finally remove it.

ADD COMMENTlink modified 9 months ago • written 9 months ago by Gordon Smyth1.9k
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: 863 users visited in the last hour