NADfinder 1.24.0
Nucleoli serve as major organizing hubs for the three-dimensional structure of mammalian heterochromatin1. Specific loci, termed nucleolar-associated domains (NADs), form frequent three-dimensional associations with nucleoli.2 Early mammalian development is a critical period to study NAD biological function, because interactions between pericentromeric chromatin and perinucleolar regions are particularly dynamic during embryonic development.4 Here, we developed a Bioconductor package NADfinder for bioinformatic analysis of the NAD-seq data, including normalization, smoothing, peak calling, peak trimming and annotation. We demonstrate the application of NADfinder in mapping the NADs in the mouse genome, determining how these associations are altered during embryonic stem cell (ESC) differentiation, and develop tools for study of these higher-order chromosome interactions in fixed and live single cells (Fig. 1).
samples
Here is an example to use NADfinder for peak calling.
Here is the code snippet for calculating coverage with a sliding window in a given step along the genome using a pair of bam files from genomic sample as background and purified nucleoleus-associated DNA as target signal.
## load the library
library(NADfinder)
library(SummarizedExperiment)
## test bam files in the package
path <- system.file("extdata", package = "NADfinder", lib.loc = NULL,
mustWork = TRUE)
bamFiles <- dir(path, ".bam$")
## window size for tile of genome. Here we set it to a big window size,
## ie., 50k because of the following two reasons:
## 1. peaks of NADs are wide;
## 2. data will be smoothed better with bigger window size.
ws <- 50000
## step for tile of genome
step <- 5000
## Set the background.
## 0.25 means 25% of the lower ratios will be used for background training.
backgroundPercentage <- 0.25
## Count the reads for each window with a given step in the genome.
## The output will be a GRanges object.
library(BSgenome.Mmusculus.UCSC.mm10)
se <- tileCount(reads=file.path(path, bamFiles),
genome=Mmusculus,
windowSize=ws,
step=step,
mode = IntersectionNotStrict,
dataOverSamples = FALSE)
Here we load the pre-computed coverage data single.count to save build time.
data(single.count)
se <- single.count
For quality asessment, cumulativePercentage
can be used to plot the
cumulative sums of sorted read counts for nucleolus-associated DNA and
whole genomic DNA. We expect the cumulative sum in the genomic DNA to
be close to a straight line because the coverage for the genomic DNA
sample should be uniformly distributed. Unlike ChIP-seq data, the
cumulative sum for the nucleoleus sample will not exhibit sharp changes
because most of NADs are broad regions as wide as 100 kb. However, we
should observe clear differences between the two curves.
## Calculate ratios for peak calling. We use nucleoleus vs genomic DNA.
dat <- log2se(se, nucleolusCols = "N18.subsampled.srt.bam",
genomeCols ="G18.subsampled.srt.bam",
transformation = "log2CPMRatio")
## Smooth the ratios for each chromosome.
## We found that for each chromosome, the ratios are higher in 5'end than 3'end.
datList <- smoothRatiosByChromosome(dat, chr = c("chr18", "chr19"), N = 100)
## check the difference between the cumulative percentage tag allocation
## in genome and nucleoleus samples.
cumulativePercentage(datList[["chr18"]])
Before peak calling, the function smoothRatiosByChromosome
is used for
log ratios calculation, normalization and smoothing.
The peaks will be called if the ratios are significantly higher than
chromosome-specific background determined by trimPeaks
.
The following figure shows the peaks (black rectangles) called
using normalized (green curve) and smoothed (red curve) log2 ratios.
## check the results of smooth function
chr18 <- datList[["chr18"]] ## we only have reads in chr18 in test data.
chr18subset <- subset(chr18, seq.int(floor(length(chr18)/10))*10)
chr18 <- assays(chr18subset)
ylim <- range(c(chr18$ratio[, 1],
chr18$bcRatio[, 1],
chr18$smoothedRatio[, 1]))
plot(chr18$ratio[, 1],
ylim=ylim*c(.9, 1.1),
type="l", main="chr18")
abline(h=0, col="cyan", lty=2)
points(chr18$bcRatio[, 1], type="l", col="green")
points(chr18$smoothedRatio[, 1], type="l", col="red")
legend("topright",
legend = c("raw_ratio", "background_corrected", "smoothed"),
fill = c("black", "green", "red"))
## call peaks for each chromosome
peaks <- lapply(datList, trimPeaks,
backgroundPercentage=backgroundPercentage,
cutoffAdjPvalue=0.05, countFilter=1000)
## plot the peaks in "chr18"
peaks.subset <- countOverlaps(rowRanges(chr18subset), peaks$chr18)>=1
peaks.run <- rle(peaks.subset)
run <- cumsum(peaks.run$lengths)
run <- data.frame(x0=c(1, run[-length(run)]), x1=run)
#run <- run[peaks.run$values, , drop=FALSE]
rect(xleft = run$x0, ybottom = ylim[2]*.75,
xright = run$x1, ytop = ylim[2]*.8,
col = "black")
## convert list to a GRanges object
peaks.gr <- unlist(GRangesList(peaks))
The following shows how to save or export the called peaks for downstream analysis.
## output the peaks
write.csv(as.data.frame(unname(peaks.gr)), "peaklist.csv", row.names=FALSE)
## export peaks to a bed file.
library(rtracklayer)
#export(peaks.gr, "peaklist.bed", "BED")
Data analysis with multiple biological replicates follows the same steps as that of a single paired samples, i.e., coverage calculation, normalization and smoothing, and peak calling. The only difference is that limma is used to determine the statistical significance in peak calling.
library(NADfinder)
## bam file path
path <- system.file("extdata", package = "NADfinder", lib.loc = NULL,
mustWork = TRUE)
bamFiles <- dir(path, ".bam$")
f <- bamFiles
ws <- 50000
step <- 5000
library(BSgenome.Mmusculus.UCSC.mm10)
se <- tileCount(reads=file.path(path, f),
genome=Mmusculus,
windowSize=ws,
step=step)
Load saved coverage.
data(triplicate.count)
se <- triplicate.count
## Calculate ratios for nucleoloar vs genomic samples.
se <- log2se(se,
nucleolusCols = c("N18.subsampled.srt-2.bam",
"N18.subsampled.srt-3.bam",
"N18.subsampled.srt.bam" ),
genomeCols = c("G18.subsampled.srt-2.bam",
"G18.subsampled.srt-3.bam",
"G18.subsampled.srt.bam"),
transformation = "log2CPMRatio")
seList<- smoothRatiosByChromosome(se, chr="chr18")
cumulativePercentage(seList[["chr18"]])
peaks <- lapply(seList, callPeaks,
cutoffAdjPvalue=0.05, countFilter=1)
peaks <- unlist(GRangesList(peaks))
peaks
## GRanges object with 552 ranges and 6 metadata columns:
## seqnames ranges strand | N18.subsampled.srt.2.bam
## <Rle> <IRanges> <Rle> | <numeric>
## chr18.1 chr18 2956001-3138000 * | 1.97569
## chr18.2 chr18 3141001-3249000 * | 2.15444
## chr18.3 chr18 3302001-3381000 * | 1.82705
## chr18.4 chr18 3413001-3455000 * | 1.91337
## chr18.5 chr18 3480001-3510000 * | 1.86436
## ... ... ... ... . ...
## chr18.552 chr18 90001001-90086000 * | 2.017107
## chr18.553 chr18 90087001-90182000 * | 2.055698
## chr18.554 chr18 90291001-90421000 * | 1.223125
## chr18.555 chr18 90465001-90554000 * | 0.849524
## chr18.556 chr18 90645001-90649000 * | 1.937102
## N18.subsampled.srt.3.bam N18.subsampled.srt.bam AveSig
## <numeric> <numeric> <numeric>
## chr18.1 1.97569 1.97569 1.97569
## chr18.2 2.15444 2.15444 2.15444
## chr18.3 1.82705 1.82705 1.82705
## chr18.4 1.91337 1.91337 1.91337
## chr18.5 1.86436 1.86436 1.86436
## ... ... ... ...
## chr18.552 2.017107 2.017107 2.017107
## chr18.553 2.055698 2.055698 2.055698
## chr18.554 1.223125 1.223125 1.223125
## chr18.555 0.849524 0.849524 0.849524
## chr18.556 1.937102 1.937102 1.937102
## P.value adj.P.Val
## <numeric> <numeric>
## chr18.1 6.26990e-45 1.1357e-43
## chr18.2 6.57176e-45 1.1357e-43
## chr18.3 7.60885e-45 1.1357e-43
## chr18.4 7.76846e-45 1.1357e-43
## chr18.5 7.83128e-45 1.1357e-43
## ... ... ...
## chr18.552 6.55868e-45 1.13570e-43
## chr18.553 7.45587e-45 1.13570e-43
## chr18.554 1.01613e-44 1.25293e-43
## chr18.555 9.66813e-45 1.20790e-43
## chr18.556 2.52998e-43 1.87847e-42
## -------
## seqinfo: 66 sequences (1 circular) from mm10 genome
The peaks can be visualized along the ideogram using plotSig
.
ideo <- readRDS(system.file("extdata", "ideo.mm10.rds",
package = "NADfinder"))
plotSig(ideo=ideo, grList=GRangesList(peaks), mcolName="AveSig",
layout=list("chr18"),
parameterList=list(types="heatmap"))
sessionInfo()
## R version 4.3.0 RC (2023-04-13 r84269)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 22.04.2 LTS
##
## Matrix products: default
## BLAS: /home/biocbuild/bbs-3.17-bioc/R/lib/libRblas.so
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
##
## 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
##
## time zone: America/New_York
## tzcode source: system (glibc)
##
## attached base packages:
## [1] stats4 stats graphics grDevices utils datasets methods
## [8] base
##
## other attached packages:
## [1] BSgenome.Mmusculus.UCSC.mm10_1.4.3 BSgenome_1.68.0
## [3] rtracklayer_1.60.0 Biostrings_2.68.0
## [5] XVector_0.40.0 NADfinder_1.24.0
## [7] SummarizedExperiment_1.30.0 Biobase_2.60.0
## [9] MatrixGenerics_1.12.0 matrixStats_0.63.0
## [11] GenomicRanges_1.52.0 GenomeInfoDb_1.36.0
## [13] IRanges_2.34.0 S4Vectors_0.38.0
## [15] BiocGenerics_0.46.0 BiocStyle_2.28.0
##
## loaded via a namespace (and not attached):
## [1] ProtGenerics_1.32.0 bitops_1.0-7
## [3] DirichletMultinomial_1.42.0 TFBSTools_1.38.0
## [5] httr_1.4.5 RColorBrewer_1.1-3
## [7] Rgraphviz_2.44.0 InteractionSet_1.28.0
## [9] numDeriv_2016.8-1.1 tools_4.3.0
## [11] backports_1.4.1 utf8_1.2.3
## [13] R6_2.5.1 HDF5Array_1.28.0
## [15] lazyeval_0.2.2 Gviz_1.44.0
## [17] sn_2.1.1 rhdf5filters_1.12.0
## [19] prettyunits_1.1.1 gridExtra_2.3
## [21] VennDiagram_1.7.3 cli_3.6.1
## [23] formatR_1.14 EmpiricalBrownsMethod_1.28.0
## [25] ATACseqQC_1.24.0 grImport_0.9-7
## [27] sandwich_3.0-2 sass_0.4.5
## [29] mvtnorm_1.1-3 readr_2.1.4
## [31] randomForest_4.7-1.1 Rsamtools_2.16.0
## [33] foreign_0.8-84 R.utils_2.12.2
## [35] dichromat_2.0-0.1 plotrix_3.8-2
## [37] limma_3.56.0 rstudioapi_0.14
## [39] RSQLite_2.3.1 generics_0.1.3
## [41] BiocIO_1.10.0 gtools_3.9.4
## [43] dplyr_1.1.2 GO.db_3.17.0
## [45] interp_1.1-4 Matrix_1.5-4
## [47] futile.logger_1.4.3 fansi_1.0.4
## [49] R.methodsS3_1.8.2 lifecycle_1.0.3
## [51] multcomp_1.4-23 yaml_2.3.7
## [53] edgeR_3.42.0 mathjaxr_1.6-0
## [55] rhdf5_2.44.0 BiocFileCache_2.8.0
## [57] grid_4.3.0 blob_1.2.4
## [59] promises_1.2.0.1 crayon_1.5.2
## [61] lattice_0.21-8 GenomicFeatures_1.52.0
## [63] annotate_1.78.0 KEGGREST_1.40.0
## [65] magick_2.7.4 GenomicScores_2.12.0
## [67] pillar_1.9.0 knitr_1.42
## [69] metapod_1.8.0 rjson_0.2.21
## [71] lpSolve_5.6.18 codetools_0.2-19
## [73] mutoss_0.1-13 glue_1.6.2
## [75] data.table_1.14.8 vctrs_0.6.2
## [77] png_0.1-8 Rdpack_2.4
## [79] gtable_0.3.3 poweRlaw_0.70.6
## [81] cachem_1.0.7 xfun_0.39
## [83] rbibutils_2.2.13 limSolve_1.5.6
## [85] mime_0.12 preseqR_4.0.0
## [87] pracma_2.4.2 baseline_1.3-4
## [89] survival_3.5-5 signal_0.7-7
## [91] interactiveDisplayBase_1.38.0 ellipsis_0.3.2
## [93] TH.data_1.1-2 bit64_4.0.5
## [95] progress_1.2.2 filelock_1.0.2
## [97] bslib_0.4.2 KernSmooth_2.23-20
## [99] rpart_4.1.19 colorspace_2.1-0
## [101] seqLogo_1.66.0 DBI_1.1.3
## [103] Hmisc_5.0-1 nnet_7.3-18
## [105] ade4_1.7-22 motifStack_1.44.0
## [107] mnormt_2.1.1 tidyselect_1.2.0
## [109] bit_4.0.5 compiler_4.3.0
## [111] curl_5.0.0 graph_1.78.0
## [113] csaw_1.34.0 htmlTable_2.4.1
## [115] SparseM_1.81 xml2_1.3.3
## [117] TFisher_0.2.0 DelayedArray_0.26.0
## [119] bookdown_0.33 checkmate_2.1.0
## [121] scales_1.2.1 caTools_1.18.2
## [123] quadprog_1.5-8 RBGL_1.76.0
## [125] rappdirs_0.3.3 stringr_1.5.0
## [127] digest_0.6.31 rmarkdown_2.21
## [129] jpeg_0.1-10 htmltools_0.5.5
## [131] pkgconfig_2.0.3 base64enc_0.1-3
## [133] highr_0.10 ensembldb_2.24.0
## [135] dbplyr_2.3.2 regioneR_1.32.0
## [137] fastmap_1.1.1 rlang_1.1.0
## [139] htmlwidgets_1.6.2 shiny_1.7.4
## [141] jquerylib_0.1.4 zoo_1.8-12
## [143] jsonlite_1.8.4 BiocParallel_1.34.0
## [145] R.oo_1.25.0 VariantAnnotation_1.46.0
## [147] RCurl_1.98-1.12 magrittr_2.0.3
## [149] polynom_1.4-1 Formula_1.2-5
## [151] GenomeInfoDbData_1.2.10 Rhdf5lib_1.22.0
## [153] munsell_0.5.0 Rcpp_1.0.10
## [155] trackViewer_1.36.0 stringi_1.7.12
## [157] zlibbioc_1.46.0 MASS_7.3-59
## [159] AnnotationHub_3.8.0 plyr_1.8.8
## [161] parallel_4.3.0 deldir_1.0-6
## [163] CNEr_1.36.0 splines_4.3.0
## [165] multtest_2.56.0 hms_1.1.3
## [167] locfit_1.5-9.7 qqconf_1.3.2
## [169] reshape2_1.4.4 biomaRt_2.56.0
## [171] futile.options_1.0.1 TFMPvalue_0.0.9
## [173] BiocVersion_3.17.1 XML_3.99-0.14
## [175] evaluate_0.20 metap_1.8
## [177] latticeExtra_0.6-30 biovizBase_1.48.0
## [179] lambda.r_1.2.4 BiocManager_1.30.20
## [181] tzdb_0.3.0 httpuv_1.6.9
## [183] ggplot2_3.4.2 xtable_1.8-4
## [185] AnnotationFilter_1.24.0 restfulr_0.0.15
## [187] later_1.3.0 ChIPpeakAnno_3.34.0
## [189] tibble_3.2.1 memoise_2.0.1
## [191] AnnotationDbi_1.62.0 GenomicAlignments_1.36.0
## [193] cluster_2.1.4 corrplot_0.92
1. Politz, J. C. R., Scalzo, D. & Groudine, M. The redundancy of the mammalian heterochromatic compartment. Current opinion in genetics & development 37, 1–8 (2016).
2. Németh, A. et al. Initial genomics of the human nucleolus. PLoS Genet 6, e1000889 (2010).
3. Koningsbruggen, S. van et al. High-resolution whole-genome sequencing reveals that specific chromatin domains from most human chromosomes associate with nucleoli. Molecular biology of the cell 21, 3735–3748 (2010).
4. Aguirre-Lavin, T. et al. 3D-fish analysis of embryonic nuclei in mouse highlights several abrupt changes of nuclear organization during preimplantation development. BMC developmental biology 12, 1 (2012).
5. Popken, J. et al. Reprogramming of fibroblast nuclei in cloned bovine embryos involves major structural remodeling with both striking similarities and differences to nuclear phenotypes of in vitro fertilized embryos. Nucleus 5, 555–589 (2014).