1 Load dataset

# Specify a working directory
directory <- "/Volumes/DataWinBackup/00_MASTER UOC BIOINFORMATICA - TEMPORAL/TFM-UOC/RNAstructure/rna-structure-prediction"
setwd(directory)
list.files()
 [1] "2D_structure_6overlapped_isoforms" "2D_structure_eocrc"               
 [3] "2D_structure_locrc"                "6_isoforms.fasta"                 
 [5] "bpRNA_st_stats_6_isoforms_all.csv" "bpRNA_st_stats_eocrc_all.csv"     
 [7] "bpRNA_st_stats_locrc_all.csv"      "bpRNA_st_stats.py"                
 [9] "fasta_to_results_rnastructure.py"  "figures"                          
[11] "isoforms_eocrc.fasta"              "isoforms_locrc.fasta"             
[13] "motifs_plots copy.Rmd"             "motifs_plots_cache"               
[15] "motifs_plots-copy_cache"           "motifs_plots-copy.Rmd"            
[17] "motifs_plots.html"                 "motifs_plots.Rmd"                 
[19] "README.md"                         "rnastructure_6_isoforms.csv"      
[21] "rnastructure_eocrc.csv"            "rnastructure_locrc.csv"           
[23] "run_bpRNA.sh"                     
# Read .csv file
bpRNA_6_isoforms <- read.csv("bpRNA_st_stats_6_isoforms_all.csv", header = TRUE,
    row.names = 1, check.names = FALSE)
bpRNA_6_isoforms <- bpRNA_6_isoforms[7:12]
bpRNA_6_isoforms
                  n_stems n_hairpins n_internal_loops n_bulges n_multiloops
ENST00000325327.4       5          2                1        2            0
ENST00000329305.6       5          1                4        0            0
ENST00000338983.7       7          2                3        2            0
ENST00000378292.9       6          2                1        3            0
ENST00000467155.7       6          1                3        2            0
ENST00000532465.1       5          2                3        0            0
                  n_external_regions
ENST00000325327.4                  2
ENST00000329305.6                  2
ENST00000338983.7                  2
ENST00000378292.9                  1
ENST00000467155.7                  1
ENST00000532465.1                  1
# Read .csv file
bpRNA_eocrc <- read.csv("bpRNA_st_stats_eocrc_all.csv", header = TRUE, row.names = 1,
    check.names = FALSE)
bpRNA_eocrc <- bpRNA_eocrc[7:12]
bpRNA_eocrc
                   n_stems n_hairpins n_internal_loops n_bulges n_multiloops
ENST00000297268.11       7          1                5        1            0
ENST00000318426.6        3          1                2        0            0
ENST00000325327.4        5          2                1        2            0
ENST00000329305.6        5          1                4        0            0
ENST00000378292.9        6          2                1        3            0
ENST00000382040.4        7          2                2        3            0
ENST00000415602.5        5          4                0        0            1
ENST00000489749.1        4          1                2        1            0
                   n_external_regions
ENST00000297268.11                  2
ENST00000318426.6                   2
ENST00000325327.4                   2
ENST00000329305.6                   2
ENST00000378292.9                   1
ENST00000382040.4                   2
ENST00000415602.5                   1
ENST00000489749.1                   2
 [ reached 'max' / getOption("max.print") -- omitted 2 rows ]
# Read .csv file
bpRNA_locrc <- read.csv("bpRNA_st_stats_locrc_all.csv", header = TRUE, row.names = 1,
    check.names = FALSE)
bpRNA_locrc <- bpRNA_locrc[7:12]
bpRNA_locrc
                   n_stems n_hairpins n_internal_loops n_bulges n_multiloops
ENST00000263398.11       4          2                2        0            0
ENST00000316673.9        6          2                1        3            0
ENST00000319481.8        7          2                1        4            0
ENST00000338983.7        7          2                3        2            0
ENST00000374429.6        7          2                3        2            0
ENST00000378292.9        6          2                1        3            0
ENST00000637069.1        6          2                3        1            0
ENST00000642527.1        5          3                1        1            0
                   n_external_regions
ENST00000263398.11                  1
ENST00000316673.9                   1
ENST00000319481.8                   1
ENST00000338983.7                   2
ENST00000374429.6                   2
ENST00000378292.9                   1
ENST00000637069.1                   2
ENST00000642527.1                   1
 [ reached 'max' / getOption("max.print") -- omitted 2 rows ]

2 Data summary

# Summary of reports
summary(bpRNA_6_isoforms)
    n_stems        n_hairpins    n_internal_loops    n_bulges    n_multiloops
 Min.   :5.000   Min.   :1.000   Min.   :1.0      Min.   :0.0   Min.   :0    
 1st Qu.:5.000   1st Qu.:1.250   1st Qu.:1.5      1st Qu.:0.5   1st Qu.:0    
 Median :5.500   Median :2.000   Median :3.0      Median :2.0   Median :0    
 Mean   :5.667   Mean   :1.667   Mean   :2.5      Mean   :1.5   Mean   :0    
 3rd Qu.:6.000   3rd Qu.:2.000   3rd Qu.:3.0      3rd Qu.:2.0   3rd Qu.:0    
 Max.   :7.000   Max.   :2.000   Max.   :4.0      Max.   :3.0   Max.   :0    
 n_external_regions
 Min.   :1.0       
 1st Qu.:1.0       
 Median :1.5       
 Mean   :1.5       
 3rd Qu.:2.0       
 Max.   :2.0       
summary(bpRNA_eocrc)
    n_stems       n_hairpins  n_internal_loops    n_bulges     n_multiloops
 Min.   :3.00   Min.   :1.0   Min.   :0.00     Min.   :0.00   Min.   :0.0  
 1st Qu.:4.25   1st Qu.:1.0   1st Qu.:1.00     1st Qu.:0.00   1st Qu.:0.0  
 Median :5.00   Median :2.0   Median :2.00     Median :0.50   Median :0.0  
 Mean   :5.10   Mean   :1.9   Mean   :2.00     Mean   :1.00   Mean   :0.2  
 3rd Qu.:5.75   3rd Qu.:2.0   3rd Qu.:2.75     3rd Qu.:1.75   3rd Qu.:0.0  
 Max.   :7.00   Max.   :4.0   Max.   :5.00     Max.   :3.00   Max.   :1.0  
 n_external_regions
 Min.   :1.00      
 1st Qu.:1.25      
 Median :2.00      
 Mean   :1.70      
 3rd Qu.:2.00      
 Max.   :2.00      
summary(bpRNA_locrc)
    n_stems      n_hairpins n_internal_loops    n_bulges    n_multiloops
 Min.   :4.0   Min.   :1    Min.   :1.0      Min.   :0.0   Min.   :0    
 1st Qu.:6.0   1st Qu.:2    1st Qu.:1.0      1st Qu.:1.0   1st Qu.:0    
 Median :6.0   Median :2    Median :2.5      Median :2.0   Median :0    
 Mean   :6.1   Mean   :2    Mean   :2.2      Mean   :1.9   Mean   :0    
 3rd Qu.:7.0   3rd Qu.:2    3rd Qu.:3.0      3rd Qu.:3.0   3rd Qu.:0    
 Max.   :7.0   Max.   :3    Max.   :4.0      Max.   :4.0   Max.   :0    
 n_external_regions
 Min.   :1.00      
 1st Qu.:1.00      
 Median :1.00      
 Mean   :1.30      
 3rd Qu.:1.75      
 Max.   :2.00      

3 Motif visualization

# Heatmap plot of the 6 overlapped isoforms
bpRNA_6_isoforms_long <- bpRNA_6_isoforms |>
    tibble::rownames_to_column("id") |>
    pivot_longer(-id, names_to = "feature", values_to = "count")

ggplot(bpRNA_6_isoforms_long, aes(feature, id, fill = count)) + geom_tile(color = "white") +
    scale_fill_viridis_c(option = "A") + theme_minimal() + theme(axis.text.x = element_text(angle = 45,
    hjust = 1, vjust = 1), plot.title = element_text(hjust = 0.5)  # center title
) +
    labs(title = "Structural elements of overlapped isoforms", x = NULL, y = NULL,
        fill = "Count")

# Heatmap plot of EOCRC transcripts
bpRNA_eocrc_long <- bpRNA_eocrc |>
    tibble::rownames_to_column("id") |>
    pivot_longer(-id, names_to = "feature", values_to = "count")

ggplot(bpRNA_eocrc_long, aes(feature, id, fill = count)) + geom_tile(color = "white") +
    scale_fill_viridis_c(option = "A") + theme_minimal() + theme(axis.text.x = element_text(angle = 45,
    hjust = 1, vjust = 1), plot.title = element_text(hjust = 0.5)  # center title
) +
    labs(title = "Structural elements of EOCRC top isoforms", x = NULL, y = NULL,
        fill = "Count")

# Heatmap plot of LOCRC transcripts
bpRNA_locrc_long <- bpRNA_locrc |>
    tibble::rownames_to_column("id") |>
    pivot_longer(-id, names_to = "feature", values_to = "count")

ggplot(bpRNA_locrc_long, aes(feature, id, fill = count)) + geom_tile(color = "white") +
    scale_fill_viridis_c(option = "A") + theme_minimal() + theme(axis.text.x = element_text(angle = 45,
    hjust = 1, vjust = 1), plot.title = element_text(hjust = 0.5)  # center title
) +
    labs(title = "Structural elements of LOCRC top isoforms", x = NULL, y = NULL,
        fill = "Count")

4 R Session Information

─ Session info ───────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.5.1 (2025-06-13)
 os       macOS Ventura 13.7.3
 system   x86_64, darwin20
 ui       X11
 language (EN)
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       Europe/Madrid
 date     2026-02-03
 pandoc   3.2 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/x86_64/ (via rmarkdown)
 quarto   1.5.57 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/quarto

─ Packages ───────────────────────────────────────────────────────────────────
 package      * version date (UTC) lib source
 base64enc      0.1-3   2015-07-28 [1] CRAN (R 4.5.0)
 bslib          0.9.0   2025-01-30 [1] CRAN (R 4.5.0)
 cachem         1.1.0   2024-05-16 [1] CRAN (R 4.5.0)
 cli            3.6.5   2025-04-23 [1] CRAN (R 4.5.0)
 codetools      0.2-20  2024-03-31 [1] CRAN (R 4.5.1)
 DBI            1.2.3   2024-06-02 [1] CRAN (R 4.5.0)
 dbplyr       * 2.5.1   2025-09-10 [1] CRAN (R 4.5.1)
 devtools       2.4.6   2025-10-03 [1] CRAN (R 4.5.1)
 digest         0.6.39  2025-11-19 [1] CRAN (R 4.5.1)
 dplyr        * 1.1.4   2023-11-17 [1] CRAN (R 4.5.0)
 ellipsis       0.3.2   2021-04-29 [1] CRAN (R 4.5.0)
 evaluate       1.0.5   2025-08-27 [1] CRAN (R 4.5.1)
 farver         2.1.2   2024-05-13 [1] CRAN (R 4.5.0)
 fastmap        1.2.0   2024-05-15 [1] CRAN (R 4.5.0)
 fmsb         * 0.7.6   2024-01-19 [1] CRAN (R 4.5.0)
 forcats      * 1.0.1   2025-09-25 [1] CRAN (R 4.5.1)
 formatR        1.14    2023-01-17 [1] CRAN (R 4.5.0)
 fs             1.6.6   2025-04-12 [1] CRAN (R 4.5.0)
 generics       0.1.4   2025-05-09 [1] CRAN (R 4.5.0)
 ggplot2      * 4.0.1   2025-11-14 [1] CRAN (R 4.5.1)
 glue           1.8.0   2024-09-30 [1] CRAN (R 4.5.0)
 gtable         0.3.6   2024-10-25 [1] CRAN (R 4.5.0)
 hms            1.1.4   2025-10-17 [1] CRAN (R 4.5.1)
 htmltools      0.5.9   2025-12-04 [1] CRAN (R 4.5.1)
 jquerylib      0.1.4   2021-04-26 [1] CRAN (R 4.5.0)
 jsonlite       2.0.0   2025-03-27 [1] CRAN (R 4.5.0)
 knitr        * 1.51    2025-12-20 [1] CRAN (R 4.5.1)
 labeling       0.4.3   2023-08-29 [1] CRAN (R 4.5.0)
 lifecycle      1.0.4   2023-11-07 [1] CRAN (R 4.5.0)
 lubridate    * 1.9.4   2024-12-08 [1] CRAN (R 4.5.0)
 magrittr       2.0.4   2025-09-12 [1] CRAN (R 4.5.1)
 memoise        2.0.1   2021-11-26 [1] CRAN (R 4.5.0)
 otel           0.2.0   2025-08-29 [1] CRAN (R 4.5.1)
 pillar         1.11.1  2025-09-17 [1] CRAN (R 4.5.1)
 pkgbuild       1.4.8   2025-05-26 [1] CRAN (R 4.5.0)
 pkgconfig      2.0.3   2019-09-22 [1] CRAN (R 4.5.0)
 pkgload        1.4.1   2025-09-23 [1] CRAN (R 4.5.1)
 plyr           1.8.9   2023-10-02 [1] CRAN (R 4.5.0)
 purrr        * 1.2.0   2025-11-04 [1] CRAN (R 4.5.1)
 R6             2.6.1   2025-02-15 [1] CRAN (R 4.5.0)
 RColorBrewer   1.1-3   2022-04-03 [1] CRAN (R 4.5.0)
 Rcpp           1.1.0   2025-07-02 [1] CRAN (R 4.5.1)
 readr        * 2.1.6   2025-11-14 [1] CRAN (R 4.5.1)
 remotes        2.5.0   2024-03-17 [1] CRAN (R 4.5.0)
 repr           1.1.7   2024-03-22 [1] CRAN (R 4.5.0)
 reshape2     * 1.4.5   2025-11-12 [1] CRAN (R 4.5.1)
 rlang          1.1.6   2025-04-11 [1] CRAN (R 4.5.0)
 rmarkdown      2.30    2025-09-28 [1] CRAN (R 4.5.1)
 rstudioapi     0.17.1  2024-10-22 [1] CRAN (R 4.5.0)
 S7             0.2.1   2025-11-14 [1] CRAN (R 4.5.1)
 sass           0.4.10  2025-04-11 [1] CRAN (R 4.5.0)
 scales       * 1.4.0   2025-04-24 [1] CRAN (R 4.5.0)
 sessioninfo    1.2.3   2025-02-05 [1] CRAN (R 4.5.0)
 skimr        * 2.2.2   2026-01-10 [1] CRAN (R 4.5.1)
 stringi        1.8.7   2025-03-27 [1] CRAN (R 4.5.0)
 stringr      * 1.6.0   2025-11-04 [1] CRAN (R 4.5.1)
 tibble       * 3.3.0   2025-06-08 [1] CRAN (R 4.5.0)
 tidyr        * 1.3.2   2025-12-19 [1] CRAN (R 4.5.1)
 tidyselect     1.2.1   2024-03-11 [1] CRAN (R 4.5.0)
 tidyverse    * 2.0.0   2023-02-22 [1] CRAN (R 4.5.0)
 timechange     0.3.0   2024-01-18 [1] CRAN (R 4.5.0)
 tzdb           0.5.0   2025-03-15 [1] CRAN (R 4.5.0)
 usethis        3.2.1   2025-09-06 [1] CRAN (R 4.5.1)
 vctrs          0.6.5   2023-12-01 [1] CRAN (R 4.5.0)
 viridisLite    0.4.2   2023-05-02 [1] CRAN (R 4.5.0)
 withr          3.0.2   2024-10-28 [1] CRAN (R 4.5.0)
 xfun           0.55    2025-12-16 [1] CRAN (R 4.5.1)
 yaml           2.3.12  2025-12-10 [1] CRAN (R 4.5.1)

 [1] /Library/Frameworks/R.framework/Versions/4.5-x86_64/Resources/library
 * ── Packages attached to the search path.

──────────────────────────────────────────────────────────────────────────────