simDNAseq simulates a segregating sites matrix consisting of n sequences based on how the population size develops.

simDNAseq(n, seqLen, mutRate, popType, ...)

## S3 method for class 'fixedPop'
simDNAseq(n, seqLen, mutRate, popType="fixedPop", expRate=NULL,
        expansionTime=NULL, proportion=NULL)

## S3 method for class 'varPop'
simDNAseq(n, seqLen, mutRate, popType="varPop", expRate, expansionTime=NULL,
        proportion=NULL)

## S3 method for class 'sudExpPop'
simDNAseq(n, seqLen, mutRate, popType="sudExpPop", expRate=NULL,
        expansionTime, proportion)

Arguments

n

the sample size.

seqLen

the length of the DNA sequences.

mutRate

the mutation rate.

popType

a string indicating which population type to simulate from. Should be either 'fixedPop', 'varPop' or 'sudExpPop'. See details.

expRate

the rate of the exponentially growing population, only used when popType is 'varPop'.

expansionTime

parameter b determining the time of expansion.

proportion

parameter \(0< \alpha \le 1\) determining the fraction of the population size before the expansion.

Value

simDNAseq returns a simulated n times seqLen segregating sites matrix. See details.

Details

If popType is 'fixedPop' we simulate the branches of the ancestral tree from a population of fixed size.

If popType is 'varPop' we simulate the branches of the ancestral tree from an exponentially growing population (forwards in time). This means that the relative size function is $$f(x)=exp(-\lambdax),$$ where \(\lambda\) is the rate of the exponentially growing population.

If popType is 'sudExpPop' we simulate the brances of the ancestral tree from a suddenly expanded population. This means that backwards in time the population size is \(N\) before the expansion and \(\alphaN\) after the expansion. The decline in population size happened at time \(bN\) (in generations) in the past.

The output is a segregating sites matrix; that is a matrix consisting of zeroes and ones. Here the number 1 indicates that a mutation occured at this specific site, and the number 0 indicates that no mutation occured.

References

Tavaré, S. (2004) Ancestral Inference in Population Genetics. Berlin: Springer-Verlag.

Wakeley J. (2009) Coalescent Theory: An Introduction. Colorado: Roberts and Company Publishers.

Examples

## An example with fixed population size simDNAseq(n = 10, seqLen = 15, mutRate = 2, popType = "fixedPop")
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] #> [1,] 0 0 0 0 0 0 0 0 0 0 0 0 0 #> [2,] 0 0 0 0 0 0 0 0 0 0 0 0 0 #> [3,] 0 0 0 0 0 0 0 0 1 0 0 0 0 #> [4,] 0 1 0 0 0 0 0 0 0 0 0 0 0 #> [5,] 0 0 1 0 0 0 0 0 0 0 0 0 0 #> [6,] 0 0 0 0 0 0 0 1 1 0 0 0 0 #> [7,] 0 0 0 0 0 0 0 0 0 0 0 0 0 #> [8,] 0 0 0 0 0 0 0 0 0 0 0 0 0 #> [9,] 0 0 0 0 0 0 0 0 0 0 0 0 0 #> [10,] 0 0 0 0 0 0 0 0 0 0 0 0 0 #> [,14] [,15] #> [1,] 0 1 #> [2,] 0 1 #> [3,] 0 0 #> [4,] 0 0 #> [5,] 0 0 #> [6,] 0 0 #> [7,] 0 0 #> [8,] 0 0 #> [9,] 0 1 #> [10,] 0 0
## An example with variable population size simDNAseq(n = 8, seqLen = 20, mutRate = 5, popType = "varPop", expRate = 1.5)
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,14] #> [1,] 0 0 0 0 0 0 1 0 0 0 0 0 0 0 #> [2,] 0 0 0 0 0 0 1 0 0 0 0 0 0 0 #> [3,] 0 0 0 0 0 0 0 0 1 0 0 0 0 0 #> [4,] 0 0 0 0 0 0 1 0 0 0 0 0 0 0 #> [5,] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 #> [6,] 0 0 0 0 0 0 1 0 0 0 0 0 0 0 #> [7,] 0 0 0 0 0 0 1 0 0 0 0 0 0 0 #> [8,] 0 0 0 0 0 0 0 0 0 0 1 0 1 0 #> [,15] [,16] [,17] [,18] [,19] [,20] #> [1,] 0 0 0 0 0 0 #> [2,] 0 0 1 0 0 0 #> [3,] 0 0 0 0 0 0 #> [4,] 0 0 1 0 0 0 #> [5,] 0 0 0 0 0 0 #> [6,] 0 0 1 0 0 0 #> [7,] 0 0 1 0 0 0 #> [8,] 0 0 0 0 0 0
## An example with suddenly expanded population size simDNAseq(n = 25, seqLen = 30, mutRate = 8, popType = "sudExpPop", expansionTime = 2, proportion = 0.9)
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] #> [1,] 0 1 0 0 0 0 0 0 0 0 0 0 0 #> [2,] 0 0 0 0 0 0 0 0 0 0 1 0 0 #> [3,] 0 0 0 0 0 0 0 1 0 0 0 0 0 #> [4,] 0 0 1 0 0 0 0 1 0 0 0 0 0 #> [5,] 0 0 0 0 0 0 0 1 0 0 0 0 0 #> [6,] 0 0 0 0 0 0 0 0 1 0 1 0 0 #> [7,] 0 0 0 0 0 0 0 0 0 0 1 0 0 #> [8,] 0 0 0 0 0 0 0 0 0 0 0 0 0 #> [9,] 0 0 0 0 0 0 0 1 0 0 0 0 0 #> [10,] 0 0 0 0 0 0 0 0 0 0 1 0 0 #> [11,] 0 0 0 0 0 0 0 0 0 0 1 0 0 #> [12,] 0 0 0 0 0 0 0 1 0 0 0 0 0 #> [13,] 0 0 0 0 0 0 0 1 0 0 0 1 0 #> [14,] 0 0 0 0 0 1 0 0 0 0 0 0 0 #> [15,] 0 0 0 0 0 0 0 0 0 0 0 0 0 #> [16,] 0 0 0 0 0 0 0 0 0 0 0 0 0 #> [17,] 0 0 0 1 0 0 0 1 0 0 0 0 0 #> [18,] 0 0 0 0 0 0 0 0 0 0 1 0 0 #> [19,] 0 0 0 0 0 0 0 0 0 0 0 0 0 #> [20,] 0 0 0 0 0 0 1 1 0 0 0 0 0 #> [21,] 0 0 0 0 0 0 0 0 0 0 1 0 0 #> [22,] 0 0 0 0 0 0 0 0 0 0 0 0 0 #> [23,] 0 0 0 0 0 0 0 1 0 0 0 0 0 #> [24,] 1 0 0 0 0 0 0 0 0 1 1 0 1 #> [25,] 0 0 0 0 0 0 0 1 0 0 0 0 0 #> [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25] #> [1,] 0 0 1 0 0 0 0 0 1 0 0 1 #> [2,] 0 0 0 1 0 0 0 0 0 0 0 0 #> [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