new_dna: Create the location of a new case

Description Usage Arguments Details Author(s) See Also Examples

View source: R/new_dna.R

Description

This function creates the DNA sequence for a new case, with or without a known infector. If the infector is missing (NULL, default), the case is imported according to parameters in config.

Usage

1
new_dna(dna = NULL, generation_time = NULL, ..., config = new_config(...))

Arguments

dna

An optional location of the infector; if provided, it must be a list with the following slots: 'location', 'dna'

generation_time

The number of days separating the dates of infection of the infector, and the infectee. Only needed if the infector is provided.

...

further arguments passed to new_config

config

optionally, a config returned by new_config

Details

We consider that all markers are biallelic, and store only mutations.

Author(s)

Thibaut Jombart thibautjombart@gmail.com

See Also

dist_dna to compute pairwise genetic distances from vectors of mutations.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## without initial location
x_dna <- new_dna()
x_dna

## drift from this sequence, different nb of generations
new_dna(x_dna, 1L) # 1 generation
new_dna(x_dna, 12L) # 12 generations

## 100 generations, other genetic params
new_dna(x_dna, 100, mutation_rate = 1e-6, genome_length = 2e6)

## illustrate reverse mutations
my_config <- new_config(mutation_rate = 0.1, genome_length = 10)
x <- integer(0)
set.seed(1)
x <- new_dna(x, 5); x
x <- new_dna(x, 5); x
x <- new_dna(x, 5); x
x <- new_dna(x, 5); x
x <- new_dna(x, 5); x

thibautjombart/quicksim documentation built on May 5, 2019, 2:42 a.m.