Filters individuals with average heterozygosity greater than a specified upper threshold or less than a specified lower threshold
Source:R/gl.filter.heterozygosity.r
gl.filter.heterozygosity.Rd
Calculates the observed heterozygosity for each individual in a genlight object and filters individuals based on specified threshold values. Use gl.report.heterozygosity to determine the appropriate thresholds.
Arguments
- x
A genlight object containing the SNP genotypes [required].
- t.upper
Filter individuals > the threshold [default 0.7].
- t.lower
Filter individuals < the threshold [default 0].
- verbose
Verbosity: 0, silent or fatal errors; 1, begin and end; 2, progress log; 3, progress and results summary; 5, full report [default 2, unless specified using gl.set.verbosity].
See also
Other filter functions:
gl.filter.allna()
,
gl.filter.callrate()
,
gl.filter.hwe()
,
gl.filter.ld()
,
gl.filter.locmetric()
,
gl.filter.maf()
,
gl.filter.monomorphs()
,
gl.filter.overshoot()
,
gl.filter.pa()
,
gl.filter.parent.offspring()
,
gl.filter.rdepth()
,
gl.filter.reproducibility()
,
gl.filter.secondaries()
,
gl.filter.sexlinked()
,
gl.filter.taglength()
Author
Custodian: Luis Mijangos – Post to https://groups.google.com/d/forum/dartr
Examples
result <- gl.filter.heterozygosity(testset.gl,t.upper=0.06,verbose=3)
#> Starting gl.filter.heterozygosity
#> Processing genlight object with SNP data
#> Warning: genlight object contains monomorphic loci which will
#> be factored into heterozygosity estimates
#> Retaining individuals with heterozygosity in the range 0 to 0.06
#> Minimum individual heterozygosity 0
#> Maximum individual heterozygosity 0.0866
#> Initial number of individuals: 250
#> Number of outlier individuals (heterozygosity > 0.06 ): 1
#> Deleted: AA019157[EmmacRussEube], Number of individuals retained: 249
#> Completed: gl.filter.heterozygosity
#>
tmp <- gl.report.heterozygosity(result,method='ind')
#> Starting gl.report.heterozygosity
#> Processing genlight object with SNP data
#> Calculating observed heterozygosity for individuals
#> Note: No adjustment for invariant loci (n.invariant set to 0)
#>
#> ind.name Ho f.hom.ref f.hom.alt
#> AA010915 0.009174312 0.6880734 0.3027523
#> UC_00126 0.008695652 0.6608696 0.3304348
#> AA032760 0.004926108 0.6699507 0.3251232
#> AA013214 0.000000000 0.6525424 0.3474576
#> AA011723 0.009049774 0.6651584 0.3257919
#> AA012411 0.000000000 0.6682028 0.3317972
#> AA019237 0.004504505 0.6801802 0.3153153
#> AA019238 0.008849558 0.6769912 0.3141593
#> AA019239 0.009132420 0.6712329 0.3196347
#> AA019235 0.000000000 0.6801802 0.3198198
#> AA019240 0.000000000 0.6740088 0.3259912
#> AA019241 0.008810573 0.6607930 0.3303965
#> AA019242 0.000000000 0.6724138 0.3275862
#> AA019243 0.004385965 0.6710526 0.3245614
#> AA019251 0.008968610 0.6591928 0.3318386
#> AA019252 0.004545455 0.6727273 0.3227273
#> AA012405 0.004524887 0.6606335 0.3348416
#> AA012406 0.004504505 0.6531532 0.3423423
#> AA012409 0.000000000 0.6607930 0.3392070
#> AA012499 0.004484305 0.6681614 0.3273543
#> AA012422 0.004566210 0.6712329 0.3242009
#> AA012434 0.008928571 0.6607143 0.3303571
#> AA012469 0.009009009 0.6486486 0.3423423
#> AA012500 0.004524887 0.6651584 0.3303167
#> AA032799 0.004329004 0.6580087 0.3376623
#> AA032826 0.000000000 0.6830357 0.3169643
#> AA010795 0.004629630 0.6898148 0.3055556
#> AA010796 0.008620690 0.6551724 0.3362069
#> AA032800 0.008810573 0.6651982 0.3259912
#> AA032801 0.008733624 0.6637555 0.3275109
#> AA032808 0.000000000 0.6846847 0.3153153
#> AA032809 0.004405286 0.6784141 0.3171806
#> AA032811 0.004484305 0.6681614 0.3273543
#> AA032812 0.000000000 0.6801802 0.3198198
#> AA032822 0.004424779 0.6681416 0.3274336
#> AA032825 0.004405286 0.6607930 0.3348018
#> AA010797 0.008888889 0.6755556 0.3155556
#> AA010752 0.004424779 0.6769912 0.3185841
#> AA010754 0.004405286 0.6740088 0.3215859
#> AA010756 0.009132420 0.6757991 0.3150685
#> AA010798 0.004444444 0.6755556 0.3200000
#> AA010799 0.004310345 0.6465517 0.3491379
#> AA010800 0.004424779 0.6858407 0.3097345
#> AA010802 0.004405286 0.6651982 0.3303965
#> AA010803 0.004424779 0.6769912 0.3185841
#> AA010804 0.004651163 0.6837209 0.3116279
#> AA010809 0.004424779 0.6637168 0.3318584
#> AA010749 0.004385965 0.6622807 0.3333333
#> AA010758 0.004255319 0.6553191 0.3404255
#> AA010763 0.004385965 0.6622807 0.3333333
#> AA010765 0.008583691 0.6609442 0.3304721
#> AA010771 0.004484305 0.6681614 0.3273543
#> AA010772 0.004524887 0.6787330 0.3167421
#> AA010781 0.008928571 0.6696429 0.3214286
#> AA032762 0.004424779 0.6681416 0.3274336
#> AA032763 0.004484305 0.6771300 0.3183857
#> AA032756 0.013274336 0.6592920 0.3274336
#> AA032757 0.004524887 0.6923077 0.3031674
#> AA032758 0.008928571 0.6651786 0.3258929
#> AA032761 0.000000000 0.6772727 0.3227273
#> AA032765 0.004366812 0.6681223 0.3275109
#> AA010931 0.004405286 0.6740088 0.3215859
#> AA010937 0.004385965 0.6622807 0.3333333
#> AA010940 0.000000000 0.6637168 0.3362832
#> AA032764 0.008403361 0.6470588 0.3445378
#> AA032768 0.008810573 0.6607930 0.3303965
#> AA010936 0.000000000 0.6846847 0.3153153
#> AA010909 0.008928571 0.6741071 0.3169643
#> AA010916 0.000000000 0.6787330 0.3212670
#> AA010917 0.004484305 0.6771300 0.3183857
#> AA010920 0.004385965 0.6710526 0.3245614
#> AA010921 0.004524887 0.6651584 0.3303167
#> AA020651 0.004385965 0.6710526 0.3245614
#> AA020652 0.004484305 0.6636771 0.3318386
#> AA020667 0.000000000 0.6637931 0.3362069
#> AA020669 0.000000000 0.6666667 0.3333333
#> AA020655 0.004385965 0.6666667 0.3289474
#> AA020656 0.009009009 0.6846847 0.3063063
#> AA020644 0.008810573 0.6740088 0.3171806
#> AA020645 0.000000000 0.6651982 0.3348018
#> AA020646 0.004366812 0.6593886 0.3362445
#> AA020649 0.004484305 0.6771300 0.3183857
#> AA013203 0.009049774 0.6696833 0.3212670
#> AA013217 0.004464286 0.6741071 0.3214286
#> AA013220 0.000000000 0.6637555 0.3362445
#> AA013202 0.008888889 0.6755556 0.3155556
#> AA013225 0.004347826 0.6782609 0.3173913
#> AA018496 0.008888889 0.6800000 0.3111111
#> AA018497 0.013452915 0.6816143 0.3049327
#> AA018513 0.013636364 0.6590909 0.3272727
#> AA013231 0.000000000 0.6681223 0.3318777
#> AA013261 0.004385965 0.6578947 0.3377193
#> AA013265 0.000000000 0.6724138 0.3275862
#> AA013270 0.004566210 0.6849315 0.3105023
#> AA018492 0.008888889 0.6711111 0.3200000
#> AA018493 0.013574661 0.6742081 0.3122172
#> AA018494 0.004761905 0.6809524 0.3142857
#> AA018495 0.004524887 0.6787330 0.3167421
#> AA018514 0.008658009 0.6580087 0.3333333
#> AA018515 0.008620690 0.6637931 0.3275862
#> AA018516 0.008888889 0.6711111 0.3200000
#> UC_00125 0.000000000 0.6863636 0.3136364
#> UC_00126a 0.009132420 0.6712329 0.3196347
#> UC_00146 0.000000000 0.6976744 0.3023256
#> UC_00149 0.004464286 0.6696429 0.3258929
#> AA018640 0.017777778 0.6622222 0.3200000
#> AA018658 0.000000000 0.6757991 0.3242009
#> AA011729 0.018181818 0.6727273 0.3090909
#> UC_00132 0.000000000 0.6636364 0.3363636
#> UC_00137 0.008547009 0.6581197 0.3333333
#> UC_00143 0.004587156 0.6743119 0.3211009
#> UC_00157 0.004464286 0.6651786 0.3303571
#> UC_00161 0.004504505 0.6801802 0.3153153
#> AA018637 0.004672897 0.6869159 0.3084112
#> AA018638 0.000000000 0.6863636 0.3136364
#> AA018639 0.000000000 0.6697248 0.3302752
#> AA011731 0.008474576 0.6483051 0.3432203
#> AA033576 0.008771930 0.6622807 0.3289474
#> AA033577 0.008888889 0.6711111 0.3200000
#> AA011732 0.013157895 0.6622807 0.3245614
#> AA011737 0.030434783 0.6478261 0.3217391
#> AA011741 0.013157895 0.6535088 0.3333333
#> AA011744 0.000000000 0.6784141 0.3215859
#> AA011745 0.013392857 0.6651786 0.3214286
#> AA011746 0.017699115 0.6637168 0.3185841
#> AA011749 0.013274336 0.6504425 0.3362832
#> AA033575 0.004464286 0.6741071 0.3214286
#> AA033578 0.004347826 0.6608696 0.3347826
#> AA012411a 0.000000000 0.6726457 0.3273543
#> AA033579 0.004484305 0.6547085 0.3408072
#> AA033582 0.008888889 0.6622222 0.3288889
#> AA033593 0.004504505 0.6756757 0.3198198
#> AA033602 0.000000000 0.6623377 0.3376623
#> AA033609 0.004444444 0.6666667 0.3288889
#> AA033617 0.009049774 0.6696833 0.3212670
#> AA010915a 0.004524887 0.6832579 0.3122172
#> AA011723a 0.009132420 0.6757991 0.3150685
#> AA019158 0.000000000 0.6801802 0.3198198
#> AA020379 0.004524887 0.6696833 0.3257919
#> UC_01044 0.000000000 0.6785714 0.3214286
#> AA018380 0.008733624 0.6593886 0.3318777
#> AA018371 0.004366812 0.6550218 0.3406114
#> AA004553 0.008810573 0.6651982 0.3259912
#> AA000328 0.004484305 0.6681614 0.3273543
#> AA000311 0.004566210 0.6621005 0.3333333
#> AA019159 0.000000000 0.6901408 0.3098592
#> AA020378 0.009049774 0.6651584 0.3257919
#> UC_01060 0.004484305 0.6726457 0.3228700
#> AA018379 0.009216590 0.6820276 0.3087558
#> AA018365 0.004464286 0.6785714 0.3169643
#> AA004554 0.022026432 0.6519824 0.3259912
#> AA000303 0.004385965 0.6666667 0.3289474
#> AA000320 0.009090909 0.6636364 0.3272727
#> AA019160 0.004587156 0.6743119 0.3211009
#> AA020377 0.008849558 0.6681416 0.3230088
#> UC_01053 0.000000000 0.6637555 0.3362445
#> AA018375 0.009090909 0.6545455 0.3363636
#> AA004555 0.017777778 0.6533333 0.3288889
#> AA000304 0.004484305 0.6681614 0.3273543
#> AA019165 0.004629630 0.6759259 0.3194444
#> AA019161 0.000000000 0.6772727 0.3227273
#> AA020376 0.008968610 0.6771300 0.3139013
#> UC_01062 0.004385965 0.6622807 0.3333333
#> AA018374 0.013574661 0.6651584 0.3212670
#> AA04523 0.026666667 0.6577778 0.3155556
#> AA000305 0.004484305 0.6726457 0.3228700
#> AA019164 0.000000000 0.6729858 0.3270142
#> AA020375 0.004566210 0.6666667 0.3287671
#> AA018373 0.018099548 0.6515837 0.3303167
#> AA032875 0.021834061 0.6550218 0.3231441
#> AA000309 0.000000000 0.6500000 0.3500000
#> AA019163 0.004504505 0.6756757 0.3198198
#> AA020374 0.008888889 0.6400000 0.3511111
#> AA018368 0.008849558 0.6592920 0.3318584
#> AA032878 0.013333333 0.6622222 0.3244444
#> AA000302 0.013636364 0.6681818 0.3181818
#> AA019162 0.004504505 0.6666667 0.3288288
#> AA020365 0.000000000 0.6621622 0.3378378
#> UC_00150 0.008695652 0.6652174 0.3260870
#> AA018369 0.022222222 0.6577778 0.3200000
#> AA004551 0.009049774 0.6606335 0.3303167
#> AA032880 0.026315789 0.6578947 0.3157895
#> AA000307 0.009009009 0.6666667 0.3243243
#> AA019156 0.004524887 0.6696833 0.3257919
#> AA020371 0.004424779 0.6548673 0.3407080
#> UC_01051 0.004385965 0.6710526 0.3245614
#> AA018370 0.004444444 0.6577778 0.3377778
#> AA004552 0.021929825 0.6491228 0.3289474
#> AA032882 0.004444444 0.6800000 0.3155556
#> AA000310 0.013513514 0.6621622 0.3243243
#> AA019075 0.004347826 0.6565217 0.3391304
#> AA004864 0.008733624 0.6550218 0.3362445
#> AA019071 0.008583691 0.6652361 0.3261803
#> AA004868 0.000000000 0.6580087 0.3419913
#> AA019083 0.000000000 0.6725664 0.3274336
#> AA019072 0.008810573 0.6607930 0.3303965
#> AA004858 0.008733624 0.6593886 0.3318777
#> AA004869 0.017391304 0.6521739 0.3304348
#> AA019082 0.013100437 0.6462882 0.3406114
#> AA019073 0.000000000 0.6531532 0.3468468
#> AA004859 0.013100437 0.6550218 0.3318777
#> AA004866 0.004444444 0.6844444 0.3111111
#> AA019077 0.008888889 0.6755556 0.3155556
#> AA004860 0.008695652 0.6652174 0.3260870
#> AA019080 0.000000000 0.6710526 0.3289474
#> AA004861 0.000000000 0.6666667 0.3333333
#> AA019079 0.004347826 0.6695652 0.3260870
#> AA004862 0.012987013 0.6580087 0.3290043
#> AA019078 0.004405286 0.6696035 0.3259912
#> AA004863 0.013100437 0.6637555 0.3231441
#> UC_00267 0.013824885 0.6405530 0.3456221
#> UC_00205 0.036529680 0.6301370 0.3333333
#> UC_00206 0.033333333 0.6523810 0.3142857
#> UC_00208 0.018691589 0.6401869 0.3411215
#> UC_00243 0.018604651 0.6279070 0.3534884
#> UC_00209 0.009433962 0.6650943 0.3254717
#> UC_00254 0.014150943 0.6367925 0.3490566
#> UC_00210 0.023923445 0.6459330 0.3301435
#> UC_00259 0.014354067 0.6507177 0.3349282
#> UC_00126c 0.009389671 0.6384977 0.3521127
#> AA063718 0.015151515 0.6919192 0.2929293
#> AA063720 0.010204082 0.7142857 0.2755102
#> AA063722 0.005235602 0.6963351 0.2984293
#> AA063726 0.020942408 0.6910995 0.2879581
#> AA063732 0.010256410 0.6923077 0.2974359
#> AA063708 0.010152284 0.6903553 0.2994924
#> AA063710 0.010101010 0.6969697 0.2929293
#> AA063712 0.000000000 0.7040816 0.2959184
#> AA063714 0.000000000 0.7020202 0.2979798
#> AA063716 0.005025126 0.6934673 0.3015075
#> AA020735 0.000000000 0.6593886 0.3406114
#> AA032442 0.000000000 0.6623377 0.3376623
#> AA032441 0.008658009 0.6536797 0.3376623
#> AA020749 0.004273504 0.6495726 0.3461538
#> AA020746 0.004310345 0.6681034 0.3275862
#> AA020744 0.008695652 0.6565217 0.3347826
#> AA020743 0.000000000 0.6709402 0.3290598
#> AA020739 0.008771930 0.6666667 0.3245614
#> AA020738 0.000000000 0.6710526 0.3289474
#> AA001451 0.004291845 0.6480687 0.3476395
#> AA01452 0.012875536 0.6523605 0.3347639
#> AA001454 0.008695652 0.6434783 0.3478261
#> AA001455 0.004255319 0.6468085 0.3489362
#> AA001446 0.000000000 0.6536797 0.3463203
#> AA001456 0.004310345 0.6465517 0.3491379
#> AA001447 0.000000000 0.6523605 0.3476395
#> AA001448 0.000000000 0.6465517 0.3534483
#> AA001449 0.008620690 0.6422414 0.3491379
#> AA001450 0.008510638 0.6468085 0.3446809
#> Completed: gl.report.heterozygosity
#>