Skip to contents

Sample (many) genotypes for pedigree members according to allele frequencies by allele dropping and possibly taking linkage into account by simulating recombination.

Usage

sample_many_pedigree_genotypes(
  pedigree,
  freqs,
  loci = names(freqs),
  unrelated_names = character(),
  linkage_map,
  number_of_replicates = 1L,
  sex_locus_name = "AMEL",
  return_transmission_vectors = FALSE
)

Arguments

pedigree

ped object

freqs

Allele frequencies (see read_allele_freqs)

loci

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

unrelated_names

Character vector with names of any additional unrelated persons. Defaults to length zero.

linkage_map

A linkage map specifying cM distances between loci. If missing, loci are assumed to be independent.

number_of_replicates

An integer specifying the number of replicate genotype samples to generate. Defaults to 1.

sex_locus_name

Character vector, defaults to "AMEL"

return_transmission_vectors

Should transmission vectors be returned as an attribute? These are usually not of interest, so the default is FALSE.

Examples

# load allele frequencies
freqs <- read_allele_freqs(system.file("extdata",
                            "FBI_extended_Cauc_022024.csv",
                            package = "simDNAmixtures"))

# define a pedigree with two full siblings: S1 and S2
ped_fs <- pedtools::nuclearPed(children = c("S1", "S2"))

# define two linked loci
linkage_map <- data.frame(chromosome = c(12, 12),
                          locus = c("vWA", "D12S391"),
                          position = c(15.15, 26.63))


# sample genotypes ignoring linkage
sample_many_pedigree_genotypes(pedigree = ped_fs, freqs = freqs,
                             loci = c("vWA", "D12S391"),
                            number_of_replicates = 10)
#>          vWA  vWA(2) D12S391 D12S391(2)
#> rep1_1   "17" "19"   "16"    "18"      
#> rep1_2   "16" "18"   "21"    "22"      
#> rep1_S1  "17" "18"   "16"    "22"      
#> rep1_S2  "16" "19"   "16"    "21"      
#> rep2_1   "16" "17"   "18"    "24"      
#> rep2_2   "17" "17"   "19"    "23"      
#> rep2_S1  "17" "17"   "19"    "24"      
#> rep2_S2  "16" "17"   "23"    "24"      
#> rep3_1   "18" "19"   "19"    "22"      
#> rep3_2   "15" "15"   "17"    "17"      
#> rep3_S1  "15" "18"   "17"    "19"      
#> rep3_S2  "15" "19"   "17"    "22"      
#> rep4_1   "17" "18"   "20"    "21"      
#> rep4_2   "14" "18"   "18"    "22"      
#> rep4_S1  "18" "18"   "20"    "22"      
#> rep4_S2  "14" "17"   "21"    "22"      
#> rep5_1   "16" "17"   "16"    "22"      
#> rep5_2   "17" "18"   "22"    "24"      
#> rep5_S1  "16" "18"   "16"    "24"      
#> rep5_S2  "17" "17"   "22"    "22"      
#> rep6_1   "18" "19"   "19"    "22"      
#> rep6_2   "16" "20"   "22"    "22"      
#> rep6_S1  "19" "20"   "22"    "22"      
#> rep6_S2  "18" "20"   "19"    "22"      
#> rep7_1   "17" "17"   "17.3"  "18"      
#> rep7_2   "17" "18"   "17"    "18"      
#> rep7_S1  "17" "18"   "17"    "17.3"    
#> rep7_S2  "17" "18"   "18"    "18"      
#> rep8_1   "14" "18"   "21"    "22"      
#> rep8_2   "16" "16"   "21"    "21"      
#> rep8_S1  "14" "16"   "21"    "21"      
#> rep8_S2  "16" "18"   "21"    "21"      
#> rep9_1   "15" "17"   "18"    "19"      
#> rep9_2   "16" "18"   "18"    "19"      
#> rep9_S1  "17" "18"   "19"    "19"      
#> rep9_S2  "15" "16"   "18"    "19"      
#> rep10_1  "15" "16"   "19"    "20"      
#> rep10_2  "14" "17"   "17"    "23"      
#> rep10_S1 "14" "15"   "19"    "23"      
#> rep10_S2 "14" "16"   "20"    "23"      

# sample genotypes taking linkage into acconut
sample_many_pedigree_genotypes(pedigree = ped_fs, freqs = freqs,
                            loci = c("vWA", "D12S391"),
                            linkage_map = linkage_map,
                            number_of_replicates = 10)
#>          vWA  vWA(2) D12S391 D12S391(2)
#> rep1_1   "17" "18"   "15"    "22"      
#> rep1_2   "15" "15"   "19"    "21"      
#> rep1_S1  "15" "18"   "15"    "19"      
#> rep1_S2  "15" "17"   "15"    "19"      
#> rep2_1   "15" "17"   "18"    "21"      
#> rep2_2   "14" "17"   "18"    "19"      
#> rep2_S1  "14" "17"   "18"    "19"      
#> rep2_S2  "15" "17"   "18"    "21"      
#> rep3_1   "15" "15"   "18"    "22"      
#> rep3_2   "17" "17"   "16"    "26"      
#> rep3_S1  "15" "17"   "22"    "26"      
#> rep3_S2  "15" "17"   "16"    "22"      
#> rep4_1   "15" "19"   "20"    "25"      
#> rep4_2   "14" "17"   "18"    "19"      
#> rep4_S1  "14" "15"   "18"    "25"      
#> rep4_S2  "14" "19"   "18"    "20"      
#> rep5_1   "17" "18"   "17"    "22"      
#> rep5_2   "18" "20"   "24"    "25"      
#> rep5_S1  "18" "20"   "17"    "24"      
#> rep5_S2  "17" "18"   "22"    "25"      
#> rep6_1   "17" "18"   "22"    "24"      
#> rep6_2   "16" "16"   "19"    "22"      
#> rep6_S1  "16" "17"   "19"    "24"      
#> rep6_S2  "16" "17"   "22"    "24"      
#> rep7_1   "14" "18"   "17"    "19"      
#> rep7_2   "16" "17"   "21"    "23"      
#> rep7_S1  "17" "18"   "17"    "23"      
#> rep7_S2  "16" "18"   "17"    "21"      
#> rep8_1   "16" "17"   "18"    "21"      
#> rep8_2   "17" "18"   "21"    "21"      
#> rep8_S1  "16" "17"   "18"    "21"      
#> rep8_S2  "17" "17"   "21"    "21"      
#> rep9_1   "15" "18"   "16"    "20"      
#> rep9_2   "18" "18"   "23"    "25"      
#> rep9_S1  "18" "18"   "16"    "25"      
#> rep9_S2  "15" "18"   "20"    "25"      
#> rep10_1  "15" "16"   "22"    "23"      
#> rep10_2  "16" "18"   "17"    "23"      
#> rep10_S1 "16" "18"   "22"    "23"      
#> rep10_S2 "16" "16"   "17"    "23"