Skip to contents

Simulate sample genotype

Usage

simulate_sample_genotype(sample_cois, locus_allele_dist, internal_relatedness)

Arguments

sample_cois

Numeric vector indicating the multiplicity of infection for each biological sample

locus_allele_dist

Allele frequencies – simplex parameter of a multinomial distribution

internal_relatedness

numeric 0-1 indicating the probability for a strain's allele to come from an existing lineage within host

Value

List with one element per sample, each a 1-row integer matrix counting the number of distinct strains carrying each allele.

Details

Simulates sampling the genetics at a single locus given an allele frequency distribution and a vector of sample COIs

Examples

simulate_sample_genotype(
  sample_cois = c(1, 2, 3),
  locus_allele_dist = c(0.5, 0.3, 0.2),
  internal_relatedness = c(0, 0, 0.5)
)
#> [[1]]
#>      [,1] [,2] [,3]
#> [1,]    0    0    1
#> 
#> [[2]]
#>      [,1] [,2] [,3]
#> [1,]    0    1    1
#> 
#> [[3]]
#>      [,1] [,2] [,3]
#> [1,]    1    0    0
#>