3. TG-Score

Overview

TG_Score() performs target gene enrichment analysis by testing whether a pathway’s genes are located unexpectedly toward one end of a ranked gene list. The ranked list is restricted to the target genes of differentially expressed miRNAs, mapped through background_MGI, and ranked by each gene’s own differential expression statistic. This is a GSEA style test, built on clusterProfiler’s GSEA().

This vignette uses the same toy BLCA example data as the package’s main Quick Start vignette. See vignette("miREA") for a description of that data and for running all nine methods together through miREA().

Required inputs

  • pathway, a two column data frame with columns pathway and gene.
  • mir_DEdata, a four column data frame with columns miRNA, log2FoldChange, stat, and padj.
  • gene_DEdata, a four column data frame with columns gene, log2FoldChange, stat, and padj.
  • background_MGI, a two column data frame with columns miRNA and gene, or NULL to use the bundled default (see vignette("miREA"), Step 1, for details on background_MGI).
  • pvalueType for TG_Score() itself, one of "pos", "neg", or "std", selecting a one sided or two sided test.
library(miREA)
data(toy_pathway)
data(toy_mir_DEdata)
data(toy_gene_DEdata)
data(background_MGI)

Run TG-Score

input_data <- getAllInputData(
    methods = "TG_Score",
    pathway = toy_pathway,
    mir_DEdata = toy_mir_DEdata,
    gene_DEdata = toy_gene_DEdata,
    background_MGI = background_MGI
)
#> Generate all input data...
#>   Start generate expression data...
#>   Start generate pathway data...
#> All the input data is ready!

input_data$data$TG_Score holds the ranked gene list, restricted to the target genes of differentially expressed miRNAs and ranked by each gene’s own differential expression statistic. input_data$pathway$TG holds the pathway gene sets, unchanged from the toy_pathway input.

res <- TG_Score(
    geneList = input_data$data$TG_Score,
    pathway = input_data$pathway$TG,
    pvalueType = "std",
    pvalueCutoff = 1
)
#> 
#>   Start TG-Score analysis ...
#>   TG-Score analysis have finished!
head(res)
#>                                                                                         pathway
#> Cell Cycle                                                                           Cell Cycle
#> Cell Cycle, Mitotic                                                         Cell Cycle, Mitotic
#> Interleukin-6 family signaling                                   Interleukin-6 family signaling
#> WNT ligand biogenesis and trafficking                     WNT ligand biogenesis and trafficking
#> IL-6-type cytokine receptor ligand interactions IL-6-type cytokine receptor ligand interactions
#> Reelin signalling pathway                                             Reelin signalling pathway
#>                                                                                     Description
#> Cell Cycle                                                                           Cell Cycle
#> Cell Cycle, Mitotic                                                         Cell Cycle, Mitotic
#> Interleukin-6 family signaling                                   Interleukin-6 family signaling
#> WNT ligand biogenesis and trafficking                     WNT ligand biogenesis and trafficking
#> IL-6-type cytokine receptor ligand interactions IL-6-type cytokine receptor ligand interactions
#> Reelin signalling pathway                                             Reelin signalling pathway
#>                                                 setSize enrichmentScore
#> Cell Cycle                                          170       0.4960855
#> Cell Cycle, Mitotic                                 136       0.4918923
#> Interleukin-6 family signaling                        9      -0.6517352
#> WNT ligand biogenesis and trafficking                 5      -0.7571285
#> IL-6-type cytokine receptor ligand interactions       5      -0.7536765
#> Reelin signalling pathway                             2      -0.9163636
#>                                                       NES      p_value
#> Cell Cycle                                       1.870494 1.547493e-05
#> Cell Cycle, Mitotic                              1.838917 1.803929e-05
#> Interleukin-6 family signaling                  -1.638431 2.538811e-02
#> WNT ligand biogenesis and trafficking           -1.559961 3.110602e-02
#> IL-6-type cytokine receptor ligand interactions -1.552849 3.244871e-02
#> Reelin signalling pathway                       -1.402965 3.232088e-02
#>                                                         padj       qvalue rank
#> Cell Cycle                                      9.019646e-05 3.797746e-05   77
#> Cell Cycle, Mitotic                             9.019646e-05 3.797746e-05   71
#> Interleukin-6 family signaling                  5.408118e-02 2.277102e-02   73
#> WNT ligand biogenesis and trafficking           5.408118e-02 2.277102e-02   38
#> IL-6-type cytokine receptor ligand interactions 5.408118e-02 2.277102e-02   73
#> Reelin signalling pathway                       5.408118e-02 2.277102e-02   26
#>                                                                    leading_edge
#> Cell Cycle                                       tags=38%, list=28%, signal=71%
#> Cell Cycle, Mitotic                              tags=38%, list=26%, signal=56%
#> Interleukin-6 family signaling                   tags=89%, list=26%, signal=68%
#> WNT ligand biogenesis and trafficking            tags=60%, list=14%, signal=53%
#> IL-6-type cytokine receptor ligand interactions tags=100%, list=26%, signal=75%
#> Reelin signalling pathway                        tags=100%, list=9%, signal=91%
#>                                                                                                                                                                                                                                                                                                                                                                                                                               core_enrichment
#> Cell Cycle                                      KIF2C/ZWINT/GINS1/CDC6/CENPA/BLM/PLK1/CENPM/BRIP1/TK1/CLSPN/DBF4/CDC25A/H2BC9/TERT/SKP2/NDC1/SPC24/BIRC5/NCAPG/CKS1B/KNTC1/BRCA1/H2BC11/H2BC5/OIP5/H2AC8/E2F1/RPA3/CENPL/PIF1/NCAPG2/SEM1/CDKN2A/H2BC8/H2BC7/H4C5/NUP210/PSMB5/NUP155/NUP93/H2BC10/NSD2/GMNN/H2AC6/PSMC4/H2BC15/SPAST/CEP152/CSNK2A1/POLD2/H4C8/E2F3/NUP43/H3C1/POLR2D/PPP2R1B/H3C6/CEP72/CENPN/H4C3/PIAS4/CEP76/PSMD13/PSMB6
#> Cell Cycle, Mitotic                                                                                                       KIF2C/ZWINT/GINS1/CDC6/CENPA/PLK1/CENPM/TK1/DBF4/CDC25A/H2BC9/SKP2/NDC1/SPC24/BIRC5/NCAPG/CKS1B/KNTC1/H2BC11/H2BC5/H2AC8/E2F1/RPA3/CENPL/NCAPG2/SEM1/CDKN2A/H2BC8/H2BC7/H4C5/NUP210/PSMB5/NUP155/NUP93/H2BC10/GMNN/H2AC6/PSMC4/H2BC15/SPAST/CEP152/CSNK2A1/POLD2/H4C8/E2F3/NUP43/H3C1/PPP2R1B/H3C6/CEP72/CENPN/H4C3
#> Interleukin-6 family signaling                                                                                                                                                                                                                                                                                                                                                                   CNTFR/CBL/OSMR/JAK2/PTPN11/SOCS3/LIFR/IL11RA
#> WNT ligand biogenesis and trafficking                                                                                                                                                                                                                                                                                                                                                                                         WNT9A/WLS/WNT2B
#> IL-6-type cytokine receptor ligand interactions                                                                                                                                                                                                                                                                                                                                                                   CNTFR/OSMR/JAK2/LIFR/IL11RA
#> Reelin signalling pathway                                                                                                                                                                                                                                                                                                                                                                                                           FYN/VLDLR
#>                                                   log2err
#> Cell Cycle                                      0.5756103
#> Cell Cycle, Mitotic                             0.5756103
#> Interleukin-6 family signaling                  0.3524879
#> WNT ligand biogenesis and trafficking           0.3524879
#> IL-6-type cytokine receptor ligand interactions 0.3217759
#> Reelin signalling pathway                       0.3217759

Run through miREA()

TG_Score() can also be run through the miREA() wrapper, which is useful when you want its result alongside other methods’ results in a single miREAResult object (see vignette("miREA"), Step 2, for the multi-method case). TG_Score() itself has no background argument, but miREA() still requires one for the TG target, since TG_ORA() shares that target and does use it. For a single target, background can be a plain character vector instead of a named list.

result <- miREA(
    methods = "TG_Score",
    input_data = input_data,
    background = unique(toy_pathway$gene),
    pvalueCutoff = 1
)
#> You didn't specify number of cores [ncores]. Use unparallel computing instead.
#> Start Enrichment analysis...
#> === Start time: 2026-11-25 13:13:43 ===
#> 
#>   Start TG-Score analysis ...
#>   TG-Score analysis have finished!
#>     - TG_Score finished, time cost: 0.427000000000007 s.
#> 
#> miREA analysis have finished!...
#> === End time: 2026-11-25 13:13:44 ===
head(result$result$TG_Score)
#>                                                                                         pathway
#> Cell Cycle                                                                           Cell Cycle
#> Cell Cycle, Mitotic                                                         Cell Cycle, Mitotic
#> Interleukin-6 family signaling                                   Interleukin-6 family signaling
#> WNT ligand biogenesis and trafficking                     WNT ligand biogenesis and trafficking
#> IL-6-type cytokine receptor ligand interactions IL-6-type cytokine receptor ligand interactions
#> Reelin signalling pathway                                             Reelin signalling pathway
#>                                                                                     Description
#> Cell Cycle                                                                           Cell Cycle
#> Cell Cycle, Mitotic                                                         Cell Cycle, Mitotic
#> Interleukin-6 family signaling                                   Interleukin-6 family signaling
#> WNT ligand biogenesis and trafficking                     WNT ligand biogenesis and trafficking
#> IL-6-type cytokine receptor ligand interactions IL-6-type cytokine receptor ligand interactions
#> Reelin signalling pathway                                             Reelin signalling pathway
#>                                                 setSize enrichmentScore
#> Cell Cycle                                          170       0.4960855
#> Cell Cycle, Mitotic                                 136       0.4918923
#> Interleukin-6 family signaling                        9      -0.6517352
#> WNT ligand biogenesis and trafficking                 5      -0.7571285
#> IL-6-type cytokine receptor ligand interactions       5      -0.7536765
#> Reelin signalling pathway                             2      -0.9163636
#>                                                       NES      p_value
#> Cell Cycle                                       1.890097 2.200406e-05
#> Cell Cycle, Mitotic                              1.872948 2.022262e-05
#> Interleukin-6 family signaling                  -1.673069 1.874649e-02
#> WNT ligand biogenesis and trafficking           -1.581917 3.716873e-02
#> IL-6-type cytokine receptor ligand interactions -1.574705 3.808084e-02
#> Reelin signalling pathway                       -1.449833 3.496592e-02
#>                                                         padj       qvalue rank
#> Cell Cycle                                      0.0001100203 4.632435e-05   77
#> Cell Cycle, Mitotic                             0.0001100203 4.632435e-05   71
#> Interleukin-6 family signaling                  0.0624883133 2.631087e-02   73
#> WNT ligand biogenesis and trafficking           0.0634680637 2.672340e-02   38
#> IL-6-type cytokine receptor ligand interactions 0.0634680637 2.672340e-02   73
#> Reelin signalling pathway                       0.0634680637 2.672340e-02   26
#>                                                                    leading_edge
#> Cell Cycle                                       tags=38%, list=28%, signal=71%
#> Cell Cycle, Mitotic                              tags=38%, list=26%, signal=56%
#> Interleukin-6 family signaling                   tags=89%, list=26%, signal=68%
#> WNT ligand biogenesis and trafficking            tags=60%, list=14%, signal=53%
#> IL-6-type cytokine receptor ligand interactions tags=100%, list=26%, signal=75%
#> Reelin signalling pathway                        tags=100%, list=9%, signal=91%
#>                                                                                                                                                                                                                                                                                                                                                                                                                               core_enrichment
#> Cell Cycle                                      KIF2C/ZWINT/GINS1/CDC6/CENPA/BLM/PLK1/CENPM/BRIP1/TK1/CLSPN/DBF4/CDC25A/H2BC9/TERT/SKP2/NDC1/SPC24/BIRC5/NCAPG/CKS1B/KNTC1/BRCA1/H2BC11/H2BC5/OIP5/H2AC8/E2F1/RPA3/CENPL/PIF1/NCAPG2/SEM1/CDKN2A/H2BC8/H2BC7/H4C5/NUP210/PSMB5/NUP155/NUP93/H2BC10/NSD2/GMNN/H2AC6/PSMC4/H2BC15/SPAST/CEP152/CSNK2A1/POLD2/H4C8/E2F3/NUP43/H3C1/POLR2D/PPP2R1B/H3C6/CEP72/CENPN/H4C3/PIAS4/CEP76/PSMD13/PSMB6
#> Cell Cycle, Mitotic                                                                                                       KIF2C/ZWINT/GINS1/CDC6/CENPA/PLK1/CENPM/TK1/DBF4/CDC25A/H2BC9/SKP2/NDC1/SPC24/BIRC5/NCAPG/CKS1B/KNTC1/H2BC11/H2BC5/H2AC8/E2F1/RPA3/CENPL/NCAPG2/SEM1/CDKN2A/H2BC8/H2BC7/H4C5/NUP210/PSMB5/NUP155/NUP93/H2BC10/GMNN/H2AC6/PSMC4/H2BC15/SPAST/CEP152/CSNK2A1/POLD2/H4C8/E2F3/NUP43/H3C1/PPP2R1B/H3C6/CEP72/CENPN/H4C3
#> Interleukin-6 family signaling                                                                                                                                                                                                                                                                                                                                                                   CNTFR/CBL/OSMR/JAK2/PTPN11/SOCS3/LIFR/IL11RA
#> WNT ligand biogenesis and trafficking                                                                                                                                                                                                                                                                                                                                                                                         WNT9A/WLS/WNT2B
#> IL-6-type cytokine receptor ligand interactions                                                                                                                                                                                                                                                                                                                                                                   CNTFR/OSMR/JAK2/LIFR/IL11RA
#> Reelin signalling pathway                                                                                                                                                                                                                                                                                                                                                                                                           FYN/VLDLR
#>                                                   log2err
#> Cell Cycle                                      0.5756103
#> Cell Cycle, Mitotic                             0.5756103
#> Interleukin-6 family signaling                  0.3524879
#> WNT ligand biogenesis and trafficking           0.3217759
#> IL-6-type cytokine receptor ligand interactions 0.3217759
#> Reelin signalling pathway                       0.3217759

Supplying your own ranked gene list

TG_Score()’s real input is a ranked list of genes targeted by miRNAs of interest, not an arbitrary ranked gene list. If you already have a miRNA list from an external analysis instead of letting getAllInputData() derive one from mir_DEdata, map that miRNA list to its target genes through background_MGI, the same step getAllInputData() performs internally, then rank those genes by their own differential expression statistic from gene_DEdata.

# replace with your own miRNA list
my_miRs <- c("hsa-miR-21-5p", "hsa-miR-155-5p")
my_TG <- unique(background_MGI$gene[background_MGI$miRNA %in% my_miRs])
my_geneList <- toy_gene_DEdata$stat[match(my_TG, toy_gene_DEdata$gene)]
names(my_geneList) <- my_TG
my_geneList <- sort(my_geneList[!is.na(my_geneList)], decreasing = TRUE)
res_custom <- TG_Score(
    geneList = my_geneList,
    pathway = toy_pathway,
    pvalueType = "std",
    pvalueCutoff = 1
)

Session info

sessionInfo()
#> R version 4.6.2 (2026-10-29)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 26.04.1 LTS
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 
#> LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.32.so;  LAPACK version 3.12.0
#> 
#> locale:
#>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
#>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
#>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
#> 
#> time zone: Etc/UTC
#> tzcode source: system (glibc)
#> 
#> attached base packages:
#> [1] stats4    stats     graphics  grDevices utils     datasets  methods  
#> [8] base     
#> 
#> other attached packages:
#>  [1] GSEABase_1.77.0             graph_1.93.0               
#>  [3] annotate_1.91.1             XML_3.99-0.25              
#>  [5] AnnotationDbi_1.77.0        SummarizedExperiment_1.45.0
#>  [7] Biobase_2.73.2              GenomicRanges_1.67.0       
#>  [9] Seqinfo_1.5.0               IRanges_2.47.5             
#> [11] S4Vectors_0.53.0            BiocGenerics_0.59.13       
#> [13] generics_0.1.4              MatrixGenerics_1.27.0      
#> [15] matrixStats_1.5.0           miREA_0.99.5               
#> [17] BiocStyle_2.41.0           
#> 
#> loaded via a namespace (and not attached):
#>   [1] RColorBrewer_1.1-3      sys_3.4.3               jsonlite_2.0.0         
#>   [4] shape_1.4.6.1           tidydr_0.0.7            magrittr_2.0.5         
#>   [7] ggtangle_0.1.5          farver_2.1.2            rmarkdown_2.32         
#>  [10] GlobalOptions_0.1.4     fs_2.1.0                vctrs_0.7.3            
#>  [13] memoise_2.0.1           ggtree_4.5.0            S4Arrays_1.15.0        
#>  [16] htmltools_0.5.9         BiocBaseUtils_1.17.0    SparseArray_1.15.0     
#>  [19] gridGraphics_0.5-1      sass_0.5.0              bslib_0.12.0           
#>  [22] htmlwidgets_1.6.4       plyr_1.8.9              httr2_1.3.0            
#>  [25] cachem_1.1.0            buildtools_1.0.0        igraph_2.3.4           
#>  [28] lifecycle_1.0.5         iterators_1.0.14        pkgconfig_2.0.3        
#>  [31] Matrix_1.7-6            R6_2.6.1                fastmap_1.2.0          
#>  [34] gson_0.2.2              clue_0.3-68             digest_0.6.39          
#>  [37] treelayout_0.1.0        aplot_0.3.2             enrichplot_2.1.0       
#>  [40] colorspace_2.1-4        ggnewscale_0.5.2        patchwork_1.3.2        
#>  [43] aisdk_1.4.12            ps_1.9.3                RSQLite_3.53.3         
#>  [46] labeling_0.4.3          abind_1.4-8             httr_1.4.9             
#>  [49] polyclip_1.10-7         compiler_4.6.2          bit64_4.8.6            
#>  [52] fontquiver_0.2.1        withr_3.0.3             doParallel_1.0.17      
#>  [55] S7_1.0.0                BiocParallel_1.47.0     DBI_1.3.0              
#>  [58] ggforce_0.5.0           MASS_7.3-66             DelayedArray_0.39.8    
#>  [61] rappdirs_0.3.4          rjson_0.2.23            tools_4.6.2            
#>  [64] otel_0.3.0              ape_5.8-1               scatterpie_0.2.6       
#>  [67] glue_1.8.1              callr_3.8.0             nlme_3.1-172           
#>  [70] GOSemSim_2.39.5         grid_4.6.2              cluster_2.1.8.3        
#>  [73] reshape2_1.4.5          gtable_0.3.6            tidyr_1.3.2            
#>  [76] data.table_1.18.6.1     XVector_0.53.0          ggrepel_0.9.8          
#>  [79] foreach_1.5.2           pillar_1.11.1           stringr_1.6.0          
#>  [82] yulab.utils_0.2.6       splines_4.6.2           circlize_0.4.18        
#>  [85] dplyr_1.2.1             tweenr_2.0.3            treeio_1.37.1          
#>  [88] lattice_0.23-1          bit_4.6.0               tidyselect_1.2.1       
#>  [91] fontLiberation_0.1.0    GO.db_3.24.0            ComplexHeatmap_2.29.0  
#>  [94] maketools_1.3.2         Biostrings_2.81.9       knitr_1.52             
#>  [97] fontBitstreamVera_0.1.1 xfun_0.62               stringi_1.8.9          
#> [100] lazyeval_0.2.3          ggfun_0.2.2             yaml_2.3.12            
#> [103] evaluate_1.0.5          codetools_0.2-20        qvalue_2.45.0          
#> [106] gdtools_0.6.0           tibble_3.3.1            BiocManager_1.30.27    
#> [109] ggplotify_0.1.4         cli_3.6.6               xtable_1.8-8           
#> [112] systemfonts_1.3.4       processx_3.10.0         jquerylib_0.1.4        
#> [115] Rcpp_1.1.2              png_0.1-9               parallel_4.6.2         
#> [118] ggplot2_4.0.4           blob_1.3.0              clusterProfiler_4.21.7 
#> [121] ggalluvial_0.12.6       DOSE_4.7.4              tidytree_0.4.9         
#> [124] ggiraph_0.9.7           enrichit_0.2.7          scales_1.4.0           
#> [127] purrr_1.2.2             crayon_1.5.3            GetoptLong_1.1.1       
#> [130] rlang_1.3.0             KEGGREST_1.53.6