Last updated: 2021-10-25
Checks: 7 0
Knit directory: smash-gen/
This reproducible R Markdown analysis was created with workflowr (version 1.6.2). 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(20180501)
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 results in this page were generated with repository version 46c8831. See the Past versions tab to see a history of the changes made to the R Markdown and HTML files.
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: .Rproj.user/
Ignored: analysis/figure/
Untracked files:
Untracked: analysis/est_nugget.Rmd
Untracked: analysis/gtex_smooth.Rmd
Untracked: analysis/gtex_smooth_individual.Rmd
Untracked: code/smash_gen_poisson.R
Unstaged changes:
Modified: analysis/sigma.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.
These are the previous versions of the repository in which changes were made to the R Markdown (analysis/chipexo.Rmd
) and HTML (docs/chipexo.html
) files. If you’ve configured a remote Git repository (see ?wflow_git_remote
), click on the hyperlinks in the table below to view the files as they were in that past version.
File | Version | Author | Date | Message |
---|---|---|---|---|
Rmd | 46c8831 | DongyueXie | 2021-10-25 | wflow_publish(c(“analysis/chipexo.Rmd”, “analysis/chipexo_revisit.Rmd”)) |
html | 364a81a | Dongyue Xie | 2020-09-08 | Build site. |
Rmd | d3b6815 | Dongyue Xie | 2020-09-08 | wflow_publish(“analysis/chipexo.Rmd”) |
html | 65bf7cd | Dongyue Xie | 2020-09-07 | Build site. |
Rmd | 0d33dfa | Dongyue Xie | 2020-09-07 | wflow_publish(“analysis/chipexo.Rmd”) |
html | a1b44cb | Dongyue | 2018-06-03 | chip exo data analysis |
Rmd | f000105 | Dongyue | 2018-06-03 | chip exo data analysis |
The lenght of sequence here is 425, which is not a power of 2 hence causing problem when using smashgen. In this real data analysis, we reflect the data then apply smashgen to the augmented data.
source('code/smash_gen_poisson.R')
extract_counts_CTCF <- function(filename){
bed_counts <- read.table(filename, header = F, stringsAsFactors = F)
colnames(bed_counts) <- c("chr", "start", "end", "name", "width", "counts")
counts <- strsplit(bed_counts$counts, split = ",")[[1]]
counts[counts == "NA"] <- 0
counts <- as.numeric(counts)
return(counts.l = list(chr = bed_counts$chr, start = bed_counts$start, end = bed_counts$end, counts = counts))
}
real_study = function(file.name,plot.name){
chipexo1 <- extract_counts_CTCF(file.name)
print(paste("proportion of 0s:", round(sum(chipexo1$counts==0)/length(chipexo1$counts),2)))
#dash.out=dash_smooth(chipexo1$counts, dash_control = list(Inf_weight = 1), progressbar = FALSE)
smash.out=smash.poiss(chipexo1$counts)
#y=reflect(chipexo1$counts,'both',c(300,299))
smashgen.vst.out=smash.gen.poiss(chipexo1$counts,smooth_method = 'smash',transformation = 'vst',robust = F)
smashgen.lik.out=smash.gen.poiss(chipexo1$counts,smooth_method = 'smash',
transformation = 'lik_expansion',ash.pm = FALSE,robust = F)
fit.pois.gaus = smash.pois.gaus(chipexo1$counts)
plot(chipexo1$counts, col = "gray80", type = "p", pch=20,ylab = "counts", xlab = "", main = plot.name)
lines(smash.out, col = "blue", lwd = 1)
#lines(dash.out$estimate, col = "red", lwd = 1)
lines(smashgen.vst.out$lambda.est,col="red",lwd=2)
lines(smashgen.lik.out$lambda.est,col='black',lwd=2)
lines(fit.pois.gaus$lambda.est,col=3)
legend("topright", # places a legend at the appropriate place
c("data","smash-poiss",'smash-gen-vst','smash-gen-lik','smash-pois-gaus'), # puts text in the legend
lty=c(1,1,1,1,1), # gives the legend appropriate symbols (lines)
lwd=c(1,1,1,1,1),
cex = 0.5,
col=c("gray80","blue", "red",'black',3))
print(paste("nugget effect estimated by vst:",round(smashgen.vst.out$nugget.est,2)))
print(paste("nugget effect estimated by lik_expansion:",round(smashgen.lik.out$nugget.est,2)))
}
file.name = "data/chipexo_examples/example_CTCF_MACE_wgEncodeBroadHistoneHelas3CtcfStdAlnRep1_forward_counts.txt"
real_study(file.name,plot.name = "EncodeBroadHistoneHelas - Rep 1 - forward")
[1] "proportion of 0s: 0.81"
[1] "nugget effect estimated by vst: 0"
[1] "nugget effect estimated by lik_expansion: 1.49"
file.name = "data/chipexo_examples/example_CTCF_MACE_wgEncodeBroadHistoneHelas3CtcfStdAlnRep1_reverse_counts.txt"
real_study(file.name,plot.name = "EncodeBroadHistoneHelas - Rep 1 - reverse")
[1] "proportion of 0s: 0.84"
[1] "nugget effect estimated by vst: 0"
[1] "nugget effect estimated by lik_expansion: 0"
file.name = "data/chipexo_examples/example_CTCF_MACE_wgEncodeOpenChromChipHelas3CtcfAlnRep1_forward_counts.txt"
real_study(file.name,plot.name = "EncodeOpenChromChipHelas - Rep 1 - Forward")
[1] "proportion of 0s: 0.83"
[1] "nugget effect estimated by vst: 0"
[1] "nugget effect estimated by lik_expansion: 0.8"
file.name = "data/chipexo_examples/example_CTCF_MACE_wgEncodeOpenChromChipHelas3CtcfAlnRep1_reverse_counts.txt"
real_study(file.name,plot.name = "EncodeOpenChromChipHelas - Rep 1 - reverse")
[1] "proportion of 0s: 0.81"
[1] "nugget effect estimated by vst: 0"
[1] "nugget effect estimated by lik_expansion: 0.96"
file.name = 'data/chipexo_examples/example_CTCF_MACE_wgEncodeOpenChromChipHelas3CtcfAlnRep2_forward_counts.txt'
real_study(file.name,plot.name = "EncodeOpenChromChipHelas - Rep 2 - Forward")
[1] "proportion of 0s: 0.79"
[1] "nugget effect estimated by vst: 0"
[1] "nugget effect estimated by lik_expansion: 0.98"
file.name = "data/chipexo_examples/example_CTCF_MACE_wgEncodeOpenChromChipHelas3CtcfAlnRep2_reverse_counts.txt"
real_study(file.name,plot.name = "EncodeOpenChromChipHelas - Rep 2 - reverse")
[1] "proportion of 0s: 0.78"
[1] "nugget effect estimated by vst: 0"
[1] "nugget effect estimated by lik_expansion: 0.83"
sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Scientific Linux 7.4 (Nitrogen)
Matrix products: default
BLAS/LAPACK: /software/openblas-0.2.19-el7-x86_64/lib/libopenblas_haswellp-r0.2.19.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[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] ashr_2.2-50 wavethresh_4.6.8 MASS_7.3-51.4 smashr_1.2-9
[5] workflowr_1.6.2
loaded via a namespace (and not attached):
[1] Rcpp_1.0.5 knitr_1.23 whisker_0.3-2
[4] magrittr_1.5 SQUAREM_2017.10-1 lattice_0.20-38
[7] R6_2.4.0 stringr_1.4.0 caTools_1.17.1.2
[10] tools_3.6.1 grid_3.6.1 data.table_1.13.2
[13] xfun_0.8 irlba_2.3.3 invgamma_1.1
[16] git2r_0.26.1 htmltools_0.3.6 yaml_2.2.0
[19] digest_0.6.20 rprojroot_2.0.2 mixsqp_0.3-17
[22] Matrix_1.2-18 later_0.8.0 bitops_1.0-6
[25] promises_1.0.1 fs_1.3.1 glue_1.3.1
[28] evaluate_0.14 rmarkdown_1.13 stringi_1.4.3
[31] compiler_3.6.1 truncnorm_1.0-8 httpuv_1.5.1