##
## ChIPseeker v1.44.0 Learn more at https://yulab-smu.top/contribution-knowledge-mining/
##
## Please cite:
##
## Qianwen Wang, Ming Li, Tianzhi Wu, Li Zhan, Lin Li, Meijun Chen, Wenqin
## Xie, Zijing Xie, Erqiang Hu, Shuangbin Xu, Guangchuang Yu. Exploring
## epigenomic datasets by ChIPseeker. Current Protocols. 2022, 2(10): e585
## Loading required package: stats4
## Loading required package: BiocGenerics
## Loading required package: generics
##
## Attaching package: 'generics'
## The following objects are masked from 'package:base':
##
## as.difftime, as.factor, as.ordered, intersect, is.element, setdiff,
## setequal, union
##
## Attaching package: 'BiocGenerics'
## The following objects are masked from 'package:stats':
##
## IQR, mad, sd, var, xtabs
## The following objects are masked from 'package:base':
##
## anyDuplicated, aperm, append, as.data.frame, basename, cbind,
## colnames, dirname, do.call, duplicated, eval, evalq, Filter, Find,
## get, grep, grepl, is.unsorted, lapply, Map, mapply, match, mget,
## order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
## rbind, Reduce, rownames, sapply, saveRDS, table, tapply, unique,
## unsplit, which.max, which.min
## Loading required package: S4Vectors
##
## Attaching package: 'S4Vectors'
## The following object is masked from 'package:utils':
##
## findMatches
## The following objects are masked from 'package:base':
##
## expand.grid, I, unname
## Loading required package: IRanges
## Loading required package: GenomeInfoDb
## Loading required package: AnnotationDbi
## Loading required package: Biobase
## Welcome to Bioconductor
##
## Vignettes contain introductory material; view with
## 'browseVignettes()'. To cite Bioconductor, see
## 'citation("Biobase")', and for packages 'citation("pkgname")'.
## clusterProfiler v4.16.0 Learn more at https://yulab-smu.top/contribution-knowledge-mining/
##
## Please cite:
##
## Guangchuang Yu, Li-Gen Wang, Yanyan Han and Qing-Yu He.
## clusterProfiler: an R package for comparing biological themes among
## gene clusters. OMICS: A Journal of Integrative Biology. 2012,
## 16(5):284-287
##
## Attaching package: 'clusterProfiler'
## The following object is masked from 'package:AnnotationDbi':
##
## select
## The following object is masked from 'package:IRanges':
##
## slice
## The following object is masked from 'package:S4Vectors':
##
## rename
## The following object is masked from 'package:stats':
##
## filter
## Warning: package 'ggplot2' was built under R version 4.5.2
setwd("/Volumes/CrucialX6/human/")
knitr::opts_chunk$set(echo = TRUE, message = TRUE, warning = TRUE,
fig.width = 8, fig.height = 5, dpi = 600)peakdir <- "19.peaks_chr11_12/"
gtf <- "gencode.v49.annotation.gtf"
plot_theme <- theme(text = element_text(size = 12, colour = "black", family = "Helvetica"),
axis.text.y = element_text(size = 12, colour = "black", family = "Helvetica"),
axis.text.x = element_text(size = 12, colour = "black", family = "Helvetica"),
axis.title = element_text(size = 12, colour = "black", family = "Helvetica"),
axis.line = element_line(linewidth = 0.3528), axis.ticks = element_line(linewidth = 0.3528),
legend.text = element_text(size = 12, family = "Helvetica", colour = "black"))## Warning in call_fun_in_txdbmaker("makeTxDbFromGFF", ...): makeTxDbFromGFF() has moved from GenomicFeatures to the txdbmaker package,
## and is formally deprecated in GenomicFeatures >= 1.59.1. Please call
## txdbmaker::makeTxDbFromGFF() to get rid of this warning.
## Import genomic features from the file as a GRanges object ... OK
## Prepare the 'metadata' data frame ... OK
## Make the TxDb object ...
## Warning in .get_cds_IDX(mcols0$type, mcols0$phase): The "phase" metadata column contains non-NA values for features of type
## stop_codon. This information was ignored.
## Warning in .makeTxDb_normarg_chrominfo(chrominfo): genome version information
## is not available for this TxDb object
## OK
## [1] 507365
samplefiles <- list.files(peakdir, full.names = TRUE)
sample_names = basename(samplefiles)
sample_names <- sub("\\.(narrowPeak|broadPeak|bed|bedgraph|bam)(\\.gz)?$", "",
sample_names, ignore.case = TRUE)
sample_names <- sub("\\.chr11_12_peaks$", "", sample_names, ignore.case = TRUE)
files_for_peakprof <- setNames(as.list(samplefiles), sample_names)
head(sample_names)## [1] "ceb_ENCFF327JFG" "ceb_ENCFF744SVA" "H3K27me3_ENCFF164ALR"
## [4] "H3K27me3_ENCFF532DQH" "H3K9ac_ENCFF193NPE" "H3K9ac_ENCFF534IPX"
ceb <- files_for_peakprof[["ceb_ENCFF327JFG"]]
H3K27me3 <- files_for_peakprof[["H3K27me3_ENCFF164ALR"]]
H3K9ac <- files_for_peakprof[["H3K9ac_ENCFF193NPE"]]This heatmap shows CEB read density ±3 kb around transcription start sites, highlighting promoter-centered binding patterns.
peak_Profile_Heatmap(
peak = ceb,
upstream = 3000,
downstream = 3000,
by = "gene",
type = "start_site",
TxDb = txdb,
nbin = 800
) ## >> binning method is used...2025-12-09 14:42:18
## >> preparing start_site regions by gene... 2025-12-09 14:42:18
## >> preparing tag matrix by binning... 2025-12-09 14:42:18
## >> preparing promoter regions... 2025-12-09 14:42:21
## >> preparing tag matrix... 2025-12-09 14:42:21
## >> binning method is used...2025-12-09 14:42:21
## >> preparing start_site regions by gene... 2025-12-09 14:42:21
## >> preparing tag matrix by binning... 2025-12-09 14:42:21
## >> generating figure... 2025-12-09 14:42:22
## >> done... 2025-12-09 14:42:22
This heatmap visualizes how the repressive H3K27me3 mark distributes relative to TSS positions.
peak_Profile_Heatmap(
peak = H3K27me3,
upstream = 3000,
downstream = 3000,
by = "gene",
type = "start_site",
TxDb = txdb,
nbin = 800
)## >> binning method is used...2025-12-09 14:42:27
## >> preparing start_site regions by gene... 2025-12-09 14:42:27
## >> preparing tag matrix by binning... 2025-12-09 14:42:27
## >> preparing promoter regions... 2025-12-09 14:42:31
## >> preparing tag matrix... 2025-12-09 14:42:31
## >> binning method is used...2025-12-09 14:42:31
## >> preparing start_site regions by gene... 2025-12-09 14:42:31
## >> preparing tag matrix by binning... 2025-12-09 14:42:31
## >> generating figure... 2025-12-09 14:42:32
## >> done... 2025-12-09 14:42:32
This plot shows enrichment of the active histone mark H3K9ac near TSS regions.
peak_Profile_Heatmap(
peak = H3K9ac,
upstream = 3000,
downstream = 3000,
by = "gene",
type = "start_site",
TxDb = txdb,
nbin = 800
) ## >> binning method is used...2025-12-09 14:42:39
## >> preparing start_site regions by gene... 2025-12-09 14:42:39
## >> preparing tag matrix by binning... 2025-12-09 14:42:39
## >> preparing promoter regions... 2025-12-09 14:42:45
## >> preparing tag matrix... 2025-12-09 14:42:45
## >> binning method is used...2025-12-09 14:42:45
## >> preparing start_site regions by gene... 2025-12-09 14:42:45
## >> preparing tag matrix by binning... 2025-12-09 14:42:45
## >> generating figure... 2025-12-09 14:42:49
## >> done... 2025-12-09 14:42:49
This line plot shows averaged tag density across promoter windows for each dataset.
promoter <- getPromoters(TxDb = txdb, upstream = 3000, downstream = 3000)
tagMatrixList <- setNames(
lapply(samplefiles, getTagMatrix, windows = promoter),
sample_names
)## >> preparing start_site regions by gene... 2025-12-09 14:43:04
## >> preparing tag matrix... 2025-12-09 14:43:04
## >> preparing start_site regions by gene... 2025-12-09 14:43:05
## >> preparing tag matrix... 2025-12-09 14:43:05
## >> preparing start_site regions by gene... 2025-12-09 14:43:07
## >> preparing tag matrix... 2025-12-09 14:43:07
## >> preparing start_site regions by gene... 2025-12-09 14:43:08
## >> preparing tag matrix... 2025-12-09 14:43:08
## >> preparing start_site regions by gene... 2025-12-09 14:43:10
## >> preparing tag matrix... 2025-12-09 14:43:10
## >> preparing start_site regions by gene... 2025-12-09 14:43:13
## >> preparing tag matrix... 2025-12-09 14:43:13
## >> plotting figure... 2025-12-09 14:43:14
This figure shows how signals distribute across scaled gene bodies with 20% upstream/downstream extension.
plotPeakProf2(files_for_peakprof,
upstream = rel(0.2), downstream = rel(0.2), by = "gene", type = "body",
TxDb = txdb, nbin = 800) + plot_theme## >> binning method is used...2025-12-09 14:43:17
## >> preparing body regions by gene... 2025-12-09 14:43:17
## >> preparing tag matrix by binning... 2025-12-09 14:43:17
## >> preparing matrix with extension from (TSS-20%)~(TTS+20%)... 2025-12-09 14:43:17
## >> 14 peaks(1.265823%), having lengths smaller than 800bp, are filtered... 2025-12-09 14:43:17
## >> binning method is used...2025-12-09 14:43:43
## >> preparing body regions by gene... 2025-12-09 14:43:43
## >> preparing tag matrix by binning... 2025-12-09 14:43:43
## >> preparing matrix with extension from (TSS-20%)~(TTS+20%)... 2025-12-09 14:43:43
## >> 15 peaks(1.221498%), having lengths smaller than 800bp, are filtered... 2025-12-09 14:43:44
## >> binning method is used...2025-12-09 14:44:13
## >> preparing body regions by gene... 2025-12-09 14:44:13
## >> preparing tag matrix by binning... 2025-12-09 14:44:13
## >> preparing matrix with extension from (TSS-20%)~(TTS+20%)... 2025-12-09 14:44:13
## >> 58 peaks(4.919423%), having lengths smaller than 800bp, are filtered... 2025-12-09 14:44:14
## >> binning method is used...2025-12-09 14:44:35
## >> preparing body regions by gene... 2025-12-09 14:44:35
## >> preparing tag matrix by binning... 2025-12-09 14:44:35
## >> preparing matrix with extension from (TSS-20%)~(TTS+20%)... 2025-12-09 14:44:35
## >> 67 peaks(5.138037%), having lengths smaller than 800bp, are filtered... 2025-12-09 14:44:35
## >> binning method is used...2025-12-09 14:44:57
## >> preparing body regions by gene... 2025-12-09 14:44:57
## >> preparing tag matrix by binning... 2025-12-09 14:44:57
## >> preparing matrix with extension from (TSS-20%)~(TTS+20%)... 2025-12-09 14:44:57
## >> 205 peaks(6.867672%), having lengths smaller than 800bp, are filtered... 2025-12-09 14:44:58
## >> binning method is used...2025-12-09 14:45:51
## >> preparing body regions by gene... 2025-12-09 14:45:51
## >> preparing tag matrix by binning... 2025-12-09 14:45:51
## >> preparing matrix with extension from (TSS-20%)~(TTS+20%)... 2025-12-09 14:45:51
## >> 147 peaks(5.671296%), having lengths smaller than 800bp, are filtered... 2025-12-09 14:45:52
This barplot summarizes the fraction of CEB peaks in promoters, introns, exons, and intergenic space.
## >> loading peak file... 2025-12-09 14:46:28
## >> preparing features information... 2025-12-09 14:46:28
## >> identifying nearest features... 2025-12-09 14:46:29
## >> calculating distance from peak to TSS... 2025-12-09 14:46:30
## >> assigning genomic annotation... 2025-12-09 14:46:30
## >> assigning chromosome lengths 2025-12-09 14:47:23
## >> done... 2025-12-09 14:47:23
## Annotated peaks generated by ChIPseeker
## 1188/1188 peaks were annotated
## Genomic Annotation Summary:
## Feature Frequency
## 8 Promoter (<=1kb) 22.8114478
## 9 Promoter (1-2kb) 8.6700337
## 10 Promoter (2-3kb) 6.2289562
## 4 5' UTR 0.6734007
## 3 3' UTR 1.7676768
## 1 1st Exon 0.1683502
## 6 Other Exon 2.5252525
## 2 1st Intron 17.8451178
## 7 Other Intron 23.6531987
## 5 Distal Intergenic 15.6565657
## Warning: `aes_string()` was deprecated in ggplot2 3.0.0.
## ℹ Please use tidy evaluation idioms with `aes()`.
## ℹ See also `vignette("ggplot2-in-packages")` for more information.
## ℹ The deprecated feature was likely used in the ChIPseeker package.
## Please report the issue at <https://github.com/YuLab-SMU/ChIPseeker/issues>.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
This annotation plot shows how H3K27me3 peaks distribute across genomic elements.
## >> loading peak file... 2025-12-09 14:47:26
## >> preparing features information... 2025-12-09 14:47:26
## >> identifying nearest features... 2025-12-09 14:47:26
## >> calculating distance from peak to TSS... 2025-12-09 14:47:26
## >> assigning genomic annotation... 2025-12-09 14:47:26
## >> assigning chromosome lengths 2025-12-09 14:47:34
## >> done... 2025-12-09 14:47:34
## Annotated peaks generated by ChIPseeker
## 1235/1235 peaks were annotated
## Genomic Annotation Summary:
## Feature Frequency
## 8 Promoter (<=1kb) 55.7894737
## 9 Promoter (1-2kb) 6.9635628
## 10 Promoter (2-3kb) 6.4777328
## 3 5' UTR 0.3238866
## 2 3' UTR 0.7287449
## 6 Other Exon 2.6720648
## 1 1st Intron 8.0971660
## 7 Other Intron 9.4736842
## 5 Downstream (<=300) 0.2429150
## 4 Distal Intergenic 9.2307692
This plot displays the annotation categories for H3K9ac peaks, a mark associated with active chromatin states.
## >> loading peak file... 2025-12-09 14:47:36
## >> preparing features information... 2025-12-09 14:47:36
## >> identifying nearest features... 2025-12-09 14:47:36
## >> calculating distance from peak to TSS... 2025-12-09 14:47:37
## >> assigning genomic annotation... 2025-12-09 14:47:37
## >> assigning chromosome lengths 2025-12-09 14:47:45
## >> done... 2025-12-09 14:47:45
## Annotated peaks generated by ChIPseeker
## 4592/4592 peaks were annotated
## Genomic Annotation Summary:
## Feature Frequency
## 9 Promoter (<=1kb) 53.33188153
## 10 Promoter (1-2kb) 8.42770035
## 11 Promoter (2-3kb) 5.64024390
## 4 5' UTR 0.41376307
## 3 3' UTR 1.95993031
## 1 1st Exon 0.26132404
## 7 Other Exon 2.35191638
## 2 1st Intron 9.97386760
## 8 Other Intron 11.86846690
## 6 Downstream (<=300) 0.06533101
## 5 Distal Intergenic 5.70557491
This multi-sample barplot compares how each dataset distributes across promoters, introns, exons, and intergenic regions.
peakAnnoList <- lapply(samplefiles, annotatePeak, TxDb = txdb,
tssRegion = c(-3000, 3000), verbose = FALSE)
names(peakAnnoList) <- sample_names
plotAnnoBar(peakAnnoList) + plot_theme## R version 4.5.1 (2025-06-13)
## Platform: aarch64-apple-darwin20
## Running under: macOS Tahoe 26.1
##
## Matrix products: default
## BLAS: /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRblas.0.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.1
##
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
##
## time zone: Asia/Kolkata
## tzcode source: internal
##
## attached base packages:
## [1] stats4 stats graphics grDevices utils datasets methods
## [8] base
##
## other attached packages:
## [1] ggplot2_4.0.1 clusterProfiler_4.16.0 GenomicFeatures_1.60.0
## [4] AnnotationDbi_1.70.0 Biobase_2.68.0 GenomicRanges_1.60.0
## [7] GenomeInfoDb_1.44.3 IRanges_2.42.0 S4Vectors_0.46.0
## [10] BiocGenerics_0.54.1 generics_0.1.4 ChIPseeker_1.44.0
##
## 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.4
## [5] ggtangle_0.0.9
## [6] farver_2.1.2
## [7] rmarkdown_2.30
## [8] fs_1.6.6
## [9] BiocIO_1.18.0
## [10] vctrs_0.6.5
## [11] memoise_2.0.1
## [12] Rsamtools_2.24.1
## [13] RCurl_1.98-1.17
## [14] ggtree_3.16.3
## [15] progress_1.2.3
## [16] htmltools_0.5.9
## [17] S4Arrays_1.8.1
## [18] TxDb.Hsapiens.UCSC.hg19.knownGene_3.2.2
## [19] plotrix_3.8-13
## [20] curl_7.0.0
## [21] SparseArray_1.8.1
## [22] gridGraphics_0.5-1
## [23] sass_0.4.10
## [24] KernSmooth_2.23-26
## [25] bslib_0.9.0
## [26] httr2_1.2.2
## [27] plyr_1.8.9
## [28] cachem_1.1.0
## [29] GenomicAlignments_1.44.0
## [30] igraph_2.2.1
## [31] lifecycle_1.0.4
## [32] pkgconfig_2.0.3
## [33] gson_0.1.0
## [34] Matrix_1.7-4
## [35] R6_2.6.1
## [36] fastmap_1.2.0
## [37] GenomeInfoDbData_1.2.14
## [38] MatrixGenerics_1.20.0
## [39] digest_0.6.39
## [40] aplot_0.2.9
## [41] enrichplot_1.28.4
## [42] colorspace_2.1-2
## [43] patchwork_1.3.2
## [44] RSQLite_2.4.5
## [45] labeling_0.4.3
## [46] filelock_1.0.3
## [47] httr_1.4.7
## [48] abind_1.4-8
## [49] compiler_4.5.1
## [50] withr_3.0.2
## [51] bit64_4.6.0-1
## [52] S7_0.2.1
## [53] BiocParallel_1.42.2
## [54] DBI_1.2.3
## [55] gplots_3.3.0
## [56] R.utils_2.13.0
## [57] biomaRt_2.64.0
## [58] rappdirs_0.3.3
## [59] DelayedArray_0.34.1
## [60] rjson_0.2.23
## [61] gtools_3.9.5
## [62] caTools_1.18.3
## [63] tools_4.5.1
## [64] otel_0.2.0
## [65] ape_5.8-1
## [66] R.oo_1.27.1
## [67] glue_1.8.0
## [68] restfulr_0.0.16
## [69] nlme_3.1-168
## [70] GOSemSim_2.34.0
## [71] grid_4.5.1
## [72] reshape2_1.4.5
## [73] fgsea_1.34.2
## [74] gtable_0.3.6
## [75] R.methodsS3_1.8.2
## [76] tidyr_1.3.1
## [77] hms_1.1.4
## [78] data.table_1.17.8
## [79] xml2_1.5.1
## [80] XVector_0.48.0
## [81] ggrepel_0.9.6
## [82] pillar_1.11.1
## [83] stringr_1.6.0
## [84] yulab.utils_0.2.2
## [85] splines_4.5.1
## [86] dplyr_1.1.4
## [87] BiocFileCache_2.16.2
## [88] treeio_1.32.0
## [89] lattice_0.22-7
## [90] rtracklayer_1.68.0
## [91] bit_4.6.0
## [92] tidyselect_1.2.1
## [93] GO.db_3.21.0
## [94] Biostrings_2.76.0
## [95] knitr_1.50
## [96] SummarizedExperiment_1.38.1
## [97] xfun_0.54
## [98] matrixStats_1.5.0
## [99] stringi_1.8.7
## [100] UCSC.utils_1.4.0
## [101] lazyeval_0.2.2
## [102] ggfun_0.2.0
## [103] yaml_2.3.11
## [104] boot_1.3-32
## [105] evaluate_1.0.5
## [106] codetools_0.2-20
## [107] tibble_3.3.0
## [108] qvalue_2.40.0
## [109] ggplotify_0.1.3
## [110] cli_3.6.5
## [111] jquerylib_0.1.4
## [112] dichromat_2.0-0.1
## [113] Rcpp_1.1.0
## [114] dbplyr_2.5.1
## [115] png_0.1-8
## [116] XML_3.99-0.20
## [117] parallel_4.5.1
## [118] blob_1.2.4
## [119] prettyunits_1.2.0
## [120] DOSE_4.2.0
## [121] bitops_1.0-9
## [122] txdbmaker_1.4.2
## [123] tidytree_0.4.6
## [124] scales_1.4.0
## [125] purrr_1.2.0
## [126] crayon_1.5.3
## [127] rlang_1.1.6
## [128] cowplot_1.2.0
## [129] fastmatch_1.1-6
## [130] KEGGREST_1.48.1