Zosterops splitstree

1 Read in filtered SNP data

#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
vcfR <- read.vcfR("~/Desktop/cali.zosterops.rad/filtered.snps.vcf.gz")

2 Convert vcfR to genlight

If needed, fix sample names to fit under 10 characters (a requirement of SplitsTree!)

#convert each to genlight
gen<-vcfR2genlight(vcfR)
#assign populations (a StaMPP requirement)
gen@pop<-as.factor(gen@ind.names)

3 Calculate pairwise divergence and write out matrix

#generate pairwise divergence matrix
sample.div <- stamppNeisD(gen, pop = FALSE)
#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
knitr::include_graphics(c("/Users/devder/Desktop/cali.zosterops.rad/phylogenetic.network.png"))