Builds the carrier detail table for a wide per-animal MHC haplotype
designation file (the checkMhcHaplotypeFile format): one
row per (haplotype x carrying animal), so a colony manager can go from
"which haplotypes are rare" (mhcHaplotypeFrequency's
summary) to "which animals do I manage." A homozygous animal appears
once per haplotype. The haplotype universe is the summary's -- the
distinct certain haplotypes -- so a label observed only as
uncertain calls has no carrier rows, matching the summary's own
exclude-and-disclose rule.
mhcHaplotypeCarriers(
genotype,
rareOnly = TRUE,
rareFrequencyThreshold = 0.01,
rareCarrierThreshold = 2L
)A dataframe with columns haplotype (character),
id (character), and uncertain (logical), one row per
(haplotype x carrying animal), ordered by haplotype then id.
dataframe with wide-format MHC haplotype data as
validated by checkMhcHaplotypeFile (which this function
re-runs defensively): columns id, haplotype1,
haplotype2, one row per animal.
logical; when TRUE (the default) only the
haplotypes mhcHaplotypeFrequency flags rare at the given
thresholds are listed, when FALSE every summary haplotype is.
single non-negative number, passed to
mhcHaplotypeFrequency. Default 0.01.
single non-negative number, passed to
mhcHaplotypeFrequency. Default 2L.
The uncertain column is a per-(haplotype x animal) disclosure:
FALSE when the animal has at least one certain call of that
haplotype, TRUE when its carriage is only provisional (every
call it has of that haplotype carries the trailing-? uncertain
marker). Provisional carriers are listed here -- for a rare haplotype,
a provisionally typed carrier is exactly what a manager wants to see --
but they are never counted in mhcHaplotypeFrequency's
nCarriers or its rare-flag arithmetic. Retaining animals that
carry rare variants is a distinct management objective from
maintaining heterozygosity (Allendorf 1986; Lacy, Ballou & Pollak
2012), which is what a per-animal carrier list is for.
Allendorf, F. W. (1986). Genetic drift and the loss of alleles versus heterozygosity. Zoo Biology, 5(2), 181-190. tools:::Rd_expr_doi("10.1002/zoo.1430050212")
Lacy, R. C., Ballou, J. D., & Pollak, J. P. (2012). PMx: software package for demographic and genetic analysis and management of pedigreed populations. Methods in Ecology and Evolution, 3(2), 433-437. tools:::Rd_expr_doi("10.1111/j.2041-210X.2011.00148.x")
mhcHaplotypeFrequency,
checkMhcHaplotypeFile, rhesusGenotypes
library(nprcgenekeepr)
## Carriers of the rare haplotypes, at the default thresholds
rareCarriers <- mhcHaplotypeCarriers(rhesusGenotypes)
head(rareCarriers)
## Every haplotype's carriers
allCarriers <- mhcHaplotypeCarriers(rhesusGenotypes, rareOnly = FALSE)
Run the code above in your browser using DataLab