Skip to contents

Identify the biological pathways (gene sets from Reactome) that each metagene (factor) might belongs to.

Usage

runGSEA(
  object,
  genesets = NULL,
  useW = TRUE,
  useV = NULL,
  customGenesets = NULL,
  gene_sets = genesets,
  mat_w = useW,
  mat_v = useV,
  custom_gene_sets = customGenesets
)

Arguments

object

A liger object with valid factorization result.

genesets

Character vector of the Reactome gene sets names to be tested. Default NULL uses all the gene sets from the Reactome.

useW

Logical, whether to use the shared factor loadings (\(W\)). Default TRUE.

useV

A character vector of the names, a numeric or logical vector of the index of the datasets where the \(V\) matrices will be included for analysis. Default NULL uses all datasets.

customGenesets

A named list of character vectors of entrez gene ids. Default NULL uses all the gene symbols from the input matrix.

gene_sets, mat_w, mat_v, custom_gene_sets

Deprecated. See Usage section for replacement.

Value

A list of matrices with GSEA analysis for each factor

Examples

# \donttest{
if (requireNamespace("org.Hs.eg.db", quietly = TRUE) &&
    requireNamespace("reactome.db", quietly = TRUE) &&
    requireNamespace("fgsea", quietly = TRUE) &&
    requireNamespace("AnnotationDbi", quietly = TRUE)) {
    runGSEA(pbmcPlot)
}
#> 
#> 'select()' returned 1:1 mapping between keys and columns
#> 'select()' returned 1:many mapping between keys and columns
#> 'select()' returned 1:1 mapping between keys and columns
#> Warning: You are trying to run fgseaSimple. It is recommended to use fgseaMultilevel. To run fgseaMultilevel, you need to remove the nperm argument in the fgsea function call.
#> Warning: There are ties in the preranked stats (40.43% of the list).
#> The order of those tied genes will be arbitrary, which may produce unexpected results.
#> Warning: All values in the stats vector are greater than zero and scoreType is "std", maybe you should switch to scoreType = "pos".
#> Warning: You are trying to run fgseaSimple. It is recommended to use fgseaMultilevel. To run fgseaMultilevel, you need to remove the nperm argument in the fgsea function call.
#> Warning: There are ties in the preranked stats (38.3% of the list).
#> The order of those tied genes will be arbitrary, which may produce unexpected results.
#> Warning: All values in the stats vector are greater than zero and scoreType is "std", maybe you should switch to scoreType = "pos".
#> Warning: You are trying to run fgseaSimple. It is recommended to use fgseaMultilevel. To run fgseaMultilevel, you need to remove the nperm argument in the fgsea function call.
#> Warning: There are ties in the preranked stats (40.43% of the list).
#> The order of those tied genes will be arbitrary, which may produce unexpected results.
#> Warning: All values in the stats vector are greater than zero and scoreType is "std", maybe you should switch to scoreType = "pos".
#> Warning: You are trying to run fgseaSimple. It is recommended to use fgseaMultilevel. To run fgseaMultilevel, you need to remove the nperm argument in the fgsea function call.
#> Warning: There are ties in the preranked stats (29.79% of the list).
#> The order of those tied genes will be arbitrary, which may produce unexpected results.
#> Warning: All values in the stats vector are greater than zero and scoreType is "std", maybe you should switch to scoreType = "pos".
#> Warning: You are trying to run fgseaSimple. It is recommended to use fgseaMultilevel. To run fgseaMultilevel, you need to remove the nperm argument in the fgsea function call.
#> Warning: There are ties in the preranked stats (42.55% of the list).
#> The order of those tied genes will be arbitrary, which may produce unexpected results.
#> Warning: All values in the stats vector are greater than zero and scoreType is "std", maybe you should switch to scoreType = "pos".
#> Warning: You are trying to run fgseaSimple. It is recommended to use fgseaMultilevel. To run fgseaMultilevel, you need to remove the nperm argument in the fgsea function call.
#> Warning: There are ties in the preranked stats (34.04% of the list).
#> The order of those tied genes will be arbitrary, which may produce unexpected results.
#> Warning: All values in the stats vector are greater than zero and scoreType is "std", maybe you should switch to scoreType = "pos".
#> Warning: You are trying to run fgseaSimple. It is recommended to use fgseaMultilevel. To run fgseaMultilevel, you need to remove the nperm argument in the fgsea function call.
#> Warning: There are ties in the preranked stats (29.79% of the list).
#> The order of those tied genes will be arbitrary, which may produce unexpected results.
#> Warning: All values in the stats vector are greater than zero and scoreType is "std", maybe you should switch to scoreType = "pos".
#> Warning: You are trying to run fgseaSimple. It is recommended to use fgseaMultilevel. To run fgseaMultilevel, you need to remove the nperm argument in the fgsea function call.
#> Warning: There are ties in the preranked stats (42.55% of the list).
#> The order of those tied genes will be arbitrary, which may produce unexpected results.
#> Warning: All values in the stats vector are greater than zero and scoreType is "std", maybe you should switch to scoreType = "pos".
#> Warning: You are trying to run fgseaSimple. It is recommended to use fgseaMultilevel. To run fgseaMultilevel, you need to remove the nperm argument in the fgsea function call.
#> Warning: There are ties in the preranked stats (46.81% of the list).
#> The order of those tied genes will be arbitrary, which may produce unexpected results.
#> Warning: All values in the stats vector are greater than zero and scoreType is "std", maybe you should switch to scoreType = "pos".
#> Warning: You are trying to run fgseaSimple. It is recommended to use fgseaMultilevel. To run fgseaMultilevel, you need to remove the nperm argument in the fgsea function call.
#> Warning: There are ties in the preranked stats (38.3% of the list).
#> The order of those tied genes will be arbitrary, which may produce unexpected results.
#> Warning: All values in the stats vector are greater than zero and scoreType is "std", maybe you should switch to scoreType = "pos".
#> Warning: You are trying to run fgseaSimple. It is recommended to use fgseaMultilevel. To run fgseaMultilevel, you need to remove the nperm argument in the fgsea function call.
#> Warning: There are ties in the preranked stats (44.68% of the list).
#> The order of those tied genes will be arbitrary, which may produce unexpected results.
#> Warning: All values in the stats vector are greater than zero and scoreType is "std", maybe you should switch to scoreType = "pos".
#> Warning: You are trying to run fgseaSimple. It is recommended to use fgseaMultilevel. To run fgseaMultilevel, you need to remove the nperm argument in the fgsea function call.
#> Warning: There are ties in the preranked stats (31.91% of the list).
#> The order of those tied genes will be arbitrary, which may produce unexpected results.
#> Warning: All values in the stats vector are greater than zero and scoreType is "std", maybe you should switch to scoreType = "pos".
#> Warning: You are trying to run fgseaSimple. It is recommended to use fgseaMultilevel. To run fgseaMultilevel, you need to remove the nperm argument in the fgsea function call.
#> Warning: There are ties in the preranked stats (51.06% of the list).
#> The order of those tied genes will be arbitrary, which may produce unexpected results.
#> Warning: All values in the stats vector are greater than zero and scoreType is "std", maybe you should switch to scoreType = "pos".
#> Warning: You are trying to run fgseaSimple. It is recommended to use fgseaMultilevel. To run fgseaMultilevel, you need to remove the nperm argument in the fgsea function call.
#> Warning: There are ties in the preranked stats (38.3% of the list).
#> The order of those tied genes will be arbitrary, which may produce unexpected results.
#> Warning: All values in the stats vector are greater than zero and scoreType is "std", maybe you should switch to scoreType = "pos".
#> Warning: You are trying to run fgseaSimple. It is recommended to use fgseaMultilevel. To run fgseaMultilevel, you need to remove the nperm argument in the fgsea function call.
#> Warning: There are ties in the preranked stats (53.19% of the list).
#> The order of those tied genes will be arbitrary, which may produce unexpected results.
#> Warning: All values in the stats vector are greater than zero and scoreType is "std", maybe you should switch to scoreType = "pos".
#> Warning: You are trying to run fgseaSimple. It is recommended to use fgseaMultilevel. To run fgseaMultilevel, you need to remove the nperm argument in the fgsea function call.
#> Warning: There are ties in the preranked stats (34.04% of the list).
#> The order of those tied genes will be arbitrary, which may produce unexpected results.
#> Warning: All values in the stats vector are greater than zero and scoreType is "std", maybe you should switch to scoreType = "pos".
#> Warning: You are trying to run fgseaSimple. It is recommended to use fgseaMultilevel. To run fgseaMultilevel, you need to remove the nperm argument in the fgsea function call.
#> Warning: There are ties in the preranked stats (34.04% of the list).
#> The order of those tied genes will be arbitrary, which may produce unexpected results.
#> Warning: All values in the stats vector are greater than zero and scoreType is "std", maybe you should switch to scoreType = "pos".
#> Warning: You are trying to run fgseaSimple. It is recommended to use fgseaMultilevel. To run fgseaMultilevel, you need to remove the nperm argument in the fgsea function call.
#> Warning: There are ties in the preranked stats (40.43% of the list).
#> The order of those tied genes will be arbitrary, which may produce unexpected results.
#> Warning: All values in the stats vector are greater than zero and scoreType is "std", maybe you should switch to scoreType = "pos".
#> Warning: You are trying to run fgseaSimple. It is recommended to use fgseaMultilevel. To run fgseaMultilevel, you need to remove the nperm argument in the fgsea function call.
#> Warning: There are ties in the preranked stats (40.43% of the list).
#> The order of those tied genes will be arbitrary, which may produce unexpected results.
#> Warning: All values in the stats vector are greater than zero and scoreType is "std", maybe you should switch to scoreType = "pos".
#> Warning: You are trying to run fgseaSimple. It is recommended to use fgseaMultilevel. To run fgseaMultilevel, you need to remove the nperm argument in the fgsea function call.
#> Warning: There are ties in the preranked stats (31.91% of the list).
#> The order of those tied genes will be arbitrary, which may produce unexpected results.
#> Warning: All values in the stats vector are greater than zero and scoreType is "std", maybe you should switch to scoreType = "pos".
#> $Factor_1
#>                    pathway        pval        padj        ES      NES
#> 1 Viral Infection Pathways 0.001391118 0.005564473 0.6841373 1.848427
#> 2       Infectious disease 0.006055455 0.012110910 0.6324946 1.732690
#> 3                  Disease 0.035265547 0.047020730 0.5555992 1.539175
#> 4            Immune System 0.402103474 0.402103474 0.3869393 1.060003
#>   nMoreExtreme size  leadingEdge
#> 1           12   16 6232, 61....
#> 2           56   18 6232, 61....
#> 3          333   21 6232, 61....
#> 4         3784   18 5473, 91....
#> 
#> $Factor_2
#>                    pathway         pval         padj         ES       NES
#> 1       Infectious disease 0.0004224757 0.0008449514  0.7516368  2.048992
#> 2 Viral Infection Pathways 0.0002133561 0.0008449514  0.7945198  2.127748
#> 3                  Disease 0.0014753926 0.0019671901  0.6878732  1.890748
#> 4            Immune System 0.4189944134 0.4189944134 -0.2442762 -1.005201
#>   nMoreExtreme size  leadingEdge
#> 1            3   18 7852, 62....
#> 2            1   16 7852, 62....
#> 3           13   21 7852, 62....
#> 4          224   18 929, 362....
#> 
#> $Factor_3
#>                    pathway      pval      padj        ES      NES nMoreExtreme
#> 1                  Disease 0.1021156 0.2902135 0.5033034 1.363403          974
#> 2       Infectious disease 0.1451067 0.2902135 0.4849868 1.296973         1372
#> 3 Viral Infection Pathways 0.2918218 0.3890957 0.4347337 1.148921         2743
#> 4            Immune System 0.4154513 0.4154513 0.3933589 1.051938         3930
#>   size  leadingEdge
#> 1   21 3553, 92....
#> 2   18 3553, 22....
#> 3   16 6202, 90....
#> 4   18 3553, 92....
#> 
#> $Factor_4
#>                    pathway      pval      padj        ES       NES nMoreExtreme
#> 1       Infectious disease 0.1959253 0.3918505 0.4457936 1.2418414         1855
#> 2 Viral Infection Pathways 0.1652452 0.3918505 0.4642226 1.2730006         1549
#> 3                  Disease 0.5654097 0.7538796 0.3355193 0.9424895         5367
#> 4            Immune System 0.9053098 0.9053098 0.2307424 0.6427760         8575
#>   size  leadingEdge
#> 1   18 9636, 61....
#> 2   16 9636, 61....
#> 3   21 9636, 61....
#> 4   18 91543, 9....
#> 
#> $Factor_5
#>                    pathway       pval      padj        ES       NES
#> 1       Infectious disease 0.06196468 0.1239294 0.5286897 1.4474224
#> 2 Viral Infection Pathways 0.05807003 0.1239294 0.5352879 1.4438988
#> 3                  Disease 0.26604925 0.3547323 0.4263150 1.1795495
#> 4            Immune System 0.90440943 0.9044094 0.2309144 0.6321869
#>   nMoreExtreme size  leadingEdge
#> 1          585   18 3553, 96....
#> 2          543   16 9636, 62....
#> 3         2527   21 3553, 96....
#> 4         8552   18 972, 355....
#> 
#> $Factor_6
#>                    pathway       pval       padj        ES      NES
#> 1            Immune System 0.02084869 0.08339476 0.5831827 1.576855
#> 2       Infectious disease 0.27787722 0.37050297 0.4286276 1.158957
#> 3 Viral Infection Pathways 0.24860011 0.37050297 0.4431857 1.186587
#> 4                  Disease 0.40515615 0.40515615 0.3858369 1.055685
#>   nMoreExtreme size  leadingEdge
#> 1          197   18 2214, 51....
#> 2         2638   18 2214, 96....
#> 3         2352   16 9636, 61....
#> 4         3865   21 2214, 96....
#> 
#> $Factor_7
#>                    pathway        pval        padj        ES       NES
#> 1       Infectious disease 0.001468275 0.005873099 0.6880527 1.8578428
#> 2                  Disease 0.012445095 0.016593460 0.6088180 1.6578106
#> 3 Viral Infection Pathways 0.008969083 0.016593460 0.6283282 1.6766993
#> 4            Immune System 0.965285789 0.965285789 0.2017394 0.5447259
#>   nMoreExtreme size  leadingEdge
#> 1           13   18 2214, 62....
#> 2          118   21 2214, 62....
#> 3           84   16 6228, 90....
#> 4         9203   18 10578, 2....
#> 
#> $Factor_8
#>                    pathway         pval         padj        ES      NES
#> 1       Infectious disease 0.0001065757 0.0002146614 0.7910399 2.175216
#> 2 Viral Infection Pathways 0.0001073307 0.0002146614 0.8328494 2.265038
#> 3                  Disease 0.0004227883 0.0005637177 0.7311131 2.035824
#> 4            Immune System 0.8661408931 0.8661408931 0.2444750 0.672262
#>   nMoreExtreme size  leadingEdge
#> 1            0   18 6133, 61....
#> 2            0   16 6133, 61....
#> 3            3   21 6133, 61....
#> 4         8126   18 10578, 6....
#> 
#> $Factor_9
#>                    pathway       pval       padj        ES      NES
#> 1            Immune System 0.01214187 0.04856747 0.6100554 1.659854
#> 2                  Disease 0.37211274 0.51569892 0.3951049 1.085591
#> 3 Viral Infection Pathways 0.38677419 0.51569892 0.4006452 1.078623
#> 4       Infectious disease 0.51869209 0.51869209 0.3590636 0.976949
#>   nMoreExtreme size  leadingEdge
#> 1          113   18 9636, 91....
#> 2         3511   21 9636, 62....
#> 3         3596   16 9636, 61....
#> 4         4869   18 9636, 61....
#> 
#> $Factor_10
#>                    pathway        pval       padj         ES       NES
#> 1 Viral Infection Pathways 0.003203075 0.01281230  0.6689367  1.819988
#> 2       Infectious disease 0.009693225 0.01938645  0.6113634  1.680414
#> 3                  Disease 0.060532432 0.08070991  0.5244344  1.459576
#> 4            Immune System 0.288492707 0.28849271 -0.2735749 -1.155878
#>   nMoreExtreme size  leadingEdge
#> 1           29   16 7852, 62....
#> 2           90   18 7852, 62....
#> 3          572   21 7852, 62....
#> 4          177   18 929, 355....
#> 
#> $Factor_11
#>                    pathway      pval      padj        ES      NES nMoreExtreme
#> 1       Infectious disease 0.1345868 0.2691736 0.4849411 1.318384         1266
#> 2 Viral Infection Pathways 0.1274247 0.2691736 0.4949309 1.326601         1188
#> 3                  Disease 0.4201841 0.5602454 0.3823529 1.052155         3971
#> 4            Immune System 0.9417888 0.9417888 0.2086250 0.567178         8865
#>   size  leadingEdge
#> 1   18 2214, 61....
#> 2   16 6133, 61....
#> 3   21 2214, 61....
#> 4   18 2207, 62....
#> 
#> $Factor_12
#>                    pathway       pval       padj        ES      NES
#> 1                  Disease 0.02467465 0.09869859 0.5886130 1.573397
#> 2       Infectious disease 0.09727301 0.15975875 0.5168881 1.364840
#> 3 Viral Infection Pathways 0.11981906 0.15975875 0.5088522 1.330409
#> 4            Immune System 0.32305924 0.32305924 0.4253640 1.123171
#>   nMoreExtreme size  leadingEdge
#> 1          236   21 6279, 62....
#> 2          930   18 3553, 61....
#> 3         1138   16 6135, 61....
#> 4         3091   18 6279, 62....
#> 
#> $Factor_13
#>                    pathway         pval        padj         ES        NES
#> 1       Infectious disease 0.0005426525 0.001085305  0.7125681  1.9947014
#> 2 Viral Infection Pathways 0.0003276540 0.001085305  0.7171567  1.9818528
#> 3                  Disease 0.0062205062 0.008294008  0.6230769  1.7643122
#> 4            Immune System 0.9898605830 0.989860583 -0.1143908 -0.4973585
#>   nMoreExtreme size  leadingEdge
#> 1            4   18 4869, 90....
#> 2            2   16 4869, 90....
#> 3           57   21 4869, 90....
#> 4          780   18 929, 513....
#> 
#> $Factor_14
#>                    pathway         pval         padj         ES       NES
#> 1                  Disease 0.0001050641 0.0001415879  0.8417415  2.308089
#> 2       Infectious disease 0.0001055632 0.0001415879  0.8800578  2.382872
#> 3 Viral Infection Pathways 0.0001061909 0.0001415879  0.9076006  2.432131
#> 4            Immune System 0.2687969925 0.2687969925 -0.2882457 -1.176610
#>   nMoreExtreme size  leadingEdge
#> 1            0   21 6164, 61....
#> 2            0   18 6164, 61....
#> 3            0   16 6164, 61....
#> 4          142   18 929, 362....
#> 
#> $Factor_15
#>                    pathway         pval         padj        ES       NES
#> 1 Viral Infection Pathways 0.0002189381 0.0008757526 0.7639766 2.1129491
#> 2       Infectious disease 0.0006509004 0.0013018008 0.7089421 1.9856468
#> 3                  Disease 0.0050690250 0.0067587000 0.6304771 1.7843747
#> 4            Immune System 0.8229550879 0.8229550879 0.2552083 0.7148025
#>   nMoreExtreme size  leadingEdge
#> 1            1   16 4869, 62....
#> 2            5   18 4869, 62....
#> 3           46   21 4869, 62....
#> 4         7585   18   5473, 4869
#> 
#> $Factor_16
#>                    pathway         pval        padj         ES       NES
#> 1 Viral Infection Pathways 0.0009634943 0.003853977  0.7242736  1.988848
#> 2       Infectious disease 0.0020129251 0.004025850  0.6729600  1.872986
#> 3                  Disease 0.0122647494 0.016352999  0.5949352  1.670171
#> 4            Immune System 0.3605683837 0.360568384 -0.2577690 -1.064250
#>   nMoreExtreme size  leadingEdge
#> 1            8   16 7852, 62....
#> 2           18   18 7852, 62....
#> 3          115   21 7852, 62....
#> 4          202   18 929, 513....
#> 
#> $Factor_17
#>                    pathway         pval        padj         ES        NES
#> 1       Infectious disease 0.0004203889 0.001681555  0.7231558  1.9422854
#> 2 Viral Infection Pathways 0.0011650074 0.002330015  0.7091217  1.8841903
#> 3                  Disease 0.0035553697 0.004740493  0.6524684  1.7706436
#> 4            Immune System 0.5881147541 0.588114754 -0.2288559 -0.9160614
#>   nMoreExtreme size  leadingEdge
#> 1            3   18 6164, 62....
#> 2           10   16 6164, 62....
#> 3           33   21 6164, 62....
#> 4          286   18 929, 513....
#> 
#> $Factor_18
#>                    pathway       pval      padj        ES      NES nMoreExtreme
#> 1            Immune System 0.08980426 0.3078081 0.5036946 1.400687          834
#> 2       Infectious disease 0.15390407 0.3078081 0.4669226 1.298430         1430
#> 3 Viral Infection Pathways 0.33178929 0.4423857 0.4085270 1.124577         3079
#> 4                  Disease 0.45788521 0.4578852 0.3603539 1.017387         4299
#>   size  leadingEdge
#> 1   18 3627, 26....
#> 2   18 2214, 96....
#> 3   16 9636, 62....
#> 4   21 2214, 96....
#> 
#> $Factor_19
#>                    pathway         pval        padj        ES       NES
#> 1 Viral Infection Pathways 0.0004265302 0.001706121 0.7083495 1.9105478
#> 2       Infectious disease 0.0021128248 0.004225650 0.6656027 1.8229746
#> 3                  Disease 0.0118784821 0.015837976 0.6023632 1.6642634
#> 4            Immune System 0.8160785971 0.816078597 0.2716142 0.7439058
#>   nMoreExtreme size  leadingEdge
#> 1            3   16 6232, 78....
#> 2           19   18 6232, 78....
#> 3          112   21 6232, 78....
#> 4         7724   18 6402, 26....
#> 
#> $Factor_20
#>                    pathway       pval       padj        ES       NES
#> 1       Infectious disease 0.03930039 0.07860078 0.5537159 1.4995176
#> 2 Viral Infection Pathways 0.03593005 0.07860078 0.5629286 1.5040992
#> 3                  Disease 0.17402243 0.23202991 0.4622005 1.2645045
#> 4            Immune System 0.60056896 0.60056896 0.3386207 0.9170184
#>   nMoreExtreme size  leadingEdge
#> 1          372   18 7852, 62....
#> 2          338   16 7852, 62....
#> 3         1659   21 7852, 62....
#> 4         5699   18 10578, 5....
#> 
# }