Last updated: 2025-05-01

Checks: 7 0

Knit directory: ATAC_learning/

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(20231016) 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 a949969. 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:    data/ACresp_SNP_table.csv
    Ignored:    data/ARR_SNP_table.csv
    Ignored:    data/All_merged_peaks.tsv
    Ignored:    data/CAD_gwas_dataframe.RDS
    Ignored:    data/CTX_SNP_table.csv
    Ignored:    data/Collapsed_expressed_NG_peak_table.csv
    Ignored:    data/DEG_toplist_sep_n45.RDS
    Ignored:    data/FRiP_first_run.txt
    Ignored:    data/Final_four_data/
    Ignored:    data/Frip_1_reads.csv
    Ignored:    data/Frip_2_reads.csv
    Ignored:    data/Frip_3_reads.csv
    Ignored:    data/Frip_4_reads.csv
    Ignored:    data/Frip_5_reads.csv
    Ignored:    data/Frip_6_reads.csv
    Ignored:    data/GO_KEGG_analysis/
    Ignored:    data/HF_SNP_table.csv
    Ignored:    data/Ind1_75DA24h_dedup_peaks.csv
    Ignored:    data/Ind1_TSS_peaks.RDS
    Ignored:    data/Ind1_firstfragment_files.txt
    Ignored:    data/Ind1_fragment_files.txt
    Ignored:    data/Ind1_peaks_list.RDS
    Ignored:    data/Ind1_summary.txt
    Ignored:    data/Ind2_TSS_peaks.RDS
    Ignored:    data/Ind2_fragment_files.txt
    Ignored:    data/Ind2_peaks_list.RDS
    Ignored:    data/Ind2_summary.txt
    Ignored:    data/Ind3_TSS_peaks.RDS
    Ignored:    data/Ind3_fragment_files.txt
    Ignored:    data/Ind3_peaks_list.RDS
    Ignored:    data/Ind3_summary.txt
    Ignored:    data/Ind4_79B24h_dedup_peaks.csv
    Ignored:    data/Ind4_TSS_peaks.RDS
    Ignored:    data/Ind4_V24h_fraglength.txt
    Ignored:    data/Ind4_fragment_files.txt
    Ignored:    data/Ind4_fragment_filesN.txt
    Ignored:    data/Ind4_peaks_list.RDS
    Ignored:    data/Ind4_summary.txt
    Ignored:    data/Ind5_TSS_peaks.RDS
    Ignored:    data/Ind5_fragment_files.txt
    Ignored:    data/Ind5_fragment_filesN.txt
    Ignored:    data/Ind5_peaks_list.RDS
    Ignored:    data/Ind5_summary.txt
    Ignored:    data/Ind6_TSS_peaks.RDS
    Ignored:    data/Ind6_fragment_files.txt
    Ignored:    data/Ind6_peaks_list.RDS
    Ignored:    data/Ind6_summary.txt
    Ignored:    data/Knowles_4.RDS
    Ignored:    data/Knowles_5.RDS
    Ignored:    data/Knowles_6.RDS
    Ignored:    data/LiSiLTDNRe_TE_df.RDS
    Ignored:    data/MI_gwas.RDS
    Ignored:    data/SNP_GWAS_PEAK_MRC_id
    Ignored:    data/SNP_GWAS_PEAK_MRC_id.csv
    Ignored:    data/SNP_gene_cat_list.tsv
    Ignored:    data/SNP_supp_schneider.RDS
    Ignored:    data/TE_info/
    Ignored:    data/TFmapnames.RDS
    Ignored:    data/all_TSSE_scores.RDS
    Ignored:    data/all_four_filtered_counts.txt
    Ignored:    data/aln_run1_results.txt
    Ignored:    data/anno_ind1_DA24h.RDS
    Ignored:    data/anno_ind4_V24h.RDS
    Ignored:    data/annotated_gwas_SNPS.csv
    Ignored:    data/background_n45_he_peaks.RDS
    Ignored:    data/cardiac_muscle_FRIP.csv
    Ignored:    data/cardiomyocyte_FRIP.csv
    Ignored:    data/col_ng_peak.csv
    Ignored:    data/cormotif_full_4_run.RDS
    Ignored:    data/cormotif_full_4_run_he.RDS
    Ignored:    data/cormotif_full_6_run.RDS
    Ignored:    data/cormotif_full_6_run_he.RDS
    Ignored:    data/cormotif_probability_45_list.csv
    Ignored:    data/cormotif_probability_45_list_he.csv
    Ignored:    data/cormotif_probability_all_6_list.csv
    Ignored:    data/cormotif_probability_all_6_list_he.csv
    Ignored:    data/datasave.RDS
    Ignored:    data/embryo_heart_FRIP.csv
    Ignored:    data/enhancer_list_ENCFF126UHK.bed
    Ignored:    data/enhancerdata/
    Ignored:    data/filt_Peaks_efit2.RDS
    Ignored:    data/filt_Peaks_efit2_bl.RDS
    Ignored:    data/filt_Peaks_efit2_n45.RDS
    Ignored:    data/first_Peaksummarycounts.csv
    Ignored:    data/first_run_frag_counts.txt
    Ignored:    data/full_bedfiles/
    Ignored:    data/gene_ref.csv
    Ignored:    data/gwas_1_dataframe.RDS
    Ignored:    data/gwas_2_dataframe.RDS
    Ignored:    data/gwas_3_dataframe.RDS
    Ignored:    data/gwas_4_dataframe.RDS
    Ignored:    data/gwas_5_dataframe.RDS
    Ignored:    data/high_conf_peak_counts.csv
    Ignored:    data/high_conf_peak_counts.txt
    Ignored:    data/high_conf_peaks_bl_counts.txt
    Ignored:    data/high_conf_peaks_counts.txt
    Ignored:    data/hits_files/
    Ignored:    data/hyper_files/
    Ignored:    data/hypo_files/
    Ignored:    data/ind1_DA24hpeaks.RDS
    Ignored:    data/ind1_TSSE.RDS
    Ignored:    data/ind2_TSSE.RDS
    Ignored:    data/ind3_TSSE.RDS
    Ignored:    data/ind4_TSSE.RDS
    Ignored:    data/ind4_V24hpeaks.RDS
    Ignored:    data/ind5_TSSE.RDS
    Ignored:    data/ind6_TSSE.RDS
    Ignored:    data/initial_complete_stats_run1.txt
    Ignored:    data/left_ventricle_FRIP.csv
    Ignored:    data/median_24_lfc.RDS
    Ignored:    data/median_3_lfc.RDS
    Ignored:    data/mergedPeads.gff
    Ignored:    data/mergedPeaks.gff
    Ignored:    data/motif_list_full
    Ignored:    data/motif_list_n45
    Ignored:    data/motif_list_n45.RDS
    Ignored:    data/multiqc_fastqc_run1.txt
    Ignored:    data/multiqc_fastqc_run2.txt
    Ignored:    data/multiqc_genestat_run1.txt
    Ignored:    data/multiqc_genestat_run2.txt
    Ignored:    data/my_hc_filt_counts.RDS
    Ignored:    data/my_hc_filt_counts_n45.RDS
    Ignored:    data/n45_bedfiles/
    Ignored:    data/n45_files
    Ignored:    data/other_papers/
    Ignored:    data/peakAnnoList_1.RDS
    Ignored:    data/peakAnnoList_2.RDS
    Ignored:    data/peakAnnoList_24_full.RDS
    Ignored:    data/peakAnnoList_24_n45.RDS
    Ignored:    data/peakAnnoList_3.RDS
    Ignored:    data/peakAnnoList_3_full.RDS
    Ignored:    data/peakAnnoList_3_n45.RDS
    Ignored:    data/peakAnnoList_4.RDS
    Ignored:    data/peakAnnoList_5.RDS
    Ignored:    data/peakAnnoList_6.RDS
    Ignored:    data/peakAnnoList_Eight.RDS
    Ignored:    data/peakAnnoList_full_motif.RDS
    Ignored:    data/peakAnnoList_n45_motif.RDS
    Ignored:    data/siglist_full.RDS
    Ignored:    data/siglist_n45.RDS
    Ignored:    data/summarized_peaks_dataframe.txt
    Ignored:    data/summary_peakIDandReHeat.csv
    Ignored:    data/test.list.RDS
    Ignored:    data/testnames.txt
    Ignored:    data/toplist_6.RDS
    Ignored:    data/toplist_full.RDS
    Ignored:    data/toplist_full_DAR_6.RDS
    Ignored:    data/toplist_n45.RDS
    Ignored:    data/trimmed_seq_length.csv
    Ignored:    data/unclassified_full_set_peaks.RDS
    Ignored:    data/unclassified_n45_set_peaks.RDS
    Ignored:    data/xstreme/

Untracked files:
    Untracked:  analysis/Expressed_RNA_associations.Rmd
    Untracked:  analysis/LFC_corr.Rmd
    Untracked:  analysis/SVA.Rmd
    Untracked:  analysis/Tan2020.Rmd
    Untracked:  analysis/my_hc_filt_counts.csv
    Untracked:  code/IGV_snapshot_code.R
    Untracked:  code/LongDARlist.R
    Untracked:  code/just_for_Fun.R
    Untracked:  output/cormotif_probability_45_list.csv
    Untracked:  output/cormotif_probability_all_6_list.csv
    Untracked:  setup.RData

Unstaged changes:
    Modified:   ATAC_learning.Rproj
    Modified:   analysis/Correlation_of_SNPnPEAK.Rmd
    Modified:   analysis/GO_KEGG_analysis.Rmd
    Modified:   analysis/Odds_ratios_ff.Rmd
    Modified:   analysis/TE_analysis_ff.Rmd
    Modified:   analysis/final_plot_attempt.Rmd

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/Raodah_mycount.Rmd) and HTML (docs/Raodah_mycount.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
Rmd a949969 reneeisnowhere 2025-05-01 update to webpage
html 6a0a917 E. Renee Matthews 2025-02-17 Build site.
Rmd 8f6c9c5 E. Renee Matthews 2025-02-17 adding log2cpm data
html b037f13 E. Renee Matthews 2025-02-14 Build site.
Rmd 4142d3d E. Renee Matthews 2025-02-14 extraQC
html 800da7a E. Renee Matthews 2025-02-12 Build site.
Rmd 099791c E. Renee Matthews 2025-02-12 adding in QC for H3K27ac data
html fb1211f E. Renee Matthews 2025-01-16 Build site.
html aa0769e E. Renee Matthews 2025-01-02 Build site.
Rmd 68ded3e E. Renee Matthews 2025-01-02 new data
html 3879098 reneeisnowhere 2024-12-16 Build site.
Rmd 0c1b6ae reneeisnowhere 2024-12-16 update volcano limits
html 9ea0c60 reneeisnowhere 2024-12-16 Build site.
html cfe4ce9 reneeisnowhere 2024-10-23 Build site.
Rmd a9d87d2 reneeisnowhere 2024-10-23 wflow_publish("analysis/Raodah_mycount.Rmd")
html 4881ad6 reneeisnowhere 2024-10-07 Build site.
Rmd 628986a reneeisnowhere 2024-10-07 pdf output
html 50f603e reneeisnowhere 2024-09-23 Build site.
Rmd a55255a reneeisnowhere 2024-09-23 adding in Raodah evaluation
Rmd 82f2027 reneeisnowhere 2024-09-16 updates to plots

library(tidyverse)
library(kableExtra)
library(broom)
library(RColorBrewer)
library(ChIPseeker)
library("TxDb.Hsapiens.UCSC.hg38.knownGene")
# library("org.Hs.eg.db")
library(rtracklayer)
library(edgeR)
# library(ggfortify)
library(limma)
library(readr)
library(BiocGenerics)
library(gridExtra)
library(VennDiagram)
library(scales)
library(Cormotif)
library(BiocParallel)
library(ggpubr)
library(devtools)
library(eulerr)
library(genomation)
library(ggsignif)
library(plyranges)
library(ggrepel)
library(ComplexHeatmap)
library(smplot2)
library(stringr)
library(cowplot)
drug_pal <- c("#8B006D","#DF707E","#F1B72B", "#3386DD","#41B333")
pca_plot <-
  function(df,
           col_var = NULL,
           shape_var = NULL,
           title = "") {
    ggplot(df) + geom_point(aes_string(
      x = "PC1",
      y = "PC2",
      color = col_var,
      shape = shape_var
    ),
    size = 5) +
      labs(title = title, x = "PC 1", y = "PC 2") +
      scale_color_manual(values = c(
        "#8B006D",
        "#DF707E",
        "#F1B72B",
        "#3386DD",
        
        "#41B333"
      ))
  }
pca_var_plot <- function(pca) {
  # x: class == prcomp
  pca.var <- pca$sdev ^ 2
  pca.prop <- pca.var / sum(pca.var)
  var.plot <-
    qplot(PC, prop, data = data.frame(PC = 1:length(pca.prop),
                                      prop = pca.prop)) +
    labs(title = 'Variance contributed by each PC',
         x = 'PC', y = 'Proportion of variance')
  plot(var.plot)
}

calc_pca <- function(x) {
  # Performs principal components analysis with prcomp
  # x: a sample-by-gene numeric matrix
  prcomp(x, scale. = TRUE, retx = TRUE)
}

get_regr_pval <- function(mod) {
  # Returns the p-value for the Fstatistic of a linear model
  # mod: class lm
  stopifnot(class(mod) == "lm")
  fstat <- summary(mod)$fstatistic
  pval <- 1 - pf(fstat[1], fstat[2], fstat[3])
  return(pval)
}

plot_versus_pc <- function(df, pc_num, fac) {
  # df: data.frame
  # pc_num: numeric, specific PC for plotting
  # fac: column name of df for plotting against PC
  pc_char <- paste0("PC", pc_num)
  # Calculate F-statistic p-value for linear model
  pval <- get_regr_pval(lm(df[, pc_char] ~ df[, fac]))
  if (is.numeric(df[, f])) {
    ggplot(df, aes_string(x = f, y = pc_char)) + geom_point() +
      geom_smooth(method = "lm") + labs(title = sprintf("p-val: %.2f", pval))
  } else {
    ggplot(df, aes_string(x = f, y = pc_char)) + geom_boxplot() +
      labs(title = sprintf("p-val: %.2f", pval))
  }
}
# saveRDS(cardiotox_highConf_3location, "data/Final_four_data/Raodah_location_counts.RDS")
# saveRDS(Raodah_counts,"data/Final_four_data/Raodah_counts_fixed.RDS" )
H3K27ac_countstable<- readRDS("data/Final_four_data/Raodah_counts.RDS")
cardiotox_highConf_3location <-  readRDS("data/Final_four_data/Raodah_location_counts.RDS")
# saveRDS(roadah_counts,  "data/Final_four_data/New_raodah_counts.RDS")
raodah_counts <- readRDS("data/Final_four_data/New_raodah_counts.RDS")
 
names(raodah_counts ) = gsub(pattern = "_final.bam*", replacement = "", x = names(raodah_counts ))
names(raodah_counts ) = gsub(pattern = "^Raodah_data/77-1/bamFiles/*", replacement = "", x = names(raodah_counts ))
names(raodah_counts ) = gsub(pattern = "^Raodah_data/87-1/bamFiles/*", replacement = "", x = names(raodah_counts ))
names(raodah_counts ) = gsub(pattern = "^Raodah_data/71-1/bamFiles/*", replacement = "", x = names(raodah_counts ))


names(raodah_counts ) = gsub(pattern = "*87_1_*", replacement = "A_", x = names(raodah_counts ))
 names(raodah_counts ) = gsub(pattern = "77_1_*", replacement = "B_", x = names(raodah_counts ))
 # names(roadah_counts) = gsub(pattern = "*79-1 *", replacement = "4_", x = names(roadah_counts))
 # names(roadah_counts) = gsub(pattern = "*78-1 *", replacement = "5_", x = names(roadah_counts))
 names(raodah_counts ) = gsub(pattern = "*71_1_*", replacement = "C_", x = names(raodah_counts ))
 names(raodah_counts ) = gsub(pattern = "3$", replacement = "_3", x = names(raodah_counts ))
 names(raodah_counts ) = gsub(pattern = "24$", replacement = "_24", x = names(raodah_counts ))
raodah_counts_list <- raodah_counts[1:6]
raodah_counts_file <- raodah_counts[,c(1,7:31)]
# saveRDS(raodah_counts_list, "data/Final_four_data/All_Raodahpeaks.RDS")

# rtracklayer::export.bed(raodah_counts_list,con="data/Final_four_data/Raodah_ac_peaks.bed",format="bed")
PCA_H3_mat <- raodah_counts_file%>% column_to_rownames("Geneid") %>% 
  as.matrix()

annotation_H3_mat <-  data.frame(timeset=colnames(PCA_H3_mat)) %>% 
  mutate(sample = timeset) %>% 
  separate(timeset, into = c("indv","trt","time"), sep= "_") %>% 
  mutate(time = factor(time, levels = c("3", "24"), labels= c("3 hours","24 hours"))) %>% 
  mutate(trt = factor(trt, levels = c("DOX","EPI", "DNR", "MTX", "VEH"))) 

PCA_H3_info <- (prcomp(t(PCA_H3_mat), scale. = TRUE)) 
PCA_H3_info_anno <- PCA_H3_info$x %>% cbind(.,annotation_H3_mat)
# autoplot(PCA_info)
summary(PCA_H3_info)
Importance of components:
                            PC1      PC2      PC3      PC4      PC5      PC6
Standard deviation     118.6544 38.53744 32.93705 23.03431 19.97846 17.65678
Proportion of Variance   0.6992  0.07375  0.05387  0.02635  0.01982  0.01548
Cumulative Proportion    0.6992  0.77291  0.82678  0.85313  0.87295  0.88843
                            PC7      PC8      PC9     PC10     PC11     PC12
Standard deviation     16.24997 15.43698 15.28003 13.60632 12.62621 12.05130
Proportion of Variance  0.01311  0.01183  0.01159  0.00919  0.00792  0.00721
Cumulative Proportion   0.90154  0.91338  0.92497  0.93417  0.94208  0.94929
                           PC13     PC14     PC15     PC16     PC17    PC18
Standard deviation     11.83553 11.20249 10.86818 10.31780 10.14317 9.56714
Proportion of Variance  0.00696  0.00623  0.00587  0.00529  0.00511 0.00455
Cumulative Proportion   0.95625  0.96248  0.96835  0.97364  0.97874 0.98329
                          PC19    PC20    PC21    PC22    PC23    PC24
Standard deviation     8.94188 7.84366 7.63001 7.26326 6.59195 6.37024
Proportion of Variance 0.00397 0.00306 0.00289 0.00262 0.00216 0.00202
Cumulative Proportion  0.98726 0.99032 0.99321 0.99583 0.99798 1.00000
                            PC25
Standard deviation     5.364e-14
Proportion of Variance 0.000e+00
Cumulative Proportion  1.000e+00
pca_plot(PCA_H3_info_anno, col_var='trt', shape_var = 'time')+ggtitle("PCA of raw counts by time and treatment")

Version Author Date
fb1211f E. Renee Matthews 2025-01-16
4881ad6 reneeisnowhere 2024-10-07
50f603e reneeisnowhere 2024-09-23
# PCA_H3_mat_t <- H3K27ac_countstable %>% 
#   dplyr::select('2_DNR_3':'3_VEH_24','6_DNR_3':'6_VEH_24')

anno_H3_mat <-  data.frame(timeset=colnames(PCA_H3_mat)) %>%
  mutate(sample = timeset) %>% 
  separate(timeset, into = c("indv","trt","time"), sep= "_") %>% 
  mutate(time = factor(time, levels = c("3", "24"), labels= c("3 hours","24 hours"))) %>% 
  mutate(trt = factor(trt, levels = c("DOX","EPI", "DNR", "MTX","VEH")))
  
lcpm_h3 <- cpm(PCA_H3_mat, log=TRUE)  ### for determining the basic cutoffs
dim(lcpm_h3)
[1] 20137    25
row_means <- rowMeans(lcpm_h3)
lcpm_h3_filtered <- PCA_H3_mat[row_means >0,]
dim(lcpm_h3_filtered)
[1] 20137    25
filt_H3_matrix_lcpm <- cpm(lcpm_h3_filtered, log=TRUE)

PCA_H3_info_filter <- (prcomp(t(filt_H3_matrix_lcpm), scale. = TRUE))
summary(PCA_H3_info_filter)
Importance of components:
                           PC1     PC2     PC3      PC4      PC5     PC6
Standard deviation     56.8156 48.4324 45.6952 36.87354 34.89198 33.2180
Proportion of Variance  0.1603  0.1165  0.1037  0.06752  0.06046  0.0548
Cumulative Proportion   0.1603  0.2768  0.3805  0.44800  0.50846  0.5633
                            PC7      PC8      PC9     PC10     PC11     PC12
Standard deviation     31.95473 28.59825 27.71405 24.76717 24.16232 24.07542
Proportion of Variance  0.05071  0.04061  0.03814  0.03046  0.02899  0.02878
Cumulative Proportion   0.61397  0.65458  0.69272  0.72318  0.75218  0.78096
                           PC13     PC14     PC15     PC16     PC17     PC18
Standard deviation     23.56663 22.47242 21.30002 20.85296 20.40028 19.42485
Proportion of Variance  0.02758  0.02508  0.02253  0.02159  0.02067  0.01874
Cumulative Proportion   0.80854  0.83362  0.85615  0.87774  0.89841  0.91715
                           PC19     PC20     PC21     PC22     PC23     PC24
Standard deviation     18.81143 18.30230 16.42981 16.14845 15.23137 14.72480
Proportion of Variance  0.01757  0.01663  0.01341  0.01295  0.01152  0.01077
Cumulative Proportion   0.93472  0.95136  0.96476  0.97771  0.98923  1.00000
                            PC25
Standard deviation     1.529e-13
Proportion of Variance 0.000e+00
Cumulative Proportion  1.000e+00
pca_var_plot(PCA_H3_info_filter)

Version Author Date
fb1211f E. Renee Matthews 2025-01-16
4881ad6 reneeisnowhere 2024-10-07
50f603e reneeisnowhere 2024-09-23
pca_H3 <- calc_pca(t(filt_H3_matrix_lcpm))
pca_H3_anno <- data.frame(anno_H3_mat, pca_H3$x)


pca_H3_anno %>%
  ggplot(.,aes(x = PC1, y = PC2, col=trt, shape=time, group=indv))+
  geom_point(size= 5)+
  scale_color_manual(values=drug_pal)+
   ggrepel::geom_text_repel(aes(label = indv))+
   ggtitle(expression("PCA of log"[2]*"(cpm) Raodah data, same three individuals"))+
  theme_bw()+
  guides(col="none", size =4)+
  labs(y = "PC 2 11.65%", x ="PC 1 16.3%")+
  theme(plot.title=element_text(size= 14,hjust = 0.5),
        axis.title = element_text(size = 12, color = "black"))

Version Author Date
b037f13 E. Renee Matthews 2025-02-14
fb1211f E. Renee Matthews 2025-01-16
cfe4ce9 reneeisnowhere 2024-10-23
4881ad6 reneeisnowhere 2024-10-07
50f603e reneeisnowhere 2024-09-23
pca_H3_anno %>%
  ggplot(.,aes(x = PC3, y = PC4, col=trt, shape=time, group=indv))+
  geom_point(size= 5)+
  scale_color_manual(values=drug_pal)+
   ggrepel::geom_text_repel(aes(label = indv))+
   ggtitle(expression("PCA of log"[2]*"(cpm)  Raodah data, same three individuals"))+
  theme_bw()+
  guides(col="none", size =4)+
  labs(y = "PC 4 6.7% ", x ="PC 3 10.4%")+
  theme(plot.title=element_text(size= 14,hjust = 0.5),
        axis.title = element_text(size = 12, color = "black"))

Version Author Date
b037f13 E. Renee Matthews 2025-02-14
fb1211f E. Renee Matthews 2025-01-16
cfe4ce9 reneeisnowhere 2024-10-23
4881ad6 reneeisnowhere 2024-10-07
50f603e reneeisnowhere 2024-09-23

Diff analysis, 3 individual and 5 individuals

3 is 2,3& 6 5 is 1 ,2, 3, 4, 5

###group for 3 individuals
group <- c( 1,2,4,5,6,7,9,10,1,2,3,4,7,8,9,10,1,2,3,5,6,7,8,9,10)

##group for 5 individuals
# group <- c(1,2,3,4,7,8,9,10,1,2,3,5,6,8,9,10, 1,2,3,4,5,6,7,8,9,10,1,2,3,4,5,6,7,8,9,10,1,2,4,5,6,7,8,9,10)
# group <- factor(group, levels =c("1","2","3","4","5","6","7","8","9","10"))
# short_names <- paste0(pca_final_four_anno$indv,"_",pca_final_four_anno$trt,"_",pca_final_four_anno$time)

for_group <- data.frame(timeset=colnames(PCA_H3_mat)) %>% 
  mutate(sample = timeset) %>% 
  separate(timeset, into = c("indv","trt","time"), sep= "_") %>% 
  unite("test", trt:time,sep="_", remove = FALSE)


dge <- DGEList.data.frame(counts = PCA_H3_mat, group = group, genes = lcpm_h3_filtered)

group_1 <- for_group$test
# efit_raodah1 <- readRDS("data/Final_four_data/efit4_raodah1.RDS")
# efit_raodah_shared <- readRDS("data/Final_four_data/efit4_raodah_shared.RDS")
dge$group$indv <- for_group$indv
dge$group$time <- for_group$time
dge$group$trt <- for_group$trt
# 
indv <- for_group$indv
# efit4 <- readRDS("data/Final_four_data/efit4_filt_bl.RDS")
mm <- model.matrix(~0 +group_1)
colnames(mm) <-  c("DNR_24", "DNR_3", "DOX_24","DOX_3","EPI_24", "EPI_3","MTX_24", "MTX_3","VEH_24", "VEH_3")
# 
# y <- voom(dge$counts, mm,plot =TRUE)
# 
# corfit <- duplicateCorrelation(y, mm, block = indv)
# 
# v <- voom(dge$counts, mm, block = indv, correlation = corfit$consensus)
# 
# fit <- lmFit(v, mm, block = indv, correlation = corfit$consensus)
# # colnames(mm) <- c("DNR_24","DNR_3","DOX_24","DOX_3","EPI_24","EPI_3","MTX_24","MTX_3","TRZ_24","TRZ_3","VEH_24", "VEH_3")
# #
# #
# cm <- makeContrasts(
#   DNR_3.VEH_3 = DNR_3-VEH_3,
#   DOX_3.VEH_3 = DOX_3-VEH_3,
#   EPI_3.VEH_3 = EPI_3-VEH_3,
#   MTX_3.VEH_3 = MTX_3-VEH_3,
#   DNR_24.VEH_24 =DNR_24-VEH_24,
#   DOX_24.VEH_24= DOX_24-VEH_24,
#   EPI_24.VEH_24= EPI_24-VEH_24,
#   MTX_24.VEH_24= MTX_24-VEH_24,
#     levels = mm)
# # 
# vfit <- lmFit(y, mm)
# # 
# vfit<- contrasts.fit(vfit, contrasts=cm)
# 
# efit_raodah_new <- eBayes(vfit)

# saveRDS(efit_raodah_new,"data/Final_four_data/efit4_raodah_new.RDS")
efit_raodah_new <- readRDS("data/Final_four_data/efit4_raodah_new.RDS")
results = decideTests(efit_raodah_new)
summary(results)
       DNR_3.VEH_3 DOX_3.VEH_3 EPI_3.VEH_3 MTX_3.VEH_3 DNR_24.VEH_24
Down           186           0           0           0           671
NotSig       19895       20137       20137       20137         18115
Up              56           0           0           0          1351
       DOX_24.VEH_24 EPI_24.VEH_24 MTX_24.VEH_24
Down              13             8             0
NotSig         19900         20041         20137
Up               224            88             0

removing low peak number samples:

Veh-3hr-71 (C) and Veh-24hr-77 (B)

PCA_H3_mat_23s <- raodah_counts_file %>% 
  dplyr::select(Geneid,B_DNR_24:B_MTX_24, B_VEH_3:C_VEH_24) %>% 
  column_to_rownames("Geneid") %>% 
  as.matrix()

anno_H3_mat_23s <-
data.frame(timeset=colnames(PCA_H3_mat_23s)) %>%
  mutate(sample = timeset) %>% 
  separate(timeset, into = c("indv","trt","time"), sep= "_") %>% 
  mutate(time = factor(time, levels = c("3", "24"), labels= c("3 hours","24 hours"))) %>% 
  mutate(trt = factor(trt, levels = c("DOX","EPI", "DNR", "MTX","VEH")))%>% 
  # dplyr::filter(sample != "C_VEH_3") %>% 
  dplyr::filter(sample != "B_VEH_24")

  
lcpm_h3_23s <- cpm(PCA_H3_mat_23s, log=TRUE)  ### for determining the basic cutoffs
# dim(lcpm_h3_23s)

row_means23s <- rowMeans(lcpm_h3_23s)
lcpm_h3_23s_filtered <- PCA_H3_mat_23s[row_means23s >0,]
dim(lcpm_h3_23s_filtered)
[1] 20137    23
filt_H3_matrix_lcpm_23s <- cpm(lcpm_h3_23s_filtered, log=TRUE)

PCA_H3_info_filter_23s <- (prcomp(t(filt_H3_matrix_lcpm_23s), scale. = TRUE))
summary(PCA_H3_info_filter_23s)
Importance of components:
                           PC1     PC2      PC3     PC4      PC5      PC6
Standard deviation     52.2001 50.2346 44.78209 40.1125 36.76144 31.78530
Proportion of Variance  0.1353  0.1253  0.09959  0.0799  0.06711  0.05017
Cumulative Proportion   0.1353  0.2606  0.36022  0.4401  0.50724  0.55741
                            PC7      PC8      PC9     PC10     PC11     PC12
Standard deviation     31.62265 29.25073 27.61829 26.82506 26.35383 25.46783
Proportion of Variance  0.04966  0.04249  0.03788  0.03573  0.03449  0.03221
Cumulative Proportion   0.60707  0.64956  0.68744  0.72317  0.75766  0.78987
                           PC13    PC14     PC15     PC16     PC17     PC18
Standard deviation     23.81706 23.4901 23.20255 21.85550 21.05976 20.47942
Proportion of Variance  0.02817  0.0274  0.02673  0.02372  0.02202  0.02083
Cumulative Proportion   0.81804  0.8454  0.87218  0.89590  0.91792  0.93875
                           PC19     PC20     PC21     PC22     PC23
Standard deviation     18.49516 18.09649 17.04140 16.53649 1.27e-13
Proportion of Variance  0.01699  0.01626  0.01442  0.01358 0.00e+00
Cumulative Proportion   0.95574  0.97200  0.98642  1.00000 1.00e+00
pca_var_plot(PCA_H3_info_filter_23s)

Version Author Date
fb1211f E. Renee Matthews 2025-01-16
4881ad6 reneeisnowhere 2024-10-07
50f603e reneeisnowhere 2024-09-23
pca_H3_23s <- calc_pca(t(filt_H3_matrix_lcpm_23s))
pca_H3_anno_23s <- data.frame(anno_H3_mat_23s, pca_H3_23s$x)


pca_H3_anno_23s %>%
  ggplot(.,aes(x = PC1, y = PC2, col=trt, shape=time, group=indv))+
  geom_point(size= 5)+
  scale_color_manual(values=drug_pal)+
   ggrepel::geom_text_repel(aes(label = indv))+
   ggtitle(expression("PCA of log"[2]*"(cpm) Raodah data, same three individuals without low peak samples"))+
  theme_bw()+
  guides(col="none", size =4)+
  labs(y = "PC 2 12.5%", x ="PC 1 13.5%")+
  theme(plot.title=element_text(size= 14,hjust = 0.5),
        axis.title = element_text(size = 12, color = "black")) 

Version Author Date
b037f13 E. Renee Matthews 2025-02-14
fb1211f E. Renee Matthews 2025-01-16
cfe4ce9 reneeisnowhere 2024-10-23
4881ad6 reneeisnowhere 2024-10-07
50f603e reneeisnowhere 2024-09-23
pca_H3_anno_23s %>%
  ggplot(.,aes(x = PC3, y = PC4, col=trt, shape=time, group=indv))+
  geom_point(size= 5)+
  scale_color_manual(values=drug_pal)+
   ggrepel::geom_text_repel(aes(label = indv))+
   ggtitle(expression("PCA of log"[2]*"(cpm)  Raodah data, same three individuals without low peak samples"))+
  theme_bw()+
  guides(col="none", size =4)+
  labs(y = "PC 4 7.5 % ", x ="PC 3 10.%")+
  theme(plot.title=element_text(size= 14,hjust = 0.5),
        axis.title = element_text(size = 12, color = "black"))

Version Author Date
b037f13 E. Renee Matthews 2025-02-14
fb1211f E. Renee Matthews 2025-01-16
cfe4ce9 reneeisnowhere 2024-10-23
4881ad6 reneeisnowhere 2024-10-07
50f603e reneeisnowhere 2024-09-23
### group for -veh3hr and 24hr individual samples
# group_23s <- c( 1,2,4,5,6,7,10,1,2,3,4,7,8,9,10,1,2,3,5,6,7,8,9)
### group for -24hr individual sample
# group_24s <- c( 1,2,4,5,6,7,9,10,1,2,3,4,7,8,9,10,1,2,3,5,6,7,8,9)
# for_group_23s <- data.frame(timeset=colnames(PCA_H3_mat_23s)) %>% 
#   mutate(sample = timeset) %>% 
#   separate(timeset, into = c("indv","trt","time"), sep= "_") %>% 
#   unite("test", trt:time,sep="_", remove = FALSE)

# dge_23s <- DGEList.data.frame(counts = PCA_H3_mat_23s, group = group_23s, genes = lcpm_h3_23s_filtered)

# group_1 <- for_group_23s$test
# 
# dge_23s$group$indv <- for_group_23s$indv
# dge_23s$group$time <- for_group_23s$time
# dge_23s$group$trt <- for_group_23s$trt
# # 
# indv_23s <- for_group_23s$indv
# mm <- model.matrix(~0 +group_1)
# colnames(mm) <-  c("DNR_24", "DNR_3", "DOX_24","DOX_3","EPI_24", "EPI_3","MTX_24", "MTX_3","VEH_24", "VEH_3")
# 
# y <- voom(dge_23s$counts, mm,plot =TRUE)
# 
# corfit <- duplicateCorrelation(y, mm, block = indv_23s)
# 
# v <- voom(dge_23s$counts, mm, block = indv_23s, correlation = corfit$consensus)
# 
# fit <- lmFit(v, mm, block = indv_23s, correlation = corfit$consensus)
# # colnames(mm) <- c("DNR_24","DNR_3","DOX_24","DOX_3","EPI_24","EPI_3","MTX_24","MTX_3","TRZ_24","TRZ_3","VEH_24", "VEH_3")
# #
# #
# cm <- makeContrasts(
#   DNR_3.VEH_3 = DNR_3-VEH_3,
#   DOX_3.VEH_3 = DOX_3-VEH_3,
#   EPI_3.VEH_3 = EPI_3-VEH_3,
#   MTX_3.VEH_3 = MTX_3-VEH_3,
#   DNR_24.VEH_24 =DNR_24-VEH_24,
#   DOX_24.VEH_24= DOX_24-VEH_24,
#   EPI_24.VEH_24= EPI_24-VEH_24,
#   MTX_24.VEH_24= MTX_24-VEH_24,
#     levels = mm)
#
# vfit <- lmFit(y, mm)
# # 
# vfit<- contrasts.fit(vfit, contrasts=cm)
# 
# efit_raodah_24s <- eBayes(vfit)

# saveRDS(efit_raodah_24s,"data/Final_four_data/efit4_raodah_24s.RDS")
efit_raodah_23s <- readRDS("data/Final_four_data/efit4_raodah_23s.RDS")
# efit_raodah_24s <- readRDS("data/Final_four_data/efit4_raodah_24s.RDS")
results = decideTests(efit_raodah_23s)

summary(results)
       DNR_3.VEH_3 DOX_3.VEH_3 EPI_3.VEH_3 MTX_3.VEH_3 DNR_24.VEH_24
Down           424           2           0           0          2007
NotSig       19502       20135       20137       20137         16669
Up             211           0           0           0          1461
       DOX_24.VEH_24 EPI_24.VEH_24 MTX_24.VEH_24
Down             126            55             0
NotSig         19756         19997         20137
Up               255            85             0
Frag_cor <- raodah_counts_file %>% 
  dplyr::select(Geneid,B_DNR_24:B_MTX_24, B_VEH_3:C_VEH_24) %>% 
  column_to_rownames("Geneid") %>% 
  cpm(., log = TRUE) %>% 
  cor()
  
filmat_groupmat_col <- data.frame(timeset = colnames(Frag_cor))

counts_corr_mat <-  filmat_groupmat_col %>% 
 # mutate(sample = timeset) %>% 
  separate(timeset, into = c("indv","trt","time"), sep= "_") %>% 
  mutate(time = factor(time, levels = c("3", "24"), labels= c("3 hours","24 hours"))) %>% 
  mutate(trt = factor(trt, levels = c("DOX","EPI", "DNR", "MTX","VEH"))) %>% 
  mutate(class = if_else(trt == "DNR", "AC", if_else(
    trt == "DOX", "AC", if_else(trt == "EPI", "AC", "nAC")
  ))) %>%
  mutate(TOP2i = if_else(trt == "DNR", "yes", if_else(
    trt == "DOX", "yes", if_else(trt == "EPI", "yes", if_else(trt == "MTX", "yes", "no"))))) %>% 
  mutate(indv=factor(indv, levels = c("A","B","C"))) 
                         
 mat_colors <- list( 
   trt= c("#F1B72B","#8B006D","#DF707E","#3386DD","#41B333"),
   # indv=c("#1B9E77", "#D95F02" ,"#7570B3", "#E7298A" ,"#66A61E", "#E6AB02"),
  indv=c(A="#1B9E77",B= "#D95F02" ,C="#7570B3"),
   time=c("pink", "chocolate4"),
   class=c("yellow1","darkorange1"), 
   TOP2i =c("darkgreen","lightgreen"))                        
                         
names(mat_colors$trt)   <- unique(counts_corr_mat$trt)                      
names(mat_colors$indv) <- unique(counts_corr_mat$indv)
names(mat_colors$time) <- unique(counts_corr_mat$time)
names(mat_colors$class) <- unique(counts_corr_mat$class)
names(mat_colors$TOP2i) <- unique(counts_corr_mat$TOP2i)

htanno <-  ComplexHeatmap::HeatmapAnnotation(df = counts_corr_mat, col = mat_colors)
ComplexHeatmap::Heatmap(Frag_cor, top_annotation = htanno)

Version Author Date
fb1211f E. Renee Matthews 2025-01-16
50f603e reneeisnowhere 2024-09-23
Frag_cor_all <- raodah_counts_file %>% 
  # dplyr::select(Geneid,B_DNR_24:B_MTX_24, B_VEH_3:C_VEH_3) %>% 
  column_to_rownames("Geneid") %>% 
  cpm(., log = TRUE) %>% 
  cor()
  
filmat_groupmat_col_all <- data.frame(timeset = colnames(Frag_cor_all))

counts_corr_mat_all <-  filmat_groupmat_col_all %>% 
 # mutate(sample = timeset) %>% 
  separate(timeset, into = c("indv","trt","time"), sep= "_") %>% 
  mutate(time = factor(time, levels = c("3", "24"), labels= c("3 hours","24 hours"))) %>% 
  mutate(trt = factor(trt, levels = c("DOX","EPI", "DNR", "MTX","VEH"))) %>% 
  mutate(class = if_else(trt == "DNR", "AC", if_else(
    trt == "DOX", "AC", if_else(trt == "EPI", "AC", "nAC")
  ))) %>%
  mutate(TOP2i = if_else(trt == "DNR", "yes", if_else(
    trt == "DOX", "yes", if_else(trt == "EPI", "yes", if_else(trt == "MTX", "yes", "no"))))) %>% 
  mutate(indv=factor(indv, levels = c("A","B","C"))) 
                         

htanno <-  ComplexHeatmap::HeatmapAnnotation(df = counts_corr_mat_all, col = mat_colors)
ComplexHeatmap::Heatmap(Frag_cor_all, top_annotation = htanno)

Version Author Date
fb1211f E. Renee Matthews 2025-01-16
50f603e reneeisnowhere 2024-09-23
FCmatrix_23s <- subset(efit_raodah_23s$coefficients)

colnames(FCmatrix_23s) <-
  c("DNR\n3h",
    "DOX\n3h",
    "EPI\n3h",
    "MTX\n3h",
    "DNR\n24h",
    "DOX\n24h",
    "EPI\n24h",
    "MTX\n24h"
     )


mat_col_FC <-
  data.frame(
    time = c(rep("3 hours", 4), rep("24 hours", 4)),
    class = (c(
      "AC", "AC", "AC", "nAC", "AC", "AC", "AC", "nAC"
    )))
rownames(mat_col_FC) <- colnames(FCmatrix_23s)

mat_colors_FC <-
  list(
    time = c("pink", "chocolate4"),
    class = c("yellow1", "lightgreen"))

names(mat_colors_FC$time) <- unique(mat_col_FC$time)
names(mat_colors_FC$class) <- unique(mat_col_FC$class)
# names(mat_colors_FC$TOP2i) <- unique(mat_col_FC$TOP2i)
corrFC_23s <- cor(FCmatrix_23s)

htanno_23s <-  HeatmapAnnotation(df = mat_col_FC, col = mat_colors_FC)
Heatmap(corrFC_23s, top_annotation = htanno_23s)

Version Author Date
fb1211f E. Renee Matthews 2025-01-16
50f603e reneeisnowhere 2024-09-23
AC.DNR_3.top= topTable(efit_raodah_23s, coef=1, adjust.method="BH", number=Inf, sort.by="p")
AC.DOX_3.top= topTable(efit_raodah_23s, coef=2, adjust.method="BH", number=Inf, sort.by="p")
AC.EPI_3.top= topTable(efit_raodah_23s, coef=3, adjust.method="BH", number=Inf, sort.by="p")
AC.MTX_3.top= topTable(efit_raodah_23s, coef=4, adjust.method="BH", number=Inf, sort.by="p")

AC.DNR_24.top= topTable(efit_raodah_23s, coef=5, adjust.method="BH", number=Inf, sort.by="p")
AC.DOX_24.top= topTable(efit_raodah_23s, coef=6, adjust.method="BH", number=Inf, sort.by="p")
AC.EPI_24.top= topTable(efit_raodah_23s, coef=7, adjust.method="BH", number=Inf, sort.by="p")
AC.MTX_24.top= topTable(efit_raodah_23s, coef=8, adjust.method="BH", number=Inf, sort.by="p")

# volcanoplot(efit2,coef = c(1,2,3,4,5,6),style = "p-value",
#                           # highlight = 8,
#                           # names = efit2$genes$SYMBOL,
#                           hl.col = "red",xlab = "Log2 Fold Change",
#                           ylab = NULL,pch = 16,cex = 0.35,
#                           main = "test")
# 

plot_filenames <- c("AC.DNR_3.top","AC.DOX_3.top","AC.EPI_3.top","AC.MTX_3.top",
                    "AC.DNR_24.top","AC.DOX_24.top","AC.EPI_24.top",
                    "AC.MTX_24.top")
plot_files <- c( AC.DNR_3.top,AC.DOX_3.top,AC.EPI_3.top,AC.MTX_3.top,
                    AC.DNR_24.top,AC.DOX_24.top,AC.EPI_24.top,
                    AC.MTX_24.top)

volcanosig <- function(df, psig.lvl) {
    df <- df %>% 
    mutate(threshold = ifelse(adj.P.Val > psig.lvl, "A", ifelse(adj.P.Val <= psig.lvl & logFC<=0,"B","C")))
      # ifelse(adj.P.Val <= psig.lvl & logFC >= 0,"B", "C")))
    ##This is where I could add labels, but I have taken out
    # df <- df %>% mutate(genelabels = "")
    # df$genelabels[1:topg] <- df$rownames[1:topg]
    
  ggplot(df, aes(x=logFC, y=-log10(P.Value))) + 
    geom_point(aes(color=threshold))+
    # geom_text_repel(aes(label = genelabels), segment.curvature = -1e-20,force = 1,size=2.5,
    # arrow = arrow(length = unit(0.015, "npc")), max.overlaps = Inf) +
    #geom_hline(yintercept = -log10(psig.lvl))+
    xlab(expression("Log"[2]*" FC"))+
    ylab(expression("-log"[10]*"P Value"))+
    scale_color_manual(values = c("black", "red","blue"))+
    ylim(0,12)+
    xlim(-5,5)+
    theme_cowplot()+
    theme(legend.position = "none",
              plot.title = element_text(size = rel(1.5), hjust = 0.5),
              axis.title = element_text(size = rel(0.8))) 
}
#v1<- volcanosig(V.DA24.top, 0.01,0)
v1 <- volcanosig(AC.DNR_3.top, 0.01)+ ggtitle("H3K27ac DNR 3 hour")
v2 <- volcanosig(AC.DNR_24.top, 0.01)+ ggtitle("H3K27ac DNR 24 hour")+ylab("")
v3 <- volcanosig(AC.DOX_3.top, 0.01)+ ggtitle("H3K27ac DOX 3 hour")
v4 <- volcanosig(AC.DOX_24.top, 0.01)+ ggtitle("H3K27ac DOX 24 hour")+ylab("")
v5 <- volcanosig(AC.EPI_3.top, 0.01)+ ggtitle("H3K27ac EPI 3 hour")
v6 <- volcanosig(AC.EPI_24.top, 0.01)+ ggtitle("H3K27ac EPI 24 hour")+ylab("")
v7 <- volcanosig(AC.MTX_3.top, 0.01)+ ggtitle("H3K27ac MTX 3 hour")
v8 <- volcanosig(AC.MTX_24.top, 0.01)+ ggtitle("H3K27ac MTX 24 hour")+ylab("")
# v9 <- volcanosig(V.TRZ_3.top, 0.01)+ ggtitle("Trastuzumab 3 hour")
# v10 <- volcanosig(V.TRZ_24.top, 0.01)+ ggtitle("Trastuzumab 24 hour")+ylab("")
# volcanoplot(efit2,coef = 10,style = "p-value",
#                           highlight = 8,
#                           names = efit2$genes$SYMBOL,
#                           hl.col = "red",xlab = "Log2 Fold Change",
#                           ylab = NULL,pch = 16,cex = 0.35,
#                           main = "Using Trastuzumab 24 hour data and volcanoplot function")
plot_grid(v1,v2,  rel_widths =c(.8,1))

Version Author Date
fb1211f E. Renee Matthews 2025-01-16
3879098 reneeisnowhere 2024-12-16
50f603e reneeisnowhere 2024-09-23
plot_grid(v3,v4,  rel_widths =c(.8,1))

Version Author Date
fb1211f E. Renee Matthews 2025-01-16
3879098 reneeisnowhere 2024-12-16
50f603e reneeisnowhere 2024-09-23
plot_grid(v5,v6,  rel_widths =c(.8,1))

Version Author Date
fb1211f E. Renee Matthews 2025-01-16
3879098 reneeisnowhere 2024-12-16
50f603e reneeisnowhere 2024-09-23
plot_grid(v7,v8,  rel_widths =c(.8,1))

Version Author Date
fb1211f E. Renee Matthews 2025-01-16
3879098 reneeisnowhere 2024-12-16
50f603e reneeisnowhere 2024-09-23
# plot_grid(v9,v10,  rel_widths =c(.8,1))
AC.DNR_3.top= topTable(efit_raodah_23s, coef=1, adjust.method="BH", number=Inf, sort.by="p")%>% rownames_to_column("peak")
AC.DOX_3.top= topTable(efit_raodah_23s, coef=2, adjust.method="BH", number=Inf, sort.by="p")%>% rownames_to_column("peak")
AC.EPI_3.top= topTable(efit_raodah_23s, coef=3, adjust.method="BH", number=Inf, sort.by="p")%>% rownames_to_column("peak")
AC.MTX_3.top= topTable(efit_raodah_23s, coef=4, adjust.method="BH", number=Inf, sort.by="p")%>% rownames_to_column("peak")

AC.DNR_24.top= topTable(efit_raodah_23s, coef=5, adjust.method="BH", number=Inf, sort.by="p")%>% rownames_to_column("peak")
AC.DOX_24.top= topTable(efit_raodah_23s, coef=6, adjust.method="BH", number=Inf, sort.by="p")%>% rownames_to_column("peak")
AC.EPI_24.top= topTable(efit_raodah_23s, coef=7, adjust.method="BH", number=Inf, sort.by="p")%>% rownames_to_column("peak")
AC.MTX_24.top= topTable(efit_raodah_23s, coef=8, adjust.method="BH", number=Inf, sort.by="p")%>% rownames_to_column("peak")
toplist_ac_23  <- list(AC.DNR_3.top,  AC.DOX_3.top, AC.EPI_3.top, AC.MTX_3.top, AC.DNR_24.top, AC.DOX_24.top, AC.EPI_24.top, AC.MTX_24.top)
names(toplist_ac_23 ) <- c("DNR_3", "DOX_3","EPI_3","MTX_3","DNR_24", "DOX_24","EPI_24","MTX_24")
# toplist_ac_lfc <-map_df(toplist_ac_23, ~as.data.frame(.x), .id="trt_time")
# # # #
# toplist_ac_lfc <- toplist_ac_lfc %>%
#   # rownames_to_column("Peakid")%>%
  # mutate(Peakid=(gsub("\\.\\.\\.{5}.$","",Peakid)))
#   separate(trt_time, into= c("trt","time"), sep = "_") %>%
#   mutate(trt=factor(trt, levels = c("DOX","EPI","DNR","MTX"))) %>%
#   mutate(time = factor(time, levels = c("3", "24"), labels = c("3 hours", "24 hours")))
# saveRDS(toplist_ac_lfc,"data/Final_four_data/toplist_ac_lfc.RDS")
toplist_ac_lfc <- readRDS("data/Final_four_data/toplist_ac_lfc.RDS") #%>% 
  # rownames_to_column("Peakid") %>% 
  # mutate(Peakid=(gsub("\\.\\.\\.*","",Peakid)))

making of median dataframe, code only

### making median lfc
library(stringr)
# 
AC_median_df <- toplist_ac_lfc %>%
    dplyr::select(Peakid:logFC)%>% 
   mutate(Peakid=str_replace(Peakid, "\\.\\.\\.[0=9]*","/")) %>% separate(Peakid, into=c("Peakid",NA),sep="/") %>% 
  pivot_wider(., id_cols=c(time,Peakid), names_from = "trt", values_from = "logFC") %>% 
  rowwise() %>% 
  mutate(median_lfc= median(c_across(DNR:MTX))) %>% 
  ungroup()

AC_median_3_lfc <-  AC_median_df %>%
    dplyr::filter(time == "3") %>% 
  ungroup() %>% 
  dplyr::select(time, Peakid,median_lfc) %>% 
  dplyr::rename("AC_3h_lfc"=median_lfc)
  

AC_median_24_lfc <- AC_median_df %>%
    dplyr::filter(time == "24") %>% 
  ungroup() %>% 
  dplyr::select(time, Peakid,median_lfc) %>% 
  dplyr::rename("AC_24h_lfc"=median_lfc)
  
write_csv(AC_median_3_lfc, "data/Final_four_data/AC_median_3_lfc.csv")
write_csv(AC_median_24_lfc, "data/Final_four_data/AC_median_24_lfc.csv")

Examples of DERs

DNR_3_top3 <- AC.DNR_3.top[1:3,1]

log_filt_23s <- lcpm_h3_23s_filtered %>% 
  cpm(., log=TRUE) %>% as.data.frame()

row.names(log_filt_23s) <- row.names(lcpm_h3_23s_filtered)
log_filt_23s %>% 
  dplyr::filter(row.names(.) %in% DNR_3_top3) %>% 
  mutate(Peak = row.names(.)) %>% 
  pivot_longer(cols = !Peak, names_to = "sample", values_to = "counts") %>% 
  separate("sample", into = c("indv","trt","time")) %>% 
  mutate(time=factor(time, levels = c("3h","24h"))) %>% 
  mutate(trt=factor(trt, levels= c("DOX","EPI","DNR","MTX","VEH"))) %>% 
  ggplot(., aes (x = time, y=counts))+
  geom_boxplot(aes(fill=trt))+
  facet_wrap(Peak~.)+
  ggtitle("top 3 DAR in 3 hour DNR")+
  scale_fill_manual(values = drug_pal)+
  theme_bw()

Version Author Date
fb1211f E. Renee Matthews 2025-01-16
4881ad6 reneeisnowhere 2024-10-07
50f603e reneeisnowhere 2024-09-23
DOX_3_top3 <- AC.DOX_3.top[1:3,1]

log_filt_23s %>% 
  dplyr::filter(row.names(.) %in% DOX_3_top3) %>% 
  mutate(Peak = row.names(.)) %>% 
  pivot_longer(cols = !Peak, names_to = "sample", values_to = "counts") %>% 
  separate("sample", into = c("indv","trt","time")) %>% 
  mutate(time=factor(time, levels = c("3h","24h"))) %>% 
  mutate(trt=factor(trt, levels= c("DOX","EPI","DNR","MTX","VEH"))) %>% 
  ggplot(., aes (x = time, y=counts))+
  geom_boxplot(aes(fill=trt))+
  facet_wrap(Peak~.)+
  ggtitle("top 3 DAR in 3 hour DOX")+
  scale_fill_manual(values = drug_pal)+
  theme_bw()

Version Author Date
fb1211f E. Renee Matthews 2025-01-16
4881ad6 reneeisnowhere 2024-10-07
50f603e reneeisnowhere 2024-09-23
EPI_3_top3 <- AC.EPI_3.top[1:3,1]

log_filt_23s %>% 
  dplyr::filter(row.names(.) %in% EPI_3_top3) %>% 
  mutate(Peak = row.names(.)) %>% 
  pivot_longer(cols = !Peak, names_to = "sample", values_to = "counts") %>% 
  separate("sample", into = c("indv","trt","time")) %>% 
  mutate(time=factor(time, levels = c("3h","24h"))) %>% 
  mutate(trt=factor(trt, levels= c("DOX","EPI","DNR","MTX","VEH"))) %>% 
  ggplot(., aes (x = time, y=counts))+
  geom_boxplot(aes(fill=trt))+
  facet_wrap(Peak~.)+
  ggtitle("top 3 DAR in 3 hour EPI")+
  scale_fill_manual(values = drug_pal)+
  theme_bw()

Version Author Date
fb1211f E. Renee Matthews 2025-01-16
4881ad6 reneeisnowhere 2024-10-07
50f603e reneeisnowhere 2024-09-23
MTX_3_top3 <- AC.MTX_3.top[1:3,1]

log_filt_23s %>% 
  dplyr::filter(row.names(.) %in% MTX_3_top3) %>% 
  mutate(Peak = row.names(.)) %>% 
  pivot_longer(cols = !Peak, names_to = "sample", values_to = "counts") %>% 
  separate("sample", into = c("indv","trt","time")) %>% 
  mutate(time=factor(time, levels = c("3h","24h"))) %>% 
  mutate(trt=factor(trt, levels= c("DOX","EPI","DNR","MTX","VEH"))) %>% 
  ggplot(., aes (x = time, y=counts))+
  geom_boxplot(aes(fill=trt))+
  facet_wrap(Peak~.)+
  ggtitle("top 3 DAR in 3 hour MTX")+
  scale_fill_manual(values = drug_pal)+
  theme_bw()

Version Author Date
fb1211f E. Renee Matthews 2025-01-16
4881ad6 reneeisnowhere 2024-10-07
50f603e reneeisnowhere 2024-09-23
DNR_24_top3 <- AC.DNR_24.top[1:3,1]

log_filt_23s <- lcpm_h3_23s_filtered %>% 
  cpm(., log=TRUE) %>% as.data.frame()

row.names(log_filt_23s) <- row.names(lcpm_h3_23s_filtered)
log_filt_23s %>% 
  dplyr::filter(row.names(.) %in% DNR_24_top3) %>% 
  mutate(Peak = row.names(.)) %>% 
  pivot_longer(cols = !Peak, names_to = "sample", values_to = "counts") %>% 
  separate("sample", into = c("indv","trt","time")) %>% 
  mutate(time=factor(time, levels = c("3h","24h"))) %>% 
  mutate(trt=factor(trt, levels= c("DOX","EPI","DNR","MTX","VEH"))) %>% 
  ggplot(., aes (x = time, y=counts))+
  geom_boxplot(aes(fill=trt))+
  facet_wrap(Peak~.)+
  ggtitle("top 3 DAR in 24 hour DNR")+
  scale_fill_manual(values = drug_pal)+
  theme_bw()

Version Author Date
fb1211f E. Renee Matthews 2025-01-16
4881ad6 reneeisnowhere 2024-10-07
50f603e reneeisnowhere 2024-09-23
DOX_24_top3 <- AC.DOX_24.top[1:3,1]

log_filt_23s %>% 
  dplyr::filter(row.names(.) %in% DOX_24_top3) %>% 
  mutate(Peak = row.names(.)) %>% 
  pivot_longer(cols = !Peak, names_to = "sample", values_to = "counts") %>% 
  separate("sample", into = c("indv","trt","time")) %>% 
  mutate(time=factor(time, levels = c("3h","24h"))) %>% 
  mutate(trt=factor(trt, levels= c("DOX","EPI","DNR","MTX","VEH"))) %>% 
  ggplot(., aes (x = time, y=counts))+
  geom_boxplot(aes(fill=trt))+
  facet_wrap(Peak~.)+
  ggtitle("top 3 DAR in 24 hour DOX")+
  scale_fill_manual(values = drug_pal)+
  theme_bw()

Version Author Date
fb1211f E. Renee Matthews 2025-01-16
4881ad6 reneeisnowhere 2024-10-07
50f603e reneeisnowhere 2024-09-23
EPI_24_top3 <- AC.EPI_24.top[1:3,1]

log_filt_23s %>% 
  dplyr::filter(row.names(.) %in% EPI_24_top3) %>% 
  mutate(Peak = row.names(.)) %>% 
  pivot_longer(cols = !Peak, names_to = "sample", values_to = "counts") %>% 
  separate("sample", into = c("indv","trt","time")) %>% 
  mutate(time=factor(time, levels = c("3h","24h"))) %>% 
  mutate(trt=factor(trt, levels= c("DOX","EPI","DNR","MTX","VEH"))) %>% 
  ggplot(., aes (x = time, y=counts))+
  geom_boxplot(aes(fill=trt))+
  facet_wrap(Peak~.)+
  ggtitle("top 3 DAR in 24 hour EPI")+
  scale_fill_manual(values = drug_pal)+
  theme_bw()

Version Author Date
fb1211f E. Renee Matthews 2025-01-16
4881ad6 reneeisnowhere 2024-10-07
50f603e reneeisnowhere 2024-09-23
MTX_24_top3 <- AC.MTX_24.top[1:3,1]

log_filt_23s %>% 
  dplyr::filter(row.names(.) %in% MTX_24_top3) %>% 
  mutate(Peak = row.names(.)) %>% 
  pivot_longer(cols = !Peak, names_to = "sample", values_to = "counts") %>% 
  separate("sample", into = c("indv","trt","time")) %>% 
  mutate(time=factor(time, levels = c("3h","24h"))) %>% 
  mutate(trt=factor(trt, levels= c("DOX","EPI","DNR","MTX","VEH"))) %>% 
  ggplot(., aes (x = time, y=counts))+
  geom_boxplot(aes(fill=trt))+
  facet_wrap(Peak~.)+
  ggtitle("top 3 DAR in 24 hour MTX")+
  scale_fill_manual(values = drug_pal)+
  theme_bw()

Version Author Date
fb1211f E. Renee Matthews 2025-01-16
4881ad6 reneeisnowhere 2024-10-07
50f603e reneeisnowhere 2024-09-23

Correlation to ATAC data

atac_median_3_lfc <- read_csv("data/Final_four_data/median_3_lfc.csv")
atac_median_24_lfc <- read_csv( "data/Final_four_data/median_24_lfc.csv")

AC_median_3_lfc <- read_csv("data/Final_four_data/AC_median_3_lfc.csv")
AC_median_24_lfc <- read_csv("data/Final_four_data/AC_median_24_lfc.csv")

overlap_atac_ac_peaks <- readRDS( "data/Final_four_data/overlapping_ac_atac_peaks.RDS")

# threehroverlap <- 
 overlap_df_ggplot <-  overlap_atac_ac_peaks %>% 
    dplyr::select(peakid, Geneid) %>% 
    left_join(AC_median_3_lfc,by = c("Geneid"="Peakid")) %>% 
    left_join(AC_median_24_lfc,by = c("Geneid"="Peakid")) %>% 
    dplyr::select(peakid:Geneid,AC_3h_lfc,AC_24h_lfc) %>% 
    left_join(., (atac_median_3_lfc %>% dplyr::select(peak,med_3h_lfc)), by = c("peakid"="peak")) %>% 
    left_join(., (atac_median_24_lfc %>% dplyr::select(peak,med_24h_lfc)), by = c("peakid"="peak"))
 
 overlap_df_ggplot %>% 
   ggplot(., aes(x=AC_3h_lfc,y=med_3h_lfc))+
   geom_point()+
   sm_statCorr(corr_method = 'pearson')+
   ggtitle("Correlation of H3K27ac peaks and ATAC peaks that overlap at 3 hours")+
  xlab("H3K27ac peak LFC")+
   ylab("ATAC peak LFC")

Version Author Date
fb1211f E. Renee Matthews 2025-01-16
4881ad6 reneeisnowhere 2024-10-07
50f603e reneeisnowhere 2024-09-23
 overlap_df_ggplot %>% 
   ggplot(., aes(x=AC_24h_lfc,y=med_24h_lfc))+
   geom_point()+
   sm_statCorr(corr_method = 'pearson')+
   
   ggtitle("Correlation of H3K27ac peaks and ATAC peaks that overlap at 24 hours")+
  xlab("H3K27ac peak LFC")+
   ylab("ATAC peak LFC")

Version Author Date
fb1211f E. Renee Matthews 2025-01-16
4881ad6 reneeisnowhere 2024-10-07
50f603e reneeisnowhere 2024-09-23
 # saveRDS(overlap_df_ggplot,"data/Final_four_data/LFC_ATAC_K27ac.RDS")
efit4 <- readRDS("data/Final_four_data/efit4_filt_bl.RDS")

ATAC.DNR_3.top_ff= topTable(efit4, coef=1, adjust.method="BH", number=Inf, sort.by="p") %>% rownames_to_column("peak")
ATAC.DOX_3.top_ff= topTable(efit4, coef=2, adjust.method="BH", number=Inf, sort.by="p")%>% rownames_to_column("peak")
ATAC.EPI_3.top_ff= topTable(efit4, coef=3, adjust.method="BH", number=Inf, sort.by="p")%>% rownames_to_column("peak")
ATAC.MTX_3.top_ff= topTable(efit4, coef=4, adjust.method="BH", number=Inf, sort.by="p")%>% rownames_to_column("peak")

ATAC.DNR_24.top_ff= topTable(efit4, coef=6, adjust.method="BH", number=Inf, sort.by="p")%>% rownames_to_column("peak")
ATAC.DOX_24.top_ff= topTable(efit4, coef=7, adjust.method="BH", number=Inf, sort.by="p")%>% rownames_to_column("peak")
ATAC.EPI_24.top_ff= topTable(efit4, coef=8, adjust.method="BH", number=Inf, sort.by="p")%>% rownames_to_column("peak")
ATAC.MTX_24.top_ff= topTable(efit4, coef=9, adjust.method="BH", number=Inf, sort.by="p")%>% rownames_to_column("peak")

ATAC_LFC_data<- ATAC.DNR_3.top_ff %>% 
  dplyr::select(peak,logFC) %>% 
  dplyr::rename("ATAC_DNR_3"=logFC) %>% 
  left_join(., (ATAC.DOX_3.top_ff %>% dplyr::select(peak,logFC) %>%
                  dplyr::rename("ATAC_DOX_3"=logFC)), by=c("peak"="peak")) %>% 
  left_join(., (ATAC.EPI_3.top_ff %>% dplyr::select(peak,logFC) %>%
                  dplyr::rename("ATAC_EPI_3"=logFC)), by=c("peak"="peak")) %>%
  left_join(., (ATAC.MTX_3.top_ff %>% dplyr::select(peak,logFC) %>%
                  dplyr::rename("ATAC_MTX_3"=logFC)), by=c("peak"="peak")) %>%
  left_join(., (ATAC.DNR_24.top_ff %>% dplyr::select(peak,logFC) %>%
                  dplyr::rename("ATAC_DNR_24"=logFC)), by=c("peak"="peak")) %>%
  left_join(., (ATAC.DOX_24.top_ff %>% dplyr::select(peak,logFC) %>%
                  dplyr::rename("ATAC_DOX_24"=logFC)), by=c("peak"="peak")) %>%
  left_join(., (ATAC.EPI_24.top_ff %>% dplyr::select(peak,logFC) %>%
                  dplyr::rename("ATAC_EPI_24"=logFC)), by=c("peak"="peak")) %>%
  left_join(., (ATAC.MTX_24.top_ff %>% dplyr::select(peak,logFC) %>%
                  dplyr::rename("ATAC_MTX_24"=logFC)), by=c("peak"="peak")) 


AC_LFC_data <-  AC.DNR_3.top %>%
  column_to_rownames("peak") %>% 
  rownames_to_column("Geneid") %>%
  dplyr::select(Geneid,logFC) %>% 
  dplyr::rename("AC_DNR_3"=logFC) %>% 
  left_join(., (AC.DOX_3.top %>%
                  column_to_rownames("peak") %>% 
                  rownames_to_column("Geneid") %>% 
                  dplyr::select(Geneid,logFC) %>%
                  dplyr::rename("AC_DOX_3"=logFC)), by=c("Geneid"="Geneid")) %>% 
  left_join(., (AC.EPI_3.top %>% 
                  column_to_rownames("peak") %>% 
                  rownames_to_column("Geneid") %>% 
                  dplyr::select(Geneid,logFC) %>%
                  dplyr::rename("AC_EPI_3"=logFC)), by=c("Geneid"="Geneid")) %>%
  left_join(., (AC.MTX_3.top %>%
                  column_to_rownames("peak") %>% 
                  rownames_to_column("Geneid") %>% 
                  dplyr::select(Geneid,logFC) %>%
                  dplyr::rename("AC_MTX_3"=logFC)), by=c("Geneid"="Geneid")) %>%
  left_join(., (AC.DNR_24.top %>%
                  column_to_rownames("peak") %>% 
                  rownames_to_column("Geneid") %>% 
                  dplyr::select(Geneid,logFC) %>%
                  dplyr::rename("AC_DNR_24"=logFC)), by=c("Geneid"="Geneid")) %>%
  left_join(., (AC.DOX_24.top %>% 
                  column_to_rownames("peak") %>% 
                  rownames_to_column("Geneid") %>% 
                  dplyr::select(Geneid,logFC) %>%
                  dplyr::rename("AC_DOX_24"=logFC)), by=c("Geneid"="Geneid")) %>%
  left_join(., (AC.EPI_24.top %>% 
                  column_to_rownames("peak") %>% 
                  rownames_to_column("Geneid") %>% 
                  dplyr::select(Geneid,logFC) %>%
                  dplyr::rename("AC_EPI_24"=logFC)), by=c("Geneid"="Geneid")) %>%
  left_join(., (AC.MTX_24.top %>% 
                  column_to_rownames("peak") %>% 
                  rownames_to_column("Geneid") %>% 
                  dplyr::select(Geneid,logFC) %>%
                  dplyr::rename("AC_MTX_24"=logFC)), by=c("Geneid"="Geneid")) 

LFC_corr <-
overlap_df_ggplot %>% 
  dplyr::select(peakid,Geneid) %>% 
  left_join(., ATAC_LFC_data, by = c("peakid"="peak")) %>% 
  left_join(., AC_LFC_data, by = c ("Geneid"="Geneid")) %>% 
  unite("name",peakid:Geneid) %>% 
  column_to_rownames("name") %>% 
  cor()
  
ComplexHeatmap::Heatmap(LFC_corr)

Version Author Date
fb1211f E. Renee Matthews 2025-01-16
4881ad6 reneeisnowhere 2024-10-07
# filmat_groupmat_col <- data.frame(timeset = colnames(LFC_corr))
# 
# counts_corr_mat <-  filmat_groupmat_col %>% 
#  # mutate(sample = timeset) %>% 
#   separate(timeset, into = c("indv","trt","time"), sep= "_") %>% 
#   mutate(time = factor(time, levels = c("3", "24"), labels= c("3 hours","24 hours"))) %>% 
#   mutate(trt = factor(trt, levels = c("DOX","EPI", "DNR", "MTX","VEH"))) %>% 
#   mutate(class = if_else(trt == "DNR", "AC", if_else(
#     trt == "DOX", "AC", if_else(trt == "EPI", "AC", "nAC")
#   ))) %>%
#   mutate(TOP2i = if_else(trt == "DNR", "yes", if_else(
#     trt == "DOX", "yes", if_else(trt == "EPI", "yes", if_else(trt == "MTX", "yes", "no"))))) %>% 
#   mutate(indv=factor(indv, levels = c("A","B","C"))) 
#                          
#  mat_colors <- list( 
#    trt= c("#F1B72B","#8B006D","#DF707E","#3386DD","#41B333"),
#    # indv=c("#1B9E77", "#D95F02" ,"#7570B3", "#E7298A" ,"#66A61E", "#E6AB02"),
#   indv=c(A="#1B9E77",B= "#D95F02" ,C="#7570B3"),
#    time=c("pink", "chocolate4"),
#    class=c("yellow1","darkorange1"), 
#    TOP2i =c("darkgreen","lightgreen"))                        
#                          
# names(mat_colors$trt)   <- unique(counts_corr_mat$trt)                      
# names(mat_colors$indv) <- unique(counts_corr_mat$indv)
# names(mat_colors$time) <- unique(counts_corr_mat$time)
# names(mat_colors$class) <- unique(counts_corr_mat$class)
# names(mat_colors$TOP2i) <- unique(counts_corr_mat$TOP2i)
# 
# htanno <-  ComplexHeatmap::HeatmapAnnotation(df = counts_corr_mat, col = mat_colors)
# ComplexHeatmap::Heatmap(Frag_cor, top_annotation = htanno)
ATAC_Full_raw_counts<- readRDS("data/Final_four_data/ATAC_filtered_raw_counts_allsamples.RDS")
ATAC_lcpm_specific <- ATAC_Full_raw_counts %>% as.data.frame() %>% 
  dplyr::select(Ind2_87DA24h:Ind2_87M3h,Ind2_87V24h:Ind3_77M3h,Ind3_77V24h:Ind3_77V3h,Ind6_71DA24h:Ind6_71M3h,Ind6_71V24h,Ind6_71V3h) %>% 
  cpm(., log=TRUE) 


K27_ac_lcpm <- filt_H3_matrix_lcpm_23s
 
counts_corr <-
  overlap_df_ggplot %>% 
  select(peakid,Geneid) %>% 
  left_join(., (ATAC_lcpm_specific %>% as.data.frame() %>% 
                  rownames_to_column("peak")), by = c("peakid"="peak")) %>% 
  left_join(., (K27_ac_lcpm %>% as.data.frame() %>% 
                  rownames_to_column("Geneid")), by = c ("Geneid"="Geneid"))%>% 
  unite("name",peakid:Geneid) %>% 
  column_to_rownames("name") %>% 
  cor()
ComplexHeatmap::Heatmap(counts_corr)

Version Author Date
fb1211f E. Renee Matthews 2025-01-16
4881ad6 reneeisnowhere 2024-10-07

Cormotif

###now adjusted for 23 samples:
# notes for self in future: I have adjusted this and run on both 23 samples and 25 samples of all 3 shared individuals.  A is individual 87, B is individual 77 and C is individual 71.
for_group3 <- data.frame(timeset=colnames(PCA_H3_mat_23s)) %>% 
  mutate(sample = timeset) %>% 
  separate(timeset, into = c("indv","trt","time"), sep= "_") %>% 
  unite("test", trt:time,sep="_", remove = FALSE)
### for 3 individuals {2,3,6}
group_3 <- c( 1,2,4,5,6,7,10,1,2,3,4,7,8,9,10,1,2,3,5,6,7,8,9)
group_fac_3 <- group_3
groupid_3 <- as.numeric(group_fac_3)
label <- for_group3$sample
compid_3 <- data.frame(c1= c(2,4,6,8,1,3,5,7), c2 = c( 10,10,10,10,9,9,9,9))

y_TMM_cpm_3 <- cpm(PCA_H3_mat_23s, log = TRUE)

colnames(y_TMM_cpm_3) <- label

# set.seed(31415)
# cormotif_initial_3 <- cormotiffit(exprs = y_TMM_cpm_3, groupid = groupid_3, compid = compid_3, K=1:6, max.iter = 500, runtype = "logCPM")
cormotif_initial_23s <- readRDS("data/Final_four_data/cormotif_3_raodah_run_23s.RDS")
# saveRDS(cormotif_initial_3,"data/Final_four_data/cormotif_3_raodah_run_23s.RDS")
plotIC(cormotif_initial_23s)

Version Author Date
fb1211f E. Renee Matthews 2025-01-16
4881ad6 reneeisnowhere 2024-10-07
50f603e reneeisnowhere 2024-09-23
plotMotif(cormotif_initial_23s)

Version Author Date
fb1211f E. Renee Matthews 2025-01-16
4881ad6 reneeisnowhere 2024-10-07
50f603e reneeisnowhere 2024-09-23
# head(cormotif_initial_3$bestmotif)
motif_prob_23s <- cormotif_initial_23s$bestmotif$clustlike
rownames(motif_prob_23s) <- rownames(y_TMM_cpm_3)

background_AC_peaks <- motif_prob_23s %>% 
  as.data.frame() %>% 
  rownames_to_column("Peakid") %>% 
  dplyr::select(Peakid) %>% 
  separate(Peakid, into=c("chr","start","end"),remove = FALSE)

NR_23s <- motif_prob_23s %>%
  as.data.frame() %>% 
  dplyr::filter(V1>.5 & V2<.5 & V3 <.5& V4<0.5) %>% 
  rownames_to_column("Peakid") %>% 
  dplyr::select(Peakid) %>% 
  separate(Peakid, into=c("chr","start","end"),remove = FALSE)
 
ESR_23s <- motif_prob_23s %>%
   as.data.frame() %>% 
  dplyr::filter(V1<.5 & V2>.5 & V3 <.5& V4<0.5) %>% 
  rownames_to_column("Peakid") %>% 
  dplyr::select(Peakid) %>% 
  separate(Peakid, into=c("chr","start","end"),remove = FALSE)
 
 
EAR_23s <- motif_prob_23s %>%
  as.data.frame() %>% 
  dplyr::filter(V1<.5 & V2<.5 & V3 >.5& V4<0.5) %>% 
  rownames_to_column("Peakid") %>% 
  dplyr::select(Peakid) %>% 
  separate(Peakid, into=c("chr","start","end"),remove = FALSE)
 

LR_23s <- motif_prob_23s %>%
  as.data.frame() %>% 
  dplyr::filter(V1<.5 & V2<.5 & V3 <.5& V4>0.5) %>% 
  rownames_to_column("Peakid") %>% 
  dplyr::select(Peakid) %>% 
  separate(Peakid, into=c("chr","start","end"),remove = FALSE)
 
# saveRDS(background_AC_peaks,"data/Final_four_data/H3K27ac_files/background_AC_peaks.RDS")
# 
# saveRDS(NR_23s,"data/Final_four_data/H3K27ac_files/NR_23s.RDS")
# 
# saveRDS(ESR_23s,"data/Final_four_data/H3K27ac_files/ESR_23s.RDS")
# 
# saveRDS(EAR_23s,"data/Final_four_data/H3K27ac_files/EAR_23s.RDS")
# 
# saveRDS(LR_23s,"data/Final_four_data/H3K27ac_files/LR_23s.RDS")
Clust_1 <- readRDS("data/Final_four_data/H3K27ac_files/NR_23s.RDS")

Clust_2 <- readRDS("data/Final_four_data/H3K27ac_files/ESR_23s.RDS")

Clust_3 <- readRDS("data/Final_four_data/H3K27ac_files/EAR_23s.RDS")

Clust_4 <- readRDS("data/Final_four_data/H3K27ac_files/LR_23s.RDS")

# AC.DNR_24.top %>% 
#   rownames_to_column("AC_Peakid") %>% 
#   dplyr::select(AC_Peakid) %>% 
#   mutate(Cluster = case_when(
#     AC_Peakid %in% Clust_1$Peakid ~ "Clust_1",
#     AC_Peakid %in% Clust_2$Peakid ~ "Clust_2",
#     AC_Peakid %in% Clust_3$Peakid ~ "Clust_3",
#     AC_Peakid %in% Clust_4$Peakid ~ "Clust_4",
#     TRUE ~ "not_in_cluster")) %>% 
#   write_delim(.,file="data/Final_four_data/H3K27ac_files/Cluster_dataframe.txt",delim="\t")

Cluster log2cpm example boxplots

set.seed(31415)
sample_peaks <- rbind(
  "clust_1"=sample_n(Clust_1,size = 2),
  "clust_2"=sample_n(Clust_2,size=2),
  "clust_3"=sample_n(Clust_3,size=2),
  "clust_4"=sample_n(Clust_4, size=2)) 
sample_peaks_choice <- sample_peaks %>% 
  dplyr::filter(rownames(.)=="clust_1.2"|
                  rownames(.)=="clust_2.1"|
                  rownames(.)=="clust_3.1"|
                  rownames(.)=="clust_4.1")
lcpm_h3_23s%>% 
  as.data.frame() %>% 
  rownames_to_column("Peakid")%>% 
  dplyr::filter(Peakid %in% sample_peaks_choice$Peakid) %>%
  pivot_longer(., cols = !Peakid, names_to = "samples",values_to = "logcpm") %>% 
  separate_wider_delim(., samples, delim = "_",names=c("ind","trt","time"), cols_remove = FALSE) %>% 
  left_join(., (sample_peaks %>% 
              rownames_to_column("cluster") %>% 
              dplyr::select(cluster,Peakid)),
            by=c("Peakid"="Peakid")) %>% 
  mutate(trt=factor(trt, levels = c("DOX","EPI","DNR","MTX","TRZ", "VEH")),
         time= factor(time, levels = c("3","24"))) %>% 
  ggplot(aes(x=time,y=logcpm))+
  geom_boxplot(aes(fill=trt))+
  # geom_point(aes(color=ind))+
  facet_wrap(~Peakid+cluster,scales="free_y", nrow=4, ncol=2)+
  ggtitle(" H3K27ac acetylation")+
  scale_fill_manual(values = drug_pal)+
  theme_bw()+
  ylab("log2 cpm H3K27ac")

Version Author Date
b037f13 E. Renee Matthews 2025-02-14

Additional QC on H3K27ac CUT&Tag

# saveRDS(H3K27ac_count_txt,"data/Final_four_data/H3K27ac_files/featureCounts_summary_masterpeak_set.RDS")

H3K27ac_count_txt <- readRDS("data/Final_four_data/H3K27ac_files/featureCounts_summary_masterpeak_set.RDS")

names(H3K27ac_count_txt ) = gsub(pattern = "_final.bam*", replacement = "", x = names(H3K27ac_count_txt ))
names(H3K27ac_count_txt ) = gsub(pattern = "^Individual_data/77-1/bamFiles/*", replacement = "", x = names(H3K27ac_count_txt ))
names(H3K27ac_count_txt ) = gsub(pattern = "^Individual_data/87-1/bamFiles/*", replacement = "", x = names(H3K27ac_count_txt ))
names(H3K27ac_count_txt ) = gsub(pattern = "^Individual_data/71-1/bamFiles/*", replacement = "", x = names(H3K27ac_count_txt ))


names(H3K27ac_count_txt ) = gsub(pattern = "*87_1_*", replacement = "A_", x = names(H3K27ac_count_txt ))
 names(H3K27ac_count_txt ) = gsub(pattern = "77_1_*", replacement = "B_", x = names(H3K27ac_count_txt ))
 names(H3K27ac_count_txt ) = gsub(pattern = "71_1_*", replacement = "C_", x = names(H3K27ac_count_txt ))
 
H3K27ac_summary <- H3K27ac_count_txt %>% 
  column_to_rownames("Status") %>% 
  t() %>% 
  as.data.frame() %>% 
  rownames_to_column("samples") %>% 
  rowwise() %>% 
  mutate(Total=sum(c_across(Assigned:Unassigned_Ambiguity))) %>% 
  mutate(percent=sprintf("%.2f",Assigned/Total*100)) %>% 
  # dplyr::select(samples, Assigned,Total,percent) %>% 
  mutate(samples=gsub("24","_24",samples)) %>% 
  mutate(samples=gsub("3","_3",samples)) %>% 
  mutate(percent=(as.numeric(percent))) %>% 
  separate_wider_delim(.,samples,names=c("Ind","trt","time"), delim="_",cols_remove=FALSE)

H3K27ac_summary %>% 
  dplyr::select(Ind,trt,time, percent) %>% 
  mutate(trt= factor(trt, levels = c("DOX","EPI","DNR","MTX","TRZ","VEH"))) %>% 
  mutate(time=factor(time, levels= c("3","24"))) %>% 
  # mutate(Ind=factor(I))
  ggplot(., aes(x=trt,y=percent,group=(interaction(time,trt))))+
  geom_boxplot(aes(fill=trt))+
   geom_point(aes(col=Ind, size =3))+
  # geom_hline(yintercept = 20)+
  facet_wrap(time~.)+
   scale_fill_manual(values=drug_pal)+
  scale_color_brewer(palette = "Dark2")+
  ggtitle("fraction of reads in high confidence regions")+
  theme_bw()+
  theme(strip.text = element_text(face = "bold",  hjust = .5, size = 8),
        strip.background = element_rect(fill = "white", linetype = "solid",
                                        color = "black", linewidth = 1),
        panel.spacing = unit(1, 'points'))

Version Author Date
800da7a E. Renee Matthews 2025-02-12

H3K27

# saveRDS(H3K27ac_frag_count,"data/Final_four_data/H3K27ac_files/featureCounts_fragments.RDS")

H3K27ac_frag_count <- readRDS("data/Final_four_data/H3K27ac_files/featureCounts_fragments.RDS")

names(H3K27ac_frag_count ) = gsub(pattern = "_final.bam*", replacement = "", x = names(H3K27ac_frag_count ))
names(H3K27ac_frag_count ) = gsub(pattern = "^Individual_data/77-1/bamFiles/*", replacement = "", x = names(H3K27ac_frag_count ))
names(H3K27ac_frag_count ) = gsub(pattern = "^Individual_data/87-1/bamFiles/*", replacement = "", x = names(H3K27ac_frag_count ))
names(H3K27ac_frag_count ) = gsub(pattern = "^Individual_data/71-1/bamFiles/*", replacement = "", x = names(H3K27ac_frag_count ))


names(H3K27ac_frag_count ) = gsub(pattern = "*87_1_*", replacement = "A_", x = names(H3K27ac_frag_count ))
 names(H3K27ac_frag_count ) = gsub(pattern = "77_1_*", replacement = "B_", x = names(H3K27ac_frag_count ))
 names(H3K27ac_frag_count ) = gsub(pattern = "71_1_*", replacement = "C_", x = names(H3K27ac_frag_count ))
 H3K27ac_frag_summary <- H3K27ac_frag_count %>% 
  column_to_rownames("Status") %>% 
  t() %>% 
  as.data.frame() %>% 
  rownames_to_column("samples") %>% 
  rowwise() %>% 
  mutate(Total=sum(c_across(Assigned:Unassigned_Ambiguity))) %>% 
  # mutate(percent=sprintf("%.2f",Assigned/Total*100)) %>% 
  # dplyr::select(samples, Assigned,Total,percent) %>% 
  mutate(samples=gsub("24","_24",samples)) %>% 
  mutate(samples=gsub("3","_3",samples)) %>% 
  separate_wider_delim(.,samples,names=c("Ind","trt","time"), delim="_",cols_remove=FALSE)

 H3K27ac_frag_summary %>% 
   dplyr::select(Ind:samples,Total) %>% 
   mutate(trt= factor(trt, levels = c("DOX","EPI","DNR","MTX","TRZ","VEH"))) %>% 
  mutate(time=factor(time, levels= c("3","24"))) %>% 
  # mutate(Ind=factor(I))
  ggplot(., aes(x=trt,y=Total,group=(interaction(time,trt))))+
  geom_boxplot(aes(fill=trt))+
   geom_point(aes(col=Ind, size =3))+
  # geom_hline(yintercept = 20)+
  facet_wrap(time~.)+
   scale_fill_manual(values=drug_pal)+
  scale_color_brewer(palette = "Dark2")+
  ggtitle("Fragments across treatment and time")+
  theme_bw()+
  theme(strip.text = element_text(face = "bold",  hjust = .5, size = 8),
        strip.background = element_rect(fill = "white", linetype = "solid",
                                        color = "black", linewidth = 1),
        panel.spacing = unit(1, 'points'))

Version Author Date
800da7a E. Renee Matthews 2025-02-12
allTSSE_ac <- readRDS( "data/Final_four_data/H3K27ac_files/H3K27ac_TSSE_scores.RDS")


allTSSE_ac %>% as.data.frame() %>% 
  rownames_to_column("sample") %>% 
  separate(sample, into = c("indv","trt","time"), sep= "_") %>%
  mutate(trt= factor(trt, levels = c("DOX","EPI","DNR","MTX","TRZ","VEH"))) %>% 
  mutate(time = factor(time, levels = c("3","24"),labels = c("3 hours","24 hours"))) %>% 
  dplyr::filter(indv !=4 &indv !=5) %>% 
  ggplot(., aes(x= time, y= V1, group = indv))+

   # geom_col(position= "dodge",aes(fill=trt)) %>%
  # geom_jitter(aes(col = trt, size = 1.5, alpha = 0.5) ,  position=position_jitter(0.25))+
  geom_point(aes(col = trt,size = 1.5,alpha = 0.5))+
  geom_hline(yintercept=5, linetype = 3)+
    geom_hline(yintercept=7, col = "blue")+
  facet_wrap(~indv)+
   theme_bw()+
  ggtitle("TSS enrichment scores")+
   scale_color_manual(values=drug_pal)+
   theme(strip.text = element_text(face = "bold",  hjust = .5, size = 8),
        strip.background = element_rect(fill = "white", linetype = "solid",
                                        color = "black", linewidth = 1))

Version Author Date
800da7a E. Renee Matthews 2025-02-12

Plot TSS profile

txdb <- TxDb.Hsapiens.UCSC.hg38.knownGene
###taken from Peak_calling rmd

## first get peakfiles (using .narrowPeak files from MACS2 calling) and upload functions
# loadFile_peakCall <- function(){
#  file <- choose.files()
#  file <- readPeakFile(file, header = FALSE)
#  return(file)
# }

# prepGRangeObj <- function(seek_object){
#  seek_object$Peaks = seek_object$V4
#  seek_object$level = seek_object$V5
#  seek_object$V4 = seek_object$V5 = NULL
#  return(seek_object)
# }
TSS = getBioRegion(TxDb=txdb, upstream=2000, downstream=2000, by = "gene", 
                   type = "start_site")

# ind4_V24hpeaks_gr <- prepGRangeObj(ind4_V24hpeaks)
# ind1_DA24hpeaks_gr <- prepGRangeObj((ind1_DA24hpeaks))
# Epi_list <- GRangesList(ind1_DA24hpeaks_gr, ind4_V24hpeaks_gr)
# # ##plotting the TSS average window (making an overlap of each using Epi_list as list holder)
# Epi_list_tagMatrix = lapply(Epi_list, getTagMatrix, windows = TSS)
# plotAvgProf(Epi_list_tagMatrix, xlim=c(-3000, 3000), ylab = "Count Frequency")
#plotPeakProf(Epi_list_tagMatrix, facet = "none", conf = 0.95)

## What I did here:  I called all my narrowpeak files
peakfiles1 <- choose.files()

##these were practice for getting file names and shortening for the for loop below
# testname <- basename(peakfiles1[1])
# str_split_i(testname, "_",3)

##This loop first established a list then (because I already knew the list had 12 files)
## I then imported each of these onto that list.  Once I had the list, I stored it as
## an R object, 
IndA_peaks <- list()
for (file in 1:8){
    testname <- basename(peakfiles1[file])
  banana_peel <- str_split_i(testname, "_",3)
 IndA_peaks[[banana_peel]] <- readPeakFile(peakfiles1[file])
}
saveRDS(IndA_peaks, "data/Final_four_data/H3K27ac_files/IndA_peaks_list.RDS")
# I then called annotatePeak on that list object, and stored that as a R object for later retrieval.)
peakAnnoList_1 <- lapply(IndA_peaks, annotatePeak, tssRegion =c(-2000,2000), TxDb= txdb)
saveRDS(peakAnnoList_1, "data/Final_four_data/H3K27ac_files/IndA_peakAnnoList.RDS")
promoter <- getPromoters(TxDb=txdb, upstream=3000, downstream=3000)
tagMatrix_C <- lapply(IndC_peaks,getTagMatrix, windows=promoter)
plotAvgProf(tagMatrix_C, xlim = c(-3000,3000),xlab = "Genomic Region (5'->3')", ylab = "Read Count Frequency")

saveRDS(tagMatrix_C, "data/Final_four_data/H3K27ac_files/IndC_tagMatrix.RDS")

Making the plot

# short_pal <- c("#8B006D","#DF707E","#F1B72B", "#3386DD","#41B333")
##load tagMatrix files from above
tagMatrix_A <- readRDS("data/Final_four_data/H3K27ac_files/IndA_tagMatrix.RDS")
tagMatrix_B <- readRDS("data/Final_four_data/H3K27ac_files/IndB_tagMatrix.RDS")
tagMatrix_C <- readRDS("data/Final_four_data/H3K27ac_files/IndC_tagMatrix.RDS")
###making the plots and storing the 3 hour as an object
a1<- plotAvgProf(tagMatrix_A[c(1,3,5,7)], xlim=c(-3000, 3000), ylab = "Count Frequency")+ ggtitle("3 hour Individual A" )+coord_cartesian(xlim=c(-2000,2000))
>> plotting figure...            2025-05-01 11:12:41 AM 
b1 <- plotAvgProf(tagMatrix_B[c(1,3,4,7)], xlim=c(-3000, 3000), ylab = "Count Frequency")+ ggtitle("3 hour Individual B" )+coord_cartesian(xlim=c(-2000,2000))
>> plotting figure...            2025-05-01 11:12:42 AM 
c1 <- plotAvgProf(tagMatrix_C[c(1,4,6,8)], xlim=c(-3000, 3000), ylab = "Count Frequency")+ ggtitle("3 hour Individual C" )+coord_cartesian(xlim=c(-2000,2000))
>> plotting figure...            2025-05-01 11:12:42 AM 
### making the plots and storing the 24 hour as an object
a2<- plotAvgProf(tagMatrix_A[c(2,4,6,8)], xlim=c(-3000, 3000), ylab = "Count Frequency")+ ggtitle("24 hour Individual A" )+coord_cartesian(xlim=c(-2000,2000))
>> plotting figure...            2025-05-01 11:12:42 AM 
b2 <- plotAvgProf(tagMatrix_B[c(2,5,6,8)], xlim=c(-3000, 3000), ylab = "Count Frequency")+ ggtitle("24 hour Individual B" )+coord_cartesian(xlim=c(-2000,2000))
>> plotting figure...            2025-05-01 11:12:42 AM 
c2 <- plotAvgProf(tagMatrix_C[c(2,3,5,7,9)], xlim=c(-3000, 3000), ylab = "Count Frequency")+ ggtitle("24 hour Individual C" )+coord_cartesian(xlim=c(-2000,2000))
>> plotting figure...            2025-05-01 11:12:43 AM 
plot_grid(a1,a2, b1,b2,c1,c2, axis="l",align = "hv",nrow=3, ncol=2)

Version Author Date
b037f13 E. Renee Matthews 2025-02-14
###overlap with chr6.36678380.36679788

overlap_SNP_peaks <- c(
  AC_peakid=c("chr6.36674959.36687167","chr9.76818277.76818859"))
 
lcpm_h3_23s%>% 
  as.data.frame() %>% 
  rownames_to_column("Peakid")%>% 
  dplyr::filter(Peakid %in% overlap_SNP_peaks) %>%
  pivot_longer(., cols = !Peakid, names_to = "samples",values_to = "logcpm") %>% 
  separate_wider_delim(., samples, delim = "_",names=c("ind","trt","time"), cols_remove = FALSE) %>% 
  left_join(., (sample_peaks %>% 
              rownames_to_column("cluster") %>% 
              dplyr::select(cluster,Peakid)),
            by=c("Peakid"="Peakid")) %>% 
  mutate(trt=factor(trt, levels = c("DOX","EPI","DNR","MTX","TRZ", "VEH")),
         time= factor(time, levels = c("3","24"))) %>% 
  ggplot(aes(x=time,y=logcpm))+
  geom_boxplot(aes(fill=trt))+
  # geom_point(aes(color=ind))+
  facet_wrap(~Peakid+cluster,scales="free_y", nrow=4, ncol=2)+
  ggtitle(" H3K27ac acetylation")+
  scale_fill_manual(values = drug_pal)+
  theme_bw()+
  ylab("log2 cpm H3K27ac")

Version Author Date
6a0a917 E. Renee Matthews 2025-02-17

sessionInfo()
R version 4.4.2 (2024-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64
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      stats4    stats     graphics  grDevices utils     datasets 
[8] methods   base     

other attached packages:
 [1] cowplot_1.1.3                           
 [2] smplot2_0.2.5                           
 [3] ComplexHeatmap_2.22.0                   
 [4] ggrepel_0.9.6                           
 [5] plyranges_1.26.0                        
 [6] ggsignif_0.6.4                          
 [7] genomation_1.38.0                       
 [8] eulerr_7.0.2                            
 [9] devtools_2.4.5                          
[10] usethis_3.1.0                           
[11] ggpubr_0.6.0                            
[12] BiocParallel_1.40.0                     
[13] Cormotif_1.52.0                         
[14] affy_1.84.0                             
[15] scales_1.3.0                            
[16] VennDiagram_1.7.3                       
[17] futile.logger_1.4.3                     
[18] gridExtra_2.3                           
[19] edgeR_4.4.2                             
[20] limma_3.62.2                            
[21] rtracklayer_1.66.0                      
[22] TxDb.Hsapiens.UCSC.hg38.knownGene_3.20.0
[23] GenomicFeatures_1.58.0                  
[24] AnnotationDbi_1.68.0                    
[25] Biobase_2.66.0                          
[26] GenomicRanges_1.58.0                    
[27] GenomeInfoDb_1.42.3                     
[28] IRanges_2.40.1                          
[29] S4Vectors_0.44.0                        
[30] BiocGenerics_0.52.0                     
[31] ChIPseeker_1.42.1                       
[32] RColorBrewer_1.1-3                      
[33] broom_1.0.7                             
[34] kableExtra_1.4.0                        
[35] lubridate_1.9.4                         
[36] forcats_1.0.0                           
[37] stringr_1.5.1                           
[38] dplyr_1.1.4                             
[39] purrr_1.0.4                             
[40] readr_2.1.5                             
[41] tidyr_1.3.1                             
[42] tibble_3.2.1                            
[43] ggplot2_3.5.1                           
[44] tidyverse_2.0.0                         
[45] workflowr_1.7.1                         

loaded via a namespace (and not attached):
  [1] fs_1.6.5                               
  [2] matrixStats_1.5.0                      
  [3] bitops_1.0-9                           
  [4] enrichplot_1.26.6                      
  [5] doParallel_1.0.17                      
  [6] httr_1.4.7                             
  [7] profvis_0.4.0                          
  [8] tools_4.4.2                            
  [9] backports_1.5.0                        
 [10] R6_2.6.1                               
 [11] mgcv_1.9-1                             
 [12] lazyeval_0.2.2                         
 [13] GetoptLong_1.0.5                       
 [14] urlchecker_1.0.1                       
 [15] withr_3.0.2                            
 [16] preprocessCore_1.68.0                  
 [17] cli_3.6.4                              
 [18] formatR_1.14                           
 [19] labeling_0.4.3                         
 [20] sass_0.4.9                             
 [21] Rsamtools_2.22.0                       
 [22] systemfonts_1.2.1                      
 [23] yulab.utils_0.2.0                      
 [24] foreign_0.8-88                         
 [25] DOSE_4.0.0                             
 [26] svglite_2.1.3                          
 [27] R.utils_2.13.0                         
 [28] sessioninfo_1.2.3                      
 [29] plotrix_3.8-4                          
 [30] BSgenome_1.74.0                        
 [31] pwr_1.3-0                              
 [32] impute_1.80.0                          
 [33] rstudioapi_0.17.1                      
 [34] RSQLite_2.3.9                          
 [35] shape_1.4.6.1                          
 [36] generics_0.1.3                         
 [37] gridGraphics_0.5-1                     
 [38] TxDb.Hsapiens.UCSC.hg19.knownGene_3.2.2
 [39] BiocIO_1.16.0                          
 [40] vroom_1.6.5                            
 [41] gtools_3.9.5                           
 [42] car_3.1-3                              
 [43] GO.db_3.20.0                           
 [44] Matrix_1.7-3                           
 [45] abind_1.4-8                            
 [46] R.methodsS3_1.8.2                      
 [47] lifecycle_1.0.4                        
 [48] whisker_0.4.1                          
 [49] yaml_2.3.10                            
 [50] carData_3.0-5                          
 [51] SummarizedExperiment_1.36.0            
 [52] gplots_3.2.0                           
 [53] qvalue_2.38.0                          
 [54] SparseArray_1.6.2                      
 [55] blob_1.2.4                             
 [56] promises_1.3.2                         
 [57] crayon_1.5.3                           
 [58] miniUI_0.1.1.1                         
 [59] ggtangle_0.0.6                         
 [60] lattice_0.22-6                         
 [61] KEGGREST_1.46.0                        
 [62] magick_2.8.5                           
 [63] pillar_1.10.1                          
 [64] knitr_1.49                             
 [65] fgsea_1.32.2                           
 [66] rjson_0.2.23                           
 [67] boot_1.3-31                            
 [68] codetools_0.2-20                       
 [69] fastmatch_1.1-6                        
 [70] glue_1.8.0                             
 [71] getPass_0.2-4                          
 [72] ggfun_0.1.8                            
 [73] data.table_1.17.0                      
 [74] remotes_2.5.0                          
 [75] vctrs_0.6.5                            
 [76] png_0.1-8                              
 [77] treeio_1.30.0                          
 [78] gtable_0.3.6                           
 [79] cachem_1.1.0                           
 [80] xfun_0.51                              
 [81] S4Arrays_1.6.0                         
 [82] mime_0.12                              
 [83] iterators_1.0.14                       
 [84] statmod_1.5.0                          
 [85] ellipsis_0.3.2                         
 [86] nlme_3.1-167                           
 [87] ggtree_3.14.0                          
 [88] bit64_4.6.0-1                          
 [89] rprojroot_2.0.4                        
 [90] bslib_0.9.0                            
 [91] affyio_1.76.0                          
 [92] rpart_4.1.24                           
 [93] KernSmooth_2.23-26                     
 [94] Hmisc_5.2-2                            
 [95] colorspace_2.1-1                       
 [96] DBI_1.2.3                              
 [97] nnet_7.3-20                            
 [98] seqPattern_1.38.0                      
 [99] tidyselect_1.2.1                       
[100] processx_3.8.6                         
[101] bit_4.6.0                              
[102] compiler_4.4.2                         
[103] curl_6.2.1                             
[104] git2r_0.35.0                           
[105] htmlTable_2.4.3                        
[106] xml2_1.3.7                             
[107] DelayedArray_0.32.0                    
[108] checkmate_2.3.2                        
[109] caTools_1.18.3                         
[110] callr_3.7.6                            
[111] digest_0.6.37                          
[112] rmarkdown_2.29                         
[113] XVector_0.46.0                         
[114] base64enc_0.1-3                        
[115] htmltools_0.5.8.1                      
[116] pkgconfig_2.0.3                        
[117] MatrixGenerics_1.18.1                  
[118] fastmap_1.2.0                          
[119] GlobalOptions_0.1.2                    
[120] rlang_1.1.5                            
[121] htmlwidgets_1.6.4                      
[122] UCSC.utils_1.2.0                       
[123] shiny_1.10.0                           
[124] farver_2.1.2                           
[125] jquerylib_0.1.4                        
[126] zoo_1.8-13                             
[127] jsonlite_1.9.1                         
[128] GOSemSim_2.32.0                        
[129] R.oo_1.27.0                            
[130] RCurl_1.98-1.16                        
[131] magrittr_2.0.3                         
[132] Formula_1.2-5                          
[133] GenomeInfoDbData_1.2.13                
[134] ggplotify_0.1.2                        
[135] patchwork_1.3.0                        
[136] munsell_0.5.1                          
[137] Rcpp_1.0.14                            
[138] ape_5.8-1                              
[139] stringi_1.8.4                          
[140] zlibbioc_1.52.0                        
[141] plyr_1.8.9                             
[142] pkgbuild_1.4.6                         
[143] parallel_4.4.2                         
[144] Biostrings_2.74.1                      
[145] splines_4.4.2                          
[146] circlize_0.4.16                        
[147] hms_1.1.3                              
[148] locfit_1.5-9.12                        
[149] ps_1.9.0                               
[150] igraph_2.1.4                           
[151] reshape2_1.4.4                         
[152] pkgload_1.4.0                          
[153] futile.options_1.0.1                   
[154] XML_3.99-0.18                          
[155] evaluate_1.0.3                         
[156] lambda.r_1.2.4                         
[157] BiocManager_1.30.25                    
[158] foreach_1.5.2                          
[159] tzdb_0.4.0                             
[160] httpuv_1.6.15                          
[161] clue_0.3-66                            
[162] gridBase_0.4-7                         
[163] xtable_1.8-4                           
[164] restfulr_0.0.15                        
[165] tidytree_0.4.6                         
[166] rstatix_0.7.2                          
[167] later_1.4.1                            
[168] viridisLite_0.4.2                      
[169] aplot_0.2.5                            
[170] memoise_2.0.1                          
[171] GenomicAlignments_1.42.0               
[172] cluster_2.1.8.1                        
[173] timechange_0.3.0