Shuffle individuals in a genclone
or
genind
object independently over each locus.
Source: R/sample_schemes.r
shufflepop.Rd
Details
This function will shuffle each locus in the data set independently of one another, rendering them essentially unlinked. The following methods are available to shuffle your data:
Permute Alleles This will redistribute all alleles in the sample throughout the locus. Missing data is fixed in place. This maintains allelic structure, but heterozygosity is variable.
Parametric Bootstrap This will redistribute available alleles within the locus based on their allelic frequencies. This means that both the allelic state and heterozygosity will vary. The resulting data set will not have missing data.
Non-Parametric Bootstrap This will shuffle the allelic state for each individual. Missing data is fixed in place.
Multilocus Style Permutation This will shuffle the genotypes at each locus, maintaining the heterozygosity and allelic structure.
References
Paul-Michael Agapow and Austin Burt. 2001. Indices of multilocus linkage disequilibrium. Molecular Ecology Notes, 1(1-2):101-102
Examples
# load the microbov dataset
data(microbov)
# Let's look at a single population for now. Howsabout Zebu
Zebu <- popsub(microbov, "Zebu")
summary(Zebu)
#>
#> // Number of individuals: 50
#> // Group sizes: 50
#> // Number of alleles per locus: 7 6 8 5 7 6 5 5 9 6 10 9 10 9 9 5 5 10 9 9 11 8 10 8 6 8 8 8 13 6
#> // Number of alleles per group: 235
#> // Percentage of missing data: 0.87 %
#> // Observed heterozygosity: 0.54 0.58 0.7 0.67 0.48 0.6 0.46 0.5 0.71 0.8 0.74 0.86 0.78 0.72 0.9 0.82 0.62 0.74 0.82 0.64 0.8 0.41 0.6 0.76 0.58 0.52 0.76 0.66 0.82 0.4
#> // Expected heterozygosity: 0.71 0.61 0.74 0.73 0.75 0.64 0.58 0.6 0.66 0.76 0.81 0.83 0.75 0.78 0.82 0.76 0.59 0.78 0.83 0.63 0.82 0.42 0.8 0.8 0.73 0.61 0.74 0.65 0.83 0.44
# Take note of the Number of alleles per population and the Observed
# heterozygosity as we go through each method.
# Permute Alleles: maintain allelic state; heterozygosity varies.
summary(shufflepop(Zebu, method=1))
#>
#> // Number of individuals: 50
#> // Group sizes: 50
#> // Number of alleles per locus: 7 6 8 5 7 6 5 5 9 6 10 9 10 9 9 5 5 10 9 9 11 8 10 8 6 8 8 8 13 6
#> // Number of alleles per group: 235
#> // Percentage of missing data: 0.87 %
#> // Observed heterozygosity: 0.66 0.66 0.76 0.76 0.69 0.58 0.64 0.7 0.75 0.8 0.76 0.82 0.73 0.7 0.7 0.78 0.66 0.8 0.8 0.66 0.9 0.41 0.79 0.84 0.72 0.62 0.6 0.64 0.84 0.42
#> // Expected heterozygosity: 0.71 0.61 0.74 0.73 0.75 0.64 0.58 0.6 0.66 0.76 0.81 0.83 0.75 0.78 0.82 0.76 0.59 0.78 0.83 0.63 0.82 0.42 0.8 0.8 0.73 0.61 0.74 0.65 0.83 0.44
# \dontrun{
# Parametric Bootstrap: do not maintain allelic state or heterozygosity
summary(shufflepop(Zebu, method=2))
#>
#> // Number of individuals: 50
#> // Group sizes: 50
#> // Number of alleles per locus: 7 6 8 5 7 6 4 5 8 6 10 9 8 9 8 5 5 8 9 9 11 6 8 8 6 8 6 7 12 5
#> // Number of alleles per group: 219
#> // Percentage of missing data: 0 %
#> // Observed heterozygosity: 0.68 0.64 0.62 0.74 0.76 0.62 0.58 0.6 0.58 0.68 0.82 0.92 0.74 0.78 0.84 0.76 0.6 0.74 0.74 0.62 0.84 0.44 0.7 0.9 0.66 0.68 0.84 0.66 0.78 0.4
#> // Expected heterozygosity: 0.76 0.64 0.67 0.74 0.76 0.59 0.61 0.57 0.7 0.74 0.81 0.84 0.74 0.75 0.81 0.77 0.55 0.78 0.79 0.64 0.8 0.38 0.77 0.79 0.69 0.62 0.73 0.66 0.83 0.45
# Non-Parametric Bootstrap: do not maintain allelic state or heterozygosity.
summary(shufflepop(Zebu, method=3))
#>
#> // Number of individuals: 50
#> // Group sizes: 50
#> // Number of alleles per locus: 7 6 8 5 7 6 5 5 9 6 10 9 10 9 9 5 5 10 9 9 11 8 10 8 6 8 8 8 13 6
#> // Number of alleles per group: 235
#> // Percentage of missing data: 0 %
#> // Observed heterozygosity: 0.9 0.9 0.84 0.78 0.76 0.76 0.84 0.84 0.86 0.92 0.92 0.9 0.96 0.96 0.82 0.72 0.86 0.86 0.92 0.88 0.9 0.86 0.84 0.92 0.82 0.84 0.84 0.84 0.86 0.84
#> // Expected heterozygosity: 0.86 0.83 0.86 0.8 0.85 0.82 0.79 0.79 0.88 0.82 0.89 0.88 0.89 0.88 0.88 0.79 0.8 0.89 0.88 0.88 0.9 0.87 0.89 0.87 0.82 0.87 0.86 0.87 0.9 0.82
# Multilocus Style: maintain allelic state and heterozygosity.
summary(shufflepop(Zebu, method=4))
#>
#> // Number of individuals: 50
#> // Group sizes: 50
#> // Number of alleles per locus: 7 6 8 5 7 6 5 5 9 6 10 9 10 9 9 5 5 10 9 9 11 8 10 8 6 8 8 8 13 6
#> // Number of alleles per group: 235
#> // Percentage of missing data: 0.87 %
#> // Observed heterozygosity: 0.54 0.58 0.7 0.67 0.48 0.6 0.46 0.5 0.71 0.8 0.74 0.86 0.78 0.72 0.9 0.82 0.62 0.74 0.82 0.64 0.8 0.41 0.6 0.76 0.58 0.52 0.76 0.66 0.82 0.4
#> // Expected heterozygosity: 0.71 0.61 0.74 0.73 0.75 0.64 0.58 0.6 0.66 0.76 0.81 0.83 0.75 0.78 0.82 0.76 0.59 0.78 0.83 0.63 0.82 0.42 0.8 0.8 0.73 0.61 0.74 0.65 0.83 0.44
# }