RNAG10
RNAseq Survival Forest Graph
This page can be used as a template of how to produce survival forest graphs for RNA-seq gene expression analysis using available tern
and hermes
functions, and to create an interactive survival forest graph for RNA-seq gene expression analysis using teal.modules.hermes
.
The code below needs both RNA-seq data (in HermesData
format) and time-to-event data (in ADTTE
format) as input.
We first prepare the time-to-event data. We define an event indicator variable, transform the time to months and filter down to the overall survival subset.
Then we prepare the RNA-seq data and join with ADTTE
, see RNAG9 for details.
We can then cut the resulting gene column in the joined adtte_data
into quantile bins. In this example we want two equally sized groups so set probs
to 0.5, and we then label the bins as Low
and High
. We could choose a different quantile cutoff. The only important restriction here is that we need to bin the genes into exactly two groups, otherwise the forest plot below cannot compare these two groups with each other.
It is now simple to create the survival forest graph by providing the data set created above with the variable specification. First we calculate the survival estimates with extract_survival_subgroups()
by providing the necessary variable specification. Here we specify our derived gene_bin
for the arm. Then we build the table portion with tabulate_survival_subgroups()
and pass our calculations from the previous step. Lastly, we generate the final graph with g_forest
.
Code
Warning in coxph.fit(X, Y, istrat, offset, init, control, weights = weights, :
Loglik converged before variable 1 ; coefficient may be infinite.
Code
See SFG01 to SFG05 for additional customization options for the survival forest graphs or the help page ?g_forest()
.
We start by importing a MultiAssayExperiment
and sample ADTTE
data; here we use the example multi_assay_experiment
available in hermes
and example ADTTE
data from random.cdisc.data
. We can then use the provided teal module tm_g_forest_tte
to include the corresponding interactive survival forest analysis in our teal app. In case that we have different non-standard column names in our ADTTE data set we could also specify them via the adtte_vars
argument, see the documentation ?tm_g_forest_tte
for more details.
Code
library(teal.modules.hermes)
data <- teal_data()
data <- within(data, {
library(random.cdisc.data)
library(dplyr)
library(hermes)
MAE <- multi_assay_experiment
ADTTE <- random.cdisc.data::cadtte %>%
mutate(is_event = .data$CNSR == 0)
})
datanames(data) <- c("MAE", "ADTTE")
join_keys(data)["ADTTE", "ADTTE"] <- c("STUDYID", "USUBJID", "PARAMCD")
app <- init(
data = data,
modules = modules(
tm_g_forest_tte(
label = "forest",
adtte_name = "ADTTE",
mae_name = "MAE"
)
)
)
[INFO] 2024-09-14 17:31:45.8850 pid:5048 token:[] teal.modules.hermes Initializing tm_g_forest_tte
[INFO] 2024-09-14 17:31:47.3630 pid:5048 token:[a04ffd8c] teal Initializing reporter_previewer_module
Warning: 'experiments' dropped; see 'drops()'
R version 4.4.1 (2024-06-14)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 22.04.4 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.20.so; LAPACK version 3.10.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] dplyr_1.1.4 random.cdisc.data_0.3.15
[3] teal.modules.hermes_0.1.6 teal_0.15.2
[5] teal.slice_0.5.1 teal.data_0.6.0
[7] teal.code_0.5.0 shiny_1.9.1
[9] hermes_1.8.1 SummarizedExperiment_1.34.0
[11] Biobase_2.64.0 GenomicRanges_1.56.1
[13] GenomeInfoDb_1.40.1 IRanges_2.38.1
[15] S4Vectors_0.42.1 BiocGenerics_0.50.0
[17] MatrixGenerics_1.16.0 matrixStats_1.4.1
[19] ggfortify_0.4.17 ggplot2_3.5.1
[21] tern_0.9.5 rtables_0.6.9
[23] magrittr_2.0.3 formatters_0.5.9
loaded via a namespace (and not attached):
[1] RColorBrewer_1.1-3 jsonlite_1.8.8
[3] shape_1.4.6.1 MultiAssayExperiment_1.30.3
[5] farver_2.1.2 rmarkdown_2.28
[7] GlobalOptions_0.1.2 zlibbioc_1.50.0
[9] vctrs_0.6.5 memoise_2.0.1
[11] webshot_0.5.5 BiocBaseUtils_1.7.3
[13] htmltools_0.5.8.1 S4Arrays_1.4.1
[15] forcats_1.0.0 progress_1.2.3
[17] curl_5.2.2 broom_1.0.6
[19] SparseArray_1.4.8 sass_0.4.9
[21] bslib_0.8.0 fontawesome_0.5.2
[23] htmlwidgets_1.6.4 httr2_1.0.4
[25] cachem_1.1.0 teal.widgets_0.4.2
[27] mime_0.12 lifecycle_1.0.4
[29] iterators_1.0.14 pkgconfig_2.0.3
[31] webshot2_0.1.1 Matrix_1.7-0
[33] R6_2.5.1 fastmap_1.2.0
[35] GenomeInfoDbData_1.2.12 rbibutils_2.2.16
[37] clue_0.3-65 digest_0.6.37
[39] colorspace_2.1-1 shinycssloaders_1.1.0
[41] ps_1.8.0 AnnotationDbi_1.66.0
[43] RSQLite_2.3.7 filelock_1.0.3
[45] labeling_0.4.3 fansi_1.0.6
[47] httr_1.4.7 abind_1.4-8
[49] compiler_4.4.1 bit64_4.0.5
[51] withr_3.0.1 doParallel_1.0.17
[53] backports_1.5.0 DBI_1.2.3
[55] logger_0.3.0 biomaRt_2.60.1
[57] rappdirs_0.3.3 DelayedArray_0.30.1
[59] rjson_0.2.22 chromote_0.3.1
[61] tools_4.4.1 httpuv_1.6.15
[63] glue_1.7.0 callr_3.7.6
[65] promises_1.3.0 grid_4.4.1
[67] checkmate_2.3.2 cluster_2.1.6
[69] generics_0.1.3 gtable_0.3.5
[71] websocket_1.4.2 tidyr_1.3.1
[73] hms_1.1.3 xml2_1.3.6
[75] utf8_1.2.4 XVector_0.44.0
[77] ggrepel_0.9.6 foreach_1.5.2
[79] pillar_1.9.0 stringr_1.5.1
[81] later_1.3.2 circlize_0.4.16
[83] splines_4.4.1 BiocFileCache_2.12.0
[85] lattice_0.22-6 survival_3.7-0
[87] bit_4.0.5 tidyselect_1.2.1
[89] ComplexHeatmap_2.20.0 Biostrings_2.72.1
[91] knitr_1.48 gridExtra_2.3
[93] teal.logger_0.2.0 xfun_0.47
[95] stringi_1.8.4 UCSC.utils_1.0.0
[97] yaml_2.3.10 shinyWidgets_0.8.6
[99] evaluate_0.24.0 codetools_0.2-20
[101] tibble_3.2.1 cli_3.6.3
[103] xtable_1.8-4 Rdpack_2.6.1
[105] processx_3.8.4 jquerylib_0.1.4
[107] munsell_0.5.1 teal.reporter_0.3.1
[109] Rcpp_1.0.13 dbplyr_2.5.0
[111] png_0.1-8 parallel_4.4.1
[113] assertthat_0.2.1 blob_1.2.4
[115] prettyunits_1.2.0 scales_1.3.0
[117] purrr_1.0.2 crayon_1.5.3
[119] GetoptLong_1.0.5 rlang_1.1.4
[121] formatR_1.14 cowplot_1.1.3
[123] KEGGREST_1.44.1 shinyjs_2.1.0