SNPfiltR quality filtering pipeline
Read in your unfiltered vcf file
library(vcfR)
##
## ***** *** vcfR *** *****
## This is vcfR 1.12.0
## browseVignettes('vcfR') # Documentation
## citation('vcfR') # Citation
## ***** ***** ***** *****
library(ggplot2)
library(gridExtra)
library(ggridges)
library(adegenet)
## Loading required package: ade4
##
## /// adegenet 2.1.5 is loaded ////////////
##
## > overview: '?adegenet'
## > tutorials/doc/questions: 'adegenetWeb()'
## > bug reports/feature requests: adegenetIssues()
library(SNPfiltR)
## This is SNPfiltR v.1.0.0
##
## Detailed usage information is available at: devonderaad.github.io/SNPfiltR/
##
## If you use SNPfiltR in your published work, please cite the following papers:
##
## DeRaad, D.A. (2022), SNPfiltR: an R package for interactive and reproducible SNP filtering. Molecular Ecology Resources, 00, 1-15. http://doi.org/10.1111/1755-0998.13618
##
## Knaus, Brian J., and Niklaus J. Grunwald. 2017. VCFR: a package to manipulate and visualize variant call format data in R. Molecular Ecology Resources, 17.1:44-53. http://doi.org/10.1111/1755-0998.12549
library(dplyr)
##
## Attaching package: 'dplyr'
## The following object is masked from 'package:gridExtra':
##
## combine
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
#read in vcf as vcfR
vcfR <- read.vcfR("~/Desktop/marsh.wren.rad/n4.vcf")
### check the metadata present in your vcf
vcfR
vcfR@fix[1:10,1:8]
vcfR@gt[1:10,1:2]
#remove extraneous samples
vcfR<-vcfR[,c(1:79,81:133,143,146:154)]
vcfR<-min_mac(vcfR, min.mac = 1) #remove invariant sites
## 6.64% of SNPs fell below a minor allele count of 1 and were removed from the VCF

vcfR
colnames(vcfR@gt)
#read in sample metadata
samps<-read.csv("~/Desktop/marsh.wren.rad/marsh.wren.rad.sampling.csv")
#retain samples that were sequenced successfully
samps<-samps[samps$Tissue.num %in% colnames(vcfR@gt),]
#reorder sampling file to match order of samples in vcf
samps<-samps[match(colnames(vcfR@gt)[-1], samps$Tissue.num),]
samps$Tissue.num == colnames(vcfR@gt)[-1] #check that order matches
#generate popmap file. Two column popmap with the same format as stacks, and the columns must be named 'id' and 'pop'
popmap<-data.frame(id=samps$Tissue.num,
pop=samps$Population)
table(popmap$pop)
step 1: Implement quality filters that don’t involve missing data.
This is because removing low data samples will alter percentage/quantile
based missing data cutoffs, so we wait to implement those until after
deciding on our final set of samples for downstream analysis
#hard filter to minimum depth of 3, and minimum genotype quality of 30
vcfR<-hard_filter(vcfR, depth = 3, gq = 30)
## 0.03% of genotypes fall below a read depth of 3 and were converted to NA
## 2.77% of genotypes fall below a genotype quality of 30 and were converted to NA
Use this function to filter for allele balance
from Puritz SNP filtering tutorial “Allele balance: a number between
0 and 1 representing the ratio of reads showing the reference allele to
all reads, considering only reads from individuals called as
heterozygous, we expect that the allele balance in our data (for real
loci) should be close to 0.5”
#execute allele balance filter
vcfR<-filter_allele_balance(vcfR)
## 13.21% of het genotypes (0.96% of all genotypes) fall outside of 0.25 - 0.75 allele balance ratio and were converted to NA

max depth filter (super high depth loci are likely multiple loci
stuck together into a single paralogous locus).
#visualize and pick appropriate max depth cutoff
max_depth(vcfR)
## cutoff is not specified, exploratory visualization will be generated.

## dashed line indicates a mean depth across all SNPs of 70.9

#filter vcf by the max depth cutoff you chose
vcfR<-max_depth(vcfR, maxdepth = 200)
## maxdepth cutoff is specified, filtered vcfR object will be returned
## 6.41% of SNPs were above a mean depth of 200 and were removed from the vcf

#remove SNPs that have become invariant
vcfR<-min_mac(vcfR, min.mac = 1)
## 9.79% of SNPs fell below a minor allele count of 1 and were removed from the VCF

#check vcfR to see how many SNPs we have left
vcfR
## ***** Object of Class vcfR *****
## 141 samples
## 36130 CHROMs
## 88,372 variants
## Object size: 405.5 Mb
## 64.6 percent missing data
## ***** ***** *****
Step 2: visualize missing data by sample. Check out the
visualizations and make decision on which samples to keep for downstream
analysis.
#run function to visualize samples
miss<-missing_by_sample(vcfR=vcfR)
## No popmap provided


missing_by_snp(vcfR=vcfR)
## cutoff is not specified, exploratory visualizations will be generated
## Picking joint bandwidth of 0.0492


## filt missingness snps.retained
## 1 0.30 0.36046880 42795
## 2 0.50 0.26865961 30682
## 3 0.60 0.19217693 21816
## 4 0.65 0.16900834 19373
## 5 0.70 0.14568612 16877
## 6 0.75 0.12366466 14451
## 7 0.80 0.10028742 11770
## 8 0.85 0.07754116 9086
## 9 0.90 0.05323804 6094
## 10 0.95 0.02924670 3086
## 11 1.00 0.00000000 138
#looks like there are 4 more samples that I would remove for low data
#run function to drop samples above the threshold we want from the vcf
vcfR<-missing_by_sample(vcfR=vcfR, cutoff = .8)
## 4 samples are above a 0.8 missing data cutoff, and were removed from VCF

#remove SNPs that became invariant
vcfR<-min_mac(vcfR, min.mac = 1)
## 0.38% of SNPs fell below a minor allele count of 1 and were removed from the VCF

#subset popmap to only include retained individuals
popmap<-popmap[popmap$id %in% colnames(vcfR@gt),]
#alternatively, you can drop individuals from vcfR manually using the following syntax, if a strict cutoff doesn't work for your dataset
#vcfR@gt <- vcfR@gt[,colnames(vcfR@gt) != "KVO248_H_dinops_Isabel"]
Step 3: Set the arbitrary missing data cutoff
We can visualize the effect that typical missing data cutoffs will
have on both the number of SNPs retained and the total missing data in
our entire dataset.
We want to choose a cutoff that minimizes the overall missing data
in the dataset, while maximizing the total number of loci retained.
#visualize missing data by SNP and the effect of various cutoffs on the missingness of each sample
missing_by_snp(vcfR)
## cutoff is not specified, exploratory visualizations will be generated
## Picking joint bandwidth of 0.0495


## filt missingness snps.retained
## 1 0.30 0.35440066 42853
## 2 0.50 0.26349595 30997
## 3 0.60 0.18546936 22145
## 4 0.65 0.16221193 19701
## 5 0.70 0.14100200 17436
## 6 0.75 0.11891495 15013
## 7 0.80 0.09612396 12380
## 8 0.85 0.07285331 9583
## 9 0.90 0.04923814 6514
## 10 0.95 0.02491843 3226
## 11 1.00 0.00000000 227
#choose a value that retains an acceptable amount of missing data in each sample, and maximizes SNPs retained while minimizing overall missing data, and filter vcf
vcfR<-missing_by_snp(vcfR, cutoff = .85)
## cutoff is specified, filtered vcfR object will be returned
## 89.11% of SNPs fell below a completeness cutoff of 0.85 and were removed from the VCF

check the effect of mac threshold on clustering
#drop invariant sites plus singletons for plotting
vcf.filt<-min_mac(vcfR, min.mac = 2)
## 32.77% of SNPs fell below a minor allele count of 2 and were removed from the VCF

#compare SNP counts
vcfR
## ***** Object of Class vcfR *****
## 137 samples
## 3087 CHROMs
## 9,583 variants
## Object size: 101.3 Mb
## 7.285 percent missing data
## ***** ***** *****
vcf.filt
## ***** Object of Class vcfR *****
## 137 samples
## 2676 CHROMs
## 6,443 variants
## Object size: 69.5 Mb
## 7.408 percent missing data
## ***** ***** *****
#assess the effect of MAC cutoff on clustering inferences
assess_missing_data_pca(vcfR, popmap = popmap, clustering = FALSE)


## PC1 PC2 PC3 PC4 PC5 PC6
## B00908 -13.2191089 -0.54099437 0.318929406 -0.37589374 0.10750228 -0.60634876
## B00910 -12.8278781 -0.40702914 0.492185027 -0.30532170 -1.57346702 0.72606031
## B00911 -13.2955761 0.28570959 -0.139234812 -0.36885553 -0.02316876 0.41912523
## B00912 -12.8548076 -0.10888916 1.191628773 -1.16172416 0.94759486 -0.37252911
## B00913 -12.7390688 1.49119551 -2.197027718 -0.76168960 0.27062505 -0.35468561
## B00914 -13.7277766 -0.64926392 -1.032675520 -1.14586523 0.60145889 -0.91604328
## B00915 -12.6483564 -1.57064083 -0.458115831 2.83194364 0.07899836 -1.71700416
## B00916 -12.4278705 -0.42454916 1.902055711 1.79701053 -1.59454896 0.92227547
## B00927 -2.6404813 0.68954259 -1.095619559 -2.52784035 -2.10521801 1.26950927
## B00928 10.8080897 -0.24531986 -1.411769757 0.77561842 -0.38633904 -1.31407007
## B00929 10.6744603 0.48079279 0.543590117 -1.45939645 -0.51463087 0.30747049
## B00930 -12.9556591 0.27262402 -1.573754515 -0.27953379 -0.45499897 -1.26059781
## B00931 7.9304026 -0.74740723 0.443744059 -3.11286615 -0.82620283 0.51790596
## B00932 -12.9148897 0.10153062 -0.964177033 -0.37949497 -0.26664232 -1.17711841
## B00934 10.8248552 0.36258559 -0.622856445 0.14874299 0.95320046 -0.09929207
## B00935 11.0510372 0.37797820 -0.827545866 -0.36363954 0.28394015 1.54771349
## B00936 8.7896040 0.85190938 -2.851983725 -0.50392423 0.09946289 0.09597382
## B00937 10.4871961 -0.12605714 -0.254554292 -0.50719795 -0.11347140 -0.09426338
## B00938 8.6264000 0.13025771 -2.439156247 -1.05820886 0.74933728 -0.12058464
## B00939 10.7769520 -0.30056558 -0.336409090 -0.30596315 0.25013107 -0.49806777
## B00940 9.1898720 0.20975332 -1.366862127 -0.42174345 -0.35130266 1.04697705
## B00941 11.4259335 0.76628263 -0.228257305 0.42731341 0.21356068 0.13456542
## B00942 9.8678865 0.77595064 -0.855263916 -0.16593047 -1.63649693 1.29591753
## B00943 11.5041603 0.51465896 0.294088204 0.46866280 0.83293892 -0.68479198
## B00944 11.1552262 0.16964992 -0.252969727 -0.11074195 0.44687236 -0.32670460
## B00945 -9.1957279 -1.48350904 2.756559465 1.56271500 1.46714666 -0.70898732
## B00946 -13.2451024 -1.50197322 -0.002586371 0.76851129 -1.45392418 -0.05972954
## B00947 -12.9780341 -0.69577778 0.809012821 1.57454396 1.39894111 1.61060602
## B00948 -11.9761492 -1.39104371 3.543702863 -1.31402540 -0.09611387 -0.44741676
## B00949 -13.0629389 -0.07029589 -0.278038301 -1.02386854 -0.34904958 0.28826784
## B00950 -10.1016076 -1.84078979 2.759765142 1.22446324 0.40359687 -0.83167577
## B00951 -12.8911858 1.02514899 -0.303470575 1.16092487 -0.18590654 0.98189736
## B00953 11.0885890 -0.71871523 -0.570637398 -0.34182891 -0.24400737 -1.24965133
## B00954 11.2204738 -0.03873995 -0.066173895 0.36062250 0.11427368 -0.36820455
## B00955 11.4620347 0.30258357 0.118612857 -0.09397094 -0.04552928 -0.13577516
## B00956 10.4288244 -0.58594010 -0.785697138 0.08439680 -1.99757792 1.19074602
## B00957 8.7779823 -0.15424163 0.022206764 0.40476643 2.51232046 0.12598321
## B00958 -13.8288900 0.46303342 0.399516402 -1.24830903 0.69514632 -0.83138921
## B00959 -12.2449956 1.02184220 -2.676709139 -1.01887300 -1.27917745 -1.97504162
## B00960 11.2895913 0.04560715 0.132916475 -0.27395360 -1.78756904 0.60456773
## B00961 8.2901227 -2.79269924 0.865112538 -1.84854114 1.19649855 -1.44143608
## B00962 -1.2424777 0.69009313 1.113817467 -0.99264052 -1.11123996 -0.49757404
## B00963 11.5273549 -0.35122117 -0.016169380 0.79407705 0.17768289 -0.50773307
## B00964 10.0464215 0.58100933 0.588687441 -0.69372219 -0.69188145 -1.33507544
## B00965 -11.3899530 -1.97021756 3.665270315 0.77333272 -0.06204018 -0.01200403
## B00966 11.2685424 0.02694593 -0.434171271 0.15901495 0.00416916 -0.34364318
## B00967 -11.6301717 -1.30326451 3.017655449 -0.30973333 -1.92469016 1.41458437
## B02324 -0.8046590 -0.01081825 -0.879639431 0.07491067 0.32144074 0.80144561
## B02325 7.5551217 2.89752090 1.569931716 0.92478062 -1.79539180 0.03827322
## B02326 9.8686869 -0.59942129 1.101343048 -1.58314142 -0.58717843 0.20635082
## B02327 10.3753428 -1.00506352 0.275532442 0.83673049 -0.51541103 0.41986042
## B02328 -0.5407796 -0.23246630 -0.605346254 0.70861843 0.02803633 0.54027640
## B02330 -1.9985352 0.47338518 0.632968115 -0.72662617 1.47649873 -1.16558694
## B02332 8.4555324 -0.18017444 0.937438815 -2.40887623 1.50734607 -1.80905304
## B02333 -7.2620854 -5.71897751 -1.351973867 0.04137030 6.63500547 4.69172339
## B02334 10.4408237 -0.40484688 -0.015515606 -0.63301964 0.10972494 0.37354135
## B02336 -9.3458043 -2.55254634 3.649537972 2.02825766 0.05966928 -1.68729959
## B02337 10.1789225 -0.69498719 0.599144442 0.74383910 -0.08301452 -1.49134257
## B02338 9.7285199 1.65076063 0.506061598 1.96096778 -0.32609694 -0.72435955
## B02339 5.0247066 -2.86467985 -0.933884828 -3.19830838 -0.12888232 -0.26211352
## B02340 -13.1679403 -0.82541807 -0.371324639 1.84369972 0.28949073 -0.59943409
## B02341 11.1077420 -0.38194049 0.329872597 0.93599188 0.28331905 -0.54136935
## B02342 -13.4420910 0.18995887 -0.115734948 -1.92234276 0.36002048 -0.67996296
## B02343 -12.2280392 -0.45812945 2.453673532 -1.85219333 -1.84034905 -0.94883098
## B02344 3.1022715 2.37491766 -1.248722754 -0.12528335 -0.50333952 -0.31992513
## B02345 6.6454648 -1.76529646 1.452790538 -1.35556679 -0.78656777 -0.14496323
## B02346 -0.7214138 -0.43534528 0.642821882 0.36525499 0.72882842 0.45353279
## B02347 10.8956057 -0.96306648 0.043784020 0.51034767 0.14525501 0.08012840
## B02348 10.3536899 -0.55107344 0.236938533 -1.51602816 -0.68170319 -0.98383286
## B02350 10.1465229 -1.03863868 0.628411681 0.59845694 -0.53329346 -0.26070402
## B02351 -11.6737766 -3.01571893 3.113459582 1.67842288 -0.40459473 -0.71205767
## B02352 10.5192503 0.24333655 -0.855480232 -0.00959697 -0.27382563 -0.27618806
## B02353 -13.8200937 -0.26855541 0.535282898 0.82974715 -0.51613503 -2.38715990
## B02354 -13.1258916 -0.83065226 1.359122360 0.22480338 -0.30301395 -1.18700580
## B02355 7.2949202 0.84743100 2.690209833 0.34333361 1.17119164 -1.96034877
## B02358 -1.1320269 -1.58779461 -1.059196745 -0.60644404 3.16384502 2.80519271
## B02360 10.7096547 1.46079451 0.386187284 -0.62603057 -0.32036459 -0.76634149
## B02361 11.2793269 0.44764689 -0.538712122 0.60459402 -0.82637152 0.11591564
## B02363 9.5850921 0.64450609 0.608583639 -1.02032884 0.67236995 -2.43943492
## B02364 -12.6663694 -0.52879588 1.732019658 1.94501583 0.61105060 -0.44139388
## B02366 -12.8475564 0.45474341 -0.753098253 2.04283923 -2.67893926 0.03878572
## B02367 8.4454017 2.19881768 0.711245034 1.96056942 0.88080565 0.28299343
## B02368 -13.4400386 1.45294988 -1.061520367 -2.68049584 -0.55045407 -0.63187658
## B02371 -11.0407007 -0.69489139 1.277916457 1.80142225 -0.07106817 -1.06000266
## B02372 -12.8307563 1.62373969 -1.209948166 -3.44394031 0.34919651 3.99120167
## B02373 -12.5893635 -0.39104407 -0.732683157 2.62079365 -2.22098220 2.39149532
## B02374 9.9263617 -0.45051965 0.260786545 -1.52084922 0.10378903 -0.28335909
## B02375 -2.0804792 -0.88804714 0.232029830 -2.59259157 -0.67234854 -0.73215327
## B02376 11.0791617 -0.51930674 -0.755776609 0.47529201 -0.18364189 0.50012868
## B02377 4.8342666 2.06735002 2.213807035 0.48358614 0.63179105 1.45467543
## B02378 -12.9223376 0.32684623 -1.716686354 -0.79712248 0.66701259 -0.06850773
## B02379 10.2449700 0.09099517 -0.393105556 -1.05065505 -0.63417673 0.82562187
## B02380 -9.3271668 1.10011757 -3.744204240 -1.08992711 1.05896287 -0.28285023
## B02381 10.4604315 0.04749081 0.259154711 0.21087064 1.00975038 0.24169181
## B02382 9.3818619 1.97178496 0.349419324 0.69022667 1.78756058 -1.92425661
## B02383 8.1322156 -2.03222064 0.455772165 -0.53931731 -0.02748885 1.09600409
## B02385 11.4849676 0.38116300 0.366682111 0.52448333 0.02822068 -0.41311994
## B02386 -12.4405495 0.63271834 2.284077173 -0.49629929 -0.95676921 2.69655807
## B02387 -12.8140899 0.61643379 -0.774677200 1.01430109 -1.54700598 2.45908033
## B02388 -12.5451754 -0.13064932 -2.380962934 2.29890263 -2.77923573 -0.70163812
## B02389 -4.3934751 -2.86102327 -5.121268751 4.27747953 -0.66717726 1.07485282
## B02390 5.3033598 0.44447699 0.927741651 1.52216108 -2.61011009 2.32820910
## B02391 -13.4873632 0.43847685 0.088263720 -2.51209691 0.77176470 1.51841336
## B02392 10.5490774 -0.71596772 -0.803688722 0.12968666 0.74620655 -0.16229830
## B02393 10.3897878 -0.23676008 1.170193383 -1.07256253 -2.45146017 1.32768518
## B02394 -12.9289819 -0.64012268 -2.426538075 -0.26744380 -1.55456329 0.69186343
## B02395 -3.6029288 -0.16841090 -2.168169155 2.69306010 -2.69572340 2.37164889
## B02397 10.2856990 -1.13085448 0.278089877 -1.09245863 0.43911839 -1.06079427
## B02438 -8.8767099 1.42266263 -3.578359141 3.03758882 0.88892433 -2.06589662
## B02439 8.0361800 2.36636449 -0.235737790 1.68309080 0.14706543 -2.67710883
## B02440 -11.9916515 -0.55789702 0.699486661 -0.58258802 -0.33865175 1.58517831
## B02441 -13.5163301 0.87124231 0.205620667 -1.05525755 0.51979559 -0.24804308
## B02449 9.9336030 0.85328439 -0.871124816 -1.04725707 1.56161584 -1.13118002
## B02456 8.9512192 -0.40677911 1.025917073 -1.51534388 0.04378285 3.79235262
## B02458 -12.9318023 -0.10758884 -0.437676334 -3.18537929 0.80410692 1.42963788
## B02459 -12.8769497 1.38230759 1.013729068 0.40135281 2.11752444 0.89856800
## B02460 -13.1486649 0.28334259 -1.649397055 -2.23654184 1.94572144 -2.11751977
## B02461 -13.4995966 -1.12130441 -1.637221385 0.71028907 0.86547254 -1.45869725
## B02464 -6.3836093 4.24286848 1.382506899 0.90625947 2.94815010 0.20237111
## B02478 -13.4254553 -0.12585358 -1.665246324 0.53453278 -0.59097586 -4.34420807
## B02546 -13.2069200 0.06883742 -2.101297576 -1.11959735 0.82139376 0.58455534
## B02569 -1.0616067 0.54198736 0.761474755 -0.57440899 0.56906766 0.31937386
## B02578 -13.2269922 1.54253096 0.990095842 -0.95988972 1.65392834 -1.42112077
## B02588 -11.9824864 0.73024585 -2.360911428 -0.50318793 -0.64530318 -2.59227720
## B02594 -6.4346283 7.72232815 2.975873229 -1.25620014 -3.03783549 1.06099802
## B02609 -3.4897942 2.77160285 -0.088560250 1.96570899 -0.48571446 4.04862576
## B02620 0.5881329 5.61454477 1.323508376 3.47127078 7.10226959 1.66471175
## 25372 12.8671273 -0.70161146 -0.538358106 0.90970144 -0.04460935 0.50951424
## 25374 12.6569457 -0.34995206 -0.508968562 1.02116220 -0.44064615 0.04547833
## 25375 13.0643404 -0.76191569 -0.404770349 0.30082746 -0.23670223 0.04475815
## 25376 12.3840783 -0.74303768 -0.181827239 0.04861344 -0.66686156 -0.08632739
## 25377 12.7339018 -1.33698901 -0.744891454 0.47469370 -0.22185444 0.49540963
## 25379 11.8765177 -0.01917460 -1.197334335 0.39157691 0.69110925 0.43168115
## 25380 12.0080344 -0.63620816 0.161048844 1.04523883 -0.33523860 0.19864206
## 25381 11.1469932 -1.07394825 1.338354091 1.52124553 -0.88899922 -0.27353996
## 25382 12.9892527 -0.46045330 -0.186592472 1.00621368 -0.38603240 -0.03894558
## 25383 11.7792736 -0.93311418 1.231052530 0.55965154 -0.40130073 0.22271573
## PC7 PC8 pop missing
## B00908 3.45861205 -0.55167104 LOSTWOODS 0.06928937
## B00910 0.06443762 2.19043141 LOSTWOODS 0.05457581
## B00911 -0.17075155 -0.01867448 LOSTWOODS 0.03140979
## B00912 1.88783693 0.57390657 LOSTWOODS 0.06960242
## B00913 -0.86239486 1.70537774 LOSTWOODS 0.09767296
## B00914 -0.33715687 -1.25336339 LOSTWOODS 0.04309715
## B00915 -0.85333062 -3.79043696 LOSTWOODS 0.04038401
## B00916 -1.00591891 0.46193468 LOSTWOODS 0.12063028
## B00927 -1.79710079 0.21795328 EYEBROW LAKE 0.11791714
## B00928 -0.09851031 0.41285554 EYEBROW LAKE 0.04841908
## B00929 0.47386910 0.86193659 EYEBROW LAKE 0.03443598
## B00930 -0.87748955 -0.59731022 EYEBROW LAKE 0.04779297
## B00931 -2.06899113 0.99530373 EYEBROW LAKE 0.05436711
## B00932 -1.18684500 -0.51123147 LOSTWOODS 0.04487113
## B00934 1.26171739 0.76968427 CRANE 0.03767088
## B00935 0.75329606 0.05768677 CRANE 0.07513305
## B00936 1.06590293 -0.35805578 CRANE 0.27225295
## B00937 -0.84237320 0.46685656 CRANE 0.09506418
## B00938 -0.02802431 -0.40471688 CRANE 0.26776584
## B00939 2.13172802 0.25462646 CRANE 0.03902744
## B00940 0.26260766 -0.91033370 CRANE 0.15214442
## B00941 0.35059714 -0.67983022 CRANE 0.02410519
## B00942 2.05054207 0.32307973 CRANE 0.02723573
## B00943 -0.02958892 -1.00105322 CRANE 0.03078368
## B00944 0.98017136 -0.15118497 CRANE 0.07847229
## B00945 -0.29315321 0.38003757 EYEBROW LAKE 0.18584994
## B00946 0.69862223 -1.45498399 EYEBROW LAKE 0.04664510
## B00947 -0.61972268 -0.08632587 EYEBROW LAKE 0.06323698
## B00948 0.75869866 3.10892258 CHAPLIN 0.15110091
## B00949 0.84645791 4.48569297 EYEBROW LAKE 0.05228008
## B00950 0.10582408 -0.73400095 EYEBROW LAKE 0.29041010
## B00951 -0.42360554 0.44274737 CHAPLIN 0.03777523
## B00953 1.96311422 -0.08027672 CRANE 0.02441824
## B00954 -0.39869528 0.50635295 CRANE 0.02869665
## B00955 -0.18046706 -0.11561775 CHAPLIN 0.02817489
## B00956 -0.11522725 -0.70538999 EYEBROW LAKE 0.02953146
## B00957 1.75958852 0.70277182 CHAPLIN 0.03547949
## B00958 1.05053904 -1.14380829 EYEBROW LAKE 0.03422728
## B00959 -1.37268955 3.13582294 CRANE 0.06803715
## B00960 -1.10267291 -0.71894549 CRANE 0.03151414
## B00961 0.76321782 0.51645787 CHAPLIN 0.07711573
## B00962 -0.17732623 -1.07583712 EYEBROW LAKE 0.03339247
## B00963 0.61701475 -0.27450154 CRANE 0.02796619
## B00964 1.77278368 -0.30253343 EYEBROW LAKE 0.02880100
## B00965 0.20976526 0.95105080 CHAPLIN 0.19837212
## B00966 1.31585294 -0.72660156 EYEBROW LAKE 0.02608786
## B00967 -0.16919636 1.97406776 EYEBROW LAKE 0.18261505
## B02324 2.16291862 0.71947967 EYEBROW LAKE 0.08264635
## B02325 -1.49711501 -0.85004631 EYEBROW LAKE 0.06010644
## B02326 -0.86490380 -0.55578325 EYEBROW LAKE 0.02514870
## B02327 1.08712318 0.20576929 EYEBROW LAKE 0.09475112
## B02328 0.90987408 0.26055792 EYEBROW LAKE 0.04800167
## B02330 -0.92466836 1.16509854 EYEBROW LAKE 0.14817907
## B02332 -0.63908912 1.63681321 EYEBROW LAKE 0.08546384
## B02333 -1.28608889 -0.50862539 EYEBROW LAKE 0.03589690
## B02334 -0.55339621 0.88232333 EYEBROW LAKE 0.04330585
## B02336 0.40144628 -0.08259083 EYEBROW LAKE 0.30199311
## B02337 -0.07854440 -1.17896825 EYEBROW LAKE 0.05791506
## B02338 -2.11904667 1.65364367 EYEBROW LAKE 0.02400083
## B02339 1.08142934 -0.32483470 EYEBROW LAKE 0.18136283
## B02340 2.76171523 -1.35901338 EYEBROW LAKE 0.03130544
## B02341 -0.77328182 0.38942960 EYEBROW LAKE 0.02587916
## B02342 -0.15529905 1.59732280 EYEBROW LAKE 0.02942711
## B02343 3.41937572 2.77745113 EYEBROW LAKE 0.09141188
## B02344 0.24581734 0.17582215 EYEBROW LAKE 0.30439320
## B02345 -1.25116384 1.20269916 EYEBROW LAKE 0.05238443
## B02346 0.14734907 -0.77186797 EYEBROW LAKE 0.08139414
## B02347 0.40714485 0.67725301 EYEBROW LAKE 0.06073255
## B02348 -0.50229773 0.12480972 EYEBROW LAKE 0.02055724
## B02350 1.30497126 -0.55947183 EYEBROW LAKE 0.11436920
## B02351 0.88944483 -0.70490543 EYEBROW LAKE 0.17124074
## B02352 -0.56848696 -0.36115309 EYEBROW LAKE 0.09151623
## B02353 -0.80828085 -3.23943293 EYEBROW LAKE 0.03902744
## B02354 0.25188261 0.22442512 EYEBROW LAKE 0.09287280
## B02355 -1.87932175 0.21450870 EYEBROW LAKE 0.13523949
## B02358 -0.94265679 0.18385526 EYEBROW LAKE 0.03840134
## B02360 -0.97152230 0.34726089 EYEBROW LAKE 0.03819263
## B02361 0.59126252 -0.74815300 EYEBROW LAKE 0.02170510
## B02363 -1.44018500 -0.12160059 EYEBROW LAKE 0.03140979
## B02364 0.34682546 1.82069288 NICOLLE FLATS 0.07680267
## B02366 -1.52038666 1.66242329 NICOLLE FLATS 0.08400292
## B02367 -2.23192388 0.30826534 NICOLLE FLATS 0.01920067
## B02368 2.04739184 1.27140319 NICOLLE FLATS 0.04017531
## B02371 -1.03637653 -1.71971144 NICOLLE FLATS 0.24157362
## B02372 -0.36095004 0.75506171 NICOLLE FLATS 0.02660962
## B02373 4.53807205 -1.42515706 NICOLLE FLATS 0.06908066
## B02374 0.83797683 -0.05610051 NICOLLE FLATS 0.06083690
## B02375 -1.04700329 -1.16182551 NICOLLE FLATS 0.10017740
## B02376 -0.01370404 -0.48297929 NICOLLE FLATS 0.04768862
## B02377 -0.45297390 -0.14421425 NICOLLE FLATS 0.20087655
## B02378 -2.49928335 1.36755159 NICOLLE FLATS 0.03683606
## B02379 0.12177088 0.14531539 NICOLLE FLATS 0.08118543
## B02380 -0.36059914 -0.83935443 EYEBROW LAKE 0.23813002
## B02381 -0.10355830 0.43903016 EYEBROW LAKE 0.03673171
## B02382 -1.19009643 1.57794041 EYEBROW LAKE 0.03401857
## B02383 0.92765470 -0.13882695 EYEBROW LAKE 0.06501096
## B02385 -0.04308921 0.19693859 EYEBROW LAKE 0.02034853
## B02386 -2.70227237 -0.96084490 NICOLLE FLATS 0.06647188
## B02387 -1.14126280 -3.48780087 NICOLLE FLATS 0.04841908
## B02388 -3.19196274 3.50137073 NICOLLE FLATS 0.06375874
## B02389 0.41308522 2.14452916 NICOLLE FLATS 0.03464468
## B02390 -2.01545870 -2.01852576 NICOLLE FLATS 0.08807263
## B02391 0.27912227 -1.17805058 NICOLLE FLATS 0.02671397
## B02392 0.24914924 0.08559084 NICOLLE FLATS 0.01857456
## B02393 -0.09375208 -1.57224373 NICOLLE FLATS 0.03547949
## B02394 -3.01442143 -1.71425404 NICOLLE FLATS 0.02890535
## B02395 4.04487901 1.01717278 NICOLLE FLATS 0.16779714
## B02397 1.11292376 -0.14473368 EYEBROW LAKE 0.01575707
## B02438 1.64337170 0.54998494 NICOLLE FLATS 0.16351873
## B02439 1.79588912 -0.60069146 EYEBROW LAKE 0.01502661
## B02440 -1.86581980 2.10491182 EYEBROW LAKE 0.09579464
## B02441 2.03702151 1.70300972 EYEBROW LAKE 0.02013983
## B02449 0.15296519 -0.07659948 EYEBROW LAKE 0.02702703
## B02456 0.09941344 -0.54433233 EYEBROW LAKE 0.02869665
## B02458 1.39474405 -3.95283698 EYEBROW LAKE 0.02379213
## B02459 0.51253278 -0.73954460 EYEBROW LAKE 0.05895857
## B02460 0.43082659 -3.16066005 EYEBROW LAKE 0.02619222
## B02461 -1.59694291 -1.85474259 EYEBROW LAKE 0.05634979
## B02464 0.18250085 -2.51274796 EYEBROW LAKE 0.02900970
## B02478 -1.86009254 -0.32327510 NICOLLE FLATS 0.03151414
## B02546 -1.52679245 1.07204312 NICOLLE FLATS 0.05061046
## B02569 0.69583074 -0.20682633 EYEBROW LAKE 0.20567672
## B02578 -1.67855256 -2.24689842 EYEBROW LAKE 0.03777523
## B02588 1.83700260 0.10860787 EYEBROW LAKE 0.07763748
## B02594 1.64022410 -1.51084600 NICOLLE FLATS 0.02473130
## B02609 -0.31297119 0.35594573 EYEBROW LAKE 0.04674945
## B02620 0.45932411 2.75744863 EYEBROW LAKE 0.03193155
## 25372 -0.76187676 -0.10347088 NEBRASKA 0.02128770
## 25374 0.02307577 -0.08364745 NEBRASKA 0.03140979
## 25375 -1.07815699 -0.10621051 NEBRASKA 0.01523531
## 25376 -1.27527491 -0.10944859 NEBRASKA 0.04716686
## 25377 -0.47122245 -0.23103359 NEBRASKA 0.03297506
## 25379 0.14130286 -0.30930946 NEBRASKA 0.12292601
## 25380 -0.66212865 -0.01178673 NEBRASKA 0.05582803
## 25381 -0.89451189 -0.07022839 NEBRASKA 0.10821246
## 25382 -0.39424030 0.03112592 NEBRASKA 0.01533966
## 25383 -0.56519018 -0.09755304 NEBRASKA 0.08942920
assess_missing_data_pca(vcf.filt, popmap = popmap, clustering = FALSE)


## PC1 PC2 PC3 PC4 PC5
## B00908 -13.2169607 -0.53527282 0.291934204 -0.38552114 0.087896850
## B00910 -12.8269064 -0.41898102 0.463524878 -0.39824902 -1.499533614
## B00911 -13.2936794 0.27864193 -0.137801784 -0.35343738 -0.004840030
## B00912 -12.8552884 -0.15178830 1.189088753 -1.16736975 0.988264717
## B00913 -12.7382204 1.57179252 -2.146944930 -0.77659877 0.316834615
## B00914 -13.7270731 -0.58992598 -1.068459354 -1.12565929 0.586535908
## B00915 -12.6459383 -1.49269573 -0.492877190 2.77131922 -0.024724890
## B00916 -12.4280507 -0.48410696 1.895351663 1.77198548 -1.661103117
## B00927 -2.6411773 0.73516422 -1.081477098 -2.63579110 -2.033315422
## B00928 10.8066701 -0.17243485 -1.414822099 0.79364939 -0.414986622
## B00929 10.6729745 0.44972555 0.563040594 -1.50456285 -0.457527129
## B00930 -12.9505813 0.32426790 -1.480602546 -0.27804803 -0.411924669
## B00931 7.9281920 -0.76172272 0.422430750 -3.16204392 -0.703200358
## B00932 -12.9125989 0.14716056 -0.934464074 -0.38256826 -0.290996941
## B00934 10.8223529 0.38423246 -0.610403298 0.18241020 0.940651840
## B00935 11.0503374 0.40304598 -0.845867164 -0.33579623 0.293330984
## B00936 8.7894666 0.97072749 -2.881347461 -0.46274180 0.090075792
## B00937 10.4870184 -0.11373257 -0.262112329 -0.52787297 -0.086907941
## B00938 8.6255774 0.22224038 -2.464318086 -1.02446755 0.780829153
## B00939 10.7734012 -0.28178848 -0.352047452 -0.28659190 0.236132356
## B00940 9.1884637 0.25773195 -1.391738491 -0.39670806 -0.360781609
## B00941 11.4248230 0.78324243 -0.198910931 0.45550169 0.188597318
## B00942 9.8659894 0.81518244 -0.842351822 -0.18132241 -1.660422598
## B00943 11.5015305 0.50119664 0.330631019 0.48153878 0.821653645
## B00944 11.1531934 0.17783540 -0.261018948 -0.08487324 0.442486356
## B00945 -9.1952266 -1.59157217 2.668887288 1.62332602 1.393743745
## B00946 -13.2431753 -1.46017760 -0.065867651 0.75496611 -1.478644809
## B00947 -12.9746830 -0.70867653 0.725660409 1.58732347 1.274568996
## B00948 -11.9767377 -1.53329005 3.487684337 -1.37321468 -0.039317148
## B00949 -13.0606431 -0.04004573 -0.274854524 -1.03590753 -0.271464872
## B00950 -10.1014392 -1.93999727 2.689126235 1.24233143 0.343954636
## B00951 -12.8882612 1.01730445 -0.252470340 1.06666428 -0.190163043
## B00953 11.0874187 -0.69457442 -0.617039368 -0.32172107 -0.261204087
## B00954 11.2179217 -0.02527704 -0.041681524 0.35951797 0.114645356
## B00955 11.4583235 0.29576907 0.122373470 -0.09262047 -0.048184239
## B00956 10.4275382 -0.56123772 -0.826196108 0.04311092 -2.045101854
## B00957 8.7759486 -0.15863235 0.027373191 0.45512197 2.507792196
## B00958 -13.8254958 0.43550163 0.382467778 -1.19502446 0.661344685
## B00959 -12.2424502 1.11382012 -2.569201047 -1.01923905 -1.197652966
## B00960 11.2866559 0.04238579 0.134964774 -0.32003274 -1.754819928
## B00961 8.2878006 -2.81518835 0.724944158 -1.81674150 1.259710166
## B00962 -1.2431578 0.64259660 1.109428204 -1.00289033 -1.063318924
## B00963 11.5247884 -0.33893684 -0.030000047 0.80672594 0.134434385
## B00964 10.0456407 0.56846448 0.607112207 -0.73410337 -0.706042210
## B00965 -11.3898033 -2.11430441 3.571609945 0.70835695 -0.071194509
## B00966 11.2663610 0.04637020 -0.432062352 0.16234163 -0.006464431
## B00967 -11.6292143 -1.41221494 2.921821887 -0.38067783 -1.865023223
## B02324 -0.8055362 0.02790476 -0.894867969 0.10109438 0.288485693
## B02325 7.5523872 2.80390945 1.693740512 0.82956956 -1.765117598
## B02326 9.8662964 -0.64331319 1.065066270 -1.62252830 -0.535338314
## B02327 10.3729931 -1.00830152 0.235119589 0.84006841 -0.552948334
## B02328 -0.5417420 -0.20348817 -0.625566201 0.74803416 -0.006680060
## B02330 -1.9990203 0.45033655 0.654339905 -0.72579840 1.488350524
## B02332 8.4528827 -0.22055985 0.906308301 -2.41840093 1.581854707
## B02333 -7.2623002 -5.70432579 -1.673920385 0.29959456 6.623716161
## B02334 10.4376996 -0.39378159 -0.032681583 -0.62245209 0.131648728
## B02336 -9.3457447 -2.67472422 3.562116623 2.01221426 -0.022970126
## B02337 10.1774015 -0.70964218 0.581120423 0.72631513 -0.097703998
## B02338 9.7251871 1.62933643 0.605390951 1.91881880 -0.350056422
## B02339 5.0238414 -2.86387562 -1.115053106 -3.23489401 -0.056094948
## B02340 -13.1647427 -0.77557342 -0.412969010 1.79364360 0.187856905
## B02341 11.1051939 -0.38505740 0.331316539 0.95667059 0.261931785
## B02342 -13.4385333 0.18885382 -0.134891786 -1.85718611 0.386067143
## B02343 -12.2262585 -0.52842155 2.374465108 -1.92378171 -1.746719415
## B02344 3.1015059 2.44661128 -1.152244390 -0.12105543 -0.507019088
## B02345 6.6440980 -1.82754603 1.383819139 -1.42310034 -0.759795961
## B02346 -0.7221602 -0.44747985 0.604332567 0.37312996 0.704735348
## B02347 10.8934602 -0.95639174 0.003168814 0.52967187 0.125860456
## B02348 10.3520484 -0.56164177 0.214554080 -1.57526330 -0.623514514
## B02350 10.1439641 -1.04790228 0.581933373 0.60709853 -0.558312852
## B02351 -11.6735125 -3.13058091 2.955862494 1.68499201 -0.511097709
## B02352 10.5177275 0.28472742 -0.847939504 -0.01440251 -0.277976613
## B02353 -13.8161951 -0.25591230 0.530803574 0.79176618 -0.532985731
## B02354 -13.1237422 -0.85571235 1.288020603 0.21637886 -0.330239549
## B02355 7.2941227 0.74744261 2.787762925 0.33734005 1.225048605
## B02358 -1.1329022 -1.57115560 -1.171068907 -0.46490916 3.200190785
## B02360 10.7081973 1.45897800 0.468174541 -0.65772922 -0.272172369
## B02361 11.2764512 0.47180137 -0.520821951 0.58401127 -0.830418660
## B02363 9.5829385 0.62524675 0.644155438 -1.05220408 0.725743736
## B02364 -12.6634630 -0.56997113 1.665663442 1.85652836 0.541324634
## B02366 -12.8442084 0.50108125 -0.675342121 1.88351643 -2.588626457
## B02367 8.4424160 2.14789621 0.832587771 1.96255330 0.860472314
## B02368 -13.4371650 1.46799796 -0.988198879 -2.63773426 -0.414188777
## B02371 -11.0382357 -0.71922378 1.234162964 1.74289499 -0.118794169
## B02372 -12.8265012 1.59538597 -1.148531203 -3.23720331 0.463289768
## B02373 -12.5843442 -0.33482810 -0.743947982 2.43062841 -2.221162528
## B02374 9.9240398 -0.46573831 0.233790969 -1.55168397 0.151087288
## B02375 -2.0808667 -0.88085704 0.171299783 -2.57312000 -0.604624558
## B02376 11.0752098 -0.48211926 -0.767619191 0.47702432 -0.210052885
## B02377 4.8337943 2.00867640 2.363467429 0.46756107 0.682649364
## B02378 -12.9172734 0.38365903 -1.596027885 -0.77400496 0.691105857
## B02379 10.2424376 0.10989804 -0.390412382 -1.07451836 -0.592426473
## B02380 -9.3265039 1.24941896 -3.696759855 -1.00470449 1.036583701
## B02381 10.4576403 0.03112008 0.269283285 0.21871017 1.014852388
## B02382 9.3803203 1.98146884 0.467854412 0.71800922 1.787025520
## B02383 8.1306258 -2.05677796 0.366805955 -0.54912643 0.013961569
## B02385 11.4841950 0.37217615 0.399779924 0.52195332 0.031653537
## B02386 -12.4351209 0.49916003 2.120783219 -0.51188475 -0.827033114
## B02387 -12.8099329 0.62805371 -0.749360197 0.97842576 -1.525293820
## B02388 -12.5427753 -0.00143434 -2.270310991 2.16398849 -2.757445669
## B02389 -4.3930532 -2.56618183 -5.054202807 4.21533045 -0.824462727
## B02390 5.3019133 0.40775283 0.954219241 1.46322778 -2.665353702
## B02391 -13.4815999 0.41782596 0.072941866 -2.30781833 0.774892308
## B02392 10.5464212 -0.67541016 -0.820239431 0.15607704 0.751027219
## B02393 10.3885209 -0.27728428 1.159714772 -1.15194191 -2.443631295
## B02394 -12.9254073 -0.51386283 -2.368600833 -0.23295365 -1.494548870
## B02395 -3.6040605 -0.06544503 -2.230638439 2.70276230 -2.887219016
## B02397 10.2839310 -1.14126055 0.208843115 -1.08327169 0.455293474
## B02438 -8.8754925 1.55816510 -3.416454357 3.03877306 0.771283336
## B02439 8.0341993 2.38996455 -0.111016388 1.69698818 0.099329141
## B02440 -11.9887683 -0.56339217 0.644751260 -0.58034926 -0.259435470
## B02441 -13.5141583 0.85243262 0.222066966 -1.01433527 0.553878291
## B02449 9.9315681 0.88076649 -0.832978623 -1.00265459 1.603452020
## B02456 8.9495216 -0.47126019 0.963713442 -1.50362052 0.071347999
## B02458 -12.9263294 -0.10509595 -0.476494053 -2.92354651 0.828423861
## B02459 -12.8737937 1.30777935 1.031070953 0.41843948 2.067524062
## B02460 -13.1454154 0.34466891 -1.626184266 -2.11545640 1.897183264
## B02461 -13.4940125 -0.99014320 -1.594607001 0.72372974 0.812101849
## B02464 -6.3820762 4.02445607 1.474146340 0.87942816 2.790182185
## B02478 -13.4201870 -0.02542005 -1.544221956 0.44511067 -0.537703519
## B02546 -13.2049484 0.15260904 -2.091567553 -1.07268419 0.826197016
## B02569 -1.0624893 0.51049211 0.765564393 -0.56966801 0.584936653
## B02578 -13.2211858 1.43280206 0.985680061 -0.85044348 1.555254318
## B02588 -11.9803402 0.82796869 -2.278775324 -0.54016928 -0.626485410
## B02594 -6.4339322 7.46197354 3.243278201 -1.40446601 -2.840417018
## B02609 -3.4895464 2.69749200 0.031421309 1.91774812 -0.479688774
## B02620 0.5870079 5.48080256 1.567593795 3.57857532 6.948882081
## 25372 12.8649363 -0.68177976 -0.558450781 0.93842811 -0.071577223
## 25374 12.6550049 -0.32715356 -0.520776664 1.04286417 -0.483031668
## 25375 13.0633850 -0.74865245 -0.430856445 0.33246692 -0.253399198
## 25376 12.3825940 -0.73274435 -0.208585646 0.04884181 -0.675355003
## 25377 12.7321327 -1.31211319 -0.800279671 0.50999425 -0.248198003
## 25379 11.8745262 0.02405736 -1.199258661 0.43768096 0.663790279
## 25380 12.0071129 -0.64064033 0.152699871 1.06158193 -0.370521338
## 25381 11.1461183 -1.12480651 1.325527827 1.51080165 -0.932704001
## 25382 12.9883333 -0.45116376 -0.192853478 1.02820372 -0.420284983
## 25383 11.7776495 -0.98082826 1.212775796 0.55801064 -0.404270462
## PC6 PC7 PC8 pop missing
## B00908 -0.513739798 3.21256770 1.155280079 LOSTWOODS 0.07124011
## B00910 0.755827852 0.11001076 -2.079636293 LOSTWOODS 0.05199441
## B00911 0.503345517 -0.11952199 0.096327642 LOSTWOODS 0.03414558
## B00912 -0.299706009 1.84480006 -0.270057242 LOSTWOODS 0.06953283
## B00913 -0.473510580 -0.71706943 -2.264652561 LOSTWOODS 0.10321279
## B00914 -0.910237834 -0.53756562 1.303676460 LOSTWOODS 0.04578612
## B00915 -1.620506657 -1.16703941 3.877915885 LOSTWOODS 0.04081949
## B00916 0.926543912 -0.92093090 -0.674820053 LOSTWOODS 0.11268043
## B00927 1.401062707 -1.89033597 -0.171626768 EYEBROW LAKE 0.12090641
## B00928 -1.373255290 -0.09375641 -0.457777205 EYEBROW LAKE 0.04718299
## B00929 0.363325576 0.50273263 -0.735640039 EYEBROW LAKE 0.03771535
## B00930 -1.185294218 -0.84475591 0.451606528 EYEBROW LAKE 0.05121838
## B00931 0.762746146 -2.16247195 -0.710999376 EYEBROW LAKE 0.05509856
## B00932 -1.091949370 -1.28022550 0.543528631 LOSTWOODS 0.04640695
## B00934 -0.180798646 1.35868057 -0.767238100 CRANE 0.04376843
## B00935 1.510062492 0.87158123 -0.153996555 CRANE 0.07217135
## B00936 -0.053396964 1.19330602 0.142841245 CRANE 0.26959491
## B00937 -0.111596453 -0.86604897 -0.557991236 CRANE 0.08831290
## B00938 -0.163623607 -0.02989341 0.373016819 CRANE 0.25935123
## B00939 -0.526969538 2.18384164 -0.202370052 CRANE 0.03662890
## B00940 1.011961628 0.27765442 0.747546761 CRANE 0.14465311
## B00941 0.098936452 0.37557226 0.638576189 CRANE 0.02390191
## B00942 1.264562155 2.16035015 -0.249385582 CRANE 0.03057582
## B00943 -0.638693202 -0.10834063 1.092983583 CRANE 0.03228310
## B00944 -0.397023791 1.02327915 0.120230945 CRANE 0.07729319
## B00945 -0.841023456 -0.21903414 -0.722046372 EYEBROW LAKE 0.18267888
## B00946 0.067399532 0.62516534 1.824238671 EYEBROW LAKE 0.04563092
## B00947 1.424629743 -0.49775288 -0.175193773 EYEBROW LAKE 0.06410057
## B00948 -0.424242062 0.93084013 -3.015407311 CHAPLIN 0.14775726
## B00949 0.264757397 0.89207510 -4.197407282 EYEBROW LAKE 0.05168400
## B00950 -0.822609439 0.07170255 0.892966326 EYEBROW LAKE 0.29054788
## B00951 1.083112310 -0.40649737 -0.310568342 CHAPLIN 0.03973304
## B00953 -1.372291371 2.02632229 0.064473660 CRANE 0.02560919
## B00954 -0.390423548 -0.41945229 -0.492112857 CRANE 0.03073103
## B00955 -0.165906351 -0.14589694 0.038578534 CHAPLIN 0.02840292
## B00956 1.279103108 -0.15271781 0.759563210 EYEBROW LAKE 0.02824771
## B00957 0.059818395 1.77854811 -0.632486474 CHAPLIN 0.03367996
## B00958 -0.916982024 0.93166548 0.832850862 EYEBROW LAKE 0.03476641
## B00959 -2.042740335 -1.09098392 -3.397212768 CRANE 0.07465466
## B00960 0.656381103 -1.16195078 0.726537038 CRANE 0.03290393
## B00961 -1.443567195 0.77705080 -0.436895542 CHAPLIN 0.07993171
## B00962 -0.443294292 -0.21392608 1.075846411 EYEBROW LAKE 0.03569766
## B00963 -0.592124064 0.61131502 0.199263899 CRANE 0.02747167
## B00964 -1.434798104 1.90399925 0.292698291 EYEBROW LAKE 0.03026540
## B00965 -0.085593527 0.29382169 -1.083648786 CHAPLIN 0.19509545
## B00966 -0.371647313 1.28816879 0.776952976 EYEBROW LAKE 0.02545398
## B00967 1.384914646 0.04980523 -2.249187064 EYEBROW LAKE 0.17771225
## B02324 0.780069180 2.24011253 -0.626232819 EYEBROW LAKE 0.08132857
## B02325 0.138475114 -1.55155745 0.854932339 EYEBROW LAKE 0.06115164
## B02326 0.296120587 -0.95350644 0.559943611 EYEBROW LAKE 0.02685085
## B02327 0.391559742 1.16379018 -0.158757430 EYEBROW LAKE 0.09762533
## B02328 0.572481234 0.93188661 -0.082512323 EYEBROW LAKE 0.04671737
## B02330 -1.104389514 -0.91659592 -1.169356863 EYEBROW LAKE 0.15334472
## B02332 -1.753902209 -0.62487808 -1.642527845 EYEBROW LAKE 0.08086295
## B02333 4.740847420 -1.16060618 0.602084582 EYEBROW LAKE 0.03647369
## B02334 0.421740457 -0.55558671 -0.800122179 EYEBROW LAKE 0.04578612
## B02336 -1.745157300 0.35611932 0.210836111 EYEBROW LAKE 0.29846345
## B02337 -1.563050742 -0.12099151 1.129911051 EYEBROW LAKE 0.06006519
## B02338 -0.667537181 -2.05638895 -1.681878334 EYEBROW LAKE 0.02374670
## B02339 -0.384256060 1.16608045 0.174402302 EYEBROW LAKE 0.17491852
## B02340 -0.632846521 2.47437369 1.514611168 EYEBROW LAKE 0.03305913
## B02341 -0.544056952 -0.74019453 -0.414039698 EYEBROW LAKE 0.02654043
## B02342 -0.656163136 -0.13670322 -1.510844219 EYEBROW LAKE 0.02933416
## B02343 -0.928999505 3.41078425 -2.463824275 EYEBROW LAKE 0.08815769
## B02344 -0.390036352 0.23887517 -0.245730422 EYEBROW LAKE 0.30265404
## B02345 -0.117677694 -1.37713590 -1.307147587 EYEBROW LAKE 0.05354648
## B02346 0.518326500 0.05983100 0.886401424 EYEBROW LAKE 0.07946609
## B02347 0.056924476 0.45419385 -0.671751175 EYEBROW LAKE 0.06347975
## B02348 -0.997794366 -0.53372435 -0.156328518 EYEBROW LAKE 0.02141859
## B02350 -0.271424588 1.27236623 0.666696448 EYEBROW LAKE 0.11547416
## B02351 -0.802721501 0.98685302 0.560050576 EYEBROW LAKE 0.16560608
## B02352 -0.328354928 -0.60380023 0.250275028 EYEBROW LAKE 0.08489834
## B02353 -2.242307488 -1.08323588 3.273413378 EYEBROW LAKE 0.03538724
## B02354 -1.146380989 0.27309696 -0.138648457 EYEBROW LAKE 0.08908893
## B02355 -1.922606595 -1.96464257 -0.247437137 EYEBROW LAKE 0.14356666
## B02358 2.899627684 -0.82269796 0.007669158 EYEBROW LAKE 0.04578612
## B02360 -0.755147113 -1.00664008 -0.378970056 EYEBROW LAKE 0.04004346
## B02361 0.042871887 0.63047497 0.632547816 EYEBROW LAKE 0.02312587
## B02363 -2.437163613 -1.48475695 -0.010146689 EYEBROW LAKE 0.03290393
## B02364 -0.346747277 0.42839313 -1.574846965 NICOLLE FLATS 0.08070774
## B02366 -0.008433307 -1.38276633 -1.892329456 NICOLLE FLATS 0.08551917
## B02367 0.325733514 -2.20720818 -0.276302065 NICOLLE FLATS 0.02234984
## B02368 -0.537548397 2.01530002 -0.876246002 NICOLLE FLATS 0.04361322
## B02371 -1.035946178 -1.03458282 1.471807550 NICOLLE FLATS 0.24072637
## B02372 3.706850902 -0.10608946 -0.960900277 NICOLLE FLATS 0.03119665
## B02373 2.065598040 4.19865970 1.250148708 NICOLLE FLATS 0.06875679
## B02374 -0.247667652 0.79656432 0.115029446 NICOLLE FLATS 0.06285892
## B02375 -0.710006502 -1.05502083 1.040544025 NICOLLE FLATS 0.10197113
## B02376 0.517263092 -0.03489924 0.500394500 NICOLLE FLATS 0.04764861
## B02377 1.656665977 -0.54205304 0.399743656 NICOLLE FLATS 0.21185783
## B02378 0.089008719 -2.39724788 -1.121396682 NICOLLE FLATS 0.03724973
## B02379 0.874069552 0.10426401 -0.037485017 NICOLLE FLATS 0.08039733
## B02380 -0.312352072 -0.50844189 0.915152218 EYEBROW LAKE 0.25128046
## B02381 0.295122735 -0.02867748 -0.374230242 EYEBROW LAKE 0.03771535
## B02382 -1.931676670 -1.18439700 -1.623518199 EYEBROW LAKE 0.03321434
## B02383 1.123293237 0.92422041 0.246422115 EYEBROW LAKE 0.07030886
## B02385 -0.394909688 -0.03452945 -0.109035865 EYEBROW LAKE 0.02157380
## B02386 2.418151687 -2.19283263 0.311241200 NICOLLE FLATS 0.06984324
## B02387 2.335022553 -1.16113811 3.155521152 NICOLLE FLATS 0.05106317
## B02388 -0.631162481 -3.14818479 -3.559597987 NICOLLE FLATS 0.06410057
## B02389 0.923435011 0.38308967 -2.096775358 NICOLLE FLATS 0.04128512
## B02390 2.407077269 -2.10584161 1.732815104 NICOLLE FLATS 0.09560764
## B02391 1.474434508 0.20424075 1.333926504 NICOLLE FLATS 0.02793730
## B02392 -0.207356270 0.26811745 -0.070862546 NICOLLE FLATS 0.02157380
## B02393 1.486442393 -0.20015387 1.783947463 NICOLLE FLATS 0.03740494
## B02394 0.658711744 -2.98897159 1.408535369 NICOLLE FLATS 0.03228310
## B02395 2.271372113 4.21216210 -1.012344040 NICOLLE FLATS 0.17786745
## B02397 -1.165204090 1.14997774 0.104265115 EYEBROW LAKE 0.01598634
## B02438 -2.109329699 1.48456195 -0.348515084 NICOLLE FLATS 0.17569455
## B02439 -2.792649842 1.78336136 0.622348953 EYEBROW LAKE 0.01660717
## B02440 1.420741173 -1.58215245 -2.247828926 EYEBROW LAKE 0.10135030
## B02441 -0.386912849 2.13141517 -1.628645190 EYEBROW LAKE 0.02281546
## B02449 -1.138175556 0.17028057 0.084618050 EYEBROW LAKE 0.02731647
## B02456 3.932960978 0.13224441 0.629134143 EYEBROW LAKE 0.02964458
## B02458 1.240353841 1.17429018 3.565915997 EYEBROW LAKE 0.02638522
## B02459 0.950609678 0.42154665 1.049465326 EYEBROW LAKE 0.06161726
## B02460 -1.993832122 0.14176556 3.443101930 EYEBROW LAKE 0.02824771
## B02461 -1.306596775 -1.54942370 1.881919602 EYEBROW LAKE 0.05602980
## B02464 0.050025090 0.22525820 1.723074230 EYEBROW LAKE 0.03259351
## B02478 -3.982437413 -1.82634669 0.459616719 NICOLLE FLATS 0.03600807
## B02546 0.507045485 -1.54903805 -1.214644988 NICOLLE FLATS 0.05525376
## B02569 0.265408405 0.70878530 0.157636891 EYEBROW LAKE 0.21697967
## B02578 -1.247540593 -1.60869585 2.066053159 EYEBROW LAKE 0.03787056
## B02588 -2.567546064 1.62913217 -0.069009486 EYEBROW LAKE 0.08381189
## B02594 1.336831867 1.48220908 1.970777435 NICOLLE FLATS 0.02886854
## B02609 4.004360367 -0.26767341 -0.095262502 EYEBROW LAKE 0.05385690
## B02620 1.708681246 0.64616695 -2.524575278 EYEBROW LAKE 0.03197268
## 25372 0.515930199 -0.79921431 0.066411252 NEBRASKA 0.02002173
## 25374 -0.002409271 0.01392823 0.001231694 NEBRASKA 0.03104144
## 25375 0.042004330 -1.12123005 0.019271272 NEBRASKA 0.01645196
## 25376 -0.059533039 -1.34730675 0.038791273 NEBRASKA 0.04951110
## 25377 0.471917703 -0.49388021 0.137244651 NEBRASKA 0.03399038
## 25379 0.431882436 0.09996172 0.324617473 NEBRASKA 0.12059600
## 25380 0.214697187 -0.71439781 -0.035276916 NEBRASKA 0.06084122
## 25381 -0.245805780 -0.94672561 0.014071841 NEBRASKA 0.11330126
## 25382 -0.038548836 -0.42051516 -0.070579057 NEBRASKA 0.01552072
## 25383 0.280609824 -0.60414392 0.158750135 NEBRASKA 0.09126183
#mac filter seems to make no difference, so we will ignore it for now.
plot quality heatmaps
#plot depth per snp and per sample
dp <- extract.gt(vcf.filt, element = "DP", as.numeric=TRUE)
heatmap.bp(dp, rlabels = FALSE)

#plot genotype quality per snp and per sample
gq <- extract.gt(vcf.filt, element = "GQ", as.numeric=TRUE)
heatmap.bp(gq, rlabels = FALSE)

We can filter for linkage (one SNP per locus) and use the convenient
function ‘write.vcf’ from vcfR to export our filtered vcf file for
downstream analyses
#final filetered vcf stats
vcfR
## ***** Object of Class vcfR *****
## 137 samples
## 3087 CHROMs
## 9,583 variants
## Object size: 101.3 Mb
## 7.285 percent missing data
## ***** ***** *****
#write out the filtered vcf file
#write.vcf(vcfR, file = "~/Desktop/marsh.wren.rad/filtered.vcf.gz")
#filter to one SNP per locus to get an unlinked dataset
unlinked.vcf<-distance_thin(vcfR, min.distance = 10000)
##
|
| | 0%
|
| | 1%
|
|= | 1%
|
|= | 2%
|
|== | 2%
|
|== | 3%
|
|== | 4%
|
|=== | 4%
|
|=== | 5%
|
|==== | 5%
|
|==== | 6%
|
|===== | 6%
|
|===== | 7%
|
|===== | 8%
|
|====== | 8%
|
|====== | 9%
|
|======= | 9%
|
|======= | 10%
|
|======= | 11%
|
|======== | 11%
|
|======== | 12%
|
|========= | 12%
|
|========= | 13%
|
|========= | 14%
|
|========== | 14%
|
|========== | 15%
|
|=========== | 15%
|
|=========== | 16%
|
|============ | 16%
|
|============ | 17%
|
|============ | 18%
|
|============= | 18%
|
|============= | 19%
|
|============== | 19%
|
|============== | 20%
|
|============== | 21%
|
|=============== | 21%
|
|=============== | 22%
|
|================ | 22%
|
|================ | 23%
|
|================ | 24%
|
|================= | 24%
|
|================= | 25%
|
|================== | 25%
|
|================== | 26%
|
|=================== | 26%
|
|=================== | 27%
|
|=================== | 28%
|
|==================== | 28%
|
|==================== | 29%
|
|===================== | 29%
|
|===================== | 30%
|
|===================== | 31%
|
|====================== | 31%
|
|====================== | 32%
|
|======================= | 32%
|
|======================= | 33%
|
|======================= | 34%
|
|======================== | 34%
|
|======================== | 35%
|
|========================= | 35%
|
|========================= | 36%
|
|========================== | 36%
|
|========================== | 37%
|
|========================== | 38%
|
|=========================== | 38%
|
|=========================== | 39%
|
|============================ | 39%
|
|============================ | 40%
|
|============================ | 41%
|
|============================= | 41%
|
|============================= | 42%
|
|============================== | 42%
|
|============================== | 43%
|
|============================== | 44%
|
|=============================== | 44%
|
|=============================== | 45%
|
|================================ | 45%
|
|================================ | 46%
|
|================================= | 46%
|
|================================= | 47%
|
|================================= | 48%
|
|================================== | 48%
|
|================================== | 49%
|
|=================================== | 49%
|
|=================================== | 50%
|
|=================================== | 51%
|
|==================================== | 51%
|
|==================================== | 52%
|
|===================================== | 52%
|
|===================================== | 53%
|
|===================================== | 54%
|
|====================================== | 54%
|
|====================================== | 55%
|
|======================================= | 55%
|
|======================================= | 56%
|
|======================================== | 56%
|
|======================================== | 57%
|
|======================================== | 58%
|
|========================================= | 58%
|
|========================================= | 59%
|
|========================================== | 59%
|
|========================================== | 60%
|
|========================================== | 61%
|
|=========================================== | 61%
|
|=========================================== | 62%
|
|============================================ | 62%
|
|============================================ | 63%
|
|============================================ | 64%
|
|============================================= | 64%
|
|============================================= | 65%
|
|============================================== | 65%
|
|============================================== | 66%
|
|=============================================== | 66%
|
|=============================================== | 67%
|
|=============================================== | 68%
|
|================================================ | 68%
|
|================================================ | 69%
|
|================================================= | 69%
|
|================================================= | 70%
|
|================================================= | 71%
|
|================================================== | 71%
|
|================================================== | 72%
|
|=================================================== | 72%
|
|=================================================== | 73%
|
|=================================================== | 74%
|
|==================================================== | 74%
|
|==================================================== | 75%
|
|===================================================== | 75%
|
|===================================================== | 76%
|
|====================================================== | 76%
|
|====================================================== | 77%
|
|====================================================== | 78%
|
|======================================================= | 78%
|
|======================================================= | 79%
|
|======================================================== | 79%
|
|======================================================== | 80%
|
|======================================================== | 81%
|
|========================================================= | 81%
|
|========================================================= | 82%
|
|========================================================== | 82%
|
|========================================================== | 83%
|
|========================================================== | 84%
|
|=========================================================== | 84%
|
|=========================================================== | 85%
|
|============================================================ | 85%
|
|============================================================ | 86%
|
|============================================================= | 86%
|
|============================================================= | 87%
|
|============================================================= | 88%
|
|============================================================== | 88%
|
|============================================================== | 89%
|
|=============================================================== | 89%
|
|=============================================================== | 90%
|
|=============================================================== | 91%
|
|================================================================ | 91%
|
|================================================================ | 92%
|
|================================================================= | 92%
|
|================================================================= | 93%
|
|================================================================= | 94%
|
|================================================================== | 94%
|
|================================================================== | 95%
|
|=================================================================== | 95%
|
|=================================================================== | 96%
|
|==================================================================== | 96%
|
|==================================================================== | 97%
|
|==================================================================== | 98%
|
|===================================================================== | 98%
|
|===================================================================== | 99%
|
|======================================================================| 99%
|
|======================================================================| 100%
## 3087 out of 9583 input SNPs were not located within 10000 base-pairs of another SNP and were retained despite filtering
#final filetered, unlinked vcf stats
unlinked.vcf
## ***** Object of Class vcfR *****
## 137 samples
## 3087 CHROMs
## 3,087 variants
## Object size: 32.3 Mb
## 7.789 percent missing data
## ***** ***** *****
#write out vcf file of unlinked SNPs
#write.vcf(unlinked.vcf, file = "~/Desktop/marsh.wren.rad/unlinked.filtered.vcf.gz")