Skip to contents

Sample a genotype according to allele frequencies

Usage

sample_genotype(freqs, loci = names(freqs), label = "U")

Arguments

freqs

Allele frequencies (see read_allele_freqs)

loci

Character vector of locus names (defaults to names attribute of freqs)

label

Sample name

Value

DataFrame with columns Sample Name, Locus, Allele1 and Allele2.

Details

A genotype is sampled randomly by drawing two alleles from allele frequencies for each locus.

Examples

# below we read an allele freqs and sample a genotype
filename <- system.file("extdata","FBI_extended_Cauc_022024.csv",
                        package = "simDNAmixtures")
freqs <- read_allele_freqs(filename)
sample_genotype(freqs, loci = c("D3S1358", "vWA"))
#>   Sample Name   Locus Allele1 Allele2
#> 1           U D3S1358      15      16
#> 2           U     vWA      16      19