lvclark / polyRAD

Genotype Calling with Uncertainty from Sequencing Data in Polyploids 🍌🍓🥔🍠🥝
27 stars 8 forks source link

Make `GetProbableGenotypes` aware of multiallelic genotypes #6

Closed lvclark closed 4 years ago

lvclark commented 4 years ago

Add the ability to correct multiallelic genotypes to ensure that the sum of copy numbers across all alleles for a given locus is always equal to the ploidy. The internal BestMultiGeno function recursively searches all possible (i.e. totaling to the ploidy) multiallelic genotypes to find the one that has the highest product of posterior probabilities across alleles, for one taxon*locus. The internal CorrectGenos function takes an allele copy number matrix such as that output by GetProbableGenotypes, finds genotypes where allele copy does not sum to the ploidy, and depending on the do_correct argument either sets these to NA or runs BestMultiGeno to correct them. GetProbableGenotypes now internally calls CorrectGenos unless the user sets multiallelic = "ignore".