Last updated: 2023-03-13
Checks: 7 0
Knit directory: misc/
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(20191122)
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 960ed1b. 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: .Rhistory
Ignored: .Rproj.user/
Untracked files:
Untracked: analysis/deconvSimulation2.Rmd
Untracked: analysis/ideas.Rmd
Untracked: code/sccytokines.R
Untracked: code/scdeCalibration.R
Untracked: data/bart/
Untracked: data/cytokine/DE_controls_output_filter10.RData
Untracked: data/cytokine/DE_controls_output_filter10_addlimma.RData
Untracked: data/cytokine/README
Untracked: data/cytokine/test.RData
Untracked: data/cytokine_normalized.RData
Untracked: data/deconv/
Untracked: data/scde/
Unstaged changes:
Modified: analysis/deconvSimulation.Rmd
Modified: analysis/deconvolution.Rmd
Modified: analysis/index.Rmd
Deleted: data/mout_high.RData
Deleted: data/scCDT.RData
Deleted: data/sva_sva_high.RData
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/mutation.Rmd
) and HTML
(docs/mutation.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 | 960ed1b | DongyueXie | 2023-03-13 | wflow_publish("analysis/mutation.Rmd") |
temp = read.table('/project2/compbio/todongyue/AtoG/mutation.A_to_G.and.mutation.T_to_C.10k')
x = temp$V4
x = as.numeric(x)
Warning: NAs introduced by coercion
x = x[!is.na(x)]
sum(x==0)/length(x)
[1] 0.9494643
range(x)
[1] 0 3
Too many zeros.
temp = read.table('/project2/compbio/todongyue/AtoG/mutation.A_to_G.and.mutation.T_to_C.100k')
temp = temp[temp$V4!='.',]
x = temp$V4
x = as.numeric(x)
x = x[!is.na(x)]
sum(x==0)/length(x)
[1] 0.605107
range(x)
[1] 0 6
s = temp$V5
s = as.numeric(s)
range(s)
[1] 0.00000 15.38728
plot(x,pch='.',col='grey80',cex=1.5)
plot(s,pch='.',col='grey80',cex=1.5)
plot(s,pch='.',col='grey80',cex=1.5,ylim=c(0,2))
Some of the scaling factors \(s\) are exactly 0?
Try smash poisson on the count \(x\),
library(smashr)
fit_smash = smash.poiss(x)
plot(x,pch='.',col='grey80',cex=1.5,xlab='position',main='A to G, 100k')
lines(fit_smash)
legend('topleft',c('data','smash fit'),pch=c('.',NA),lty=c(NA,1))
plot(fit_smash,type='l',xlab='position',main='A to G, 100k, smash fit')
Try smash gaus on the \(log(x/s)\).
x_tilde = log((x+0.1)/(s+0.1))
fit_smash_gaus = smash.gaus(x_tilde,ebnm_param = list(prior_family = "point_laplace"))
plot(x,pch='.',col='grey80',cex=1.5,xlab='position',main='A to G, 100k, x/s')
lines(exp(fit_smash_gaus))
legend('topleft',c('data','smash fit'),pch=c('.',NA),lty=c(NA,1))
plot(fit_smash_gaus,type='l',xlab='position',main='A to G, 100k, smash fit, x/s')
temp = read.table('/project2/compbio/todongyue/AtoG/mutation.A_to_G.and.mutation.T_to_C.10m')
temp = temp[temp$V4!='.',]
x = temp$V4
x = as.numeric(x)
x = x[!is.na(x)]
sum(x==0)/length(x)
[1] 0.04333333
range(x)
[1] 0 90
s = temp$V5
s = as.numeric(s)
range(s)
[1] 0.00000 77.91058
plot(x,pch='.',col='grey80',cex=1.5)
plot(s,pch='.',col='grey80',cex=1.5)
Why range of s is much larger?
Try smash poisson on the count \(x\),
fit_smash = smash.poiss(x)
plot(x,pch='.',col='grey80',cex=2,xlab='position',main='A to G, 10m')
lines(fit_smash)
legend('topleft',c('data','smash fit'),pch=c('.',NA),lty=c(NA,1))
plot(fit_smash,type='l',xlab='position',main='A to G, 100k, smash fit')
library(genlasso)
Loading required package: Matrix
Loading required package: igraph
Attaching package: 'igraph'
The following objects are masked from 'package:stats':
decompose, spectrum
The following object is masked from 'package:base':
union
fit_tf = trendfilter(x)
fit_tf_cv =cv.trendfilter(fit_tf)
Fold 1 ... Fold 2 ... Fold 3 ... Fold 4 ... Fold 5 ...
plot(fit_tf,lambda = fit_tf_cv$lambda.min,col='grey80',pch=20)
temp = read.table('/project2/compbio/todongyue/CtoT/mutation.C_to_T.nonCpG.and.mutation.G_to_A.nonCpG.bed.100k')
temp = temp[temp$V4!='.',]
x = temp$V4
x = as.numeric(x)
x = x[!is.na(x)]
sum(x==0)/length(x)
[1] 0.630434
range(x)
[1] 0 5
s = temp$V5
s = as.numeric(s)
range(s)
[1] 0.000000 4.546582
plot(x,pch='.',col='grey80',cex=2)
plot(s,pch='.',col='grey80',cex=2)
plot(s,pch='.',col='grey80',cex=2,ylim=c(0,2))
Try smash poisson on the count \(x\),
fit_smash = smash.poiss(x)
plot(x,pch='.',col='grey80',cex=2,xlab='position',main='C to T, 100k')
lines(fit_smash)
legend('topleft',c('data','smash fit'),pch=c('.',NA),lty=c(NA,1))
plot(fit_smash,type='l',xlab='position',main='C to T, 100k, smash fit')
Try smash gaus on the \(log(x/s)\).
x_tilde = log((x+0.1)/(s+0.1))
fit_smash_gaus = smash.gaus(x_tilde,ebnm_param = list(prior_family = "point_laplace"))
plot(x,pch='.',col='grey80',cex=1.5,xlab='position',main='A to G, 100k, x/s')
lines(exp(fit_smash_gaus))
legend('topleft',c('data','smash fit'),pch=c('.',NA),lty=c(NA,1))
plot(fit_smash_gaus,type='l',xlab='position',main='A to G, 100k, smash fit, x/s')
temp = read.table('/project2/compbio/todongyue/CtoT/mutation.C_to_T.nonCpG.and.mutation.G_to_A.nonCpG.bed.10m')
temp = temp[temp$V4!='.',]
x = temp$V4
x = as.numeric(x)
x = x[!is.na(x)]
sum(x==0)/length(x)
[1] 0.03333333
range(x)
[1] 0 87
s = temp$V5
s = as.numeric(s)
range(s)
[1] 0.00000 82.47824
plot(x,pch='.',col='grey80',cex=2)
plot(s,pch='.',col='grey80',cex=2)
Try smash poisson on the count \(x\),
fit_smash = smash.poiss(x)
plot(x,pch='.',col='grey80',cex=2,xlab='position',main='C to T, 10m')
lines(fit_smash)
legend('topleft',c('data','smash fit'),pch=c('.',NA),lty=c(NA,1))
temp = read.table('/project2/compbio/todongyue/CtoT2/CtoT_nonCpG.500k')
temp = temp[temp$V4!='.',]
x = temp$V4
x = as.numeric(x)
x = x[!is.na(x)]
sum(x==0)/length(x)
[1] 0.1485457
range(x)
[1] 0 16
s = temp$V5
s = as.numeric(s)
range(s)
[1] 0.000000 6.358331
plot(x,pch='.',col='grey80',cex=2)
plot(s,pch='.',col='grey80',cex=2)
Try smash poisson on the count \(x\),
fit_smash = smash.poiss(x)
plot(x,pch='.',col='grey80',cex=2,xlab='position',main='C to T, 500k')
lines(fit_smash)
legend('topleft',c('data','smash fit'),pch=c('.',NA),lty=c(NA,1))
sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)
Matrix products: default
BLAS: /software/R-4.1.0-no-openblas-el7-x86_64/lib64/R/lib/libRblas.so
LAPACK: /software/R-4.1.0-no-openblas-el7-x86_64/lib64/R/lib/libRlapack.so
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=C
[4] LC_COLLATE=C LC_MONETARY=C LC_MESSAGES=C
[7] LC_PAPER=C LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=C LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] genlasso_1.6.1 igraph_1.4.1 Matrix_1.5-3 smashr_1.3-6
[5] workflowr_1.6.2
loaded via a namespace (and not attached):
[1] Rcpp_1.0.10 horseshoe_0.2.0 invgamma_1.1 lattice_0.20-44
[5] rprojroot_2.0.2 digest_0.6.31 utf8_1.2.3 truncnorm_1.0-8
[9] R6_2.5.1 evaluate_0.14 ggplot2_3.4.1 highr_0.9
[13] pillar_1.8.1 rlang_1.0.6 wavethresh_4.7.2 rstudioapi_0.13
[17] data.table_1.14.8 ebnm_1.0-11 irlba_2.3.5.1 whisker_0.4
[21] jquerylib_0.1.4 rmarkdown_2.9 splines_4.1.0 stringr_1.5.0
[25] munsell_0.5.0 mixsqp_0.3-48 compiler_4.1.0 httpuv_1.6.1
[29] xfun_0.24 pkgconfig_2.0.3 SQUAREM_2021.1 htmltools_0.5.4
[33] tidyselect_1.2.0 tibble_3.1.8 fansi_1.0.4 dplyr_1.1.0
[37] later_1.3.0 MASS_7.3-54 bitops_1.0-7 grid_4.1.0
[41] jsonlite_1.8.4 gtable_0.3.1 lifecycle_1.0.3 git2r_0.28.0
[45] magrittr_2.0.3 scales_1.2.1 cli_3.6.0 stringi_1.6.2
[49] fs_1.5.0 promises_1.2.0.1 bslib_0.2.5.1 generics_0.1.3
[53] vctrs_0.5.2 trust_0.1-8 tools_4.1.0 glue_1.6.2
[57] fastmap_1.1.0 yaml_2.3.7 colorspace_2.1-0 ashr_2.2-54
[61] caTools_1.18.2 deconvolveR_1.2-1 knitr_1.33 sass_0.4.0