Last updated: 2025-06-01
Checks: 6 1
Knit directory: CX5461_Project/
This reproducible R Markdown analysis was created with workflowr (version 1.7.1). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
The R Markdown is untracked by Git. To know which version of the R
Markdown file created these results, you’ll want to first commit it to
the Git repo. If you’re still working on the analysis, you can ignore
this warning. When you’re finished, you can run
wflow_publish
to commit the R Markdown file and build the
HTML.
Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.
The command set.seed(20250129)
was run prior to running
the code in the R Markdown file. Setting a seed ensures that any results
that rely on randomness, e.g. subsampling or permutations, are
reproducible.
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.
Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.
Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility.
The results in this page were generated with repository version 6c52518. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.
Note that you need to be careful to ensure that all relevant files for
the analysis have been committed to Git prior to generating the results
(you can use wflow_publish
or
wflow_git_commit
). workflowr only checks the R Markdown
file, but you know if there are other scripts or data files that it
depends on. Below is the status of the Git repository when the results
were generated:
Ignored files:
Ignored: .RData
Ignored: .Rhistory
Ignored: .Rproj.user/
Ignored: 0.1 box.svg
Ignored: Rplot04.svg
Ignored: analysis/Corrmotif_Conc.html
Untracked files:
Untracked: 0.1 density.svg
Untracked: 0.1.emf
Untracked: 0.1.svg
Untracked: 0.5 box.svg
Untracked: 0.5 density.svg
Untracked: 0.5.svg
Untracked: Additional/
Untracked: Autosome factors.svg
Untracked: CX_5461_Pattern_Genes_24hr.csv
Untracked: CX_5461_Pattern_Genes_3hr.csv
Untracked: Cell viability box plot.svg
Untracked: DEG GO terms.svg
Untracked: DNA damage associated GO terms.svg
Untracked: DRC1.svg
Untracked: Figure 1.jpeg
Untracked: Figure 1.pdf
Untracked: Figure_CM_Purity.pdf
Untracked: G Quadruplex DEGs.svg
Untracked: PC2 Vs PC3 Autosome.svg
Untracked: PCA autosome.svg
Untracked: Rplot 18.svg
Untracked: Rplot.svg
Untracked: Rplot01.svg
Untracked: Rplot02.svg
Untracked: Rplot03.svg
Untracked: Rplot05.svg
Untracked: Rplot06.svg
Untracked: Rplot07.svg
Untracked: Rplot08.jpeg
Untracked: Rplot08.svg
Untracked: Rplot09.svg
Untracked: Rplot10.svg
Untracked: Rplot11.svg
Untracked: Rplot12.svg
Untracked: Rplot13.svg
Untracked: Rplot14.svg
Untracked: Rplot15.svg
Untracked: Rplot16.svg
Untracked: Rplot17.svg
Untracked: Rplot18.svg
Untracked: Rplot19.svg
Untracked: Rplot20.svg
Untracked: Rplot21.svg
Untracked: Rplot22.svg
Untracked: Rplot23.svg
Untracked: TOP2B.bed
Untracked: TS HPA (Violin).svg
Untracked: TS HPA.svg
Untracked: TS_HA.svg
Untracked: TS_HV.svg
Untracked: Violin HA.svg
Untracked: Violin HV (CX vs DOX).svg
Untracked: Violin HV.svg
Untracked: analysis/DDR_Gquad.Rmd
Untracked: data/AF.csv
Untracked: data/AF_Mapped.csv
Untracked: data/AF_genes.csv
Untracked: data/Annotated_DOX_Gene_Table.csv
Untracked: data/BP/
Untracked: data/CAD_genes.csv
Untracked: data/Cardiotox.csv
Untracked: data/Cardiotox_mapped.csv
Untracked: data/Corrmotif_GO/
Untracked: data/DOX_Vald.csv
Untracked: data/DOX_Vald_Mapped.csv
Untracked: data/DOX_alt.csv
Untracked: data/Entrez_Cardiotox.csv
Untracked: data/Entrez_Cardiotox_Mapped.csv
Untracked: data/GWAS.xlsx
Untracked: data/GWAS_SNPs.bed
Untracked: data/HF.csv
Untracked: data/HF_Mapped.csv
Untracked: data/HF_genes.csv
Untracked: data/Hypertension_genes.csv
Untracked: data/MI_genes.csv
Untracked: data/P53_Target_mapped.csv
Untracked: data/Sample_annotated.csv
Untracked: data/Samples.csv
Untracked: data/Samples.xlsx
Untracked: data/TOP2A.bed
Untracked: data/TOP2A_target.csv
Untracked: data/TOP2A_target_lit.csv
Untracked: data/TOP2A_target_lit_mapped.csv
Untracked: data/TOP2A_target_mapped.csv
Untracked: data/TOP2B.bed
Untracked: data/TOP2B_target.csv
Untracked: data/TOP2B_target_heatmap.csv
Untracked: data/TOP2B_target_heatmap_mapped.csv
Untracked: data/TOP2B_target_mapped.csv
Untracked: data/TS.csv
Untracked: data/TS_HPA.csv
Untracked: data/TS_HPA_mapped.csv
Untracked: data/Toptable_CX_0.1_24.csv
Untracked: data/Toptable_CX_0.1_3.csv
Untracked: data/Toptable_CX_0.1_48.csv
Untracked: data/Toptable_CX_0.5_24.csv
Untracked: data/Toptable_CX_0.5_3.csv
Untracked: data/Toptable_CX_0.5_48.csv
Untracked: data/Toptable_DOX_0.1_24.csv
Untracked: data/Toptable_DOX_0.1_3.csv
Untracked: data/Toptable_DOX_0.1_48.csv
Untracked: data/Toptable_DOX_0.5_24.csv
Untracked: data/Toptable_DOX_0.5_3.csv
Untracked: data/Toptable_DOX_0.5_48.csv
Untracked: data/count.tsv
Untracked: data/ts_data_mapped
Untracked: results/
Untracked: run_bedtools.bat
Unstaged changes:
Deleted: analysis/Actox.Rmd
Modified: analysis/index.Rmd
Modified: data/DOX_0.5_48 (Combined).csv
Modified: data/Total_number_of_Mapped_reads_by_Individuals.csv
Modified: data/all_GO/prob_5_0.5.csv
Modified: data/count.csv
Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.
There are no past versions. Publish this analysis with
wflow_publish()
to start tracking its development.
### 📦 Load Required Libraries
library(tidyverse)
library(data.table)
library(ComplexHeatmap)
library(circlize)
library(grid)
### 📁 Input GO Enrichment Files (First Set)
go_files <- list(
"CX_0.1_3" = "data/BP/All_Terms/GO_BP_CX_0.1_3.csv",
"CX_0.1_24" = "data/BP/All_Terms/GO_BP_CX_0.1_24.csv",
"CX_0.1_48" = "data/BP/All_Terms/GO_BP_CX_0.1_48.csv",
"CX_0.5_3" = "data/BP/All_Terms/GO_BP_CX_0.5_3.csv",
"CX_0.5_24" = "data/BP/All_Terms/GO_BP_CX_0.5_24.csv",
"CX_0.5_48" = "data/BP/All_Terms/GO_BP_CX_0.5_48.csv",
"DOX_0.1_3" = "data/BP/All_Terms/GO_BP_DOX_0.1_3.csv",
"DOX_0.1_24"= "data/BP/All_Terms/GO_BP_DOX_0.1_24.csv",
"DOX_0.1_48"= "data/BP/All_Terms/GO_BP_DOX_0.1_48.csv",
"DOX_0.5_3" = "data/BP/All_Terms/GO_BP_DOX_0.5_3.csv",
"DOX_0.5_24"= "data/BP/All_Terms/GO_BP_DOX_0.5_24.csv",
"DOX_0.5_48"= "data/BP/All_Terms/GO_BP_DOX_0.5_48.csv"
)
### 🧬 Define GO parent terms of interest and map their children
parent_terms <- list(
"GO:0006974" = "DNA damage response",
"GO:0141112" = "broken chromosome clustering",
"GO:0006281" = "DNA repair",
"GO:0140861" = "DNA repair-dependent chromatin remodeling",
"GO:0008630" = "intrinsic apoptotic signaling pathway in response to DNA damage",
"GO:0042770" = "signal transduction in response to DNA damage",
"GO:0009432" = "SOS response",
"GO:0043247" = "telomere maintenance in response to DNA damage"
)
child_map <- list(
"GO:0006281" = c("GO:0006284", "GO:0006307", "GO:0006302", "GO:0006298", "GO:0043504",
"GO:0006289", "GO:0006301", "GO:0006290", "GO:0000725", "GO:0000012"),
"GO:0008630" = c("GO:0042771", "GO:1902230", "GO:1902231", "GO:1902229"),
"GO:0042770" = c("GO:0000077", "GO:0030330", "GO:0042772", "GO:0044773",
"GO:2000002", "GO:2000003", "GO:2000001"),
"GO:0043247" = c("GO:1904506", "GO:1904507", "GO:0031848", "GO:1904505", "GO:0097698")
)
# Store ordered list of DDR GO descriptions
ddr_descriptions <- unname(unlist(parent_terms))
### 🔁 Step 1: Retrieve p-values across all samples
go_matrix_df <- map_dfr(names(go_files), function(cond) {
file <- go_files[[cond]]
df <- tryCatch(fread(file), error = function(e) return(data.table()))
# Check if expected columns exist
if (nrow(df) == 0 || !all(c("ID", "Description", "pvalue") %in% colnames(df))) {
message("⚠️ Skipping or padding malformed file: ", cond)
return(tibble(Description = ddr_descriptions, pvalue = NA, log10p = NA, Condition = cond))
}
df <- as_tibble(df) %>% dplyr::select(ID, Description, pvalue)
results <- lapply(names(parent_terms), function(parent_id) {
all_ids <- c(parent_id, child_map[[parent_id]])
df_sub <- df %>% filter(ID %in% all_ids)
if (nrow(df_sub) == 0) {
tibble(Description = parent_terms[[parent_id]], pvalue = NA, log10p = NA, Condition = cond)
} else {
best_row <- df_sub %>% slice_min(pvalue, n = 1)
tibble(Description = parent_terms[[parent_id]],
pvalue = best_row$pvalue,
log10p = -log10(best_row$pvalue),
Condition = cond)
}
})
bind_rows(results)
})
### 🧱 Step 2: Build heatmap matrix
heatmap_data <- go_matrix_df %>%
dplyr::select(Description, Condition, log10p) %>%
pivot_wider(names_from = Condition, values_from = log10p) %>%
column_to_rownames("Description") %>%
as.matrix()
pval_matrix <- go_matrix_df %>%
dplyr::select(Description, Condition, pvalue) %>%
pivot_wider(names_from = Condition, values_from = pvalue) %>%
column_to_rownames("Description") %>%
as.matrix()
### 🔧 Ensure all conditions are included (even if fully NA)
all_conditions <- names(go_files)
missing_cols <- setdiff(all_conditions, colnames(heatmap_data))
if (length(missing_cols) > 0) {
for (cond in missing_cols) {
heatmap_data[, cond] <- NA
pval_matrix[, cond] <- NA
}
heatmap_data <- heatmap_data[, all_conditions]
pval_matrix <- pval_matrix[, all_conditions]
}
### 🎨 Step 3: Define color gradient
breaks <- seq(0, 20, by = 2.5)
palette <- colorRampPalette(c("white", "#fde0dd", "#fa9fb5", "#f768a1", "#c51b8a", "#7a0177", "#49006a"))(length(breaks))
col_fun <- colorRamp2(breaks, palette)
### 🔥 Step 4: Plot Heatmap
ht <- Heatmap(
heatmap_data,
name = "-log10(p)",
col = col_fun,
na_col = "white",
rect_gp = gpar(col = "black", lwd = 0.5),
cluster_rows = FALSE,
cluster_columns = FALSE,
row_names_gp = gpar(fontsize = 9),
column_names_gp = gpar(fontsize = 9),
column_names_rot = 45,
row_names_max_width = max_text_width(rownames(heatmap_data), gp = gpar(fontsize = 9)),
cell_fun = function(j, i, x, y, width, height, fill) {
raw_p <- pval_matrix[i, j]
if (!is.na(raw_p) && raw_p < 0.05) {
grid.text("*", x, y, gp = gpar(fontsize = 12))
}
},
heatmap_legend_param = list(
title = "-log10(p value)",
at = breaks,
labels = as.character(breaks),
legend_width = unit(5, "cm"),
direction = "horizontal",
title_gp = gpar(fontsize = 10, fontface = "bold"),
labels_gp = gpar(fontsize = 9)
)
)
### 🖼️ Final Draw
draw(ht, heatmap_legend_side = "top")
sessionInfo()
R version 4.3.0 (2023-04-21 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 11 x64 (build 26100)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.utf8
[2] LC_CTYPE=English_United States.utf8
[3] LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8
time zone: America/Chicago
tzcode source: internal
attached base packages:
[1] grid stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] circlize_0.4.16 ComplexHeatmap_2.18.0 data.table_1.17.0
[4] lubridate_1.9.4 forcats_1.0.0 stringr_1.5.1
[7] dplyr_1.1.4 purrr_1.0.4 readr_2.1.5
[10] tidyr_1.3.1 tibble_3.2.1 ggplot2_3.5.2
[13] tidyverse_2.0.0
loaded via a namespace (and not attached):
[1] shape_1.4.6.1 gtable_0.3.6 rjson_0.2.23
[4] xfun_0.52 bslib_0.9.0 GlobalOptions_0.1.2
[7] tzdb_0.5.0 Cairo_1.6-2 vctrs_0.6.5
[10] tools_4.3.0 generics_0.1.3 stats4_4.3.0
[13] parallel_4.3.0 cluster_2.1.8.1 pkgconfig_2.0.3
[16] RColorBrewer_1.1-3 S4Vectors_0.40.2 lifecycle_1.0.4
[19] compiler_4.3.0 git2r_0.36.2 munsell_0.5.1
[22] codetools_0.2-20 clue_0.3-66 httpuv_1.6.15
[25] htmltools_0.5.8.1 sass_0.4.10 yaml_2.3.10
[28] later_1.3.2 pillar_1.10.2 crayon_1.5.3
[31] jquerylib_0.1.4 cachem_1.1.0 magick_2.8.6
[34] iterators_1.0.14 foreach_1.5.2 tidyselect_1.2.1
[37] digest_0.6.34 stringi_1.8.3 rprojroot_2.0.4
[40] fastmap_1.2.0 colorspace_2.1-0 cli_3.6.1
[43] magrittr_2.0.3 withr_3.0.2 scales_1.3.0
[46] promises_1.3.2 timechange_0.3.0 rmarkdown_2.29
[49] matrixStats_1.5.0 workflowr_1.7.1 png_0.1-8
[52] GetoptLong_1.0.5 hms_1.1.3 evaluate_1.0.3
[55] knitr_1.50 IRanges_2.36.0 doParallel_1.0.17
[58] rlang_1.1.3 Rcpp_1.0.12 glue_1.7.0
[61] BiocGenerics_0.48.1 rstudioapi_0.17.1 jsonlite_2.0.0
[64] R6_2.6.1 fs_1.6.3