Skip to contents

Single-sample GSEA transformation

Usage

ss_gsea(mat, gs, scale = TRUE, set_level = set_level_mean)

Arguments

mat

A numeric matrix.

gs

A list of gene sets. Genes should have the same ID type as in mat.

scale

Whether to apply z-score scaling on rows?

set_level

A function to calculate the geneset-level score. This function should accept two arguments: a vector of scores for all genes, and a corresponding logical vector repressenting which genes are in the current gene set.

Examples

data(p53_dataset)
expr = p53_dataset$expr
gs = p53_dataset$gs
mat_gs = ss_gsea(expr, gs)
head(mat_gs)
#>                          X786.0     BT.549    CCRF.CEM   COLO.205        EKVX
#> 41bbPathway           0.5721238  0.3716575 -0.03419229 -0.3803926 -0.17893732
#> ace2Pathway           0.1150494 -0.1215859 -0.53927782 -0.5206118  0.07957701
#> acetaminophenPathway  0.7119185 -0.7219183 -0.24630432 -0.4053178 -0.06886475
#> achPathway            0.1695001  0.0124123  0.50325172 -0.2961399 -0.33026951
#> actinYPathway        -0.5898666  0.1509440  0.09254110 -0.6550168 -0.29620835
#> agpcrPathway          0.3056068 -0.3469833  0.22963846 -0.4034337  0.07078834
#>                         HCC.2998      HCT.15      HOP.62      HOP.92
#> 41bbPathway           0.10626012 -0.01356768  0.37492685 -0.11419128
#> ace2Pathway          -0.06029373 -0.45067546  0.19145159  0.18684321
#> acetaminophenPathway -0.31668970 -0.31598656  0.39354926 -0.40100280
#> achPathway           -0.28396887 -0.04807015 -0.27747298 -0.44336771
#> actinYPathway         0.12333378 -0.23761987  0.05979451  0.22101402
#> agpcrPathway         -0.67816740 -0.53734152  0.04512116 -0.07729705
#>                          HS.578T        HT29        K.562        KM12
#> 41bbPathway          -0.04994074 -0.18924036 -0.005963629 -0.20893435
#> ace2Pathway           1.14660761 -0.06168806 -0.216575126 -0.36083639
#> acetaminophenPathway  0.53864238 -0.52610568  0.309069060 -0.01298177
#> achPathway           -0.05929257  0.18103222 -0.335725023 -0.27550963
#> actinYPathway         0.25260140 -0.05067002 -0.359799705  0.35064838
#> agpcrPathway         -0.29671158 -0.57691305  0.750348698 -0.47843059
#>                             M14 MDA.MB.231.ATCC  MDA.MB.435    NCI.H23
#> 41bbPathway          -0.1884429      0.07285171 -0.20801352 -0.1040037
#> ace2Pathway          -0.1363734     -0.34398995 -0.24756707 -0.3974075
#> acetaminophenPathway -0.5185060     -0.57863908 -0.09553902  0.4852677
#> achPathway           -0.3207411      0.04745092  0.19951061 -0.2217484
#> actinYPathway         0.5578817      0.04598913  0.21846789  0.2022725
#> agpcrPathway          0.1183200     -0.09693392 -0.09628469  0.3306239
#>                        NCI.H322M    NCI.H522    OVCAR.3     OVCAR.5    OVCAR.8
#> 41bbPathway           0.26486231  0.33999053  0.2623441  0.03621417 -0.1222128
#> ace2Pathway          -0.08871991 -0.61364549  0.3953051  0.05046776 -0.2256692
#> acetaminophenPathway  0.24843338 -0.52213915  0.3826191 -0.25680728 -0.2318977
#> achPathway            0.56894615 -0.08125878  0.6331867  0.10085314  0.2978465
#> actinYPathway        -0.07839660  0.32193300 -0.0484540 -0.38456584 -0.2461460
#> agpcrPathway         -0.10183342  0.46315505  0.1904777 -0.22047566 -0.1482666
#>                              PC.3     RXF.393      SF.268      SF.295
#> 41bbPathway          -0.367647540  0.70307461  0.13816271  0.08380162
#> ace2Pathway          -0.549911229 -0.03108937  0.20299944 -0.35823572
#> acetaminophenPathway -0.096277074  0.97222403 -0.04890103 -0.29169099
#> achPathway            0.006470029  0.04851479  0.21356620 -0.24726560
#> actinYPathway        -0.313699115 -0.06042797 -0.05364847 -0.02145482
#> agpcrPathway         -0.162792092  0.28068162  0.74907910 -0.12161759
#>                        SK.MEL.2      SN12C     SNB.19      SNB.75      SW.620
#> 41bbPathway           0.2198677 -0.2459852 -0.1428077 -0.06085097 -0.21290326
#> ace2Pathway          -0.5088797 -0.4270613  0.2079099  0.43510540 -0.47359220
#> acetaminophenPathway -0.5159262  0.4583862  1.0251767 -0.30382062 -0.33630877
#> achPathway           -0.1259368  0.4694338 -0.1092592  0.10332531 -0.07836556
#> actinYPathway         0.4424018  0.0198115 -0.1912613  0.17624852 -0.30873648
#> agpcrPathway          0.0955258  0.3665543  0.2771834 -0.24934697 -0.28255251
#>                            T.47D        U251        A498  A549.ATCC        ACHN
#> 41bbPathway          -0.35350932 -0.33010142  0.44530267 -0.1580738 -0.05169276
#> ace2Pathway          -0.35987801  0.22097953  0.46689204  0.7314822  0.47436482
#> acetaminophenPathway -0.56042375  0.21693683  0.37951156  0.5488031 -0.73347586
#> achPathway           -0.04505649 -0.16812274 -0.05785023 -0.1192585 -0.01661068
#> actinYPathway        -0.42982226  0.03434598  0.17498022 -0.3036893  0.26605746
#> agpcrPathway         -0.35743853  0.43198789 -0.05491016 -0.4415421 -0.27916591
#>                            CAKI.1    HCT.116    LOX.IMVI    MALME.3M
#> 41bbPathway          -0.244779899 -0.1006201  0.33764334 -0.08916169
#> ace2Pathway           0.008909841 -0.4487473 -0.23490020 -0.09868361
#> acetaminophenPathway -0.113470566 -1.0274496  0.02708292 -0.01892766
#> achPathway           -0.094527508 -0.3372435 -0.10600546  0.06179853
#> actinYPathway        -0.156996859 -0.2556593  0.27260077  0.37517476
#> agpcrPathway          0.034521276 -0.2521381 -0.33699830  0.20072880
#>                             MCF7     MOLT.4    NCI.H460     OVCAR.4      SF.539
#> 41bbPathway          -0.11747436  0.4444458  0.06408283 -0.02384906 -0.13952795
#> ace2Pathway           0.11933998 -0.2080729  0.85966316  0.39370032  0.64369124
#> acetaminophenPathway -0.22222806  0.5773385  0.83322594  1.61148209 -0.43261073
#> achPathway            0.18913955  0.2068222 -0.40095440  0.31791504 -0.16697275
#> actinYPathway        -0.09374744 -0.2153535 -0.10847776 -0.07891680 -0.03325021
#> agpcrPathway          0.08859516  0.3560098  0.36606696 -0.48187246  0.26640656
#>                       SK.MEL.5           SR    UACC.257     UACC.62       UO.31
#> 41bbPathway          0.1968299  0.016528468 -0.50217533 -0.25179350  0.14001610
#> ace2Pathway          0.5741174  0.147216325 -0.28103333  0.03288648  0.68044168
#> acetaminophenPathway 0.5914818 -0.102059842 -0.12046868  0.33260513 -0.50101511
#> achPathway           0.1032344  0.417725038  0.01113510  0.29147789 -0.10755418
#> actinYPathway        0.5589044  0.186858322 -0.01078968  0.23435538  0.24351468
#> agpcrPathway         0.6122329  0.009465496  0.32885093  0.17773933 -0.06626231