Given two alleles of a marker, one allele can belong to one side of a barrier
to geneflow and the other to the other side. Which allele belongs where is a non-trivial
matter. A marker state in an individual can be encoded as 0 if the individual is
homozygous for the first allele, and 2 if the individual is homozygous for the second
allele. Marker polarity determines how the marker will be imported. Marker polarity
equal to FALSE means that the marker will be imported as-is. A marker with
polarity equal to TRUE will be imported with states 0 mapped as 2 and states 2
mapped as 0, in effect switching which allele belongs to which side of a barrier to
geneflow.
When markerPolarity = FALSE, diem uses random null polarities to
initiate the EM algorithm. To fix the null polarities, markerPolarity must be
a list of length equal to the length of the files argument, where each element
in the list is a logical vector of length equal to the number of markers (rows) in
the specific file.
Ploidy needs to be given for each compartment and for each individual. For example,
for a dataset of three diploid mammal males consisting of an autosomal
compartment, an X chromosome
compartment and a Y chromosome compartment, the ploidy list would be
ploidy = list(rep(2, 3), rep(1, 3), rep(1, 3). If the dataset consisted of
one male and two females,
ploidy for the sex chromosomes should be vectors reflecting that females have two X
chromosomes, but males only one, and females have no Y chromosomes:
ploidy = list(rep(2, 3), c(1, 2, 2), c(1, 0, 0)).
When a subset of individuals is used to inform the genome polarisation in the
ChosenInds argument, ploidy must still be provided for all individuals
included in the files.
ChosenInds should preferably be numeric values within the range from 1 to the
number of individuals in the files. Logical vectors must have a length equal
to the number of individuals in the files.
When verbose = TRUE, diem will output multiple files with information
on the iterations of the EM algorithm, including tracking marker polarities and the
respective likelihood-based diagnostics. See vignette vignette("Understanding-genome-polarisation-output-files",
package = "diemr") for a detailed explanation of the individual output files.