As the genind object requires ploidy to be consistent across loci, a
workaround to importing polyploid data was to code missing alleles as "0"
(for microsatellite data sets). The advantage of this is that users would be
able to calculate Bruvo's distance, the index of association, and genotypic
diversity statistics. The tradeoff was the fact that this broke all other
analyses as they relied on allele frequencies and the missing alleles are
treated as extra alleles. This function removes those alleles and returns a
genind object where
allele frequencies are coded based on the number of alleles observed at a
single locus per individual. See the examples for more details.
for genind or genclone objects: if
add zeroes onto genind or genclone objects with uneven ploidy?
The genind object has two caveats that make it difficult to work with polyploid data sets:
ploidy must be constant throughout the data set
missing data is treated as "all-or-none"
In an ideal world, polyploid genotypes would be just as unambiguous as diploid or haploid genotypes. Unfortunately, the world we live in is far from ideal and a genotype of AB in a tetraploid organism could be AAAB, AABB, or ABBB. In order to get polyploid data in to adegenet or poppr, we must code all loci to have the same number of allelic states as the ploidy or largest observed heterozygote (if ploidy is unknown). The way to do this is to insert zeroes to pad the alleles. So, to import two genotypes of:
they should be coded as:
This zero is treated as an extra allele and is represented in the genind object as so:
This function remedies this problem by removing the zero column. The above table would become:
With this, the user is able to calculate frequency based statistics on the data set.
This is an approximation, and a bad one at that. Poppr was not originally intended for polyploids, but with the inclusion of Bruvo's distance, it only made sense to attempt something beyond single use.
Zhian N. Kamvar
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
data(Pinf) iPinf <- recode_polyploids(Pinf) # Note that the difference between the number of alleles. nAll(Pinf) nAll(iPinf) ## Not run: library("ape") # Removing missing data. setPop(Pinf) <- ~Country # Calculating Rogers' distance. rog <- rogers.dist(genind2genpop(Pinf)) irog <- rogers.dist(recode_polyploids(genind2genpop(Pinf))) # We will now plot neighbor joining trees. Note the decreased distance in the # original data. plot(nj(rog), type = "unrooted") add.scale.bar(lcol = "red", length = 0.02) plot(nj(irog), type = "unrooted") add.scale.bar(lcol = "red", length = 0.02) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.