Last updated: 2026-02-12

Checks: 7 0

Knit directory: DXR_continue/

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(20250701) 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 8d883d6. 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:    .Rhistory
    Ignored:    .Rproj.user/
    Ignored:    data/Bed_exports/
    Ignored:    data/Cormotif_data/
    Ignored:    data/DER_data/
    Ignored:    data/Other_paper_data/
    Ignored:    data/RDS_files/
    Ignored:    data/TE_annotation/
    Ignored:    data/alignment_summary.txt
    Ignored:    data/all_peak_final_dataframe.txt
    Ignored:    data/cell_line_info_.tsv
    Ignored:    data/full_summary_QC_metrics.txt
    Ignored:    data/motif_lists/
    Ignored:    data/number_frag_peaks_summary.txt

Untracked files:
    Untracked:  H3K27ac_all_regions_test.bed
    Untracked:  H3K27ac_consensus_clusters_test.bed
    Untracked:  analysis/GREAT_H3K27ac.Rmd
    Untracked:  analysis/H3K27ac_ChromHMM_FC.Rmd
    Untracked:  analysis/H3K27me3_TE_investigation.Rmd
    Untracked:  analysis/H3K36me3_TE_investigation.Rmd
    Untracked:  analysis/Top2a_Top2b_expression.Rmd
    Untracked:  analysis/maps_and_plots.Rmd
    Untracked:  analysis/proteomics.Rmd
    Untracked:  code/For_john.R
    Untracked:  other_analysis/

Unstaged changes:
    Modified:   analysis/H3K27ac_TE_investigation.Rmd
    Modified:   analysis/H3K27ac_summit_processing.Rmd
    Modified:   analysis/dual_histone_TE_investigation.Rmd
    Modified:   analysis/summit_files_processing.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/H3K27ac_cisRE.Rmd) and HTML (docs/H3K27ac_cisRE.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 8d883d6 reneeisnowhere 2026-02-12 wflow_publish("analysis/H3K27ac_cisRE.Rmd")
html cdf088c reneeisnowhere 2026-02-12 Build site.
Rmd ea3b358 reneeisnowhere 2026-02-12 wflow_publish("analysis/H3K27ac_cisRE.Rmd")

library(tidyverse)
library(GenomicRanges)
library(plyranges)
library(genomation)
library(readr)
library(rtracklayer)
library(stringr)
library(ggrepel)
library(DT)
library(readxl)
library(ChIPseeker)
SCREEN_hg38_cCREs <- import(
  "data/Bed_exports/cisRE/GRCh38-cCREs.bed",
  format = "BED",
  extraCols = c(
    DHS_ID = "character",
    cCRE_ID = "character",
    cCRE_class = "character"
  )
)

strand(SCREEN_hg38_cCREs) <- "*"
cCRE_split_1 <- split(SCREEN_hg38_cCREs, SCREEN_hg38_cCREs$cCRE_class)
names(cCRE_split)

outdir <- "data/Bed_exports/cisRE/by_class"
dir.create(outdir, showWarnings = FALSE, recursive = TRUE)

for (cls in names(cCRE_split_1)) {
  export(
    cCRE_split_1[[cls]],
    con = file.path(outdir, paste0("SCREEN_hg38_", cls, ".bed")),
    format = "BED"
  )
}
SCREEN_heart_hg38_cCREs <- import(
  "data/Other_paper_data/SCREEN_LVHEART_F_53_ENCFF417JSF_ENCFF651XRK_ENCFF320IPT_ENCFF440RUS.bed",
  format = "BED",
  extraCols = c(
    DHS_ID = "character",
    cCRE_ID = "character",
    cCRE_class = "character"
  )
)

strand(SCREEN_heart_hg38_cCREs) <- "*"
cCRE_split <- split(SCREEN_heart_hg38_cCREs, SCREEN_heart_hg38_cCREs$cCRE_ID)
names(cCRE_split)

outdir <- "data/Bed_exports/cisRE/heart_by_class"
dir.create(outdir, showWarnings = FALSE, recursive = TRUE)

for (cls in names(cCRE_split)) {
  export(
    cCRE_split[[cls]],
    con = file.path(outdir, paste0("SCREEN_heartLV_", cls, ".bed")),
    format = "BED"
  )
}

H3K27ac set enrichment

SCREEN_hg38_cCREs <- import(
  "data/Bed_exports/cisRE/GRCh38-cCREs.bed",
  format = "BED",
  extraCols = c(
    DHS_ID = "character",
    cCRE_ID = "character",
    cCRE_class = "character"))

H3K27ac_anno_ROIs <- readRDS("data/motif_lists/H3K27ac_annotated_peaks.RDS")
H3K27ac_toplist <- readRDS( "data/DER_data/H3K27ac_toplist.RDS")
H3K27ac_toptable_list <- bind_rows(H3K27ac_toplist, .id = "group")
## Loading single summit locations and adding in 
H3K27ac_summit_gr <- readRDS("data/RDS_files/H3K27ac_complete_summit_gr.RDS")

##assigning Peakid as name of summit region
 mcols(H3K27ac_summit_gr)$name <- mcols(H3K27ac_summit_gr)$Peakid
 

## Creating a lookup file if needed
H3K27ac_lookup <- imap_dfr(H3K27ac_anno_ROIs[1:3], ~
  tibble(Peakid = .x@anno$Peakid, cluster = .y)
)
# cRE_color_palette <- c("#E64B35FF", "#4DBBD5FF", "#00A087FF" ,"#3C5488FF", "#F39B7FFF", "#8491B4FF", "#91D1C2FF", "#DC0000FF", "#7E6148FF", "#B09C85FF" )
# 
# 
# cCRE_discrete_colors <- paletteer_d("ggsci::default_aaas")
H3K27ac_cre_hits <- findOverlaps(H3K27ac_summit_gr, SCREEN_hg38_cCREs, ignore.strand = TRUE)

H3K27ac_cre_df <- tibble(
  Peakid=mcols(H3K27ac_summit_gr)$Peakid[queryHits(H3K27ac_cre_hits)],
  cluster   = mcols(H3K27ac_summit_gr)$cluster[queryHits(H3K27ac_cre_hits)],
  cCRE_ID   = mcols(SCREEN_hg38_cCREs)$cCRE_ID[subjectHits(H3K27ac_cre_hits)],
  cCRE_class= mcols(SCREEN_hg38_cCREs)$cCRE_class[subjectHits(H3K27ac_cre_hits)])
scale_fill_cCREs <-  function(...){
  ggplot2:::manual_scale(
    'fill', 
    values = setNames(c( "#E64B35FF", "#4DBBD5FF", "#00A087FF" ,"#3C5488FF", "#F39B7FFF", "#8491B4FF", "#91D1C2FF", "#DC0000FF", "#7E6148FF", "#B09C85FF" ), c(unique(H3K27ac_cre_df$cCRE_class),"NA")), 
    ...
  )
}
H3K27ac_cre_anno <- H3K27ac_anno_ROIs$all_H3K27ac %>% as.data.frame() %>% 
  left_join(.,H3K27ac_cre_df ) %>% 
  dplyr::select(Peakid,cluster, cCRE_ID,cCRE_class) %>% 
  mutate(cluster = if_else(is.na(cluster), "not_assigned", cluster), 
         cCRE_ID=if_else(is.na(cCRE_ID),"NA",cCRE_ID),
         cCRE_class=if_else(is.na(cCRE_class),"NA",cCRE_class))

H3K27ac_cre_anno_full<- H3K27ac_cre_anno %>% rbind(H3K27ac_cre_anno %>% mutate(cluster="all_ROIs"))

H3K27ac_cre_counts <- H3K27ac_cre_anno_full %>% 
  count(cluster, cCRE_class) %>% 
  group_by(cluster) %>% 
  mutate(percent= n/sum(n)) %>% 
  dplyr::filter(cluster != "not_assigned")

 ggplot(H3K27ac_cre_counts, aes(x = cluster, y = percent, fill = cCRE_class)) +
  geom_col() +
  scale_y_continuous(labels = scales::percent) +
  labs(
    y = "Proportion of ROIs",
    x = "Set",
    fill = "cCRE class"
  ) +
  theme_bw()+
     ggtitle("H3K27ac ROI summits crossing :hg38 all cCREs ")+scale_fill_cCREs()

Version Author Date
cdf088c reneeisnowhere 2026-02-12
SCREEN_heart_hg38_cCREs <- import(
  "data/Other_paper_data/SCREEN_LVHEART_F_53_ENCFF417JSF_ENCFF651XRK_ENCFF320IPT_ENCFF440RUS.bed",
  format = "BED",
  extraCols = c(
    DHS_ID = "character",
    cCRE_ID = "character",
    cCRE_class = "character"))
SCREEN_heart_hg38_cCREs %>% as.data.frame() %>% distinct(cCRE_ID)
     cCRE_ID
1  Low-DNase
2        PLS
3    CA-CTCF
4    CA-only
5       pELS
6       dELS
7 CA-H3K4me3
H3K27ac_heart_cre_hits <- findOverlaps(H3K27ac_summit_gr, SCREEN_heart_hg38_cCREs, ignore.strand = TRUE)

H3K27ac_heart_cre_df <- tibble(
  Peakid=mcols(H3K27ac_summit_gr)$Peakid[queryHits(H3K27ac_heart_cre_hits)],
  cluster   = mcols(H3K27ac_summit_gr)$cluster[queryHits(H3K27ac_heart_cre_hits)],
  cCRE_ID   = mcols(SCREEN_hg38_cCREs)$cCRE_ID[subjectHits(H3K27ac_heart_cre_hits)],
  cCRE_class= mcols(SCREEN_hg38_cCREs)$cCRE_class[subjectHits(H3K27ac_heart_cre_hits)])

H3K27ac_heart_cre_anno <- H3K27ac_anno_ROIs$all_H3K27ac %>% as.data.frame() %>% 
  left_join(.,H3K27ac_heart_cre_df ) %>% 
  dplyr::select(Peakid,cluster, cCRE_ID,cCRE_class) %>% 
  mutate(cluster = if_else(is.na(cluster), "not_assigned", cluster), 
         cCRE_ID=if_else(is.na(cCRE_ID),"NA",cCRE_ID),
         cCRE_class=if_else(is.na(cCRE_class),"NA",cCRE_class))
H3K27ac_heart_cre_counts <- H3K27ac_heart_cre_anno %>% 
  count(cluster, cCRE_class) %>% 
  group_by(cluster) %>% 
  mutate(percent= n/sum(n))

 ggplot(H3K27ac_heart_cre_counts, aes(x = cluster, y = percent, fill = cCRE_class)) +
  geom_col() +
  scale_y_continuous(labels = scales::percent) +
  labs(
    yy = "Proportion of ROIs",
    x = "Set",
    fill = "cCRE class"
  ) +
  theme_classic()+
     ggtitle("Heart-left ventricle cCREs")+scale_fill_cCREs()

Version Author Date
cdf088c reneeisnowhere 2026-02-12
# all.equal(SCREEN_heart_hg38_cCREs, SCREEN_hg38_cCREs)
# 
# identical(
#   dplyr::arrange(SCREEN_heart_hg38_cCREs, across(everything())),
#   dplyr::arrange(SCREEN_hg38_cCREs, across(everything()))
# )
# 
# dplyr::left_join((SCREEN_heart_hg38_cCREs %>% as.data.frame()),(SCREEN_hg38_cCREs %>% as.data.frame())                 )

sessionInfo()
R version 4.4.2 (2024-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 26200)

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] ChIPseeker_1.42.1    readxl_1.4.5         DT_0.33             
 [4] ggrepel_0.9.6        rtracklayer_1.66.0   genomation_1.38.0   
 [7] plyranges_1.26.0     GenomicRanges_1.58.0 GenomeInfoDb_1.42.3 
[10] IRanges_2.40.1       S4Vectors_0.44.0     BiocGenerics_0.52.0 
[13] lubridate_1.9.4      forcats_1.0.0        stringr_1.5.1       
[16] dplyr_1.1.4          purrr_1.1.0          readr_2.1.5         
[19] tidyr_1.3.1          tibble_3.3.0         ggplot2_3.5.2       
[22] tidyverse_2.0.0      workflowr_1.7.1     

loaded via a namespace (and not attached):
  [1] RColorBrewer_1.1-3                     
  [2] rstudioapi_0.17.1                      
  [3] jsonlite_2.0.0                         
  [4] magrittr_2.0.3                         
  [5] ggtangle_0.0.7                         
  [6] GenomicFeatures_1.58.0                 
  [7] farver_2.1.2                           
  [8] rmarkdown_2.29                         
  [9] fs_1.6.6                               
 [10] BiocIO_1.16.0                          
 [11] zlibbioc_1.52.0                        
 [12] vctrs_0.6.5                            
 [13] memoise_2.0.1                          
 [14] Rsamtools_2.22.0                       
 [15] RCurl_1.98-1.17                        
 [16] ggtree_3.14.0                          
 [17] htmltools_0.5.8.1                      
 [18] S4Arrays_1.6.0                         
 [19] TxDb.Hsapiens.UCSC.hg19.knownGene_3.2.2
 [20] plotrix_3.8-4                          
 [21] curl_7.0.0                             
 [22] cellranger_1.1.0                       
 [23] SparseArray_1.6.2                      
 [24] gridGraphics_0.5-1                     
 [25] sass_0.4.10                            
 [26] KernSmooth_2.23-26                     
 [27] bslib_0.9.0                            
 [28] htmlwidgets_1.6.4                      
 [29] plyr_1.8.9                             
 [30] impute_1.80.0                          
 [31] cachem_1.1.0                           
 [32] GenomicAlignments_1.42.0               
 [33] igraph_2.1.4                           
 [34] whisker_0.4.1                          
 [35] lifecycle_1.0.4                        
 [36] pkgconfig_2.0.3                        
 [37] Matrix_1.7-3                           
 [38] R6_2.6.1                               
 [39] fastmap_1.2.0                          
 [40] GenomeInfoDbData_1.2.13                
 [41] MatrixGenerics_1.18.1                  
 [42] enrichplot_1.26.6                      
 [43] digest_0.6.37                          
 [44] aplot_0.2.8                            
 [45] colorspace_2.1-1                       
 [46] patchwork_1.3.2                        
 [47] AnnotationDbi_1.68.0                   
 [48] ps_1.9.1                               
 [49] rprojroot_2.1.1                        
 [50] RSQLite_2.4.3                          
 [51] labeling_0.4.3                         
 [52] timechange_0.3.0                       
 [53] httr_1.4.7                             
 [54] abind_1.4-8                            
 [55] compiler_4.4.2                         
 [56] bit64_4.6.0-1                          
 [57] withr_3.0.2                            
 [58] BiocParallel_1.40.2                    
 [59] DBI_1.2.3                              
 [60] gplots_3.2.0                           
 [61] R.utils_2.13.0                         
 [62] rappdirs_0.3.3                         
 [63] DelayedArray_0.32.0                    
 [64] rjson_0.2.23                           
 [65] caTools_1.18.3                         
 [66] gtools_3.9.5                           
 [67] tools_4.4.2                            
 [68] ape_5.8-1                              
 [69] httpuv_1.6.16                          
 [70] R.oo_1.27.1                            
 [71] glue_1.8.0                             
 [72] restfulr_0.0.16                        
 [73] callr_3.7.6                            
 [74] nlme_3.1-168                           
 [75] GOSemSim_2.32.0                        
 [76] promises_1.3.3                         
 [77] getPass_0.2-4                          
 [78] gridBase_0.4-7                         
 [79] reshape2_1.4.4                         
 [80] fgsea_1.32.4                           
 [81] generics_0.1.4                         
 [82] gtable_0.3.6                           
 [83] BSgenome_1.74.0                        
 [84] tzdb_0.5.0                             
 [85] R.methodsS3_1.8.2                      
 [86] seqPattern_1.38.0                      
 [87] data.table_1.17.8                      
 [88] hms_1.1.3                              
 [89] XVector_0.46.0                         
 [90] pillar_1.11.0                          
 [91] yulab.utils_0.2.1                      
 [92] later_1.4.2                            
 [93] splines_4.4.2                          
 [94] treeio_1.30.0                          
 [95] lattice_0.22-7                         
 [96] bit_4.6.0                              
 [97] tidyselect_1.2.1                       
 [98] GO.db_3.20.0                           
 [99] Biostrings_2.74.1                      
[100] knitr_1.50                             
[101] git2r_0.36.2                           
[102] SummarizedExperiment_1.36.0            
[103] xfun_0.52                              
[104] Biobase_2.66.0                         
[105] matrixStats_1.5.0                      
[106] stringi_1.8.7                          
[107] UCSC.utils_1.2.0                       
[108] lazyeval_0.2.2                         
[109] boot_1.3-32                            
[110] ggfun_0.2.0                            
[111] yaml_2.3.10                            
[112] evaluate_1.0.5                         
[113] codetools_0.2-20                       
[114] qvalue_2.38.0                          
[115] ggplotify_0.1.2                        
[116] cli_3.6.5                              
[117] processx_3.8.6                         
[118] jquerylib_0.1.4                        
[119] dichromat_2.0-0.1                      
[120] Rcpp_1.1.0                             
[121] png_0.1-8                              
[122] XML_3.99-0.18                          
[123] parallel_4.4.2                         
[124] blob_1.2.4                             
[125] DOSE_4.0.1                             
[126] bitops_1.0-9                           
[127] tidytree_0.4.6                         
[128] scales_1.4.0                           
[129] crayon_1.5.3                           
[130] rlang_1.1.6                            
[131] fastmatch_1.1-6                        
[132] cowplot_1.2.0                          
[133] KEGGREST_1.46.0