Skip to contents

Calculate the eigengene of a module from a data set

Usage

eigengene(x, g, mset = NULL, k = 1)

Arguments

x

data; genes in rows, samples in columns

g

genes -- a vector gene IDs corresponding to annotation in modules

mset

-- a module set; eigengenes will be calculated for each module in the set

k

which component defines the eigengene (default: 1)

Value

A numeric matrix with rows corresponding to modules. If there was not a sufficient number of genes in a module corresponding to the data set, the row will contain only NA's.

Details

The eigengene of a module is here defined as the first principal component of a PCA on the gene expression of all genes from a module.

Examples

data(Egambia)
data(tmod)
x <- Egambia[ , -c(1:3) ]
ifns <- tmod[ grep("[Ii]nterferon", tmod$gs$Title) ]
eigv <- eigengene(x, Egambia$GENE_SYMBOL, ifns)
plot(eigv["LI.M127", ], eigv["DC.M1.2",])


# which interferon modules are correlated
cor(eigv) 
#>               NID      NID.1       NID.2       NID.3      NID.4         NID.5
#> NID     1.0000000  0.7340461  0.77798648  0.43569182  0.6926534 -1.734962e-01
#> NID.1   0.7340461  1.0000000  0.95401316  0.83478049  0.7306611  2.306428e-01
#> NID.2   0.7779865  0.9540132  1.00000000  0.74323177  0.6722409 -5.528967e-02
#> NID.3   0.4356918  0.8347805  0.74323177  1.00000000  0.8401116  3.873480e-01
#> NID.4   0.6926534  0.7306611  0.67224089  0.84011165  1.0000000  2.541241e-01
#> NID.5  -0.1734962  0.2306428 -0.05528967  0.38734803  0.2541241  1.000000e+00
#> NID.6   0.8756612  0.9478450  0.94194598  0.80322636  0.8452683  5.833721e-02
#> NID.7   0.9548356  0.8843013  0.89828262  0.67475455  0.8236078 -2.060135e-02
#> NID.8  -0.4810708 -0.7120692 -0.56315144 -0.60601374 -0.4078260 -3.478841e-01
#> NID.9   0.6380659  0.5662710  0.60627916  0.07841018  0.1981659  4.324869e-05
#> NID.10  0.8403301  0.7763935  0.74094404  0.77326055  0.9276373  7.791330e-02
#> NID.11 -0.3180777 -0.7121303 -0.61548802 -0.96721064 -0.7734526 -3.454134e-01
#> NID.12  0.7737778  0.9495713  0.98561371  0.82191750  0.7683774 -3.091130e-02
#> NID.13  0.9099939  0.8284390  0.78934672  0.58557580  0.7976842  1.917862e-01
#> NID.14 -0.1343416 -0.2774313 -0.20654154 -0.69664252 -0.6533970 -1.571156e-01
#> TB     -0.6544796 -0.5961499 -0.63533955 -0.11489311 -0.2276562 -4.990075e-03
#> TB.1   -0.3304879 -0.1769852 -0.15061192 -0.41894723 -0.7644742 -1.999860e-01
#> TB.2   -0.2341156 -0.4330071 -0.60783939 -0.10169786  0.1298679  4.313480e-01
#> TB.3   -0.6537368 -0.8475219 -0.83803820 -0.92962662 -0.8770582 -6.571663e-02
#> TB.4   -0.7060308 -0.4003332 -0.62168527 -0.26606706 -0.4737239  7.183756e-01
#> TB.5   -0.2839792 -0.3754146 -0.46711297  0.09143206  0.1653776  1.280893e-01
#> TB.6    0.6600716  0.8701071  0.88239264  0.86625597  0.7391022 -3.975092e-02
#> TB.7   -0.7966635 -0.9786370 -0.96792652 -0.73416627 -0.6975659 -1.405127e-01
#> TB.8   -0.8829098 -0.9458024 -0.94452731 -0.64804464 -0.6881623 -7.347971e-02
#> TB.9   -0.7693677 -0.9855857 -0.95954455 -0.73275699 -0.6364853 -1.506282e-01
#> TB.10   0.3578804  0.5199361  0.67276398  0.13671390 -0.0866007 -4.152575e-01
#> TB.11  -0.1857347 -0.1500524  0.09807492 -0.33949876 -0.4906118 -6.787103e-01
#> TB.12  -0.8189205 -0.9295643 -0.92003603 -0.60836887 -0.6271554 -1.396041e-01
#> TB.13  -0.8518470 -0.9525634 -0.95482739 -0.68567649 -0.7170650 -9.502084e-02
#> TB.14  -0.8337039 -0.9781274 -0.97603940 -0.80233886 -0.7764050 -6.419038e-02
#>              NID.6       NID.7       NID.8         NID.9      NID.10
#> NID     0.87566122  0.95483555 -0.48107084  6.380659e-01  0.84033007
#> NID.1   0.94784501  0.88430128 -0.71206920  5.662710e-01  0.77639351
#> NID.2   0.94194598  0.89828262 -0.56315144  6.062792e-01  0.74094404
#> NID.3   0.80322636  0.67475455 -0.60601374  7.841018e-02  0.77326055
#> NID.4   0.84526830  0.82360783 -0.40782595  1.981659e-01  0.92763729
#> NID.5   0.05833721 -0.02060135 -0.34788413  4.324869e-05  0.07791330
#> NID.6   1.00000000  0.97704511 -0.64401417  5.097922e-01  0.91720401
#> NID.7   0.97704511  1.00000000 -0.56294339  5.953459e-01  0.91157034
#> NID.8  -0.64401417 -0.56294339  1.00000000 -1.585251e-01 -0.61122011
#> NID.9   0.50979223  0.59534595 -0.15852505  1.000000e+00  0.23157490
#> NID.10  0.91720401  0.91157034 -0.61122011  2.315749e-01  1.00000000
#> NID.11 -0.69957799 -0.55325071  0.62610321  1.571175e-01 -0.73673533
#> NID.12  0.96541657  0.91190778 -0.56669163  4.917367e-01  0.81826656
#> NID.13  0.89114042  0.94192214 -0.47450406  7.190426e-01  0.81857892
#> NID.14 -0.39157910 -0.28581938  0.37648308  5.778862e-01 -0.63154589
#> TB     -0.53981271 -0.62026756  0.18012972 -9.992731e-01 -0.26056218
#> TB.1   -0.35239539 -0.39428864 -0.21716936  1.480823e-02 -0.54288263
#> TB.2   -0.31466633 -0.28022823  0.06586720 -5.766755e-01  0.05021625
#> TB.3   -0.90833069 -0.82391276  0.59882562 -1.345957e-01 -0.90215713
#> TB.4   -0.60963802 -0.66513646  0.02363313 -2.726630e-01 -0.59265792
#> TB.5   -0.22914673 -0.26810816 -0.01678149 -8.784607e-01  0.14656595
#> TB.6    0.90237277  0.81103279 -0.69772482  1.812551e-01  0.84197903
#> TB.7   -0.94130149 -0.91228883  0.60021618 -7.085946e-01 -0.73854320
#> TB.8   -0.94552686 -0.94996228  0.60177810 -7.532665e-01 -0.76828095
#> TB.9   -0.92869877 -0.88413287  0.71494136 -6.592636e-01 -0.72399710
#> TB.10   0.41170699  0.38371956 -0.24820743  6.162657e-01  0.06072030
#> TB.11  -0.20901503 -0.20955715  0.46996776  2.175370e-01 -0.47336749
#> TB.12  -0.89111800 -0.89484329  0.54041102 -8.241310e-01 -0.67144924
#> TB.13  -0.94525855 -0.94108352  0.54722048 -7.476153e-01 -0.75913704
#> TB.14  -0.98866788 -0.95021228  0.66457734 -5.564392e-01 -0.85165175
#>             NID.11       NID.12     NID.13      NID.14           TB
#> NID    -0.31807767  0.773777840  0.9099939 -0.13434156 -0.654479590
#> NID.1  -0.71213029  0.949571293  0.8284390 -0.27743134 -0.596149920
#> NID.2  -0.61548802  0.985613714  0.7893467 -0.20654154 -0.635339553
#> NID.3  -0.96721064  0.821917503  0.5855758 -0.69664252 -0.114893112
#> NID.4  -0.77345256  0.768377430  0.7976842 -0.65339702 -0.227656219
#> NID.5  -0.34541337 -0.030911302  0.1917862 -0.15711564 -0.004990075
#> NID.6  -0.69957799  0.965416567  0.8911404 -0.39157910 -0.539812707
#> NID.7  -0.55325071  0.911907781  0.9419221 -0.28581938 -0.620267563
#> NID.8   0.62610321 -0.566691632 -0.4745041  0.37648308  0.180129718
#> NID.9   0.15711754  0.491736690  0.7190426  0.57788617 -0.999273111
#> NID.10 -0.73673533  0.818266556  0.8185789 -0.63154589 -0.260562184
#> NID.11  1.00000000 -0.717113060 -0.4160525  0.83369527 -0.120462002
#> NID.12 -0.71711306  1.000000000  0.7870787 -0.36138921 -0.523961175
#> NID.13 -0.41605250  0.787078745  1.0000000 -0.11730749 -0.737154188
#> NID.14  0.83369527 -0.361389210 -0.1173075  1.00000000 -0.549375803
#> TB     -0.12046200 -0.523961175 -0.7371542 -0.54937580  1.000000000
#> TB.1    0.36165203 -0.265623092 -0.4756171  0.48350122 -0.002285465
#> TB.2   -0.01720856 -0.499936438 -0.1640475 -0.41370097  0.584867685
#> TB.3    0.90574639 -0.915949390 -0.6643777  0.70423756  0.171254936
#> TB.4    0.22769184 -0.646727640 -0.4622499  0.23229497  0.289579675
#> TB.5   -0.30060329 -0.320490564 -0.3482806 -0.75150895  0.873606287
#> TB.6   -0.85202294  0.931489381  0.6102478 -0.60666554 -0.216909522
#> TB.7    0.57450973 -0.943522533 -0.8823073  0.12463608  0.734570474
#> TB.8    0.48707671 -0.914920286 -0.9268414  0.07785277  0.776066388
#> TB.9    0.59816723 -0.930089598 -0.8293954  0.14347513  0.685648607
#> TB.10  -0.02647334  0.561375851  0.2541044  0.38031162 -0.625688853
#> TB.11   0.39000033  0.007723622 -0.3231090  0.51245393 -0.211287698
#> TB.12   0.42082046 -0.873608565 -0.9116563 -0.03823067  0.844385571
#> TB.13   0.51603308 -0.930561213 -0.9239908  0.09427945  0.771666476
#> TB.14   0.68874472 -0.981648585 -0.8603866  0.31898318  0.586545117
#>                TB.1        TB.2        TB.3        TB.4        TB.5        TB.6
#> NID    -0.330487895 -0.23411559 -0.65373682 -0.70603081 -0.28397915  0.66007162
#> NID.1  -0.176985180 -0.43300715 -0.84752192 -0.40033317 -0.37541455  0.87010714
#> NID.2  -0.150611919 -0.60783939 -0.83803820 -0.62168527 -0.46711297  0.88239264
#> NID.3  -0.418947227 -0.10169786 -0.92962662 -0.26606706  0.09143206  0.86625597
#> NID.4  -0.764474179  0.12986795 -0.87705823 -0.47372390  0.16537761  0.73910216
#> NID.5  -0.199985996  0.43134804 -0.06571663  0.71837563  0.12808933 -0.03975092
#> NID.6  -0.352395392 -0.31466633 -0.90833069 -0.60963802 -0.22914673  0.90237277
#> NID.7  -0.394288638 -0.28022823 -0.82391276 -0.66513646 -0.26810816  0.81103279
#> NID.8  -0.217169363  0.06586720  0.59882562  0.02363313 -0.01678149 -0.69772482
#> NID.9   0.014808230 -0.57667549 -0.13459572 -0.27266296 -0.87846074  0.18125508
#> NID.10 -0.542882627  0.05021625 -0.90215713 -0.59265792  0.14656595  0.84197903
#> NID.11  0.361652030 -0.01720856  0.90574639  0.22769184 -0.30060329 -0.85202294
#> NID.12 -0.265623092 -0.49993644 -0.91594939 -0.64672764 -0.32049056  0.93148938
#> NID.13 -0.475617122 -0.16404751 -0.66437774 -0.46224989 -0.34828058  0.61024777
#> NID.14  0.483501220 -0.41370097  0.70423756  0.23229497 -0.75150895 -0.60666554
#> TB     -0.002285465  0.58486769  0.17125494  0.28957967  0.87360629 -0.21690952
#> TB.1    1.000000000 -0.44409891  0.42355047  0.29808958 -0.33967090 -0.18270269
#> TB.2   -0.444098908  1.00000000  0.18700992  0.42092095  0.81772264 -0.34718704
#> TB.3    0.423550473  0.18700992  1.00000000  0.58059746 -0.08041998 -0.96569126
#> TB.4    0.298089581  0.42092095  0.58059746  1.00000000  0.14279440 -0.59903621
#> TB.5   -0.339670904  0.81772264 -0.08041998  0.14279440  1.00000000 -0.02900436
#> TB.6   -0.182702687 -0.34718704 -0.96569126 -0.59903621 -0.02900436  1.00000000
#> TB.7    0.196048777  0.51142297  0.77754307  0.47129975  0.51247495 -0.79934897
#> TB.8    0.199571885  0.46824105  0.73681984  0.52301158  0.50926668 -0.76401158
#> TB.9    0.062721103  0.51946374  0.77407446  0.42119081  0.48536009 -0.82984952
#> TB.10   0.503440922 -0.97573435 -0.24961886 -0.44293758 -0.80152033  0.43540358
#> TB.11   0.435622227 -0.80500976  0.23636108 -0.32792620 -0.58783844 -0.11105102
#> TB.12   0.172474604  0.51453056  0.65671273  0.43286798  0.61301882 -0.68078601
#> TB.13   0.256536168  0.48220801  0.75569266  0.52302291  0.51706377 -0.76543984
#> TB.14   0.243177777  0.42927180  0.88781960  0.57240936  0.33119533 -0.90761097
#>               TB.7        TB.8        TB.9       TB.10        TB.11       TB.12
#> NID    -0.79666351 -0.88290982 -0.76936770  0.35788036 -0.185734668 -0.81892047
#> NID.1  -0.97863701 -0.94580240 -0.98558567  0.51993611 -0.150052382 -0.92956430
#> NID.2  -0.96792652 -0.94452731 -0.95954455  0.67276398  0.098074922 -0.92003603
#> NID.3  -0.73416627 -0.64804464 -0.73275699  0.13671390 -0.339498760 -0.60836887
#> NID.4  -0.69756595 -0.68816227 -0.63648533 -0.08660070 -0.490611839 -0.62715543
#> NID.5  -0.14051273 -0.07347971 -0.15062819 -0.41525754 -0.678710349 -0.13960414
#> NID.6  -0.94130149 -0.94552686 -0.92869877  0.41170699 -0.209015031 -0.89111800
#> NID.7  -0.91228883 -0.94996228 -0.88413287  0.38371956 -0.209557152 -0.89484329
#> NID.8   0.60021618  0.60177810  0.71494136 -0.24820743  0.469967764  0.54041102
#> NID.9  -0.70859461 -0.75326646 -0.65926358  0.61626571  0.217537045 -0.82413104
#> NID.10 -0.73854320 -0.76828095 -0.72399710  0.06072030 -0.473367493 -0.67144924
#> NID.11  0.57450973  0.48707671  0.59816723 -0.02647334  0.390000328  0.42082046
#> NID.12 -0.94352253 -0.91492029 -0.93008960  0.56137585  0.007723622 -0.87360856
#> NID.13 -0.88230734 -0.92684139 -0.82939544  0.25410440 -0.323108950 -0.91165632
#> NID.14  0.12463608  0.07785277  0.14347513  0.38031162  0.512453932 -0.03823067
#> TB      0.73457047  0.77606639  0.68564861 -0.62568885 -0.211287698  0.84438557
#> TB.1    0.19604878  0.19957189  0.06272110  0.50344092  0.435622227  0.17247460
#> TB.2    0.51142297  0.46824105  0.51946374 -0.97573435 -0.805009763  0.51453056
#> TB.3    0.77754307  0.73681984  0.77407446 -0.24961886  0.236361081  0.65671273
#> TB.4    0.47129975  0.52301158  0.42119081 -0.44293758 -0.327926197  0.43286798
#> TB.5    0.51247495  0.50926668  0.48536009 -0.80152033 -0.587838436  0.61301882
#> TB.6   -0.79934897 -0.76401158 -0.82984952  0.43540358 -0.111051022 -0.68078601
#> TB.7    1.00000000  0.98426163  0.98489508 -0.58680560  0.048731754  0.98164190
#> TB.8    0.98426163  1.00000000  0.96895130 -0.56513568  0.084735154  0.98630687
#> TB.9    0.98489508  0.96895130  1.00000000 -0.61944375  0.069527590  0.95741472
#> TB.10  -0.58680560 -0.56513568 -0.61944375  1.00000000  0.696897059 -0.59236549
#> TB.11   0.04873175  0.08473515  0.06952759  0.69689706  1.000000000  0.03399204
#> TB.12   0.98164190  0.98630687  0.95741472 -0.59236549  0.033992037  1.00000000
#> TB.13   0.99242123  0.99385347  0.96405792 -0.55795686  0.057476994  0.98837873
#> TB.14   0.97204537  0.96206201  0.96901144 -0.52149131  0.117519234  0.92206173
#>              TB.13       TB.14
#> NID    -0.85184701 -0.83370395
#> NID.1  -0.95256337 -0.97812735
#> NID.2  -0.95482739 -0.97603940
#> NID.3  -0.68567649 -0.80233886
#> NID.4  -0.71706500 -0.77640500
#> NID.5  -0.09502084 -0.06419038
#> NID.6  -0.94525855 -0.98866788
#> NID.7  -0.94108352 -0.95021228
#> NID.8   0.54722048  0.66457734
#> NID.9  -0.74761532 -0.55643916
#> NID.10 -0.75913704 -0.85165175
#> NID.11  0.51603308  0.68874472
#> NID.12 -0.93056121 -0.98164859
#> NID.13 -0.92399082 -0.86038663
#> NID.14  0.09427945  0.31898318
#> TB      0.77166648  0.58654512
#> TB.1    0.25653617  0.24317778
#> TB.2    0.48220801  0.42927180
#> TB.3    0.75569266  0.88781960
#> TB.4    0.52302291  0.57240936
#> TB.5    0.51706377  0.33119533
#> TB.6   -0.76543984 -0.90761097
#> TB.7    0.99242123  0.97204537
#> TB.8    0.99385347  0.96206201
#> TB.9    0.96405792  0.96901144
#> TB.10  -0.55795686 -0.52149131
#> TB.11   0.05747699  0.11751923
#> TB.12   0.98837873  0.92206173
#> TB.13   1.00000000  0.96366110
#> TB.14   0.96366110  1.00000000