This is the repository of ComplexSim package, which is an R package for simulating longitudial omics data with user defined structures.
The simulation function includes the Gaussian and Negative Binomial distributions and takes into consideration the treatment effect, time effect, subject level random effect as well as the sample correlations.
devtools::install_github("BEDApub/ComplexSim", build_vignettes = TRUE)
vignette("ComplexSim", package = "ComplexSim")
RNA sequencing data in discrete count unit can be described by a negative binomial distribution.
The following Delta method is introduced to illustrate the link between the mean and variance of the two distributions, which guarantees the equivalence of the two simulation functions.
Following the RNA sequencing procedure, we build the negative binomial model for the mapped read counts:
The mean and variance of this negative binomial distribution are
One important proposition of the gene expression count data is the over-despersion property. We can use the variance-mean ratio or taking the difference between the variance and the mean to quantify the dispersion. The ratio is given by
and the difference is
From the ratio and the difference, it is obvious to see that the counts of mapped reads which follow the negative binomial distribution is over dispersed. The variance can be decomposed to
If
Alternatively, one can normalize the count data by using the log-cpm described as follows. Let
This re-scaling of the count data can be considered as the simplest way of normalization, and the normalized data is usually considered as Gaussian. We use both Gaussian and Negative Binomial distribution to simulate the normalized and raw gene expression data.
Consider a read count
The expected value is defined as
which corresponds to
and has variance
following the Delta-method. The mean and variance of the normalized sequencing data is linked to the original mean and dispersion of the negative binomial data and can be modeled and estimated.
In this R package, we allow simulation using both Gaussian and Negative Binomial distribution with different set ups of the parameters, that is, mean and variance of Gaussian, mean and dispersion parameter of Negative Binomial. One can switch between the two distributions to get equivalent simulations.