By-Locus Summaries

Eric Archer

2017-04-10

There are several by-locus summary functions available for gtypes objects. Given some sample microsatellite data:

data(msats.g)
msats <- stratify(msats.g, "broad")
msats <- msats[, locNames(msats)[1:4], ]

One can calculate the following summaries:

The number of alleles at each locus:

numAlleles(msats)
##  D11t  EV37  EV94 Ttr11 
##    12    22    15     9

The number of samples with missing data at each locus:

numMissing(msats)
##  D11t  EV37  EV94 Ttr11 
##     1     7     1     1

which can also be expressed as a proportion of samples with missing data:

numMissing(msats, prop = TRUE)
##  D11t  EV37  EV94 Ttr11 
## 0.004 0.028 0.004 0.004

The allelic richness, or the average number of alleles per sample:

allelicRichness(msats)
##  D11t  EV37  EV94 Ttr11 
## 0.096 0.185 0.120 0.072

The observed and expected heterozygosity:

obsvdHet(msats)
##  D11t  EV37  EV94 Ttr11 
##  0.70  0.70  0.78  0.70
exptdHet(msats)
##  D11t  EV37  EV94 Ttr11 
##  0.75  0.83  0.83  0.80

The proportion of alleles that are unique (present in only one sample):

propUniqueAlleles(msats)
##  D11t  EV37  EV94 Ttr11 
## 0.250 0.136 0.067 0.222

The value of theta based on heterozygosity:

theta(msats)
##  D11t  EV37  EV94 Ttr11 
##  0.56  0.62  0.62  0.59

These measures are all calculated in the summarizeLoci function and returned as a matrix. This function also allows you to calculate the measures for each stratum separately, which returns a list for each stratum:

summarizeLoci(msats)
##       num.genotyped prop.genotyped num.alleles allelic.richness
## D11t            125           0.99          12            0.096
## EV37            119           0.94          22            0.185
## EV94            125           0.99          15            0.120
## Ttr11           125           0.99           9            0.072
##       prop.unique.alleles exptd.heterozygosity obsvd.heterozygosity
## D11t                0.250                 0.75                 0.70
## EV37                0.136                 0.83                 0.70
## EV94                0.067                 0.83                 0.78
## Ttr11               0.222                 0.80                 0.70
summarizeLoci(msats, by.strata = TRUE)
## $Coastal
##       num.genotyped prop.genotyped num.alleles allelic.richness
## D11t             67           0.99           3            0.045
## EV37             63           0.93           7            0.111
## EV94             68           1.00           5            0.074
## Ttr11            68           1.00           4            0.059
##       prop.unique.alleles exptd.heterozygosity obsvd.heterozygosity
## D11t                 0.00                 0.49                 0.52
## EV37                 0.43                 0.61                 0.62
## EV94                 0.00                 0.77                 0.74
## Ttr11                0.00                 0.66                 0.63
## 
## $Offshore
##       num.genotyped prop.genotyped num.alleles allelic.richness
## D11t             58           1.00          12             0.21
## EV37             56           0.97          22             0.39
## EV94             57           0.98          15             0.26
## Ttr11            57           0.98           9             0.16
##       prop.unique.alleles exptd.heterozygosity obsvd.heterozygosity
## D11t                0.250                 0.86                 0.91
## EV37                0.136                 0.94                 0.79
## EV94                0.067                 0.86                 0.82
## Ttr11               0.222                 0.82                 0.79

One can also obtain the allelic frequencies for each locus overall and by-strata by:

alleleFreqs(msats)
## $D11t
##     freq  prop
## 117    1 0.004
## 119    1 0.004
## 121    4 0.016
## 127    1 0.004
## 129    3 0.012
## 131   16 0.064
## 133   75 0.300
## 135   96 0.384
## 137   20 0.080
## 139   20 0.080
## 141    7 0.028
## 143    6 0.024
## 
## $EV37
##     freq   prop
## 190    3 0.0126
## 200    4 0.0168
## 202    5 0.0210
## 204    2 0.0084
## 206    7 0.0294
## 208    8 0.0336
## 210    3 0.0126
## 212   13 0.0546
## 214   86 0.3613
## 216   39 0.1639
## 218    8 0.0336
## 220    6 0.0252
## 222   20 0.0840
## 224   11 0.0462
## 226    3 0.0126
## 228    8 0.0336
## 230    5 0.0210
## 232    2 0.0084
## 234    1 0.0042
## 236    2 0.0084
## 240    1 0.0042
## 254    1 0.0042
## 
## $EV94
##     freq  prop
## 229    1 0.004
## 239    2 0.008
## 243   15 0.060
## 245   18 0.072
## 247    3 0.012
## 249   83 0.332
## 251   41 0.164
## 253    7 0.028
## 255    6 0.024
## 259   27 0.108
## 261   27 0.108
## 263    7 0.028
## 265    8 0.032
## 269    3 0.012
## 271    2 0.008
## 
## $Ttr11
##     freq  prop
## 193    1 0.004
## 197   10 0.040
## 207   53 0.212
## 209   17 0.068
## 211   35 0.140
## 213   80 0.320
## 215   46 0.184
## 217    7 0.028
## 219    1 0.004
alleleFreqs(msats, by.strata = TRUE)
## $D11t
## , , Coastal
## 
##     freq  prop
## 117    0 0.000
## 119    0 0.000
## 121    0 0.000
## 127    0 0.000
## 129    0 0.000
## 131    0 0.000
## 133   48 0.358
## 135   83 0.619
## 137    3 0.022
## 139    0 0.000
## 141    0 0.000
## 143    0 0.000
## 
## , , Offshore
## 
##     freq   prop
## 117    1 0.0086
## 119    1 0.0086
## 121    4 0.0345
## 127    1 0.0086
## 129    3 0.0259
## 131   16 0.1379
## 133   27 0.2328
## 135   13 0.1121
## 137   17 0.1466
## 139   20 0.1724
## 141    7 0.0603
## 143    6 0.0517
## 
## 
## $EV37
## , , Coastal
## 
##     freq   prop
## 190    0 0.0000
## 200    0 0.0000
## 202    0 0.0000
## 204    0 0.0000
## 206    0 0.0000
## 208    0 0.0000
## 210    0 0.0000
## 212    1 0.0079
## 214   71 0.5635
## 216   33 0.2619
## 218    2 0.0159
## 220    0 0.0000
## 222   11 0.0873
## 224    7 0.0556
## 226    1 0.0079
## 228    0 0.0000
## 230    0 0.0000
## 232    0 0.0000
## 234    0 0.0000
## 236    0 0.0000
## 240    0 0.0000
## 254    0 0.0000
## 
## , , Offshore
## 
##     freq   prop
## 190    3 0.0268
## 200    4 0.0357
## 202    5 0.0446
## 204    2 0.0179
## 206    7 0.0625
## 208    8 0.0714
## 210    3 0.0268
## 212   12 0.1071
## 214   15 0.1339
## 216    6 0.0536
## 218    6 0.0536
## 220    6 0.0536
## 222    9 0.0804
## 224    4 0.0357
## 226    2 0.0179
## 228    8 0.0714
## 230    5 0.0446
## 232    2 0.0179
## 234    1 0.0089
## 236    2 0.0179
## 240    1 0.0089
## 254    1 0.0089
## 
## 
## $EV94
## , , Coastal
## 
##     freq  prop
## 229    0 0.000
## 239    0 0.000
## 243    0 0.000
## 245   12 0.088
## 247    0 0.000
## 249   47 0.346
## 251   30 0.221
## 253    0 0.000
## 255    0 0.000
## 259   25 0.184
## 261   22 0.162
## 263    0 0.000
## 265    0 0.000
## 269    0 0.000
## 271    0 0.000
## 
## , , Offshore
## 
##     freq   prop
## 229    1 0.0088
## 239    2 0.0175
## 243   15 0.1316
## 245    6 0.0526
## 247    3 0.0263
## 249   36 0.3158
## 251   11 0.0965
## 253    7 0.0614
## 255    6 0.0526
## 259    2 0.0175
## 261    5 0.0439
## 263    7 0.0614
## 265    8 0.0702
## 269    3 0.0263
## 271    2 0.0175
## 
## 
## $Ttr11
## , , Coastal
## 
##     freq  prop
## 193    0 0.000
## 197    0 0.000
## 207   42 0.309
## 209    0 0.000
## 211    0 0.000
## 213   59 0.434
## 215   33 0.243
## 217    2 0.015
## 219    0 0.000
## 
## , , Offshore
## 
##     freq   prop
## 193    1 0.0088
## 197   10 0.0877
## 207   11 0.0965
## 209   17 0.1491
## 211   35 0.3070
## 213   21 0.1842
## 215   13 0.1140
## 217    5 0.0439
## 219    1 0.0088