I am trying to run a Fst on VCF file output from STACKS from DDRAD sequencing run. The problem is that when I am running:
vcf.fn <- "batch_1.vcf"
snpgdsVCF2GDS(vcf.fn, "test.gds", method = "biallelic.only")
snpgdsSummary("test.gds")
genofile <- snpgdsOpen("test.gds")
sample.id <- read.gdsn(index.gdsn(genofile, "sample.id"))
pop_code <- scan("/Users/allisavincent/Desktop/pop.txt", what=character())
Read 129 items
head(cbind(sample.id, pop_code))
sample.id pop_code
[1,] "BC-B39.all" "BC"
[2,] "BC_10_2.all" "BC"
[3,] "BC_11_2.all" "BC"
[4,] "BC_30_2.all" "BC"
[5,] "BC_32_2.all" "BC"
[6,] "BC_7_2.all" "BC"
flag <- pop_code %in% c("BC", "CI", "CK", "EPP", "GA", "GI", "HI", "DI", "OZ", "PA", "PF", "PI", "CS")
samp.sel <- sample.id[flag]
pop.sel <- pop_code[flag]
snpgdsFst(genofile, sample.id = samp.sel, population = as.factor(pop.sel), method = "W&C84")
Fst estimation on genotypes:
Excluding 22,590 SNPs on non-autosomes
Error in .InitFile2(cmd = "Fst estimation on genotypes:", gdsobj = gdsobj, :
There is no SNP!
The problem is that it believes that all SNPS are on non-autosomes so no SNPs are left for analysis. Is this a problem with the format of the VCF file I am inputing or maybe a problem with how I am reading in the VCF file?
VCF file information:
##fileformat=VCFv4.2
##fileDate=20180406
##source="Stacks v1.46"
##INFO=<ID=NS,Number=1,Type=Integer,Description="Number of Samples With Data">
##INFO=<ID=AF,Number=.,Type=Float,Description="Allele Frequency">
##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
##FORMAT=<ID=DP,Number=1,Type=Integer,Description="Read Depth">
##FORMAT=<ID=AD,Number=1,Type=Integer,Description="Allele Depth">
##FORMAT=<ID=GL,Number=.,Type=Float,Description="Genotype Likelihood">
##INFO=<ID=locori,Number=1,Type=Character,Description="Orientation the corresponding Stacks locus aligns in">
#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT BC-B39.all BC_10_2.all BC_11_2.all BC_30_2.all BC_32_2.all BC_7_2.all BC_B12.all BC_B13.all BC_B19.all BC_B24.all BC_B25.all BC_B33.all BC_B36.all BC_B38.all BC_B47.all BC_B5.all BC_B6.all CI_B11.all CI_B18.all CI_B2.all CI_B20.all CI_B33_2.all CI_B34_2.all CI_B35_2.all CI_B4.all CI_B5.all CI_B6.all CK_B11.all CK_B13.all CK_B18.all CK_B2.all CK_B26_2.all CK_B27.all CK_B30.all CK_B34.all CK_B48.all CK_B5.all CK_B50.all EPP_B10.all EPP_B12.all EPP_B13.all EPP_B14.all EPP_B16.all EPP_B18.all GA_B10_2.all GA_B2.all GA_B31.all GA_B32.all GA_B38.all GA_B45.all GA_B7.all GI_B1.all GI_B14.all GI_B15_2.all GI_B21.all GI_B22.all GI_B27.all GI_B31.all GI_B33.all GI_B38.all GI_B39.all GI_B4.all GI_B40_2.all GI_B43_2.all GI_B47.all GI_B48.all GI_B9.all HI_B1_2.all HI_SRL_2.all HI_WRL.all NERR_B28.all NERR_B29.all NERR_B33.all NERR_B36.all NERR_B38_2.all NERR_B40_2.all NERR_B41.all NERR_B45_2.all NERR_B47.all NERR_B54.all OZ_B13_2.all OZ_B16.all OZ_B17_2.all OZ_B18_2.all OZ_B26.all OZ_B32.all OZ_B40.all OZ_B45_2.all PA_B12.all PA_B16_2.all PA_B19.all PA_B20.all PA_B23_2.all PA_B25.all PA_B26.all PA_B27.all PA_B2_2.all PA_B3.all PA_B31.all PA_B37.all PA_B42.all PA_B5.all PF_B11.all PF_B16.all PF_B23.all PF_B3.all PF_B30.all PF_B32.all PF_B37.all PF_B38.all PF_B39.all PF_B40.all PF_B45.all PI_B13.all PI_B14.all PI_B15.all PI_B17.all PI_B2.all PI_B26.all PI_B30.all PI_B31.all PI_B33.all PI_B35.all PI_B36.all PI_B5.all PI_B7.all S1_B10.all S1_B5.all S1_B9.all
un 83 2_6 G A . PASS NS=13;AF=0.231;locori=p GT:DP:AD 0/0:26:26,0 ./.:8:.,. ./.:0:.,. ./.:0:.,. ./.:0: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./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. 0/1:38:11,27 ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,.
un 87 2_10 A C . PASS NS=13;AF=0.500;locori=p GT:DP:AD 1/1:26:0,26 0/0:8:8,0 ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. 0/0:38:38,0 1/1:8:0,8 ./.:0:.,. ./.:0:.,. ./.:0:.,. 0/0:49:49,0 ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. 1/1:4:0,4 ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:8:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. 1/1:7:0,7 ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. 1/1:26:0,26 ./.:0:.,. 0/0:10:10,0 ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. 1/1:10:0,10 ./.:0:.,. ./.:0:.,. ./.:0:.,. 0/1:19:10,9 ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. 0/0:6:6,0 ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,. 0/0:38:38,0 ./.:0:.,. ./.:0:.,. ./.:0:.,. ./.:0:.,.