Hi,
I want to calculate P values for pairwise Fst estimates among populations for my RADseq SNP dataset. I have been trying to use the R package StAMPP. The accepted input formats are .stampp, .vcf, .csv and an R genlight object. See: https://cran.r-project.org/web/packages/StAMPP/StAMPP.pdf
The problem I have is that .vcf and genlight objects do not seem to contain a population column for individuals, but this is required by StaMPP to estimate allele frequencies (and then Fst estimates).
Is there a way to include population information in a vcf file or genlight object?
Alternatively, is there an easy way to produce a .stampp file? The format is hard to reproduce manually with a dataset of tens of thousands of SNPs.
Packages
{r}
#LOAD LIBRARIES
library(pinfsc50)
library(vcfR)
library(adegenet)
library(StAMPP)
Method 1
##1.1 Read fstat .dat into R and convert to genind object
genind<-read.fstat("f002-p3-r90-m10.dat", quiet=FALSE)
No genind2genlight
command?
Method 2
##2.1 Read vcf file into into R
vcf<-read.vcfR("f002-p3-r60-m10.vcf", verbose = FALSE)
##2.2 Convert vcf into genlight object
x <- vcfR2genlight(vcf)
##2.3 Convert genlight to allele frequencies for StAMPP
data.freq<-stamppConvert(x, type = "genlight")
Error in pop.num[i] <- which(pop.names[i] == pops) : replacement has length zero
Need a population column in the vcf file or genlight object!