createInSilicoPopulation: Creates a population of in silico individuals.

Description Usage Arguments Details Value Examples

View source: R/in_silico_population.R

Description

Creates a population of in silico individuals to be simulated.

Usage

1
2
3
4
5
6
7
8
9
createInSilicoPopulation(
  nInd,
  insilicosystem,
  genvariants = NULL,
  genvariants.freq = NULL,
  InitVar = NULL,
  initialNoise = TRUE,
  ...
)

Arguments

nInd

Integer. The number of in silico individuals to create.

insilicosystem

An insilicosystem object. The in silico system based on which individuals are created. See createInSilicoSystem.

genvariants

A named list giving the variants segregating in the population for each gene. Each element corresponds to one gene in the system (name of the element = gene ID). Each element is a matrix, in which each column represents a variant of the gene segregating in the population. The rows represent the QTL effect coefficients of each variant (i.e. the impact of each mutation the variant carries). If none provided, will be automatically generated by the function createVariants.

genvariants.freq

A named list giving for each gene the allelic frequency of each segregating variant. Each element corresponds to one gene in the system (name of the element = gene ID). Each element is a vector, of length equal to the number of variants of the gene segregating in the population, giving the allele frequency of each of the variants. If none provided, it is assumed that all variants of a given gene have the same allelic frequency.

InitVar

A list of the multiplicative coefficients to be applied to the initial abundance of the different molecules: elements "R" and "P" of the list giving the coefficients for the RNA and protein form of the genes, respectively (coefficient for gene i at the i-th position in the vectors). If NULL, all coefficients set to 1.

initialNoise

Logical. Is stochastic noise applied to the initial abundance of the different molecules? Default value is TRUE (see Details).

...

Other arguments to be passed to the function insilicoindividualargs (i.e. parameters for the generation of the in silico individuals).

Details

initialNoise: by default, the initial abundance of a molecule is equal to its steady state abundance in the absence of any regulation (e.g. for the RNA abundance of a gene, it is transcription rate / decay rate). If initialNoise = TRUE, instead the initial abundance of the molecule will be sampled from a truncated Normal distribution of mean SSabund and SD sqrt(SSabund), where SSabund is its steady state abundance in the absence of any regulation, as specified above. The Normal distribution is truncated to only return positive values.

Value

An object of class insilicopopulation, that is a list composed of:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
## Creating a first population with 3 diploid individuals,
## with 2 variants of each gene segregating in the population
mysystem = createInSilicoSystem(G = 6, ploidy = 2)
mypop1 = createInSilicoPopulation(nInd = 3, mysystem, ngenevariants = 2)

## Creating a population with 10 tetraploid individuals
mysystem = createInSilicoSystem(G = 6, ploidy = 4)
mypop2 = createInSilicoPopulation(nInd = 10, mysystem)

## Creating a population with a given list of gene variants
mysystem = createInSilicoSystem(G = 3, PC.p = 1, ploidy = 2)

## We will create only 1 variant of gene 1, 3 variants of gene 2 and
## 2 variants of gene 3
nbvariants = c(1, 3, 2)

qtlnames = c("qtlTCrate", "qtlRDrate",
             "qtlTCregbind", "qtlRDregrate",
             "qtlactivity", "qtlTLrate",
             "qtlPDrate", "qtlTLregbind",
             "qtlPDregrate", "qtlPTMregrate")

genvariants = lapply(nbvariants, function(x){
  matrix(1, nrow = length(qtlnames), ncol = x,
         dimnames = list(qtlnames, 1:x))
})
names(genvariants) = mysystem$genes$id

## the 2nd variant of gene 2 has a mutation reducing its transcription rate by 3
genvariants$`2`["qtlTCrate", 2] = 0.33
## and the 3rd variant has an increased translation rate
genvariants$`2`["qtlTLrate", 2] = 1.5

## The 2nd variant of gene 3 has a mutation decreasing the activity of
## its active product
genvariants$`3`["qtlactivity", 2] = 0.7

## Allelic frequency of each variant
genvariants.freq = list('1' = c(1),
                        '2' = c(0.6, 0.3, 0.1),
                        '3' = c(0.9, 0.1))

## The third gene is not expressed at the beginning of the simulation
## (its initial abundance is 0)
InitVar = list("R" = c(1, 1, 0), "P" = c(1, 1, 0))

mypop = createInSilicoPopulation(10, mysystem,
                                 genvariants = genvariants,
                                 genvariants.freq = genvariants.freq,
                                 InitVar = InitVar)

sismonr documentation built on Feb. 11, 2020, 9:07 a.m.