#load libraries
library(vcfR) #v1.14.0
library(ggplot2) #v3.4.1
library(adegenet) #v2.1.10
library(SNPfiltR) #v1.0.1
library(StAMPP) #v1.6.3
#read in vcf
<- read.vcfR("~/Desktop/cali.zosterops.rad/filtered.snps.vcf.gz") vcfR
Zosterops splitstree
1 Read in filtered SNP data
2 Convert vcfR to genlight
If needed, fix sample names to fit under 10 characters (a requirement of SplitsTree!)
#convert each to genlight
<-vcfR2genlight(vcfR)
gen#assign populations (a StaMPP requirement)
@pop<-as.factor(gen@ind.names) gen
3 Calculate pairwise divergence and write out matrix
#generate pairwise divergence matrix
<- stamppNeisD(gen, pop = FALSE)
sample.div #export for splitstree
#stamppPhylip(distance.mat=sample.div, file="~/Desktop/cali.zosterops.rad/90.filtered.splits.txt")
Open the matrix in splitstree and visualize your results. Manipulate tip colors and clean up the visualization
4 Show the final product
#visualize splitstree
::include_graphics(c("/Users/devder/Desktop/cali.zosterops.rad/phylogenetic.network.png")) knitr