Last updated: 2018-11-07
workflowr checks: (Click a bullet for more information) ✔ R Markdown file: up-to-date
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.
✔ Environment: empty
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.
✔ Seed:
set.seed(1)
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.
✔ Session information: recorded
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
✔ Repository version: f5dec9c
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: 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: analysis/.#chipseq.Rmd
Unstaged changes:
Modified: analysis/spikesdemo.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.
File | Version | Author | Date | Message |
---|---|---|---|---|
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”) |
Rmd | 891e862 | Peter Carbonetto | 2018-10-18 | wflow_publish(“chipseq.Rmd”) |
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”) |
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",upgrade_dependencies = FALSE)
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)
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.
Next, we apply SMASH to the read counts to estimate the mean and variance of the underlying signal. It may take several minutes to complete this step.
res <- smash.poiss(counts,post.var = TRUE)
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.
macs.file <- "../data/Gm1287peaks_chr1_sorted.txt"
peaks <- read.macs.peaks(macs.file,min(bppos),max(bppos))
This next plot shows the intensity function estimated by SMASH (orange 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,(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))
Version | Author | Date |
---|---|---|
17b5a47 | Peter Carbonetto | 2018-10-18 |
Based on this plot, it is clear that the the strongest 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] cowplot_0.9.3 ggplot2_3.1.0 smashr_1.2-0
#
# loaded via a namespace (and not attached):
# [1] Rcpp_0.12.19 bindr_0.1.1 pillar_1.2.1
# [4] plyr_1.8.4 compiler_3.4.3 git2r_0.23.0
# [7] workflowr_1.1.1 R.methodsS3_1.7.1 R.utils_2.6.0
# [10] bitops_1.0-6 iterators_1.0.9 tools_3.4.3
# [13] digest_0.6.17 tibble_1.4.2 evaluate_0.11
# [16] gtable_0.2.0 lattice_0.20-35 pkgconfig_2.0.2
# [19] rlang_0.2.2 Matrix_1.2-12 foreach_1.4.4
# [22] yaml_2.2.0 parallel_3.4.3 bindrcpp_0.2.2
# [25] withr_2.1.2 dplyr_0.7.6 stringr_1.3.1
# [28] knitr_1.20 REBayes_1.3 caTools_1.17.1
# [31] tidyselect_0.2.4 rprojroot_1.3-2 grid_3.4.3
# [34] glue_1.3.0 data.table_1.11.4 R6_2.2.2
# [37] rmarkdown_1.10 purrr_0.2.5 ashr_2.2-7
# [40] magrittr_1.5 whisker_0.3-2 backports_1.1.2
# [43] scales_0.5.0 codetools_0.2-15 htmltools_0.3.6
# [46] MASS_7.3-48 assertthat_0.2.0 colorspace_1.4-0
# [49] labeling_0.3 wavethresh_4.6.8 stringi_1.2.4
# [52] Rmosek_8.0.69 lazyeval_0.2.1 doParallel_1.0.11
# [55] pscl_1.5.2 munsell_0.4.3 truncnorm_1.0-8
# [58] SQUAREM_2017.10-1 R.oo_1.21.0
This reproducible R Markdown analysis was created with workflowr 1.1.1