tTEscanR Visualization Module


1. Overview

tTEscanR includes a dedicated visualization module that provides multiple functions for generating plots based on the output tables produced at each step of the analysis. The primary goal of this module is to facilitate a more intuitive and streamlined interpretation of results, allowing researchers to easily explore and understand their data. Additionally, it helps summarize complex findings in a visually accessible manner, enhancing the overall clarity and impact of the analysis.

if (!requireNamespace("BiocManager", quietly = TRUE)) {
    install.packages("BiocManager")
}

BiocManager::install("tTEscanR")
library(tTEscanR)
library(dplyr)

To illustrate the usage of each plotting function and demonstrate the flexibility provided by various parameters, we will first run tTEscanR. In this tutorial, we will analyze a single-cell fetal human atlas described in (Cao et al. 2020) and (Domcke et al. 2020), and previously examined by (Gao et al. 2022). A subset of this dataset is included as a default dataset in tTEscanR and can be directly loaded to perform the analysis. A step-by-step explanation of this pipeline is available in the tTEscanR User Guide vignette.

data(
    default_tTEscanR_mRNA_data,
    default_tTEscanR_tRNA_data,
    default_tTEscanR_metadata
)
tTEobject <- runPipeline(
    mRNA_data = default_tTEscanR_mRNA_data,
    tRNA_data = default_tTEscanR_tRNA_data,
    meta_data = default_tTEscanR_metadata,
    species = "hg38", batch = "tissue", sample_id = "conditions",
    runDESeq = FALSE
)
#>   |                                                                              |                                                                      |   0%  |                                                                              |=                                                                     |   1%  |                                                                              |==                                                                    |   2%  |                                                                              |==                                                                    |   4%  |                                                                              |===                                                                   |   5%  |                                                                              |====                                                                  |   6%  |                                                                              |=====                                                                 |   7%  |                                                                              |======                                                                |   8%  |                                                                              |=======                                                               |   9%  |                                                                              |=======                                                               |  11%  |                                                                              |========                                                              |  12%  |                                                                              |=========                                                             |  13%  |                                                                              |==========                                                            |  14%  |                                                                              |===========                                                           |  15%  |                                                                              |============                                                          |  16%  |                                                                              |============                                                          |  18%  |                                                                              |=============                                                         |  19%  |                                                                              |==============                                                        |  20%  |                                                                              |===============                                                       |  21%  |                                                                              |================                                                      |  22%  |                                                                              |================                                                      |  24%  |                                                                              |=================                                                     |  25%  |                                                                              |==================                                                    |  26%  |                                                                              |===================                                                   |  27%  |                                                                              |====================                                                  |  28%  |                                                                              |=====================                                                 |  29%  |                                                                              |=====================                                                 |  31%  |                                                                              |======================                                                |  32%  |                                                                              |=======================                                               |  33%  |                                                                              |========================                                              |  34%  |                                                                              |=========================                                             |  35%  |                                                                              |==========================                                            |  36%  |                                                                              |==========================                                            |  38%  |                                                                              |===========================                                           |  39%  |                                                                              |============================                                          |  40%  |                                                                              |=============================                                         |  41%  |                                                                              |==============================                                        |  42%  |                                                                              |==============================                                        |  44%  |                                                                              |===============================                                       |  45%  |                                                                              |================================                                      |  46%  |                                                                              |=================================                                     |  47%  |                                                                              |==================================                                    |  48%  |                                                                              |===================================                                   |  49%  |                                                                              |===================================                                   |  51%  |                                                                              |====================================                                  |  52%  |                                                                              |=====================================                                 |  53%  |                                                                              |======================================                                |  54%  |                                                                              |=======================================                               |  55%  |                                                                              |========================================                              |  56%  |                                                                              |========================================                              |  58%  |                                                                              |=========================================                             |  59%  |                                                                              |==========================================                            |  60%  |                                                                              |===========================================                           |  61%  |                                                                              |============================================                          |  62%  |                                                                              |============================================                          |  64%  |                                                                              |=============================================                         |  65%  |                                                                              |==============================================                        |  66%  |                                                                              |===============================================                       |  67%  |                                                                              |================================================                      |  68%  |                                                                              |=================================================                     |  69%  |                                                                              |=================================================                     |  71%  |                                                                              |==================================================                    |  72%  |                                                                              |===================================================                   |  73%  |                                                                              |====================================================                  |  74%  |                                                                              |=====================================================                 |  75%  |                                                                              |======================================================                |  76%  |                                                                              |======================================================                |  78%  |                                                                              |=======================================================               |  79%  |                                                                              |========================================================              |  80%  |                                                                              |=========================================================             |  81%  |                                                                              |==========================================================            |  82%  |                                                                              |==========================================================            |  84%  |                                                                              |===========================================================           |  85%  |                                                                              |============================================================          |  86%  |                                                                              |=============================================================         |  87%  |                                                                              |==============================================================        |  88%  |                                                                              |===============================================================       |  89%  |                                                                              |===============================================================       |  91%  |                                                                              |================================================================      |  92%  |                                                                              |=================================================================     |  93%  |                                                                              |==================================================================    |  94%  |                                                                              |===================================================================   |  95%  |                                                                              |====================================================================  |  96%  |                                                                              |====================================================================  |  98%  |                                                                              |===================================================================== |  99%  |                                                                              |======================================================================| 100%
#>   |                                                                              |                                                                      |   0%  |                                                                              |=                                                                     |   1%  |                                                                              |==                                                                    |   2%  |                                                                              |==                                                                    |   4%  |                                                                              |===                                                                   |   5%  |                                                                              |====                                                                  |   6%  |                                                                              |=====                                                                 |   7%  |                                                                              |======                                                                |   8%  |                                                                              |=======                                                               |   9%  |                                                                              |=======                                                               |  11%  |                                                                              |========                                                              |  12%  |                                                                              |=========                                                             |  13%  |                                                                              |==========                                                            |  14%  |                                                                              |===========                                                           |  15%  |                                                                              |============                                                          |  16%  |                                                                              |============                                                          |  18%  |                                                                              |=============                                                         |  19%  |                                                                              |==============                                                        |  20%  |                                                                              |===============                                                       |  21%  |                                                                              |================                                                      |  22%  |                                                                              |================                                                      |  24%  |                                                                              |=================                                                     |  25%  |                                                                              |==================                                                    |  26%  |                                                                              |===================                                                   |  27%  |                                                                              |====================                                                  |  28%  |                                                                              |=====================                                                 |  29%  |                                                                              |=====================                                                 |  31%  |                                                                              |======================                                                |  32%  |                                                                              |=======================                                               |  33%  |                                                                              |========================                                              |  34%  |                                                                              |=========================                                             |  35%  |                                                                              |==========================                                            |  36%  |                                                                              |==========================                                            |  38%  |                                                                              |===========================                                           |  39%  |                                                                              |============================                                          |  40%  |                                                                              |=============================                                         |  41%  |                                                                              |==============================                                        |  42%  |                                                                              |==============================                                        |  44%  |                                                                              |===============================                                       |  45%  |                                                                              |================================                                      |  46%  |                                                                              |=================================                                     |  47%  |                                                                              |==================================                                    |  48%  |                                                                              |===================================                                   |  49%  |                                                                              |===================================                                   |  51%  |                                                                              |====================================                                  |  52%  |                                                                              |=====================================                                 |  53%  |                                                                              |======================================                                |  54%  |                                                                              |=======================================                               |  55%  |                                                                              |========================================                              |  56%  |                                                                              |========================================                              |  58%  |                                                                              |=========================================                             |  59%  |                                                                              |==========================================                            |  60%  |                                                                              |===========================================                           |  61%  |                                                                              |============================================                          |  62%  |                                                                              |============================================                          |  64%  |                                                                              |=============================================                         |  65%  |                                                                              |==============================================                        |  66%  |                                                                              |===============================================                       |  67%  |                                                                              |================================================                      |  68%  |                                                                              |=================================================                     |  69%  |                                                                              |=================================================                     |  71%  |                                                                              |==================================================                    |  72%  |                                                                              |===================================================                   |  73%  |                                                                              |====================================================                  |  74%  |                                                                              |=====================================================                 |  75%  |                                                                              |======================================================                |  76%  |                                                                              |======================================================                |  78%  |                                                                              |=======================================================               |  79%  |                                                                              |========================================================              |  80%  |                                                                              |=========================================================             |  81%  |                                                                              |==========================================================            |  82%  |                                                                              |==========================================================            |  84%  |                                                                              |===========================================================           |  85%  |                                                                              |============================================================          |  86%  |                                                                              |=============================================================         |  87%  |                                                                              |==============================================================        |  88%  |                                                                              |===============================================================       |  89%  |                                                                              |===============================================================       |  91%  |                                                                              |================================================================      |  92%  |                                                                              |=================================================================     |  93%  |                                                                              |==================================================================    |  94%  |                                                                              |===================================================================   |  95%  |                                                                              |====================================================================  |  96%  |                                                                              |====================================================================  |  98%  |                                                                              |===================================================================== |  99%  |                                                                              |======================================================================| 100%

2. Configuration options

The visualization functions in tTEscanR are highly customizable and can be applied to any properly formatted dataset. Depending on the plot type, specific data requirements must be met, which may involve prior data transformation or restructuring.

This guide provides an overview of the available visualization options in tTEscanR, and illustrates key parameter settings and their effects through practical examples.

The visualization functions in tTEscanR are not limited to outputs generated within the package’s pipeline. Users can apply them to external dataset, provided that the required data formatting and structure are met.

Function Purpose
plotProportion() Shows features’ frequencies differences within and
between conditions
plotDistribution() Displays features’ distributions across
conditions
plotTargetComparison() Variation of plotDistribution() to
compare a target feature against the mean across conditions
plotCorrelation() Features correlation
plotPermutation() Compares the baseline codon exonic background
against the current codon usage
plotTEscore() Represents the tTE scores obtained from
computeTheoreticalTE()

2.1. Data transformation

There are helper functions in tTEscanR designed to properly transform data for downstream analysis and visualization. the data. One such function is transformFormat(), which converts a count matrix, with features as rows and conditions as columns, into a long-format table. In this format, each row-column combination from the original matrix becomes an individual row in the output.

The function also provides an option to normalize the input data. Parameters such as rownames_to_column, names_to and values_to allow users to customize the names of the columns in the resulting long-format table.

The normalization performed by transformFormat() is done by converting the raw counts into relative abundances (i.e. dividing each column by its column-wise sum).

head(SummarizedExperiment::assay(tTEobject, "CodonUsage"))
#>     Adrenal-Adrenocortical cells Adrenal-Chromaffin cells
#> AAA                      6166175                   886228
#> CAA                      3066594                   448080
#> GAA                      8300641                   910614
#> TAA                       112872                    11098
#> ACA                      3187448                   466826
#> CCA                      3059730                   390216
#>     Adrenal-CSH1_CSH2 positive cells Adrenal-Erythroblasts
#> AAA                             3344                 44304
#> CAA                             1402                 22537
#> GAA                             3492                 59136
#> TAA                               25                   841
#> ACA                             1475                 22276
#> CCA                             1334                 23884
#>     Adrenal-Lymphoid cells Adrenal-Megakaryocytes Adrenal-Myeloid cells
#> AAA                  11038                  42300                 36893
#> CAA                   5101                  19093                 17955
#> GAA                  12985                  64845                 47507
#> TAA                    175                   1052                   626
#> ACA                   6900                  15392                 17871
#> CCA                   6195                  16781                 20070
#>     Adrenal-Schwann cells Adrenal-SLC26A4_PAEP positive cells
#> AAA                109220                                1430
#> CAA                 52286                                 705
#> GAA                 79659                                2063
#> TAA                   366                                  33
#> ACA                 62369                                 721
#> CCA                 36385                                 707
#>     Adrenal-Stromal cells Adrenal-Sympathoblasts
#> AAA                225932                 157616
#> CAA                115227                  78964
#> GAA                299018                 155340
#> TAA                  3813                   1499
#> ACA                105923                  82729
#> CCA                107250                  64360
#>     Adrenal-Vascular endothelial cells Kidney-Erythroblasts
#> AAA                            1275567                 9538
#> CAA                             501192                 4876
#> GAA                            1215295                13806
#> TAA                               4343                  160
#> ACA                             527553                 4295
#> CCA                             454083                 6158
#>     Kidney-Lymphoid cells Kidney-Megakaryocytes Kidney-Mesangial cells
#> AAA                 34199                  7478                2504779
#> CAA                 14132                  3140                1261824
#> GAA                 37766                  9261                3370219
#> TAA                   687                   103                  54056
#> ACA                 19593                  3120                1242898
#> CCA                 19358                  3014                1215544
#>     Kidney-Metanephric cells Kidney-Myeloid cells Kidney-Stromal cells
#> AAA                  7521573               139053                55697
#> CAA                  3670040                61444                27835
#> GAA                  8056900               164372                71086
#> TAA                   105181                 3090                 1204
#> ACA                  4058174                68573                28082
#> CCA                  3476146                80878                28061
#>     Kidney-Ureteric bud cells Kidney-Vascular endothelial cells
#> AAA                    527428                            664824
#> CAA                    250736                            275177
#> GAA                    659729                            671394
#> TAA                     10527                              4116
#> ACA                    319696                            290949
#> CCA                    307435                            258525
#>     Liver-Erythroblasts Liver-Hematopoietic stem cells Liver-Hepatoblasts
#> AAA             1037985                          29892            2126351
#> CAA              524436                          15073             905114
#> GAA             1434153                          38646            2343218
#> TAA               13997                            430              29070
#> ACA              487704                          14841            1102880
#> CCA              537230                          15920            1076046
#>     Liver-Lymphoid cells Liver-Megakaryocytes Liver-Mesothelial cells
#> AAA                28317                66910                    5774
#> CAA                13309                31489                    2913
#> GAA                34481               102769                    7454
#> TAA                  238                 1122                     117
#> ACA                14895                26452                    3015
#> CCA                14527                29211                    2901
#>     Liver-Myeloid cells Liver-Stellate cells Liver-Vascular endothelial cells
#> AAA               59673                38651                           256809
#> CAA               27005                20439                           108669
#> GAA               77027                53415                           269968
#> TAA                 751                  508                              993
#> ACA               29575                18573                           109748
#> CCA               33653                18590                           101172
#>     Cerebellum-Astrocytes Cerebellum-Granule neurons
#> AAA              63739371                   97625429
#> CAA              31160666                   47400759
#> GAA              47789505                   69668438
#> TAA                173957                     257708
#> ACA              35966713                   56256886
#> CCA              21105159                   31257078
#>     Cerebellum-Inhibitory interneurons Cerebellum-Microglia
#> AAA                           49465234               297019
#> CAA                           23923518               140519
#> GAA                           35011710               285373
#> TAA                             117706                 2084
#> ACA                           28389418               152719
#> CCA                           15911559               121642
#>     Cerebellum-Oligodendrocytes Cerebellum-Purkinje neurons
#> AAA                     3003825                    67460691
#> CAA                     1470164                    32637390
#> GAA                     2229290                    55778231
#> TAA                        6584                      362118
#> ACA                     1716456                    38149185
#> CCA                      976600                    22440911
#>     Cerebellum-SLC24A4_PEX5L positive cells Cerebellum-Unipolar brush cells
#> AAA                                 5633163                        22696252
#> CAA                                 2692071                        11052623
#> GAA                                 4690387                        15371447
#> TAA                                   42222                           31911
#> ACA                                 3228251                        13119797
#> CCA                                 2092925                         7287252
#>     Cerebellum-Vascular endothelial cells Muscle-Erythroblasts
#> AAA                               1308766                  625
#> CAA                                540715                  306
#> GAA                               1227159                  797
#> TAA                                  6185                   15
#> ACA                                590357                  319
#> CCA                                479972                  337
#>     Muscle-Lymphatic endothelial cells Muscle-Lymphoid cells
#> AAA                               1882                  2414
#> CAA                               1032                  1051
#> GAA                               2467                  2773
#> TAA                                 37                    38
#> ACA                               1015                  1398
#> CCA                               1053                  1364
#>     Muscle-Megakaryocytes Muscle-Myeloid cells Muscle-Satellite cells
#> AAA                   771                 5797                 118294
#> CAA                   364                 2783                  58697
#> GAA                  1260                 7176                 157236
#> TAA                    18                  103                   2907
#> ACA                   232                 2788                  60254
#> CCA                   227                 2868                  55010
#>     Muscle-Schwann cells Muscle-Skeletal muscle cells
#> AAA                43338                       509886
#> CAA                20801                       242311
#> GAA                31235                       790478
#> TAA                  124                        13174
#> ACA                24545                       188972
#> CCA                13583                       172747
#>     Muscle-Smooth muscle cells Muscle-Stromal cells
#> AAA                      13370               445242
#> CAA                       6691               220292
#> GAA                      17521               398327
#> TAA                        214                 3208
#> ACA                       6467               243093
#> CCA                       6596               166050
#>     Muscle-Vascular endothelial cells Cerebrum-Astrocytes
#> AAA                             83586            18749795
#> CAA                             35162             9116905
#> GAA                             86955            13416790
#> TAA                               872               38173
#> ACA                             38762            10651432
#> CCA                             33625             6015299
#>     Cerebrum-Excitatory neurons Cerebrum-Inhibitory neurons
#> AAA                   349533872                    94160656
#> CAA                   169638650                    46000061
#> GAA                   257515243                    70790567
#> TAA                     1105201                      296421
#> ACA                   202245156                    53689149
#> CCA                   112603689                    31279430
#>     Cerebrum-Limbic system neurons Cerebrum-Megakaryocytes Cerebrum-Microglia
#> AAA                       17994113                    6887             263870
#> CAA                        8763701                    3250             130367
#> GAA                       13368227                    7326             272598
#> TAA                          55092                      62               1906
#> ACA                       10285897                    3380             135911
#> CCA                        5995050                    2370             112700
#>     Cerebrum-Oligodendrocytes Cerebrum-SKOR2_NPSR1 positive cells
#> AAA                   4162874                             3599275
#> CAA                   2034080                             1743538
#> GAA                   3044826                             2968252
#> TAA                      7783                               18212
#> ACA                   2380833                             2027494
#> CCA                   1325881                             1187244
#>     Cerebrum-Vascular endothelial cells Pancreas-Acinar cells
#> AAA                             1498256                363958
#> CAA                              620067                156909
#> GAA                             1424395                438365
#> TAA                                6959                  8878
#> ACA                              671093                185052
#> CCA                              551141                187057
#>     Pancreas-CCL19_CCL21 positive cells Pancreas-Ductal cells Pancreas-ENS glia
#> AAA                                5968                295649            187157
#> CAA                                2709                 83691             89394
#> GAA                                7590                334266            140486
#> TAA                                 245                  4323               906
#> ACA                                3121                110839            106996
#> CCA                                3299                126963             65345
#>     Pancreas-ENS neurons Pancreas-Erythroblasts Pancreas-Islet endocrine cells
#> AAA                27941                  29052                         461602
#> CAA                13931                  14045                         230025
#> GAA                29722                  38413                         423322
#> TAA                  363                    600                           4367
#> ACA                14003                  15026                         257090
#> CCA                12603                  23596                         191086
#>     Pancreas-Lymphatic endothelial cells Pancreas-Lymphoid cells
#> AAA                                 4635                  267075
#> CAA                                 2527                  100799
#> GAA                                 6346                  277923
#> TAA                                  113                    7618
#> ACA                                 2638                  155246
#> CCA                                 2714                  154827
#>     Pancreas-Mesothelial cells Pancreas-Myeloid cells
#> AAA                       5150                  43166
#> CAA                       2524                  18032
#> GAA                       6809                  50133
#> TAA                        155                   1396
#> ACA                       2481                  23813
#> CCA                       2722                  26757
#>     Pancreas-Smooth muscle cells Pancreas-Stromal cells
#> AAA                        80597                 271887
#> CAA                        38350                 130149
#> GAA                       105058                 328945
#> TAA                         2446                   6664
#> ACA                        43975                 146884
#> CCA                        42656                 132276
#>     Pancreas-Vascular endothelial cells Placenta-AFP_ALB positive cells
#> AAA                              556209                            2137
#> CAA                              221018                             887
#> GAA                              541793                            2200
#> TAA                                4042                              38
#> ACA                              244386                            1146
#> CCA                              216252                            1026
#>     Placenta-Extravillous trophoblasts Placenta-IGFBP1_DKK1 positive cells
#> AAA                             418572                               16917
#> CAA                             158537                                7735
#> GAA                             376697                               20008
#> TAA                                331                                 273
#> ACA                             165712                                9144
#> CCA                             140175                                8029
#>     Placenta-Lymphoid cells Placenta-Megakaryocytes Placenta-Myeloid cells
#> AAA                   11178                    1271                   6544
#> CAA                    5290                     613                   2863
#> GAA                   13276                    2134                   7337
#> TAA                     141                      23                     97
#> ACA                    6905                     402                   3185
#> CCA                    6400                     424                   3432
#>     Placenta-PAEP_MECOM positive cells Placenta-Smooth muscle cells
#> AAA                              12906                        76837
#> CAA                               5594                        31321
#> GAA                              14070                        76282
#> TAA                                 96                          218
#> ACA                               5934                        31184
#> CCA                               5488                        26946
#>     Placenta-Stromal cells
#> AAA                 343642
#> CAA                 160005
#> GAA                 406782
#> TAA                   2612
#> ACA                 152375
#> CCA                 145711
#>     Placenta-Syncytiotrophoblasts and villous cytotrophoblasts
#> AAA                                                     613968
#> CAA                                                     274864
#> GAA                                                     676102
#> TAA                                                       3983
#> ACA                                                     279587
#> CCA                                                     255352
#>     Placenta-Trophoblast giant cells Placenta-Vascular endothelial cells
#> AAA                            34321                               24423
#> CAA                            14531                               12141
#> GAA                            33752                               29453
#> TAA                              187                                 262
#> ACA                            15861                               12661
#> CCA                            13457                               11590
#>     Lung-Bronchiolar and alveolar epithelial cells
#> AAA                                        3222845
#> CAA                                        1462215
#> GAA                                        3865594
#> TAA                                          61533
#> ACA                                        1603224
#> CCA                                        1573921
#>     Lung-Ciliated epithelial cells Lung-CSH1_CSH2 positive cells
#> AAA                          72744                           495
#> CAA                          34409                           212
#> GAA                         100343                           562
#> TAA                           1431                             6
#> ACA                          33289                           221
#> CCA                          33931                           219
#>     Lung-Lymphatic endothelial cells Lung-Lymphoid cells Lung-Megakaryocytes
#> AAA                           102923               67449               13995
#> CAA                            54729               31391                6369
#> GAA                           138140               78435               22082
#> TAA                             2459                 902                 306
#> ACA                            54711               40496                4850
#> CCA                            51471               36966                5408
#>     Lung-Mesothelial cells Lung-Myeloid cells Lung-Neuroendocrine cells
#> AAA                  23260              53276                    119725
#> CAA                  11985              25753                     54782
#> GAA                  30139              65154                    103953
#> TAA                    486                972                      1146
#> ACA                  11866              25626                     70777
#> CCA                  11664              27738                     42161
#>     Lung-Squamous epithelial cells Lung-Stromal cells
#> AAA                           5486            2771166
#> CAA                           2435            1450024
#> GAA                           7713            3943915
#> TAA                            152              43319
#> ACA                           3533            1165550
#> CCA                           3666            1244298
#>     Lung-Vascular endothelial cells Lung-Visceral neurons
#> AAA                          550874                 26229
#> CAA                          237725                 12837
#> GAA                          593870                 22759
#> TAA                            5079                   188
#> ACA                          246349                 14404
#> CCA                          225850                  9641
#>     Spleen-AFP_ALB positive cells Spleen-Erythroblasts Spleen-Lymphoid cells
#> AAA                          3217                 9406                 35713
#> CAA                          1407                 4761                 16695
#> GAA                          3400                12379                 44104
#> TAA                            60                  169                   518
#> ACA                          1682                 4695                 19686
#> CCA                          1487                 4893                 19567
#>     Spleen-Megakaryocytes Spleen-Mesothelial cells Spleen-Myeloid cells
#> AAA                  3736                     5855                24754
#> CAA                  1666                     3086                11124
#> GAA                  5986                     8088                31114
#> TAA                    63                      149                  340
#> ACA                  1252                     3326                11971
#> CCA                  1525                     3266                13592
#>     Spleen-STC2_TLX1 positive cells Spleen-Stromal cells
#> AAA                          124738                45875
#> CAA                           55682                24177
#> GAA                          138082                62590
#> TAA                            1733                  699
#> ACA                           61544                21531
#> CCA                           58700                22483
#>     Spleen-Vascular endothelial cells Eye-Amacrine cells Eye-Astrocytes
#> AAA                            183729             642837           4663
#> CAA                             76415             320262           2332
#> GAA                            186958             502347           5748
#> TAA                               876               2209             52
#> ACA                             78269             359421           2268
#> CCA                             69262             227118           2316
#>     Eye-Bipolar cells Eye-Corneal and conjunctival epithelial cells
#> AAA             37504                                          2593
#> CAA             17406                                          1239
#> GAA             38751                                          3439
#> TAA               302                                            88
#> ACA             18405                                          1295
#> CCA             15490                                          1439
#>     Eye-Ganglion cells Eye-Horizontal cells Eye-Lens fibre cells Eye-Microglia
#> AAA            1090893                75604                11333          2204
#> CAA             528290                39817                 8562          1077
#> GAA             899746                80200                14304          2763
#> TAA               5877                  869                  656            29
#> ACA             611991                40194                 6790           995
#> CCA             372863                33719                 4540          1055
#>     Eye-PDE11A_FAM19A2 positive cells Eye-Photoreceptor cells
#> AAA                             52261                  482211
#> CAA                             26428                  237095
#> GAA                             43819                  455306
#> TAA                               265                    4317
#> ACA                             28925                  275268
#> CCA                             19305                  184170
#>     Eye-Retinal pigment cells Eye-Retinal progenitors and Muller glia
#> AAA                    134046                                  406188
#> CAA                     41481                                  192007
#> GAA                    138783                                  472685
#> TAA                       323                                    4289
#> ACA                     61895                                  191632
#> CCA                     52159                                  178683
#>     Eye-Skeletal muscle cells Eye-Smooth muscle cells Eye-Stromal cells
#> AAA                      7716                    5462             23240
#> CAA                      3844                    1964             12228
#> GAA                      9522                    5882             28577
#> TAA                       123                      22               433
#> ACA                      3526                    2481             11422
#> CCA                      2712                    2103             10866
#>     Eye-Vascular endothelial cells Stomach-Ciliated epithelial cells
#> AAA                          12054                              6845
#> CAA                           5038                              3252
#> GAA                          12099                              9265
#> TAA                             81                               145
#> ACA                           5379                              3297
#> CCA                           4546                              3415
#>     Stomach-ENS glia Stomach-ENS neurons Stomach-Erythroblasts
#> AAA            11798                3561                  1710
#> CAA             5694                1866                   885
#> GAA             9049                3489                  2172
#> TAA               37                  48                    21
#> ACA             6679                1859                   934
#> CCA             3997                1680                  1096
#>     Stomach-Goblet cells Stomach-Lymphatic endothelial cells
#> AAA                83460                                1383
#> CAA                37402                                 688
#> GAA               105566                                1860
#> TAA                 1846                                  22
#> ACA                45214                                 664
#> CCA                48877                                 712
#>     Stomach-Lymphoid cells Stomach-Mesothelial cells
#> AAA                  10400                      3391
#> CAA                   4188                      1587
#> GAA                  11137                      4374
#> TAA                    208                        84
#> ACA                   6128                      1709
#> CCA                   5979                      1706
#>     Stomach-MUC13_DMBT1 positive cells Stomach-Myeloid cells
#> AAA                              18058                  2125
#> CAA                               9193                   975
#> GAA                              22771                  2539
#> TAA                                402                    51
#> ACA                              10487                  1095
#> CCA                              10354                  1160
#>     Stomach-Neuroendocrine cells Stomach-Parietal and chief cells
#> AAA                         9372                            86730
#> CAA                         4657                            28953
#> GAA                         9332                            95954
#> TAA                           87                             1618
#> ACA                         5221                            37644
#> CCA                         4088                            39536
#>     Stomach-PDE1C_ACSM3 positive cells Stomach-Squamous epithelial cells
#> AAA                               2011                             32042
#> CAA                                783                             15298
#> GAA                               2413                             41261
#> TAA                                 26                               945
#> ACA                               1084                             17413
#> CCA                               1186                             17673
#>     Stomach-Stromal cells Stomach-Vascular endothelial cells
#> AAA                 26946                              15719
#> CAA                 13372                               6417
#> GAA                 36561                              15638
#> TAA                   589                                108
#> ACA                 13378                               6943
#> CCA                 13862                               6044
#>     Heart-Cardiomyocytes Heart-CLC_IL5RA positive cells
#> AAA              2581453                           3255
#> CAA              1227461                           1463
#> GAA              3850426                           4354
#> TAA                52899                             84
#> ACA               931815                           1415
#> CCA               910526                           1417
#>     Heart-ELF3_AGBL2 positive cells Heart-Endocardial cells
#> AAA                            5975                  292037
#> CAA                            2650                  122232
#> GAA                            8351                  328205
#> TAA                             125                    4909
#> ACA                            2316                  132140
#> CCA                            2331                  118043
#>     Heart-Epicardial fat cells Heart-Erythroblasts
#> AAA                      54397                 144
#> CAA                      26782                  44
#> GAA                      69648                 137
#> TAA                       1129                   4
#> ACA                      27155                  76
#> CCA                      26569                  88
#>     Heart-Lymphatic endothelial cells Heart-Lymphoid cells Heart-Megakaryocytes
#> AAA                             26998                39860                12002
#> CAA                             13938                17846                 5417
#> GAA                             36490                45353                17179
#> TAA                               598                  674                  300
#> ACA                             13639                23783                 5153
#> CCA                             13206                21929                 5472
#>     Heart-Myeloid cells Heart-SATB2_LRRC7 positive cells Heart-Schwann cells
#> AAA               22190                            32589              100318
#> CAA               10318                            15521               48234
#> GAA               26344                            27265               70868
#> TAA                 515                              170                 203
#> ACA               10959                            19105               57456
#> CCA               11476                            11490               31765
#>     Heart-Smooth muscle cells Heart-Stromal cells
#> AAA                     47608              258513
#> CAA                     22503              128591
#> GAA                     61426              336125
#> TAA                       986                5491
#> ACA                     22233              127869
#> CCA                     22242              127515
#>     Heart-Vascular endothelial cells Heart-Visceral neurons
#> AAA                           187186                  28268
#> CAA                            79279                  13530
#> GAA                           199368                  30030
#> TAA                             2016                    331
#> ACA                            85184                  14410
#> CCA                            76083                  12359
#>     Thymus-Antigen presenting cells Thymus-Stromal cells
#> AAA                            9115                 1263
#> CAA                            4422                  604
#> GAA                           11108                 1752
#> TAA                             178                   29
#> ACA                            5034                  703
#> CCA                            4986                  799
#>     Thymus-Thymic epithelial cells Thymus-Thymocytes
#> AAA                           4941            218827
#> CAA                           2662            105918
#> GAA                           6591            259913
#> TAA                             64              2314
#> ACA                           2652            139906
#> CCA                           2431            125338
#>     Thymus-Vascular endothelial cells Intestine-Chromaffin cells
#> AAA                              2744                      18674
#> CAA                              1256                       9315
#> GAA                              3316                      18963
#> TAA                                35                        213
#> ACA                              1197                      10950
#> CCA                              1166                       9087
#>     Intestine-ENS glia Intestine-ENS neurons Intestine-Erythroblasts
#> AAA             286565                210365                    3543
#> CAA             137380                105341                    1814
#> GAA             218156                194831                    5065
#> TAA               1033                  2170                      53
#> ACA             162294                111556                    1640
#> CCA             100810                 86397                    2241
#>     Intestine-Intestinal epithelial cells Intestine-Lymphatic endothelial cells
#> AAA                                682907                                  5093
#> CAA                                318641                                  2689
#> GAA                                830938                                  6742
#> TAA                                 16172                                   104
#> ACA                                372760                                  2825
#> CCA                                369770                                  2745
#>     Intestine-Lymphoid cells Intestine-Mesothelial cells
#> AAA                    66416                        6218
#> CAA                    29621                        3301
#> GAA                    77269                        8334
#> TAA                      945                         117
#> ACA                    40509                        3040
#> CCA                    38967                        3102
#>     Intestine-Myeloid cells Intestine-Smooth muscle cells
#> AAA                   62630                         36695
#> CAA                   28344                         18181
#> GAA                   73927                         54542
#> TAA                    1251                           729
#> ACA                   33699                         14400
#> CCA                   35498                         15171
#>     Intestine-Stromal cells Intestine-Vascular endothelial cells
#> AAA                  368558                                98706
#> CAA                  181956                                40222
#> GAA                  517574                                97682
#> TAA                    7811                                  483
#> ACA                  175951                                42900
#> CCA                  176015                                37294
long_format_codon_usage <- transformFormat(
    data = SummarizedExperiment::assay(tTEobject, "CodonUsage"),
    normalize = TRUE,
    rownames_to_column = "codon", # features (row) of the CodonUsage matrix
    names_to = "condition", # conditions (col) of the CodonUsage matrix
    values_to = "usage"
) # values of the CodonUsage matrix

# long_format_codon_usage contains 3 columns: codon, condition, usage
# We are going to divide the condition column into tissue and cell_type
long_format_codon_usage <- long_format_codon_usage %>%
    tidyr::separate(
        .data$condition,
        into = c("tissue", "cell_type"), sep = "-"
    )
head(long_format_codon_usage)
#>   codon  tissue            cell_type        usage
#> 1   AAA Adrenal Adrenocortical cells 0.0296446778
#> 2   CAA Adrenal Adrenocortical cells 0.0147430443
#> 3   GAA Adrenal Adrenocortical cells 0.0399063970
#> 4   TAA Adrenal Adrenocortical cells 0.0005426466
#> 5   ACA Adrenal Adrenocortical cells 0.0153240654
#> 6   CCA Adrenal Adrenocortical cells 0.0147100447
long_format_AA_demand <- transformFormat(
    data = SummarizedExperiment::assay(tTEobject, "AADemand"),
    normalize = TRUE,
    rownames_to_column = "AA", # features (row) of the AADemand matrix
    names_to = "condition", # conditions (col) of the AADemand matrix
    values_to = "demand"
) # values of the AADemand matrix

# long_format_AA_demand contains 3 columns: AA, condition, demand
# We are going to divide the condition column into tissue and cell_type
long_format_AA_demand <- long_format_AA_demand %>%
    tidyr::separate(.data$condition, into = c("tissue", "cell_type"), sep = "-")

2.2. Parameters

To enhance usability, parameters’ names and structures have been kept consistent across functions with most parameters being shared among them. This standardization simplifies customization and ensures an intuitive workflow.

Parameter | Description

|————————|————————————————-| | data | Properly formatted dataset | | plot | A character string indicating the type of plot to generate | | ncols | Numeric; Number of columns for arranging panels. Defaults to 1 | | x_axis_col | Name of the column in data to use for the x-axis | | y_axis_col | Name of the column in data to use for the y-axis | | condition_col | Name of the column in data to use for coloring/grouping by condition | | targeted_arg | Optional; A vector defining key feature clusters to highlight or label. | | color_palette | Optional; A vector of color codes to customize plot appearance | | filename | Optional; Name for the saved plot | | show_legend | A character string specifying the position of the legend. Supported formats: “none” (default), “top”, “bottom”, “right” and “left” | | add_titles | Logical; if TRUE, includes titles in the plot. Defaults to TRUE |

  • Function-specific parameters will be introduced within each plot’s corresponding description section.
  • Not all generic parameters are required by every function; usage depends on the specific plotting context.
  • The values provided for x_axis_col, y_axis_col and condition_col must exactly match the column names in the input data.

  • 3. Visualization options

    The plotDistribution() function generates jitter plots, barplots or boxplots to visualize data distributions (e.g. raw or normalize codon usage) across features (e.g. codons). This function provides an intuitive representation of how usage patterns vary across conditions. The type of plot can be specified via the plot argument, while layout and grouping can be controlled using the panels parameter.

    In the example below, we visualize normalized codon usage across conditions to explore how codon preferences fluctuate. The dataset is a single-cell dataset, where each cell is annotated by its type and tissue of origin. As a general guideline, the jitter plot mode is well-suited for large datasets, as it allows users to observe the distribution of values at a general level and identify patterns across groups.

    # Codon usage distribution plot (jitter)
    plotDistribution(
        data = long_format_codon_usage, plot = "jitter", x_axis_col = "codon",
        y_axis_col = "usage", condition_col = "tissue", show_legend = "right",
        add_titles = FALSE
    )

    Alternatively, to reduce dataset complexity and enable more in-depth analysis, we can focus on a subset of target conditions. In this example, we restrict the analysis to spleen-derived cells, specifically selecting those belonging to the lymphoid and myeloid lineages. For this approach we can use a barplot plot mode.

    # Data subset: spleen tissue and selected cell types (lymphoid and myeloid)
    spleen_indexes <- grep("Spleen", long_format_codon_usage$tissue, fixed = TRUE)
    long_format_cu_spleen <- long_format_codon_usage[spleen_indexes, ]
    
    lymphoid_indexes <- grep(
        "Lymphoid", long_format_cu_spleen$cell_type,
        fixed = TRUE
    )
    myeloid_indexes <- grep(
        "Myeloid", long_format_cu_spleen$cell_type,
        fixed = TRUE
    )
    
    cells_indexes <- c(lymphoid_indexes, myeloid_indexes)
    
    long_format_codon_usage_subset <- long_format_cu_spleen[cells_indexes, ]

    To facilitate visualization, we enable the panels parameter in plotDistribution, which arranges each condition in a separate facet. This separation allows for easier comparison across groups. Additionally, the ncols parameter controls the number of columns used in the facet layout, helping optimize the plot’s readability, especially when working with multiple conditions.

    # Codon usage distribution plot (barplot)
    plotDistribution(
        data = long_format_codon_usage_subset, plot = "barplot", ncols = 1,
        facet_col = "cell_type",
        x_axis_col = "codon", y_axis_col = "usage", condition_col = "cell_type",
        show_legend = "none", add_titles = FALSE
    )

    If, instead of comparing the distributions of two cell types within the same tissue, we want to explore how distributions vary across two different tissues, we can switch to the boxplot mode. This plot type summarizes the variation and central tendency of the data, making it easier to compare distribution between broader biological groups.

    # Data subset: specific codons in spleen and heart tissues
    spleen_indexes <- grep("Spleen", long_format_codon_usage$tissue, fixed = TRUE)
    heart_indexes <- grep("Heart", long_format_codon_usage$tissue, fixed = TRUE)
    
    tissue_indexes <- c(spleen_indexes, heart_indexes)
    
    long_format_cu_tissues <- long_format_codon_usage[tissue_indexes, ]
    
    selected_codons <- c(
        "CAA", "CAC", "CAG", "CAT", "CCA", "CCC", "CCG", "CCT", "CGA", "CGC",
        "CGG", "CGT", "CTA", "CTC", "CTG", "CTT", "GAA", "GAC", "GAG", "GAT",
        "GCA", "GCC", "GCG", "GCT", "GGA", "GGC", "GGG", "GGT", "GTA", "GTC",
        "GTG", "GTT"
    )
    
    codons_indexes <- which(long_format_cu_tissues$codon %in% selected_codons)
    long_format_cu_tissues <- long_format_cu_tissues[codons_indexes, ]

    In this example, we introduce a pre-defined color_palette to explicitly assign specific colors to each of the tissues being analyzed.

    # Codon usage distribution plot (barplot)
    plotDistribution(
        data = long_format_cu_tissues, plot = "boxplot",
        x_axis_col = "codon", y_axis_col = "usage", add_stats = FALSE,
        condition_col = "tissue",
        color_palette = c(Heart = "#de77ae", Spleen = "#7fbc41"),
        show_legend = "bottom", add_titles = FALSE
    )


    The plotTargetComparison() function extends the functionality of plotDistribution() by allowing direct comparison between a target condition and the overall mean. This visualization helps identify how codon, anticodon, or amino acid usage in the selected condition deviates from the average profile.

    Function-specific parameters:

  • mean - A numeric vector containing the mean values of the codons/anticodon/amino acids present in data.
  • show_difference - Logical; if TRUE, displays the differences between the mean and the targeted values.
  • In the following example, we focus on cells from the cerebellum. To enable a proper comparison, we first subset the dataset to include only cerebellum-specific data and then compute the mean codon usage using computeMeanUsage(). The overall mean codon usage was previously obtained during the initial execution of runPipeline().

    # Data subset: mean codon usage across cerebellum cell types
    codon_usage <- SummarizedExperiment::assay(tTEobject, "CodonUsage")
    cerebellum_indexes <- grep("Cerebellum", colnames(codon_usage), fixed = TRUE)
    cerebrum_indexes <- grep("Cerebrum", colnames(codon_usage), fixed = TRUE)
    brain_indexes <- c(cerebellum_indexes, cerebrum_indexes)
    brain_codon_usage <- codon_usage[, brain_indexes]
    
    # Define the metadata
    metadata_brain <- data.frame(
        label = colnames(brain_codon_usage), stringsAsFactors = FALSE
    )
    metadata_brain <- tidyr::separate(
        metadata_brain, label,
        into = c("tissue", "cell.type"), sep = "-"
    )
    metadata_brain$conditions <- colnames(brain_codon_usage)
    
    mean_brain_codon_usage <- computeMeanUsage(
        data = brain_codon_usage, metadata = metadata_brain,
        batch = "tissue"
    )
    #> A . Evaluating the input.
    #> A . COMPLETED
    #> B . Calculating the mean usage across conditions.
    #> - Size-correcting the matrix to account for sequencing depth.
    #> - Detected metadata column: 'conditions'
    #> - Final dataset contains 18 unique samples.
    #> - The 'data', 'metadata' and 'batch' parameters have been properly loaded.
    #> - Size-correcting the counts using DESeq2.
    #> - Filtering (if necessary) the 'data' and 'metadata' for common features.
    #> - Detected metadata column: 'conditions'
    #> - Final dataset contains 18 unique samples.
    #> - Building exploratory model based on batch: ~ tissue
    #> - Running DESeq2 pipeline...
    #> estimating size factors
    #> estimating dispersions
    #> gene-wise dispersion estimates
    #> mean-dispersion relationship
    #> final dispersion estimates
    #> fitting model and testing
    #> - Extracting the size-corrected counts.
    #> - Normalizing the usage matrix.
    #> B . COMPLETED

    Based on the calculations above, the plot illustrates: (i) the mean codon usage of the cerebellum cells as purple dots, (ii) the overall mean codon usage across conditions as grey bars, and (iii) the difference between the two as blue lines.

    meta <- S4Vectors::metadata(tTEobject)
    additional_metrics <- meta[["CodonUsage_AdditionalMetrics"]]
    plotTargetComparison(
        target_data = data.frame(mean_brain_codon_usage),
        overall_data = data.frame(additional_metrics$MeanCodonUsage),
        x_axis_col = "feature", y_axis_col = "mean_usage_across_conditions",
        show_difference = TRUE, add_titles = FALSE
    )


    The plotProportion() function provides a summary visualization of a specific metrics’ distribution across features or conditions. It supports multiple display modes, including bar, radar or donut plots, allowing users to choose the most effective format for their data.

    The choice of plot type in this and other functions within tTEscanR is left to the user’s discretion, depending on the nature of the data (e.g. number of features, distribution of counts) and the specific research question being addressed.

    mean_codon_usage <- additional_metrics$MeanCodonUsage
    mean_codon_usage$codon <- mean_codon_usage$feature
    
    mean_codon_usage <- featuresToAA(
        data = mean_codon_usage, position = "feature",
        notation_from = "codon", notation_to = "aa"
    )
    #> --- Translating the input features ---
    #> 1 . Checking the format of the input data.
    #> 1 . COMPLETED
    #> 2 . Extracting the features to translate.
    #> 2 . COMPLETED
    #> 3 . Translating the features.
    #> - 64 out of 64 will be translated.
    #> 3 . COMPLETED
    #> --- The features have been successfully translated ---
    plotProportion(
        data = mean_codon_usage, plot = "bar",
        var_numerical = "mean_usage_across_conditions",
        var_categorical = "codon", var_color = "feature", show_legend = "none"
    ) # Here feature corresponds to AA
    #> $plot

    # Data subset: mean codon usage across cerebellum cell types
    aa_demand <- SummarizedExperiment::assay(tTEobject, "AADemand")
    cerebellum_indexes_AA <- grep("Cerebellum", colnames(aa_demand), fixed = TRUE)
    cerebrum_indexes_AA <- grep("Cerebrum", colnames(aa_demand), fixed = TRUE)
    brain_indexes_AA <- c(cerebellum_indexes_AA, cerebrum_indexes_AA)
    brain_AAdemand <- aa_demand[, brain_indexes_AA]
    
    mean_brain_AAdemand <- computeMeanUsage(
        data = brain_AAdemand, metadata = metadata_brain, batch = "tissue"
    )
    #> A . Evaluating the input.
    #> A . COMPLETED
    #> B . Calculating the mean usage across conditions.
    #> - Size-correcting the matrix to account for sequencing depth.
    #> - Detected metadata column: 'conditions'
    #> - Final dataset contains 18 unique samples.
    #> - The 'data', 'metadata' and 'batch' parameters have been properly loaded.
    #> - Size-correcting the counts using DESeq2.
    #> - Filtering (if necessary) the 'data' and 'metadata' for common features.
    #> - Detected metadata column: 'conditions'
    #> - Final dataset contains 18 unique samples.
    #> - Building exploratory model based on batch: ~ tissue
    #> - Running DESeq2 pipeline...
    #> estimating size factors
    #> estimating dispersions
    #> gene-wise dispersion estimates
    #> mean-dispersion relationship
    #> -- note: fitType='parametric', but the dispersion trend was not well captured by the
    #>    function: y = a/x + b, and a local regression fit was automatically substituted.
    #>    specify fitType='local' or 'mean' to avoid this message next time.
    #> final dispersion estimates
    #> fitting model and testing
    #> - Extracting the size-corrected counts.
    #> - Normalizing the usage matrix.
    #> B . COMPLETED
    plotProportion(
        data = mean_brain_AAdemand, plot = "donut",
        var_numerical = "mean_usage_across_conditions",
        var_categorical = "feature", show_legend = "none"
    ) # Here feature corresponds to AA
    #> $plot


    The plotTEscore() function generates a violin plot to compare the tTE scores between a specified target condition and all other conditions in the dataset. This visualization helps assess how distinct the translation efficiency profile of the target group is relative to the rest.

    As plotTEscore() uses violin plots, it is important to ensure that each group, especially the targeted condition, has a sufficient number of data points. Violin plots may not provide a reliable representation of the distribution if the sample size is too small. Alternatively, plotDistribution and plotProportion() could be used.

    tTEobject_meta <- S4Vectors::metadata(tTEobject)[["tTE_results"]]
    tTEresults_codon <- tTEobject_meta[["tTEresults_codon"]]
    tTEresults_AA <- tTEobject_meta[["tTEresults_AA"]]
    
    conditions_metadata <- as.data.frame(SummarizedExperiment::colData(tTEobject))
    plotTEscore(
        data = tTEresults_codon, metadata = conditions_metadata,
        index_col = "conditions", class_col = "tissue", add_stats = FALSE
    )
    #> Warning in defineMergedData(data = data, meta = metadata, index = index_col, :
    #> One or more groups have fewer than 2 samples. Statistics (p-values) will return
    #> NA.
    #> $plot
    #> Warning: Groups with fewer than two datapoints have been dropped.
    #> ℹ Set `drop = FALSE` to consider such groups for position adjustment purposes.

    #> 
    #> $stats
    #> NULL
    # Targeted condition: lymphoid and myeloid cells
    conditions_metadata$group <- "other"
    conditions_metadata$group[
        grep("Myeloid", conditions_metadata$conditions, fixed = TRUE)
    ] <- "myeloid"
    conditions_metadata$group[
        grep("Lymphoid", conditions_metadata$conditions, fixed = TRUE)
    ] <- "lymphoid"
    # input data has 4 columns: condition, tTE, p_value, neg_log10_tTE_p_value
    # Codon-anticodon tTE score
    plotTEscore(
        data = tTEresults_codon, metadata = conditions_metadata,
        index_col = "conditions", class_col = "group",
        color_palette = c(
            myeloid = "#abd9e9", lymphoid = "#f1b6da", other = "#fee0b6"
        ),
        add_stats = TRUE
    )
    #> $plot

    #> 
    #> $stats
    #>     group1  group2   p_value          comparison p_signif   class
    #> 1 lymphoid myeloid 0.7922078 lymphoid_vs_myeloid       ns myeloid
    #> 2 lymphoid   other 0.5128688   lymphoid_vs_other       ns   other
    #> 3  myeloid   other 0.2770987    myeloid_vs_other       ns   other
    
    # AA demand-supply tTE score
    plotTEscore(
        data = tTEresults_AA, metadata = conditions_metadata,
        index_col = "conditions", class_col = "group",
        color_palette = c(
            myeloid = "#abd9e9", lymphoid = "#f1b6da", other = "#fee0b6"
        ),
        add_stats = FALSE
    )
    #> $plot

    #> 
    #> $stats
    #> NULL

    In cases where we want to refine the selection of target cell types, such as including or excluding specific subtypes, it is essential to encode this distinction explicitly in the input metadata (targets) data frame.

    For instance, if we aim to focus on neurons but exclude cells labeled as ENS neurons, we need to assign those excluded cells to a different category, referred to as “other” in the metadata. This ensures the function correctly recognizes which cells belong to the target group and which do not.

    # Targeted condition: neurons
    conditions_metadata$group <- "other"
    conditions_metadata$group[grep(
        "neuron", conditions_metadata$conditions,
        fixed = TRUE
    )] <- "neurons"
    conditions_metadata$group[grep(
        "ENS neuron", conditions_metadata$conditions,
        fixed = TRUE
    )] <- "other"
    # AA demand-supply tTE score
    plotTEscore(
        data = tTEresults_AA, metadata = conditions_metadata,
        index_col = "conditions", class_col = "group",
        color_palette = c(neurons = "#8073ac", other = "#fee0b6"),
        add_stats = TRUE
    )
    #> $plot

    #> 
    #> $stats
    #>    group1 group2    p_value       comparison p_signif class
    #> 1 neurons  other 0.02818374 neurons_vs_other        * other

    4. References

    #> 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] Seurat_5.6.0         SeuratObject_5.4.0   sp_2.2-4            
    #>  [4] Signac_1.17.1        Rsamtools_2.29.0     Biostrings_2.81.9   
    #>  [7] XVector_0.53.0       GenomicRanges_1.65.4 IRanges_2.47.5      
    #> [10] S4Vectors_0.51.10    Seqinfo_1.3.2        BiocGenerics_0.59.12
    #> [13] generics_0.1.4       Matrix_1.7-6         dplyr_1.2.1         
    #> [16] biomaRt_2.69.6       tTEscanR_0.99.2      BiocStyle_2.41.0    
    #> 
    #> loaded via a namespace (and not attached):
    #>   [1] RcppAnnoy_0.0.23            later_1.4.8                
    #>   [3] splines_4.6.2               bitops_1.1-0               
    #>   [5] filelock_1.0.3              tibble_3.3.1               
    #>   [7] polyclip_1.10-7             fastDummies_1.7.6          
    #>   [9] lifecycle_1.0.5             httr2_1.3.0                
    #>  [11] rstatix_1.1.0               doParallel_1.0.17          
    #>  [13] globals_0.20.0              lattice_0.23-1             
    #>  [15] MASS_7.3-66                 MultiAssayExperiment_1.39.1
    #>  [17] backports_1.5.1             magrittr_2.0.5             
    #>  [19] plotly_4.12.1               sass_0.4.10                
    #>  [21] rmarkdown_2.32              jquerylib_0.1.4            
    #>  [23] yaml_2.3.12                 httpuv_1.6.17              
    #>  [25] otel_0.2.0                  sctransform_0.4.3          
    #>  [27] spam_2.11-4                 spatstat.sparse_3.2-0      
    #>  [29] reticulate_1.47.0           cowplot_1.2.0              
    #>  [31] pbapply_1.7-5               DBI_1.3.0                  
    #>  [33] buildtools_1.0.0            RColorBrewer_1.1-3         
    #>  [35] abind_1.4-8                 Rtsne_0.17                 
    #>  [37] purrr_1.2.2                 circlize_0.4.18            
    #>  [39] ggrepel_0.9.8               irlba_2.4.1                
    #>  [41] spatstat.utils_3.2-5        listenv_1.1.0              
    #>  [43] maketools_1.3.2             goftest_1.2-3              
    #>  [45] RSpectra_0.16-2             spatstat.random_3.5-2      
    #>  [47] fitdistrplus_1.2-6          parallelly_1.50.0          
    #>  [49] codetools_0.2-20            DelayedArray_0.39.8        
    #>  [51] RcppRoll_0.4.0              tidyselect_1.2.1           
    #>  [53] shape_1.4.6.1               UCSC.utils_1.9.0           
    #>  [55] farver_2.1.2                viridis_0.6.5              
    #>  [57] spatstat.explore_3.8-3      matrixStats_1.5.0          
    #>  [59] BiocFileCache_3.3.1         jsonlite_2.0.0             
    #>  [61] GetoptLong_1.1.1            progressr_1.1.0            
    #>  [63] Formula_1.2-6               ggridges_0.5.7             
    #>  [65] survival_3.8-12             iterators_1.0.14           
    #>  [67] foreach_1.5.2               tools_4.6.2                
    #>  [69] progress_1.2.3              ica_1.0-3                  
    #>  [71] Rcpp_1.1.2                  glue_1.8.1                 
    #>  [73] gridExtra_2.3.1             SparseArray_1.13.4         
    #>  [75] BiocBaseUtils_1.15.1        xfun_0.62                  
    #>  [77] DESeq2_1.53.7               MatrixGenerics_1.25.0      
    #>  [79] GenomeInfoDb_1.49.2         withr_3.0.3                
    #>  [81] BiocManager_1.30.27         fastmap_1.2.0              
    #>  [83] digest_0.6.39               mime_0.13                  
    #>  [85] R6_2.6.1                    colorspace_2.1-4           
    #>  [87] scattermore_1.2             tensor_1.5.1               
    #>  [89] spatstat.data_3.1-9         RSQLite_3.53.3             
    #>  [91] tidyr_1.3.2                 data.table_1.18.6.1        
    #>  [93] Structstrings_1.29.0        htmlwidgets_1.6.4          
    #>  [95] prettyunits_1.2.0           httr_1.4.9                 
    #>  [97] S4Arrays_1.13.2             uwot_0.2.5                 
    #>  [99] pkgconfig_2.0.3             gtable_0.3.6               
    #> [101] blob_1.3.0                  ComplexHeatmap_2.29.0      
    #> [103] lmtest_0.9-40               S7_0.2.2                   
    #> [105] sys_3.4.3                   htmltools_0.5.9            
    #> [107] carData_3.0-6               dotCall64_1.2              
    #> [109] clue_0.3-68                 scales_1.4.0               
    #> [111] Biobase_2.73.2              dendsort_0.3.4             
    #> [113] png_0.1-9                   spatstat.univar_3.2-0      
    #> [115] knitr_1.52                  reshape2_1.4.5             
    #> [117] rjson_0.2.23                nlme_3.1-172               
    #> [119] curl_8.1.0                  cachem_1.1.0               
    #> [121] zoo_1.9-1                   GlobalOptions_0.1.4        
    #> [123] stringr_1.6.0               KernSmooth_2.23-27         
    #> [125] parallel_4.6.2              miniUI_0.1.2               
    #> [127] AnnotationDbi_1.75.2        pillar_1.11.1              
    #> [129] grid_4.6.2                  vctrs_0.7.3                
    #> [131] RANN_2.6.3                  promises_1.5.0             
    #> [133] ggpubr_1.0.0                car_3.1-5                  
    #> [135] dbplyr_2.6.0                xtable_1.8-8               
    #> [137] cluster_2.1.8.3             evaluate_1.0.5             
    #> [139] cli_3.6.6                   locfit_1.5-9.12            
    #> [141] compiler_4.6.2              rlang_1.3.0                
    #> [143] crayon_1.5.3                future.apply_1.21.0        
    #> [145] ggsignif_0.6.4              labeling_0.4.3             
    #> [147] plyr_1.8.9                  stringi_1.8.9              
    #> [149] deldir_2.0-4                viridisLite_0.4.3          
    #> [151] BiocParallel_1.47.0         spatstat.geom_3.8-3        
    #> [153] RcppHNSW_0.7.0              hms_1.1.4                  
    #> [155] patchwork_1.3.2             sparseMatrixStats_1.25.0   
    #> [157] bit64_4.8.6                 future_1.82.0              
    #> [159] ggplot2_4.0.3               shiny_1.14.0               
    #> [161] KEGGREST_1.53.6             SummarizedExperiment_1.43.0
    #> [163] ROCR_1.0-12                 igraph_2.3.4               
    #> [165] broom_1.0.13                memoise_2.0.1              
    #> [167] bslib_0.12.0                fastmatch_1.1-8            
    #> [169] bit_4.6.0
    Cao, J., D. R. O’Day, H. A. Pliner, et al. 2020. “A Human Cell Atlas of Fetal Gene Expression.” Science 370 (6518). https://doi.org/10.1126/science.aba7721.
    Domcke, S., A. J. Hill, R. M. Daza, et al. 2020. “A Human Cell Atlas of Fetal Chromatin Accessibility.” Science 370 (6518). https://doi.org/10.1126/science.aba7612.
    Gao, W., C. J. Gallardo-Dodd, and C. Kutter. 2022. “Cell Type-Specific Analysis by Single-Cell Profiling Identifies a Stable Mammalian tRNA-mRNA Interface and Increased Translation Efficiency in Neurons.” Genome Research 32 (1): 97–110. https://doi.org/10.1101/gr.275944.121.