Last updated: 2025-02-07

Checks: 7 0

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.


Great! Since the R Markdown file has been committed to the Git repository, you know the exact version of the code that produced these results.

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 8c48250. 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/

Untracked files:
    Untracked:  data/LOG2FC.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.


These are the previous versions of the repository in which changes were made to the R Markdown (analysis/LogFC_Correlation.Rmd) and HTML (docs/LogFC_Correlation.html) files. If you’ve configured a remote Git repository (see ?wflow_git_remote), click on the hyperlinks in the table below to view the files as they were in that past version.

File Version Author Date Message
html 2523ee0 sayanpaul01 2025-02-07 Build site.
Rmd 7f4d39b sayanpaul01 2025-02-07 Fixed file path issue
html 7f3dfe5 sayanpaul01 2025-02-07 Build site.
Rmd 450696e sayanpaul01 2025-02-07 Fixed file path issue
Rmd 17a94f8 sayanpaul01 2025-02-07 Saved Toptables in RDS file for LogFC correlation
Rmd 7698b5e sayanpaul01 2025-02-06 Build site.

πŸ“Œ LogFC Correlation Analysis

This analysis generates correlation heatmaps of log fold change (logFC) values across different comparisons.

πŸ“Œ Load Required Libraries

library(ComplexHeatmap)
Warning: package 'ComplexHeatmap' was built under R version 4.3.1
library(tidyverse)
Warning: package 'tidyverse' was built under R version 4.3.2
Warning: package 'ggplot2' was built under R version 4.3.3
Warning: package 'tidyr' was built under R version 4.3.3
Warning: package 'readr' was built under R version 4.3.3
Warning: package 'purrr' was built under R version 4.3.1
Warning: package 'dplyr' was built under R version 4.3.2
Warning: package 'stringr' was built under R version 4.3.2
Warning: package 'lubridate' was built under R version 4.3.1
library(data.table)
Warning: package 'data.table' was built under R version 4.3.2

πŸ“Œ Load LogFC Data

# Load logFC data from CSV
logFC_corr <- read.csv("data/LOG2FC.csv")

# Convert to dataframe
logFC_corr_df <- data.frame(logFC_corr)

# Remove 'X' prefix from the first column
names(logFC_corr_df)[1] <- sub("^X", "", names(logFC_corr_df)[1])

# Convert to matrix format for correlation analysis
log2corr <- as.matrix(logFC_corr_df[, -1])

# Display first few rows
print(head(log2corr))
     CX.5461_0.1_3 CX.5461_0.1_24 CX.5461_0.1_48 CX.5461_0.5_3 CX.5461_0.5_24
[1,]   0.004014353     0.01797208      0.1843569    0.02720364     0.01672747
[2,]   0.175440414     0.09122136      0.2212550   -0.18005874    -0.11889672
[3,]   0.078881609     0.07834693      0.2786495   -0.08765174     0.10414165
[4,]   0.178167060     0.16311897      0.1577607   -0.17199420    -0.14578900
[5,]   0.303563222     0.10207047      0.3053246   -0.06573953     0.49701105
[6,]   0.152614389     0.04773016      0.1732226   -0.26468304    -0.09250807
     CX.5461_0.5_48   DOX_0.1_3 DOX_0.1_24 DOX_0.1_48    DOX_0.5_3 DOX_0.5_24
[1,]     0.05809672  0.08247267  0.2200048  0.2815441  0.115454181  0.1581417
[2,]    -0.03169605 -0.13564062 -0.1407592 -0.2064884 -0.195284631 -0.9096266
[3,]    -0.11362867  0.09288180  0.2546936  0.3313280  0.006547797  0.2891939
[4,]    -0.21285541 -0.13223667 -0.2684351 -0.2338832 -0.192421781 -0.5155552
[5,]    -0.37877928 -0.09045264  0.1014059  0.4197312  0.177886764  0.4371439
[6,]    -0.08389116 -0.09231344 -0.2104519 -0.1243965 -0.375429448 -0.5502692
     DOX_0.5_48
[1,]  0.4372001
[2,] -1.3556420
[3,]  0.3328763
[4,] -0.9117574
[5,]  0.1966726
[6,] -0.7475815

πŸ“Œ Load Metadata

# Load metadata
meta <- read.csv("data/Meta.csv")

# Assign column names based on sample metadata
colnames(log2corr) <- meta$Sample
Drug <- meta$Drug
time <- meta$Time
conc <- as.character(meta$Conc.)

πŸ“Œ Define Color Annotations for Heatmap

time_colors <- c("3" = "purple", "24" = "pink", "48" = "tomato3")
drug_colors <- c("CX-5461" = "yellow", "DOX" = "magenta4")
conc_colors <- c("0.1" = "lightblue", "0.5" = "lightcoral")

# Create annotations
top_annotation1 <- HeatmapAnnotation(
  timepoints = time,
  drugs = Drug,
  concentrations = conc,
  col = list(
    timepoints = time_colors,
    drugs = drug_colors,
    concentrations = conc_colors
  )
)

πŸ“Œ Compute Pearson and Spearman Correlation Matrices

cor_matrix1 <- cor(log2corr, method = "pearson")
cor_matrix2 <- cor(log2corr, method = "spearman")

πŸ“Œ Generate Heatmap (Pearson Correlation)

heatmap1 <- Heatmap(
  cor_matrix1,
  name = "Correlation",
  top_annotation = top_annotation1,
  rect_gp = gpar(col = "black", lwd = 1),
  show_row_names = TRUE,
  show_column_names = TRUE,
  cell_fun = function(j, i, x, y, width, height, fill) {
    grid.text(sprintf("%.3f", cor_matrix1[i, j]), x, y, gp = gpar(fontsize = 10, col = "black"))
  }
)

# Draw the heatmap
draw(heatmap1)

Version Author Date
7f3dfe5 sayanpaul01 2025-02-07

πŸ“Œ Generate Heatmap (Spearman Correlation)

heatmap2 <- Heatmap(
  cor_matrix2,
  name = "Correlation",
  top_annotation = top_annotation1,
  rect_gp = gpar(col = "black", lwd = 1),
  show_row_names = TRUE,
  show_column_names = TRUE,
  cell_fun = function(j, i, x, y, width, height, fill) {
    grid.text(sprintf("%.3f", cor_matrix2[i, j]), x, y, gp = gpar(fontsize = 10, col = "black"))
  }
)

# Draw the heatmap
draw(heatmap2)

Version Author Date
7f3dfe5 sayanpaul01 2025-02-07

sessionInfo()
R version 4.3.0 (2023-04-21 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 11 x64 (build 22631)

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] data.table_1.14.10    lubridate_1.9.3       forcats_1.0.0        
 [4] stringr_1.5.1         dplyr_1.1.4           purrr_1.0.2          
 [7] readr_2.1.5           tidyr_1.3.1           tibble_3.2.1         
[10] ggplot2_3.5.1         tidyverse_2.0.0       ComplexHeatmap_2.18.0
[13] workflowr_1.7.1      

loaded via a namespace (and not attached):
 [1] gtable_0.3.6        circlize_0.4.16     shape_1.4.6.1      
 [4] rjson_0.2.23        xfun_0.50           bslib_0.8.0        
 [7] GlobalOptions_0.1.2 processx_3.8.5      tzdb_0.4.0         
[10] callr_3.7.6         Cairo_1.6-2         vctrs_0.6.5        
[13] tools_4.3.0         ps_1.8.1            generics_0.1.3     
[16] stats4_4.3.0        parallel_4.3.0      cluster_2.1.6      
[19] pkgconfig_2.0.3     RColorBrewer_1.1-3  S4Vectors_0.40.1   
[22] lifecycle_1.0.4     compiler_4.3.0      git2r_0.35.0       
[25] munsell_0.5.1       getPass_0.2-4       codetools_0.2-20   
[28] clue_0.3-66         httpuv_1.6.15       htmltools_0.5.8.1  
[31] sass_0.4.9          yaml_2.3.10         later_1.3.2        
[34] pillar_1.10.1       crayon_1.5.3        jquerylib_0.1.4    
[37] whisker_0.4.1       cachem_1.0.8        magick_2.8.5       
[40] iterators_1.0.14    foreach_1.5.2       tidyselect_1.2.1   
[43] digest_0.6.34       stringi_1.8.3       rprojroot_2.0.4    
[46] fastmap_1.1.1       colorspace_2.1-0    cli_3.6.1          
[49] magrittr_2.0.3      withr_3.0.2         scales_1.3.0       
[52] promises_1.3.0      timechange_0.3.0    rmarkdown_2.29     
[55] httr_1.4.7          matrixStats_1.4.1   hms_1.1.3          
[58] png_0.1-8           GetoptLong_1.0.5    evaluate_1.0.3     
[61] knitr_1.49          IRanges_2.36.0      doParallel_1.0.17  
[64] rlang_1.1.3         Rcpp_1.0.12         glue_1.7.0         
[67] BiocGenerics_0.48.1 rstudioapi_0.17.1   jsonlite_1.8.9     
[70] R6_2.5.1            fs_1.6.3