# In Silico Simulation Parameters

Source: `R/Param.R`
`insilicoNBParam.Rd`

With this function, the user can define the parameters of the negative binomial distribution needed for the simulations. The mean, dispersion and dropout need to be specified for bulk RNAseq experiments. For single cell RNAseq experiments, the mean and dispersion should be chosen so that a high number of dropouts are generated (see details).

    insilicoNBParam(means, dispersion,
    dropout=NULL, sf=NULL, RNAseq=c("bulk", "singlecell"))

## Arguments

means | mean parameter of the NB read count distribution defined by a function sampling from a random distribution, e.g. function(x) rgamma(n=x, shape=2, rate=2).
dispersion | dispersion parameter of the NB read count distribution. This can be: (1) a constant, e.g. 0.2 (2) a function relating to the mean expression. The parametric fit employed in DESeq2 is recommended to get an estimate, e.g. function(x) 3 + 150/x.
dropout | The probability of droput per gene. This can be: (1) a constant (2) a function sampling from a random distribution, e.g. function(x) runif(x, min=0, max=0.25). The default is `NULL`, i.e. no dropout. Note that the dropout is not considered for single cell simulations. This should be inherently given by low mean expression coupled with high dispersion.
sf | The size factor: (1) a vector (2) a function sampling from a random distribution, e.g. function(x) rnorm(x, mean=1, sd=0.2). The default is `NULL`, i.e. equal size factor of 1.
RNAseq | is a character value: "bulk" or "singlecell".

## Value

List with the following vectors:

means

  Mean log2 read counts per gene.

dispersion

  Log2 dispersion per gene.

p0

  Probability that the count will be zero per gene.

sf

  Size factor per sample.

estFramework

  "in silico" by default.

## Examples

    # NOT RUN {
    ## Bulk RNA-seq experiment in silico parameters:
    insilico.bulk <- insilicoNBParam(means=function(x) 2^runif(x, 9, 12),
    dispersion=0.2,
    dropout=function(x) runif(x, min = 0, max = 0.25),
    sf=function(x) truncnorm::rtruncnorm(x, a = 0.6, b = 1.4, mean=1, sd=0.2),
    RNAseq='bulk')
    ## Single cell RNA-seq experiment in silico parameters:
    insilico.singlecell <- insilicoNBParam(means=function(x) rgamma(x, 4, 2),
    dispersion=function(x) 2 + 150/x,
    dropout=NULL,
    sf=function(x) 2^rnorm(n=x, mean=0, sd=0.5),
    RNAseq='singlecell')
    # }