Contents

1 Overview

The EpiCompare package is designed to facilitate the comparison of epigenetic datasets for quality control and benchmarking purposes. The package combines several downstream analysis tools for epigenetic data and generates a single report that collates all results of the analysis. This allows users to conduct downstream analysis of multiple epigenetic datasets simultaneously and compare the results in a simple and efficient way.

1.1 Introduction

For many years, ChIP-seq has been the standard method for epigenomic profiling, but it suffers from a host of limitations. Recently, many other epigenetic technologies (e.g. CUT&Run, CUT&Tag and TIP-seq etc.), designed to overcome these constraints, have been developed. To better understand the performance of these novel approaches, it is important that we systematically compare these technologies and benchmark against a “gold-standard”.

There are many tools in R (e.g. ChIPseeker) that can be used to conduct downstream analysis and comparison of epigenetic datasets. However, these are often scattered across different packages and difficult to use for researchers with none or little computational experience.

EpiCompare is designed to provide a simple and comprehensive way of analysing and comparing epigenetic datasets. It combines many useful downstream analysis tools, which can easily be controlled by users and it collates the results in a single report. This allows researchers to systematically compare different epigenetic technologies.

While the main functionality of EpiCompare is to contrast epigenetic technologies, it can also be used to compare datasets generated using different experimental conditions and data analysis workflows of one technology. This can help researchers to establish a consensus regarding the optimal use of the method.

Currently, EpiCompare only works for human genome as it uses human-based hg19 and/or hg38 genome references.

2 Data

The EpiCompare package contains a small subset of histone mark H3K27ac profile data obtained/generated from:

It also contains human genome hg19 and hg38 blacklisted regions obtained from ENCODE. The ENCODE blacklist includes regions of the genome that have anomalous and/or unstructured signals independent of the cell-line or experiment. Removal of ENCODE blacklist is recommended for quality measure.

These dataset will be used to showcase EpiCompare functionality

3 Installation

To install the package, run the following:

if (!require("BiocManager", quietly = TRUE))
    install.packages("BiocManager")

BiocManager::install("EpiCompare") 

4 Running EpiCompare

In this example analysis, we will compare CUT&Run and CUT&Tag of histone mark H3K27ac against ENCODE ChIP-seq.

4.1 Load package and example datasets

Once installed, load the package:

library(EpiCompare)
## 
## 
## Warning: replacing previous import 'Biostrings::pattern' by 'grid::pattern' when
## loading 'genomation'

Load example datasets used in this analysis:

data("encode_H3K27ac") # ENCODE ChIP-seq
data("CnT_H3K27ac") # CUT&Tag
data("CnR_H3K27ac") # CUT&Run
data("hg19_blacklist") # hg19 genome blacklist 
data("CnT_H3K27ac_picard") # CUT&Tag Picard summary output
data("CnR_H3K27ac_picard") # CUT&Run Picard summary output

4.2 Prepare input data

4.2.1 Peaklist

EpiCompare accepts datasets both as GRanges object and as paths to BED files. Peakfiles (GRanges or paths) that you would like to analyse must be listed and named (see below).

# To import BED files as GRanges object
peak_GRanges <-ChIPseeker::readPeakFile("/path/to/peak/file.bed",as = "GRanges")
# EpiCompare also accepts paths (to BED files) as input 
peak_path <- "/path/to/BED/file1.bed"
# Create named peak list
peaklist <- list(peak_GRanges, peak_path)
names(peaklist) <- c("sample1", "sample2")

In this example, we will use built-in data, which have been converted into GRanges object previously (CnT_H3K27ac and CnR_H3K27ac).

peaklist <- list(CnT_H3K27ac, CnR_H3K27ac) # create list of peakfiles 
names(peaklist) <- c("CnT", "CnR") # set names 

4.2.2 Blacklist

ENCODE blacklist contains regions of the genome that have anomalous and/or unstructured signals independent of the cell-line or experiment. Removal of these regions from peakfiles is recommended for quality measure.

EpiCompare contains two blacklist files, hg19 and hg38, downloaded from here.

In this example analysis, since all peakfiles (encode_H3K27ac, CnT_H3K27ac, CnR_H3K27ac) were generated using human genome reference build hg19, hg19_blacklist will be used. For hg38, use data(hg38_blacklist).

Please ensure that you specify the correct blacklist.

4.2.3 Picard summary files

Note that this is OPTIONAL. If you want the report to include metrics on DNA fragments (e.g. mapped fragments and duplication rate), please input summary files from Picard.

Picard can be used to mark duplicate reads. This outputs a metrics file with ending .MarkDuplicates.metrics.txt. To import this text file into R as data frame, use:

picard <- read.table("/path/to/Picard/summary.txt", header = TRUE, fill = TRUE)

In this example. we will use built-in data, which have been converted into data frame previously (CnT_H3K27ac_picard and CnR_H3K27ac_picard). The files must be listed and named:

# create list of Picard summary
picard <- list(CnT_H3K27ac_picard, CnR_H3K27ac_picard) 
names(picard) <- c("CnT", "CnR") # set names 

4.2.4 Reference file

This is OPTIONAL. If reference peak file is provided, stat_plot and chromHMM_plot of overlapping peaks are included in the report (see Optional plots section below).

Reference file must be listed and named. In this example, we will use built-in data (encode_H3K27ac), which has been converted to GRanges previously:

reference_peak <- list("ENCODE_H3K27ac" = encode_H3K27ac)

4.2.5 Output Directory

When running EpiCompare(), please ensure that you specify output_dir. All outputs (figures and HTML report) will be saved in the specified output_dir.

4.3 Run EpiCompare

Running EpiCompare is done using the function, EpiCompare() . Users can choose which analyses to run and include in the report by setting parameters to TRUE or FALSE.

EpiCompare(peakfiles = peaklist,
           genome_build = "hg19",
           blacklist = hg19_blacklist,
           picard_files = picard,
           reference = reference_peak,
           upset_plot = FALSE,
           stat_plot = FALSE,
           chromHMM_plot = FALSE,
           chromHMM_annotation = "K562",
           chipseeker_plot = FALSE,
           enrichment_plot = FALSE,
           tss_plot = FALSE,
           interact = FALSE,
           save_output = FALSE,
           output_filename = "EpiCompare",
           output_timestamp = FALSE,
           output_dir = tempdir())

4.3.1 Optional plots

By default, these plots will not be included in the report unless set TRUE.

  • upset_plot : Upset plot showing the number of overlapping peaks between samples. EpiCompare uses UpSetR package.
  • stat_plot : A reference peakfile must be included for this plot. The plot displays distribution of statistical significance (q-values) of sample peaks that are overlapping/non-overlapping with the reference dataset.
  • chromHMM_plot : ChromHMM annotation of peaks. If reference is provided, ChromHMM annotation of overlapping and non-overlapping peaks with the reference is also included in the report.
  • chipseeker_plot : ChIPseeker functional annotation of peaks.
  • enrichment_plot : KEGG pathway and GO enrichment analysis of peaks.
  • tss_plot : Peak frequency around (+/- 3000bp) transcriptional start site. Note that it may take awhile to generate this plot for large sample sizes.

4.3.2 Other options

  • chromHMM_annotation : Cell-line annotation for ChromHMM. Default is K562. Options are:
    • “K562” = K-562 cells
    • “Gm12878” = Cellosaurus cell-line GM12878
    • “H1hesc” = H1 Human Embryonic Stem Cell
    • “Hepg2” = Hep G2 cell
    • “Hmec” = Human Mammary Epithelial Cell
    • “Hsmm” = Human Skeletal Muscle Myoblasts
    • “Huvec” = Human Umbilical Vein Endothelial Cells
    • “Nhek” = Normal Human Epidermal Keratinocytes
    • “Nhlf” = Normal Human Lung Fibroblasts
  • interact : By default, all heatmaps (percentage overlap and ChromHMM heatmaps) in the report will be interactive. If set FALSE, all heatmaps will be static. N.B. If interact=TRUE, interactive heatmaps will be saved as html files, which may take time for larger sample sizes.
  • output_filename : By default, the report is named EpiCompare.html. You can specify the filename of the report here.
  • output_timestamp : By default FALSE. If TRUE, the filename of the report includes the date.

4.4 Output

EpiCompare outputs

  • An HTML report consisting of three sections:
      1. General Metrics: Metrics on peaks (percentage of blacklisted and non-standard peaks, and peak widths) and fragments (duplication rate) of samples.
      1. Peak Overlap: Percetnage and statistical significance of overlapping and non-overlapping peaks. Also includes upset plot.
      1. Functional Annotation: Functional annotation (ChromHMM, ChIPseeker and enrichment analysis) of peaks. Also includes peak enrichment around TSS.
  • EpiCompare_file containing all plots generated by EpiCompare if save_output = TRUE.

Both outputs are saved in the specified output_dir.

5 Future Enhancements

In the current version, EpiCompare only recognizes certain BED formats. We hope to improve this. Moreover, if there are other downstream analysis tools that may be suitable in EpiCompare, feel free to report this through Github.

6 Session Information

utils::sessionInfo()
## R version 4.2.0 RC (2022-04-19 r82224)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 20.04.4 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.15-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.15-bioc/R/lib/libRlapack.so
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_GB              LC_COLLATE=C              
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] EpiCompare_1.0.0 BiocStyle_2.24.0
## 
## loaded via a namespace (and not attached):
##   [1] utf8_1.2.2                             
##   [2] tidyselect_1.1.2                       
##   [3] htmlwidgets_1.5.4                      
##   [4] RSQLite_2.2.12                         
##   [5] AnnotationDbi_1.58.0                   
##   [6] grid_4.2.0                             
##   [7] BiocParallel_1.30.0                    
##   [8] scatterpie_0.1.7                       
##   [9] munsell_0.5.0                          
##  [10] colorspace_2.0-3                       
##  [11] GOSemSim_2.22.0                        
##  [12] Biobase_2.56.0                         
##  [13] filelock_1.0.2                         
##  [14] highr_0.9                              
##  [15] knitr_1.39                             
##  [16] stats4_4.2.0                           
##  [17] DOSE_3.22.0                            
##  [18] labeling_0.4.2                         
##  [19] MatrixGenerics_1.8.0                   
##  [20] GenomeInfoDbData_1.2.8                 
##  [21] polyclip_1.10-0                        
##  [22] seqPattern_1.28.0                      
##  [23] bit64_4.0.5                            
##  [24] farver_2.1.0                           
##  [25] downloader_0.4                         
##  [26] vctrs_0.4.1                            
##  [27] treeio_1.20.0                          
##  [28] generics_0.1.2                         
##  [29] xfun_0.30                              
##  [30] BiocFileCache_2.4.0                    
##  [31] R6_2.5.1                               
##  [32] GenomeInfoDb_1.32.0                    
##  [33] graphlayouts_0.8.0                     
##  [34] locfit_1.5-9.5                         
##  [35] bitops_1.0-7                           
##  [36] BRGenomics_1.8.0                       
##  [37] cachem_1.0.6                           
##  [38] fgsea_1.22.0                           
##  [39] gridGraphics_0.5-1                     
##  [40] DelayedArray_0.22.0                    
##  [41] assertthat_0.2.1                       
##  [42] promises_1.2.0.1                       
##  [43] BiocIO_1.6.0                           
##  [44] scales_1.2.0                           
##  [45] ggraph_2.0.5                           
##  [46] enrichplot_1.16.0                      
##  [47] gtable_0.3.0                           
##  [48] tidygraph_1.2.1                        
##  [49] rlang_1.0.2                            
##  [50] genefilter_1.78.0                      
##  [51] splines_4.2.0                          
##  [52] rtracklayer_1.56.0                     
##  [53] lazyeval_0.2.2                         
##  [54] impute_1.70.0                          
##  [55] plyranges_1.16.0                       
##  [56] BiocManager_1.30.17                    
##  [57] yaml_2.3.5                             
##  [58] reshape2_1.4.4                         
##  [59] GenomicFeatures_1.48.0                 
##  [60] httpuv_1.6.5                           
##  [61] qvalue_2.28.0                          
##  [62] clusterProfiler_4.4.0                  
##  [63] tools_4.2.0                            
##  [64] bookdown_0.26                          
##  [65] ggplotify_0.1.0                        
##  [66] gridBase_0.4-7                         
##  [67] ggplot2_3.3.5                          
##  [68] ellipsis_0.3.2                         
##  [69] gplots_3.1.3                           
##  [70] jquerylib_0.1.4                        
##  [71] RColorBrewer_1.1-3                     
##  [72] BiocGenerics_0.42.0                    
##  [73] Rcpp_1.0.8.3                           
##  [74] plyr_1.8.7                             
##  [75] progress_1.2.2                         
##  [76] zlibbioc_1.42.0                        
##  [77] purrr_0.3.4                            
##  [78] RCurl_1.98-1.6                         
##  [79] prettyunits_1.1.1                      
##  [80] viridis_0.6.2                          
##  [81] S4Vectors_0.34.0                       
##  [82] SummarizedExperiment_1.26.0            
##  [83] ggrepel_0.9.1                          
##  [84] magrittr_2.0.3                         
##  [85] magick_2.7.3                           
##  [86] data.table_1.14.2                      
##  [87] DO.db_2.9                              
##  [88] matrixStats_0.62.0                     
##  [89] hms_1.1.1                              
##  [90] patchwork_1.1.1                        
##  [91] mime_0.12                              
##  [92] evaluate_0.15                          
##  [93] xtable_1.8-4                           
##  [94] XML_3.99-0.9                           
##  [95] IRanges_2.30.0                         
##  [96] gridExtra_2.3                          
##  [97] compiler_4.2.0                         
##  [98] biomaRt_2.52.0                         
##  [99] tibble_3.1.6                           
## [100] KernSmooth_2.23-20                     
## [101] crayon_1.5.1                           
## [102] shadowtext_0.1.2                       
## [103] htmltools_0.5.2                        
## [104] tzdb_0.3.0                             
## [105] ggfun_0.0.6                            
## [106] later_1.3.0                            
## [107] tidyr_1.2.0                            
## [108] geneplotter_1.74.0                     
## [109] aplot_0.1.3                            
## [110] DBI_1.1.2                              
## [111] tweenr_1.0.2                           
## [112] ChIPseeker_1.32.0                      
## [113] genomation_1.28.0                      
## [114] dbplyr_2.1.1                           
## [115] MASS_7.3-57                            
## [116] rappdirs_0.3.3                         
## [117] boot_1.3-28                            
## [118] readr_2.1.2                            
## [119] Matrix_1.4-1                           
## [120] cli_3.3.0                              
## [121] parallel_4.2.0                         
## [122] igraph_1.3.1                           
## [123] GenomicRanges_1.48.0                   
## [124] pkgconfig_2.0.3                        
## [125] TxDb.Hsapiens.UCSC.hg19.knownGene_3.2.2
## [126] GenomicAlignments_1.32.0               
## [127] plotly_4.10.0                          
## [128] xml2_1.3.3                             
## [129] ggtree_3.4.0                           
## [130] annotate_1.74.0                        
## [131] bslib_0.3.1                            
## [132] XVector_0.36.0                         
## [133] yulab.utils_0.0.4                      
## [134] stringr_1.4.0                          
## [135] digest_0.6.29                          
## [136] Biostrings_2.64.0                      
## [137] rmarkdown_2.14                         
## [138] fastmatch_1.1-3                        
## [139] tidytree_0.3.9                         
## [140] restfulr_0.0.13                        
## [141] curl_4.3.2                             
## [142] shiny_1.7.1                            
## [143] Rsamtools_2.12.0                       
## [144] gtools_3.9.2                           
## [145] rjson_0.2.21                           
## [146] lifecycle_1.0.1                        
## [147] nlme_3.1-157                           
## [148] jsonlite_1.8.0                         
## [149] viridisLite_0.4.0                      
## [150] BSgenome_1.64.0                        
## [151] fansi_1.0.3                            
## [152] pillar_1.7.0                           
## [153] lattice_0.20-45                        
## [154] KEGGREST_1.36.0                        
## [155] fastmap_1.1.0                          
## [156] httr_1.4.2                             
## [157] plotrix_3.8-2                          
## [158] survival_3.3-1                         
## [159] GO.db_3.15.0                           
## [160] interactiveDisplayBase_1.34.0          
## [161] glue_1.6.2                             
## [162] UpSetR_1.4.0                           
## [163] png_0.1-7                              
## [164] BiocVersion_3.15.2                     
## [165] bit_4.0.4                              
## [166] ggforce_0.3.3                          
## [167] stringi_1.7.6                          
## [168] sass_0.4.1                             
## [169] blob_1.2.3                             
## [170] DESeq2_1.36.0                          
## [171] org.Hs.eg.db_3.15.0                    
## [172] AnnotationHub_3.4.0                    
## [173] caTools_1.18.2                         
## [174] memoise_2.0.1                          
## [175] dplyr_1.0.8                            
## [176] ape_5.6-2

7 Contact

7.0.1 Neurogenomics Lab

UK Dementia Research Institute
Department of Brain Sciences
Faculty of Medicine
Imperial College London
GitHub
DockerHub