Last updated: 2020-02-01

Checks: 7 0

Knit directory: Thesis_single_RNA/

This reproducible R Markdown analysis was created with workflowr (version 1.5.0). 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(20191113) 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:    .RData
    Ignored:    .Rhistory
    Ignored:    analysis/.RData
    Ignored:    analysis/.Rhistory

Unstaged changes:
    Modified:   Data_sim.Rmd
    Deleted:    analysis/MLE.py
    Deleted:    analysis/MLE_bootstrap.Rmd
    Deleted:    analysis/MLE_bootstrap_variability_by_sample_size.Rmd
    Deleted:    analysis/MLE_estimates.Rmd
    Deleted:    analysis/MLE_estimation_with_noise_parameter.Rmd
    Deleted:    analysis/MLE_variability_by_sample_size.Rmd
    Deleted:    analysis/MLE_with_si.py
    Deleted:    analysis/Real_data_filter.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.


There are no past versions. Publish this analysis with wflow_publish() to start tracking its development.


Data generation for one gene under two-state model with different parameters

Three-parameter model for stochastic gene expression assumes that cell can be either in “on” and “off” transcription states which is characterized by Beta distribution.

While the cell is in “on” mode, mRNA is transcribed with \(k_r\) rate, so mRNA expression follows two-state model of gene expression, where

\(x|k_r,p\sim Poisson(k_rp)\) and \(p|k_{on},k_{off}\sim Beta(k_{on},k_{off})\)

Further extension of this model includes four-parameter model, that accounts for degradation rate d, which is a positive value less than one, so now model is \(x|k_r,p,d\sim d*Poisson(k_rp)\)

Four-parameter model can be written as three-parameter model is we scale mRNA expression level by d or \(BetaPoisson(x|k_{on},k_{off},k_r,d) = BetaPoisson(\frac{x}{d}|k_{on},k_{off},k_r)\)

Here is the R code to simulate mRNA copy number for 1 gene in n cells:

generate_one_gene<-function(k_on,k_off,k_r,n){
  p=rbeta(n,k_on,k_off)
  x=rpois(n,p*k_r)
  return(x)}

Different parameters of \(k_{on}\) and \(k_{off}\) lead to different mRNA copy number distribution

I) Small \(k_{on}\) and \(k_{off}\) lead to bimodal distribution (large number of cells have low expression with few cells with high expression):

#Fixed k=100 as in Munsky paper the Fig.2
par(mfrow=c(2,2))
k=c(0.001,0.01,0.1,0.5)
for (i in k){
  x=generate_one_gene(i,i,100,n=10000)
  name=paste('k_on,k_off=',i)
  hist(x,xlim=c(0,200),ylim=c(0,0.06),freq=FALSE,main=name)}

II) Large \(k_{on}\) and \(k_{off}\) lead to Poisson or negative binomial distribution:

par(mfrow=c(2,2))
k=c(2,10,50,100)
for (i in k){
  x=generate_one_gene(i,i,100,n=10000)
  name=paste('k_on,k_off=',i)
  hist(x,xlim=c(0,200),ylim=c(0,0.06),freq=FALSE,main=name)}

III) Large value if \(k_{off}\) and small \(k_{on}\)

par(mfrow=c(1,2))
k=list(c(0.1,1),c(1,10))
for (i in k){
  x=generate_one_gene(i[1],i[2],100,n=10000)
  name=paste("k_on",i[1],'k_off',i[2])
  hist(x,xlim=c(0,200),ylim=c(0,0.1),freq=FALSE,main=name)}

IV) Small value if \(k_{off}\) and big \(k_{on}\)

par(mfrow=c(1,2))
k=list(c(1,0.1),c(10,1))
for (i in k){
  x=generate_one_gene(i[1],i[2],100,n=10000)
  name=paste("k_on",i[1],'k_off',i[2])
  hist(x,xlim=c(0,200),ylim=c(0,0.1),freq=FALSE,main=name)}


sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] workflowr_1.5.0 Rcpp_1.0.2      later_0.8.0     digest_0.6.17  
 [5] rprojroot_1.3-2 R6_2.3.0        backports_1.1.2 git2r_0.26.1   
 [9] magrittr_1.5    evaluate_0.11   stringi_1.1.7   promises_1.0.1 
[13] fs_1.3.1        rmarkdown_1.10  tools_3.5.0     stringr_1.3.1  
[17] glue_1.3.0      httpuv_1.5.1    yaml_2.2.0      compiler_3.5.0 
[21] htmltools_0.3.6 knitr_1.20