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 cfc813a. 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/Raodah_mycount.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/Figure_6.Rmd) and HTML (docs/Figure_6.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 99ea869 E. Renee Matthews 2025-02-26 Build site.
Rmd 3af930f E. Renee Matthews 2025-02-26 wflow_publish("analysis/Figure_6.Rmd")

Figure 6:

knitr::include_graphics("assets/Figure\ 6.png", error=FALSE)

Version Author Date
ca5c73f E. Renee Matthews 2025-02-26
50f3de9 E. Renee Matthews 2025-02-21
knitr::include_graphics("docs/assets/Figure\ 6.png",error = FALSE)

library(tidyverse)
library(kableExtra)
library(broom)
library(RColorBrewer)
library("TxDb.Hsapiens.UCSC.hg38.knownGene")
library("org.Hs.eg.db")
library(rtracklayer)
library(ggfortify)
library(readr)
library(BiocGenerics)
library(gridExtra)
library(VennDiagram)
library(scales)
library(ggVennDiagram)
library(BiocParallel)
library(ggpubr)
library(edgeR)
library(genomation)
library(ggsignif)
library(plyranges)
library(ggrepel)
library(ComplexHeatmap)
library(cowplot)
library(smplot2)
library(readxl)
library(devtools)
library(vargen)
Collapsed_new_peaks <- read_delim("data/Final_four_data/collapsed_new_peaks.txt", delim = "\t", col_names = TRUE)
Collapsed_new_peaks_gr <- Collapsed_new_peaks %>% dplyr::select(chr:Peakid) %>%  dplyr::filter(chr!="chrY") %>%
  GRanges() %>% 
  keepStandardChromosomes(pruning.mode = "coarse")  


RNA_median_3_lfc <- readRDS("data/other_papers/RNA_median_3_lfc.RDS")
RNA_median_24_lfc <- readRDS("data/other_papers/RNA_median_24_lfc.RDS")

RNA_LFC <- RNA_median_3_lfc %>% 
  left_join(RNA_median_24_lfc, by = c("ENTREZID"="ENTREZID","SYMBOL"="SYMBOL"))


ATAC_24_lfc <- read_csv("data/Final_four_data/median_24_lfc.csv") 
ATAC_3_lfc <- read_csv("data/Final_four_data/median_3_lfc.csv")

ATAC_LFC <- Collapsed_new_peaks %>%
                 dplyr::select(Peakid) %>% 
  left_join(.,(ATAC_3_lfc %>% dplyr::select(peak, med_3h_lfc)), by=c("Peakid"="peak")) %>% 
  left_join(.,(ATAC_24_lfc %>% dplyr::select(peak, med_24h_lfc)), by=c("Peakid"="peak"))

Schneider_all_SNPS <- read_delim("data/other_papers/Schneider_all_SNPS.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)

Schneider_all_SNPS_df <- Schneider_all_SNPS %>% 
  dplyr::rename("RSID"="#Uploaded_variation") %>% 
  dplyr::select(RSID,Location,SYMBOL,Gene, SOURCE) %>%
  distinct(RSID,Location,SYMBOL,.keep_all = TRUE) %>% 
  separate_wider_delim(Location,delim=":",names=c("Chr","Coords")) %>% 
  separate_wider_delim(Coords,delim= "-", names= c("Start","End")) %>% 
  mutate(Chr=paste0("chr",Chr)) %>% 
  group_by(RSID) %>% 
  summarize(Chr=unique(Chr),
            Start=unique(Start),
            End=unique(End),
            SYMBOL=paste(unique(SYMBOL),collapse=";"),
            Gene=paste(Gene,collapse=";"),
            SOURCE=paste(SOURCE,collapse=";")
            ) %>% 
  GRanges() %>% keepStandardChromosomes(pruning.mode = "coarse")  %>% as.data.frame 

schneider_gr <-Schneider_all_SNPS_df%>%
  dplyr::select(seqnames,start,end,RSID:SOURCE) %>%
  distinct() %>% 
  GRanges()

schneider_10k_gr <- Schneider_all_SNPS_df%>%
  dplyr::select(seqnames,start,end,RSID:SOURCE) %>%
  mutate(start=(start-5000),end=(end+4999), width=10000) %>%
  distinct() %>% 
  GRanges()
 
schneider_20k_gr <- Schneider_all_SNPS_df%>%
  dplyr::select(seqnames,start,end,RSID:SOURCE) %>%
  mutate(start=(start-10000),end=(end+9999), width=20000) %>%
  distinct() %>% 
  GRanges()

schneider_50k_gr <- Schneider_all_SNPS_df%>%
  dplyr::select(seqnames,start,end,RSID:SOURCE) %>%
  mutate(start=(start-20000),end=(end+24999), width=50000) %>%
  distinct() %>% 
  GRanges()
 

SNP_peak_check <- join_overlap_intersect(Collapsed_new_peaks_gr,schneider_gr) %>%
  as.data.frame()
 
SNP_peak_check_10k <- join_overlap_intersect(Collapsed_new_peaks_gr,schneider_10k_gr) %>%
  as.data.frame()

SNP_peak_check_20k <- join_overlap_intersect(Collapsed_new_peaks_gr,schneider_20k_gr) %>% 
  as.data.frame()
SNP_peak_check_50k <- join_overlap_intersect(Collapsed_new_peaks_gr,schneider_50k_gr) %>% 
  as.data.frame()

point_only <- SNP_peak_check
SNP_10k_only <- SNP_peak_check_10k
SNP_20k_only <- SNP_peak_check_20k
SNP_50k_only <- SNP_peak_check_50k

ATAC_peaks_gr <- Collapsed_new_peaks %>% GRanges()

Peaks_cutoff <- read_delim("data/Final_four_data/LCPM_matrix_ff.txt",delim = "/") %>%
  dplyr::select(Peakid)
  
schneider_short_list <- point_only %>% as.data.frame %>% dplyr::filter(Peakid %in%Peaks_cutoff$Peakid)
schneider_10k_list <- SNP_10k_only %>% distinct(RSID,Peakid)%>% dplyr::filter(Peakid %in%Peaks_cutoff$Peakid)
schneider_20k_list <- SNP_20k_only %>% distinct(RSID,Peakid)%>% dplyr::filter(Peakid %in%Peaks_cutoff$Peakid)
schneider_50k_list <- SNP_50k_only %>% distinct(RSID,Peakid)%>% dplyr::filter(Peakid %in%Peaks_cutoff$Peakid)

Nine_te_df <- readRDS("data/Final_four_data/Nine_group_TE_df.RDS")
###needed to change TE status to at least 1 bp overlap
match <- Nine_te_df %>% 
   mutate(TEstatus=if_else(!is.na(per_ol),"TE_peak","not_TE_peak")) %>% 
  distinct(Peakid,TEstatus,mrc,.keep_all = TRUE) 

Figure 6A:

hm_lfc_df <- SNP_peak_check_20k %>% 
  left_join(., Nine_te_df, by = c("Peakid"="Peakid") ) %>% 
  dplyr::filter(mrc != "NR") %>% 
  dplyr::filter(mrc !="not_mrc") %>%  
  mutate(dist_to_SNP=case_when(
    Peakid %in% schneider_short_list$Peakid &RSID %in% schneider_short_list$RSID~ 0,
    Peakid %in% schneider_10k_list$Peakid &RSID %in% schneider_10k_list$RSID~ 10,
    Peakid %in% schneider_20k_list$Peakid &RSID %in% schneider_20k_list$RSID~ 20,
     Peakid %in% schneider_50k_list$Peakid &RSID %in% schneider_50k_list$RSID ~ 50)) %>% 
    left_join(ATAC_LFC) %>% 
  tidyr::unite(name,Peakid,RSID,SYMBOL, sep = "_", remove = FALSE) %>% 
  group_by(Peakid, RSID) %>% 
   summarize(name=unique(name),
           med_3h_lfc=unique(med_3h_lfc),
           med_24h_lfc=unique(med_24h_lfc),
           repClass=paste(unique(repClass),collapse=":"),
           TEstatus=paste(unique(TEstatus),collapse=";"),
          SYMBOL=paste(unique(SYMBOL),collapse=";"),
          mrc=unique(mrc),
          dist_to_SNP=min(dist_to_SNP))  %>% 
  arrange(., Peakid)
  


hm_lfc_mat <-hm_lfc_df %>%
  dplyr::select(Peakid,RSID,  med_3h_lfc, med_24h_lfc) %>% 
  tidyr::unite(name, Peakid, RSID, sep = "_") %>% 
  column_to_rownames("name") %>% 
  as.matrix()

hm_name_mat <-hm_lfc_df %>% 
  dplyr::select (Peakid, RSID, TEstatus, mrc,dist_to_SNP) %>% 
   tidyr::unite(name, Peakid, RSID, sep = "_")  
  col_fun <- circlize::colorRamp2(c(-4, 0, 4), c("blue", "white", "red"))
row_anno_lfc <- ComplexHeatmap::rowAnnotation(
    TE_status=hm_name_mat$TEstatus,
    reheat_status=hm_name_mat$reheat,
    MRC=hm_name_mat$mrc,
    direct_overlap=hm_name_mat$dist_to_SNP,
    col= list(
    TE_status=c("TE_peak"="goldenrod",
                "not_TE_peak"="lightblue"),
    MRC = c("EAR_open" = "#F8766D",
            "EAR_close" = "#f6483c",
            "ESR_open" = "#7CAE00",
            "ESR_close" = "#587b00",
            "ESR_opcl"="grey40",
            "ESR_clop"="tan",
            "LR_open" = "#00BFC4",
            "LR_close" = "#008d91",
            "NR" = "#C77CFF",
            "not_mrc"="black"),   
    reheat_status=c("reheat_gene"="green",
                    "not_reheat_gene"="orange"),
    direct_overlap=c("0"="red",
                     "10"="pink",
                     "20"="tan2",
                     "50"="grey8")))

simply_map_lfc <- ComplexHeatmap::Heatmap(hm_lfc_mat,
                                          col = col_fun,
                        left_annotation = row_anno_lfc,
                        show_row_names = TRUE,
                       row_names_max_width= max_text_width(rownames(hm_lfc_mat),                                                        gp=gpar(fontsize=16)),
                        heatmap_legend_param = list(direction = "horizontal"),
                        show_column_names = TRUE,
                        cluster_rows = FALSE,
                        cluster_columns = FALSE)

draw(simply_map_lfc, 
     merge_legend = TRUE, 
     heatmap_legend_side = "bottom", 
    annotation_legend_side = "bottom")

Version Author Date
99ea869 E. Renee Matthews 2025-02-26
ParkSNPs <- readRDS("data/other_papers/ParkSNPs_pull_VEF.RDS")

ParkSNP_table <-
  ParkSNPs %>% 
  dplyr::select(1:2) %>% 
    distinct() %>% 
    separate_wider_delim(.,Location,delim=":",names=c("chr","position"), cols_remove=FALSE) %>% 
    separate_wider_delim(.,position,delim="-",names=c("begin","term")) %>%
    mutate(chr=paste0("chr",chr)) 
ParkSNP_gr <- ParkSNP_table %>% 
  mutate("start" = begin, "end"=term) %>% 
    GRanges()
ParkSNP_10k_gr <- ParkSNP_table %>% 
  mutate(begin=as.numeric(begin),term=as.numeric(term)) %>% 
  mutate(start=begin-5000, end=term+5000) %>% 
  GRanges()

ParkSNP_20k_gr <- ParkSNP_table %>% 
  mutate(begin=as.numeric(begin),term=as.numeric(term)) %>% 
  mutate(start=begin-10000, end=term+10000) %>% 
  GRanges()

ParkSNP_gr_check <- join_overlap_intersect(Collapsed_new_peaks_gr,ParkSNP_gr) %>%
  as.data.frame()

ParkSNP_gr_10k_check <- join_overlap_intersect(Collapsed_new_peaks_gr,ParkSNP_10k_gr) %>%
  as.data.frame()

ParkSNP_gr_20k_check <- join_overlap_intersect(Collapsed_new_peaks_gr,ParkSNP_20k_gr) %>%
  as.data.frame()
ParkSNP_gr_check <- join_overlap_intersect(Collapsed_new_peaks_gr,ParkSNP_gr) %>%
  as.data.frame()
Park_df <-ParkSNP_gr_20k_check%>% 
  as.data.frame() %>%
  dplyr::select(Peakid, X.Uploaded_variation) %>% 
  dplyr::rename("SNPS"=X.Uploaded_variation) %>% 
  left_join(., Nine_te_df, by=("Peakid"="Peakid")) %>%
  dplyr::select(Peakid, SNPS,mrc,TEstatus) %>% 
  # left_join(., (Collapsed_new_peaks %>% 
  #             dplyr::select(Peakid,NCBI_gene,SYMBOL)), by=c("Peakid"="Peakid"))
  left_join(., (ATAC_3_lfc %>%
          dplyr::select(peak,med_3h_lfc)),by=c("Peakid"="peak")) %>% 
  left_join(., (ATAC_24_lfc %>%
              dplyr::select(peak,med_24h_lfc)),by=c("Peakid"="peak"))%>% 
    dplyr::filter(mrc !="NR") %>%
  dplyr::filter(mrc !="not_mrc") %>% 
 mutate(dist_to_SNP=case_when(
    Peakid %in% ParkSNP_gr_check$Peakid &SNPS %in% ParkSNP_gr_check$X.Uploaded_variation~ 0,
    Peakid %in% ParkSNP_gr_10k_check$Peakid &SNPS %in% ParkSNP_gr_10k_check$X.Uploaded_variation~ 10,
    Peakid %in% ParkSNP_gr_20k_check$Peakid &SNPS %in% ParkSNP_gr_20k_check$X.Uploaded_variation~ 20)) %>% 
    tidyr::unite(name,Peakid,SNPS, sep = "_", remove = FALSE) %>% 
  group_by(Peakid) %>% 
   summarize(name=unique(name),
           med_3h_lfc=unique(med_3h_lfc),
           med_24h_lfc=unique(med_24h_lfc),
           TEstatus=paste(unique(TEstatus),collapse=";"),
          mrc=unique(mrc),
          dist_to_SNP=min(dist_to_SNP))  %>% 
  arrange(., Peakid)
 
new_park_mat <- Park_df%>% 
  ungroup() %>% 
  dplyr::select(name,med_3h_lfc, med_24h_lfc) %>% 
  column_to_rownames("name") %>% 
  as.matrix()
new_park_name_mat <- Park_df %>% 
  ungroup() %>% 
  dplyr::select(name,TEstatus,mrc,dist_to_SNP)

row_anno_park <-
  rowAnnotation(
    TE_status=new_park_name_mat$TEstatus,
    # gwas_status=new_park_name_mat$GWAS,
    MRC=new_park_name_mat$mrc,
    direct_overlap=new_park_name_mat$dist_to_SNP,
    col= list(TE_status=c("TE_peak"="goldenrod",
                          "not_TE_peak"="lightblue"), 
              MRC = c("EAR_open" = "#F8766D",
                      "EAR_close" = "#f6483c",
                      "ESR_open" = "#7CAE00",
                      "ESR_close" = "#587b00",
                      "ESR_opcl"="grey40", 
                      "ESR_clop"="tan",
                      "LR_open" = "#00BFC4",
                      "LR_close" = "#008d91",
                      "NR" = "#C77CFF",
                      "not_mrc"="black"),
              # gwas_status=c("AF"="green",
              #               "HF"="orange", 
              #               "AF;HF"="purple3"),
              direct_overlap=c("0"="red",
                               "10"="pink",
                               "20"="tan2",
                               "50"="grey8")))
col_fun <- circlize::colorRamp2(c(-4, 0, 4), c("blue", "white", "red"))
simply_map_park <- ComplexHeatmap::Heatmap(new_park_mat,
                                           col=col_fun,
                        left_annotation = row_anno_park,
                        row_names_max_width = max_text_width(rownames(new_park_mat),  
                                                             gp=gpar(fontsize=16)),
                        heatmap_legend_param = list(direction = "horizontal"),
                        show_column_names = TRUE,
                        cluster_rows = FALSE,
                        cluster_columns = FALSE)

draw(simply_map_park, merge_legend = TRUE, heatmap_legend_side = "bottom", 
    annotation_legend_side = "bottom")

Version Author Date
99ea869 E. Renee Matthews 2025-02-26

Figure 6B: Chromatin accessibility within 5 kb of rs10753081

drug_pal <- c("#8B006D","#DF707E","#F1B72B", "#3386DD","#707031","#41B333")
# K27_counts <-  readRDS("data/Final_four_data/All_Raodahpeaks.RDS")
ATAC_counts <- readRDS("data/Final_four_data/ATAC_filtered_raw_counts_allsamples.RDS") %>% 
  cpm(., log = TRUE) %>% 
   as.data.frame() %>%
  rename_with(.,~gsub(pattern = "Ind1_75", replacement = "D_",.)) %>%
  rename_with(.,~gsub(pattern = "Ind2_87", replacement = "A_",.)) %>%
  rename_with(.,~gsub(pattern = "Ind3_77", replacement = "B_",.)) %>%
  rename_with(.,~gsub(pattern = "Ind6_71", replacement = "C_",.)) %>%
  rename_with(.,~gsub( "DX" ,'DOX',.)) %>%
  rename_with(.,~gsub( "DA" ,'DNR',.)) %>%
  rename_with(.,~gsub( "E" ,'EPI',.)) %>%
  rename_with(.,~gsub( "T" ,'TRZ',.)) %>%
  rename_with(.,~gsub( "M" ,'MTX',.)) %>%
  rename_with(.,~gsub( "V" ,'VEH',.)) %>%
  rename_with(.,~gsub("24h","_24h",.)) %>%
  rename_with(.,~gsub("3h","_3h",.)) %>% 
  rownames_to_column("Peakid")




RNA_counts <- readRDS("data/other_papers/cpmcount.RDS") %>%
  dplyr::rename_with(.,~gsub(pattern="Da",replacement="DNR",.)) %>% 
 dplyr::rename_with(.,~gsub(pattern="Do",replacement="DOX",.)) %>% 
  dplyr::rename_with(.,~gsub(pattern="Ep",replacement="EPI",.)) %>% 
   dplyr::rename_with(.,~gsub(pattern="Mi",replacement="MTX",.)) %>% 
    dplyr::rename_with(.,~gsub(pattern="Tr",replacement="TRZ",.)) %>% 
       dplyr::rename_with(.,~gsub(pattern="Ve",replacement="VEH",.)) %>% 
  rownames_to_column("ENTREZID")

df_gene_schneider <- data.frame(SYMBOL=c("PRDX6","DARS2"))

df_gene_schneider <- df_gene_schneider %>% 
left_join(., (RNA_median_24_lfc %>% dplyr::select(ENTREZID,SYMBOL)), by = c ("SYMBOL"="SYMBOL")) %>% 
   left_join(., (hm_lfc_df %>% dplyr::select(RSID,Peakid,SYMBOL) %>% separate_longer_delim(SYMBOL,delim=";")),by = c("SYMBOL"="SYMBOL")) %>% distinct(SYMBOL,.keep_all = TRUE)


ATAC_counts %>% 
    dplyr::filter(Peakid %in% df_gene_schneider$Peakid) %>% 
  pivot_longer(cols = !Peakid, names_to = "sample", values_to = "counts") %>% 
  left_join(., df_gene_schneider, by =c("Peakid"="Peakid")) %>% 
  separate("sample", into = c("ind","trt","time")) %>% 
  mutate(time=factor(time, levels = c("3h","24h"))) %>% 
  mutate(trt=factor(trt, levels= c("DOX","EPI","DNR","MTX","TRZ","VEH"))) %>% 
  ggplot(., aes (x = time, y=counts))+
  geom_boxplot(aes(fill=trt))+
  facet_wrap(~Peakid+SYMBOL,scales="free_y")+
  ggtitle(" ATAC accessibility")+
  scale_fill_manual(values = drug_pal)+
  theme_bw()+
  ylab("log2 cpm ATAC")

Version Author Date
99ea869 E. Renee Matthews 2025-02-26

Figure 6C: Gene expression of rs10753081 heart eGene

RNA_counts %>% 
  dplyr::filter(ENTREZID %in% df_gene_schneider$ENTREZID) %>% 
  pivot_longer(cols = !ENTREZID, names_to = "sample", values_to = "counts") %>% 
  # mutate(ENTREZID=as.numeric(ENTREZID)) %>% 
  left_join(., df_gene_schneider, by =c("ENTREZID"="ENTREZID")) %>%  
  # left_join(., df_gene_schneider, by =c("ENTREZID"="ENTREZID.x")) %>% 
  separate("sample", into = c("trt","ind","time")) %>% 
  mutate(time=factor(time, levels = c("3h","24h"))) %>% 
  mutate(trt=factor(trt, levels= c("DOX","EPI","DNR","MTX","TRZ","VEH"))) %>% 
  ggplot(., aes (x = time, y=counts))+
  geom_boxplot(aes(fill=trt))+
  facet_wrap(~SYMBOL, scales="free_y")+
    scale_fill_manual(values = drug_pal)+
  ggtitle("RNA Log 2 cpm of expressed gene")+
  theme_bw()+
  ylab("log2 cpm RNA")

Version Author Date
99ea869 E. Renee Matthews 2025-02-26

Figure 6D: Chromatin accessibility at rs117299725

Park_rsid <- data.frame("RSID"=c("rs117299725"),"Peakid"=c("chr9.76808694.76808955"))


ATAC_counts %>% 
  dplyr::filter(Peakid %in% Park_rsid$Peakid) %>% 
  # mutate(Peakid = row.names(.)) %>% 
  pivot_longer(cols = !Peakid, names_to = "sample", values_to = "counts") %>% 
  left_join(., Park_rsid, by =c("Peakid"="Peakid")) %>% 
  separate("sample", into = c("ind","trt","time")) %>% 
  mutate(time=factor(time, levels = c("3h","24h"))) %>% 
  mutate(trt=factor(trt, levels= c("DOX","EPI","DNR","MTX","TRZ","VEH"))) %>% 
  ggplot(., aes (x = time, y=counts))+
  geom_boxplot(aes(fill=trt))+
  facet_wrap(~Peakid,scales="free_y")+
  ggtitle(" ATAC accessibility")+
  scale_fill_manual(values = drug_pal)+
  theme_bw()+
  ylab("log2 cpm ATAC")

Version Author Date
99ea869 E. Renee Matthews 2025-02-26

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

loaded via a namespace (and not attached):
  [1] later_1.4.1                 BiocIO_1.16.0              
  [3] bitops_1.0-9                cellranger_1.1.0           
  [5] rpart_4.1.24                XML_3.99-0.18              
  [7] lifecycle_1.0.4             rstatix_0.7.2              
  [9] doParallel_1.0.17           rprojroot_2.0.4            
 [11] vroom_1.6.5                 processx_3.8.6             
 [13] lattice_0.22-6              backports_1.5.0            
 [15] magrittr_2.0.3              Hmisc_5.2-2                
 [17] sass_0.4.9                  rmarkdown_2.29             
 [19] remotes_2.5.0               jquerylib_0.1.4            
 [21] yaml_2.3.10                 plotrix_3.8-4              
 [23] httpuv_1.6.15               sessioninfo_1.2.3          
 [25] pkgbuild_1.4.6              DBI_1.2.3                  
 [27] pkgload_1.4.0               abind_1.4-8                
 [29] zlibbioc_1.52.0             RCurl_1.98-1.16            
 [31] nnet_7.3-20                 git2r_0.35.0               
 [33] circlize_0.4.16             GenomeInfoDbData_1.2.13    
 [35] svglite_2.1.3               codetools_0.2-20           
 [37] DelayedArray_0.32.0         xml2_1.3.7                 
 [39] tidyselect_1.2.1            shape_1.4.6.1              
 [41] farver_2.1.2                UCSC.utils_1.2.0           
 [43] base64enc_0.1-3             matrixStats_1.5.0          
 [45] GenomicAlignments_1.42.0    jsonlite_1.9.1             
 [47] GetoptLong_1.0.5            ellipsis_0.3.2             
 [49] Formula_1.2-5               iterators_1.0.14           
 [51] systemfonts_1.2.1           foreach_1.5.2              
 [53] tools_4.4.2                 Rcpp_1.0.14                
 [55] glue_1.8.0                  SparseArray_1.6.2          
 [57] xfun_0.51                   MatrixGenerics_1.18.1      
 [59] withr_3.0.2                 formatR_1.14               
 [61] fastmap_1.2.0               callr_3.7.6                
 [63] digest_0.6.37               mime_0.12                  
 [65] timechange_0.3.0            R6_2.6.1                   
 [67] seqPattern_1.38.0           colorspace_2.1-1           
 [69] RSQLite_2.3.9               generics_0.1.3             
 [71] data.table_1.17.0           htmlwidgets_1.6.4          
 [73] httr_1.4.7                  S4Arrays_1.6.0             
 [75] whisker_0.4.1               pkgconfig_2.0.3            
 [77] gtable_0.3.6                blob_1.2.4                 
 [79] impute_1.80.0               XVector_0.46.0             
 [81] htmltools_0.5.8.1           carData_3.0-5              
 [83] profvis_0.4.0               pwr_1.3-0                  
 [85] clue_0.3-66                 png_0.1-8                  
 [87] knitr_1.49                  lambda.r_1.2.4             
 [89] rstudioapi_0.17.1           tzdb_0.4.0                 
 [91] reshape2_1.4.4              rjson_0.2.23               
 [93] checkmate_2.3.2             curl_6.2.1                 
 [95] zoo_1.8-13                  cachem_1.1.0               
 [97] GlobalOptions_0.1.2         KernSmooth_2.23-26         
 [99] miniUI_0.1.1.1              parallel_4.4.2             
[101] foreign_0.8-88              restfulr_0.0.15            
[103] pillar_1.10.1               vctrs_0.6.5                
[105] urlchecker_1.0.1            promises_1.3.2             
[107] car_3.1-3                   xtable_1.8-4               
[109] cluster_2.1.8.1             htmlTable_2.4.3            
[111] evaluate_1.0.3              magick_2.8.5               
[113] cli_3.6.4                   locfit_1.5-9.12            
[115] compiler_4.4.2              futile.options_1.0.1       
[117] Rsamtools_2.22.0            rlang_1.1.5                
[119] crayon_1.5.3                labeling_0.4.3             
[121] ps_1.9.0                    getPass_0.2-4              
[123] plyr_1.8.9                  fs_1.6.5                   
[125] stringi_1.8.4               viridisLite_0.4.2          
[127] gridBase_0.4-7              munsell_0.5.1              
[129] Biostrings_2.74.1           Matrix_1.7-3               
[131] BSgenome_1.74.0             patchwork_1.3.0            
[133] hms_1.1.3                   bit64_4.6.0-1              
[135] shiny_1.10.0                KEGGREST_1.46.0            
[137] statmod_1.5.0               SummarizedExperiment_1.36.0
[139] memoise_2.0.1               bslib_0.9.0                
[141] bit_4.6.0