Checks if the list containing sample data is conformable to provided population allele frequencies and reformats it if needed.
Arguments
- dsmp
a list with each element corresponding to one sample.
- afreq
a list of allele frequencies. Each element of the list corresponds to a locus.
Value
A list of the same length as dsmp
, with each element matching
the lengths and the names of afreq
and its elements.
Details
The function reorders loci and alleles in dsmp
to match those
in afreq
and inserts alleles into dsmp
if they are present in
afreq
and not in dsmp
; doesn't handle cases when alleles are
present in dsmp
but not in afreq
. Allele names are required
for this procedure.
Examples
afile <- system.file("extdata", "MozAfreq.csv", package = "dcifer")
afreq2 <- readAfreq(afile, lvar = "locus", avar = "allele", fvar = "freq")
dsmp2 <- matchAfreq(dsmp, afreq2)