Fixes allele encoding so that the minor allele homozygote is always encoded as 2

fix_allele_encoding(G)

Arguments

G

- goenotype matrix

Value

genotype matrix G (row - ind, col - marker) with fixed encoding: 0 - major allele homozygote, 1 - heterozygote, 2 - minor allele homozygote being simply the count of the minor allele

Details

The genotype matrix G should be returning counts of minor allele. If the major allele is not the reference allele, one needs to fix encoding and this function takes care of this task. It counts reference and alternative allele and if the reference allele is the minor allele, it swaps encoding for homozygotes.

Author

Marcin Kierczak <marcin.kierczak__REPLACE_WITH_AT__scilifelab.se>