Last updated: 2019-12-18
Checks: 7 0
Knit directory: smash-paper/analysis/
This reproducible R Markdown analysis was created with workflowr (version 1.5.0.9000). 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(1)
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 version displayed above was the version of the Git repository at the time these results were generated.
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: analysis/figure/
Ignored: dsc/code/Wavelab850/MEXSource/CPAnalysis.mexmac
Ignored: dsc/code/Wavelab850/MEXSource/DownDyadHi.mexmac
Ignored: dsc/code/Wavelab850/MEXSource/DownDyadLo.mexmac
Ignored: dsc/code/Wavelab850/MEXSource/FAIPT.mexmac
Ignored: dsc/code/Wavelab850/MEXSource/FCPSynthesis.mexmac
Ignored: dsc/code/Wavelab850/MEXSource/FMIPT.mexmac
Ignored: dsc/code/Wavelab850/MEXSource/FWPSynthesis.mexmac
Ignored: dsc/code/Wavelab850/MEXSource/FWT2_PO.mexmac
Ignored: dsc/code/Wavelab850/MEXSource/FWT_PBS.mexmac
Ignored: dsc/code/Wavelab850/MEXSource/FWT_PO.mexmac
Ignored: dsc/code/Wavelab850/MEXSource/FWT_TI.mexmac
Ignored: dsc/code/Wavelab850/MEXSource/IAIPT.mexmac
Ignored: dsc/code/Wavelab850/MEXSource/IMIPT.mexmac
Ignored: dsc/code/Wavelab850/MEXSource/IWT2_PO.mexmac
Ignored: dsc/code/Wavelab850/MEXSource/IWT_PBS.mexmac
Ignored: dsc/code/Wavelab850/MEXSource/IWT_PO.mexmac
Ignored: dsc/code/Wavelab850/MEXSource/IWT_TI.mexmac
Ignored: dsc/code/Wavelab850/MEXSource/LMIRefineSeq.mexmac
Ignored: dsc/code/Wavelab850/MEXSource/MedRefineSeq.mexmac
Ignored: dsc/code/Wavelab850/MEXSource/UpDyadHi.mexmac
Ignored: dsc/code/Wavelab850/MEXSource/UpDyadLo.mexmac
Ignored: dsc/code/Wavelab850/MEXSource/WPAnalysis.mexmac
Ignored: dsc/code/Wavelab850/MEXSource/dct_ii.mexmac
Ignored: dsc/code/Wavelab850/MEXSource/dct_iii.mexmac
Ignored: dsc/code/Wavelab850/MEXSource/dct_iv.mexmac
Ignored: dsc/code/Wavelab850/MEXSource/dst_ii.mexmac
Ignored: dsc/code/Wavelab850/MEXSource/dst_iii.mexmac
Untracked files:
Untracked: files.txt
Unstaged changes:
Modified: code/chipseq.functions.R
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 R Markdown and HTML files. If you’ve configured a remote Git repository (see ?wflow_git_remote
), click on the hyperlinks in the table below to view them.
File | Version | Author | Date | Message |
---|---|---|---|---|
Rmd | e576395 | Peter Carbonetto | 2019-12-18 | wflow_publish(“chipseq.Rmd”) |
Rmd | f899adf | Peter Carbonetto | 2019-12-18 | Working on code to run HF method in chipseq example. |
Rmd | 500381a | Zhengrong Xing | 2019-10-28 | move gausdemo; add HF for chipseq |
html | 99d1f34 | Peter Carbonetto | 2018-12-07 | Re-built all the outdated workflowr webpages. |
Rmd | a09d13e | Peter Carbonetto | 2018-11-09 | Adjusted setup steps in a few of the R Markdown files. |
html | 0fa970b | Peter Carbonetto | 2018-11-07 | Some small adjustments to the chipseq example text. |
Rmd | d9f6b81 | Peter Carbonetto | 2018-11-07 | wflow_publish(“chipseq.Rmd”) |
html | 0b15924 | Peter Carbonetto | 2018-11-07 | Added setup instructions to chipseq analysis. |
Rmd | f5dec9c | Peter Carbonetto | 2018-11-07 | wflow_publish(“chipseq.Rmd”) |
Rmd | f9f193c | Peter Carbonetto | 2018-11-07 | Revised setup instructions for a couple .Rmd files. |
html | 9cf40ea | Peter Carbonetto | 2018-11-07 | Build site. |
Rmd | 63bc42d | Peter Carbonetto | 2018-11-07 | wflow_publish(“chipseq.Rmd”) |
html | b66089f | Peter Carbonetto | 2018-10-19 | Added a bit of explanatory text to the end of the chipseq.Rmd analysis. |
Rmd | 891e862 | Peter Carbonetto | 2018-10-19 | wflow_publish(“chipseq.Rmd”) |
html | f49c927 | Peter Carbonetto | 2018-10-18 | Adjusted size of figure in chipseq example. |
Rmd | 3683070 | Peter Carbonetto | 2018-10-18 | wflow_publish(“chipseq.Rmd”) |
html | 17b5a47 | Peter Carbonetto | 2018-10-18 | Adjusted chipseq R Markdown source. |
Rmd | 38211a8 | Peter Carbonetto | 2018-10-18 | wflow_publish(“chipseq.Rmd”) |
html | b9c076d | Peter Carbonetto | 2018-10-18 | First wflow_publish(“chipseq.Rmd”). |
Rmd | 90e3ac9 | Peter Carbonetto | 2018-10-18 | wflow_publish(“chipseq.Rmd”) |
Rmd | 1ef7492 | Peter Carbonetto | 2018-10-18 | Working on chipseq R Markdown file. |
This is an illustration of “SMoothing by Adaptive SHrinkage” (SMASH) applied to chromatin immunoprecipitation sequencing (“ChIP-seq”) data. This implements the SMASH analysis presented in Sec. 5.2 of the manuscript.
To run this example on your own computer, please follow these setup instructions. These instructions assume you already have R (optionally, RStudio) installed on your computer.
Download or clone the git repository on your computer.
Launch R, and change the working directory to be the “analysis” folder inside your local copy of the git repository.
Install the devtools, ggplot2 and cowplot packages used here and in the code below:
install.packages(c("devtools","ggplot2","cowplot"))
Finally, install the smashr package from GitHub:
devtools::install_github("stephenslab/smashr")
See the “Session Info” at the bottom for the versions of the software and R packages that were used to generate the results shown below.
Loading the smashr, ggplot2 and cowplot packages, as well as some additional functions used to implement the analysis below.
source("../code/chipseq.functions.R")
library(smashr)
library(ggplot2)
library(cowplot)
library(haarfisz)
The ChIP-seq data are sequencing read counts for transcription factor YY1 in cell line GM12878, restricted to 880,001–1,011,072 bp on chromosome 1. These data were collected as part of the ENCODE (“Encyclopedia Of DNA Elements”) project. The data are included with the git repository.
load("../data/reg_880000_1011072.RData")
bppos <- 880001:1011072
counts <- M[1,] + M[,2]
Note that there are two replicates of the GM12878 cell line, so we analyze the combined read counts from both replicates, stored in the counts
vectors.
The Haar-Fisz method transforms the Poisson counts, then applies Gaussian wavelet methods to the transformed data. Note that this call can take several minutes to run on a modern desktop computer.
res.hf <- denoise.poisson(counts,meth.1 = hf.la10.ti4,cs.1 = 50,hybrid = FALSE)
Next, we apply SMASH to the read counts to estimate the mean and variance of the underlying signal. It could also take several minutes to complete this step.
res <- smash.poiss(counts,post.var = TRUE)
# Warning in estimate_mixprop(data, g, prior, optmethod = optmethod, control
# = control, : Optimization failed to converge. Results may be unreliable.
# Try increasing maxiter and rerunning.
# Warning in estimate_mixprop(data, g, prior, optmethod = optmethod, control
# = control, : Optimization failed to converge. Results may be unreliable.
# Try increasing maxiter and rerunning.
# Warning in estimate_mixprop(data, g, prior, optmethod = optmethod, control
# = control, : Optimization failed to converge. Results may be unreliable.
# Try increasing maxiter and rerunning.
# Warning in estimate_mixprop(data, g, prior, optmethod = optmethod, control
# = control, : Optimization failed to converge. Results may be unreliable.
# Try increasing maxiter and rerunning.
# Warning in estimate_mixprop(data, g, prior, optmethod = optmethod, control
# = control, : Optimization failed to converge. Results may be unreliable.
# Try increasing maxiter and rerunning.
# Warning in estimate_mixprop(data, g, prior, optmethod = optmethod, control
# = control, : Optimization failed to converge. Results may be unreliable.
# Try increasing maxiter and rerunning.
To provide a “baseline” to compare against the SMASH estimates, we retrieve the peaks identified in the same ChIP-seq data using the MACS software. Again, these data should have been included with the git repository you downloaded.
macs.file <- "../data/Gm1287peaks_chr1_sorted.txt"
peaks <- read.macs.peaks(macs.file,min(bppos),max(bppos))
This next plot shows the intensity functions estimated by SMASH (orange line) and the Haar-Fisz method (dark blue line). The read count data are depicted as light blue circles, in which the area of each circle is scaled by the number of data points that fall within each 1.6-kb “bin”. (We show counts summarized within bins because there are too many data points to plot them individually.)
The peaks identified by the MACS software are shown as red triangles. (Specifically, these are the mean positions of the identified peak intervals; the peak intervals are short enough that it is not useful to show both the start and end positions of these intervals.)
create.chipseq.plot(bppos/1e6,counts,res$est,res.hf,
(peaks$start + peaks$end)/2e6,nbreaks = 80) +
scale_x_continuous(limits = c(0.88,1.02),breaks = seq(0.88,1.02,0.02)) +
scale_y_continuous(limits = c(-1,9),breaks = seq(0,8,2))
Based on this plot, it is clear that the strongest Haar-Fisz and SMASH intensity estimates align very closely with the peaks found by MACS. Intriguingly, the SMASH estimates also suggest the presence of several additional weaker peaks that were not identified by MACS.
sessionInfo()
# R version 3.4.3 (2017-11-30)
# Platform: x86_64-apple-darwin15.6.0 (64-bit)
# Running under: macOS High Sierra 10.13.6
#
# Matrix products: default
# BLAS: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRblas.0.dylib
# LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
#
# locale:
# [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#
# attached base packages:
# [1] stats graphics grDevices utils datasets methods base
#
# other attached packages:
# [1] haarfisz_4.5 wavethresh_4.6.8 MASS_7.3-48 cowplot_0.9.4
# [5] ggplot2_3.2.0 smashr_1.2-5
#
# loaded via a namespace (and not attached):
# [1] tidyselect_0.2.5 xfun_0.7 ashr_2.2-39
# [4] purrr_0.2.5 lattice_0.20-35 colorspace_1.4-0
# [7] htmltools_0.3.6 yaml_2.2.0 rlang_0.4.2
# [10] mixsqp_0.3-6 later_0.8.0 pillar_1.3.1
# [13] glue_1.3.1 withr_2.1.2.9000 foreach_1.4.4
# [16] plyr_1.8.4 stringr_1.4.0 munsell_0.4.3
# [19] gtable_0.2.0 workflowr_1.5.0.9000 caTools_1.17.1.2
# [22] codetools_0.2-15 evaluate_0.13 labeling_0.3
# [25] knitr_1.23 pscl_1.5.2 doParallel_1.0.14
# [28] httpuv_1.5.0 parallel_3.4.3 Rcpp_1.0.1
# [31] promises_1.0.1 backports_1.1.2 scales_0.5.0
# [34] truncnorm_1.0-8 fs_1.2.7 digest_0.6.18
# [37] stringi_1.4.3 dplyr_0.8.0.1 grid_3.4.3
# [40] rprojroot_1.3-2 tools_3.4.3 bitops_1.0-6
# [43] magrittr_1.5 lazyeval_0.2.1 tibble_2.1.1
# [46] crayon_1.3.4 whisker_0.3-2 pkgconfig_2.0.2
# [49] Matrix_1.2-12 SQUAREM_2017.10-1 data.table_1.12.0
# [52] assertthat_0.2.1 rmarkdown_1.17 iterators_1.0.10
# [55] R6_2.4.0 git2r_0.26.1 compiler_3.4.3