
Find all allele assignments for genotypes within the same infection
Source:R/helpers.R
enumerate_alleles.Rd
Note that this function is not tested for input with alleles mixed with NA.
Arguments
- y.inf
List of alleles observed across markers for genotypes within one infection. Alleles must not be repeated for the same marker.
- gs.inf
Vector of genotype names for genotypes within one infection.
- use.sym
Boolean for permutation symmetry is exploited as a computational shortcut. Due to permutation symmetry of intra-infection genotypes, we can fix a single assignment for one of the markers whose number of alleles observed is equal to the MOI (consider it the anchor) and permute the rest, discarding combinations that under-represent the observed marker diversity. The default behaviour is to use this symmetry such that less assignments have to be considered.
Value
List of dataframes, one for each marker. The columns correspond to genotypes, while the rows correspond to allele assignments for a marker.
Examples
# 3 markers
y.inf <- list(m1 = c("A", "B"), m2 = c("B", "C", "D"), m3 = c("C"))
enumerate_alleles(y.inf, c("g1", "g2", "g3"))
#> $m1
#> g1 g2 g3
#> 1 B A A
#> 2 A B A
#> 3 B B A
#> 4 A A B
#> 5 B A B
#> 6 A B B
#>
#> $m2
#> g1 g2 g3
#> 1 B C D
#>
#> $m3
#> g1 g2 g3
#> 1 C C C
#>
# 6 assignments for m1 (BAA, ABA, BBA, AAB, BAB, ABB)
# 1 assignment for m2 (accounting for permutation symmetry)
# 1 assignment for m3 (CCC)