limma results topTable vs toptable differ
2
0
Entering edit mode
9.3 years ago
TriS ★ 4.7k

Hi all

I'm a bit confused about the difference between the topTable and toptable function in limma.

The LogFC in toptable is equal to the N of topTable but, for the same gene, I get different p.values and adjusted p.values.

I looked at the limma manual (limma_man file) but it does not specify it.

Can anyone help me clarify this?

Thanks

design <- cbind(N=1,D=c(1,0,1,0,1,1,1,0,1,0))
rownames(design) <- colnames(exprs(eset))
design
fit <- lmFit(eset, design)
fit <- eBayes(fit)
> toptable(fit,adjust="BH",p.value = 0.01,n=10)
                   logFC        t      P.Value    adj.P.Val        B
AFFX-hum_alu_at 11.76798 65.91482 1.606215e-15 1.400083e-11 20.74657
35278_at        10.84990 60.27242 4.245924e-15 1.400083e-11 20.44270
31509_at        10.37781 58.10878 6.315064e-15 1.400083e-11 20.30723
32438_at        10.78534 58.09325 6.333416e-15 1.400083e-11 20.30622
33667_at        10.08915 57.83446 6.647998e-15 1.400083e-11 20.28920
31962_at        11.20030 57.82977 6.653860e-15 1.400083e-11 20.28889
34593_g_at      10.77212 56.13055 9.197907e-15 1.658908e-11 20.17258
33994_g_at      10.36453 55.40145 1.060048e-14 1.672888e-11 20.12012
327_f_at        10.30210 53.83738 1.446484e-14 2.029096e-11 20.00206
35905_s_at      10.57997 52.58897 1.865876e-14 2.355669e-11 19.90205
> topTable(fit,adjust="BH",p.value = 0.01,n=10)
                       N           T  AveExpr        F      P.Value    adj.P.Val
AFFX-hum_alu_at 11.76798  0.06389285 11.80632 5466.434 4.500308e-17 5.115957e-13
35278_at        10.84990  0.17770262 10.95652 4630.934 1.109314e-16 5.115957e-13
33667_at        10.08915 -0.05339206 10.05711 4154.550 2.001889e-16 5.115957e-13
32438_at        10.78534 -0.21478303 10.65647 4118.725 2.098423e-16 5.115957e-13
31962_at        11.20030 -0.16281600 11.10261 4107.960 2.128500e-16 5.115957e-13
31509_at        10.37781 -0.49468443 10.08100 3985.109 2.510588e-16 5.115957e-13
33994_g_at      10.36453  0.02694039 10.38070 3848.633 3.034344e-16 5.115957e-13
34593_g_at      10.77212 -0.31503286 10.58310 3802.107 3.241795e-16 5.115957e-13
33322_i_at      11.29747  0.46220237 11.57479 3559.200 4.641677e-16 6.051772e-13
327_f_at        10.30210 -0.20314128 10.18021 3538.194 4.793483e-16 6.051772e-13
microarray differential-expression R limma • 7.0k views
ADD COMMENT
1
Entering edit mode

You might have a look through the code for topTable(), which actually calls toptable() internally. It's likely that topTable() is just overriding some of the toptable() defaults.

ADD REPLY
1
Entering edit mode
9.3 years ago
TriS ★ 4.7k

Devon, you are right, it does call internally toptable(), also, using coef=2 I got the same results independently from using toptable() or topTable().

Thanks :)

ADD COMMENT
0
Entering edit mode

That makes sense then, I imagine that topTable() is just tweaking coefficients and contrasts. That also explains why they state in the documentation that toptable() is only included for backwards compatibility. BTW, I'm going to move your comment to an answer since it essentially demonstrates the problem's resolution.

ADD REPLY
0
Entering edit mode

that is correct and at the same moment I had no idea lol. in fact, if I build the contrast matrix so that I get the contrasts -1 and 1, then calling topTable() gives the same results as if I run topTable() with coef=2

ADD REPLY
0
Entering edit mode

That makes sense since the contrast and the coefficient should be identical there.

ADD REPLY
0
Entering edit mode

I think you mean contrast=c(0,1), because that is equivalent to coef=2.

ADD REPLY
1
Entering edit mode
9.3 years ago
Gordon Smyth ★ 7.0k

You can see the defaults for both functions by typing ?topTable or ?toptable.

In topTable,the default for coef is 1:ncol(design), which is not actually what you want here. On the other hand, the default for toptable is coef=1, again not what you want here. The second coef is the logFC between the two groups, so you want coef=2.

Unfortunately, we can't set topTable and toptable to have the same defaults because the former can handle a vector argument for coef whereas toptable can't. The simplest solution of course is just not to use toptable, as it has been deprecated for a long time.

ADD COMMENT

Login before adding your answer.

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