I can convert VCF to genclone by reading vcf data with vcfR, converting to into genind and then into genclone object in two separate ways, however, each conversion results in a different problem.
Method 1
genIndObj<-vcfR2genind(vcf,ploidy=1,strata=Loc)
genCloneObj<-as.genclone(genIndObj)
Problem with method 1
When I look at the locus table with locus_table(genCloneObj) I get only one allele in each locus, even though there are 2.
info_table(genCloneObj,type="missing",plot=T) works fine, I can see all missing loci information.
Method 2
genIndObj<-vcfR2genind(vcf,ploidy=1,strata=Loc)
genind2genalex(genIndObj,filename ="genalex.xls")
genCloneObj<-read.genalex("genalex.xls")
Problem with method 2
In this one locus_table(genCloneObj) works as expected.
However I lose some loci, and all missing loci information. when I run info_table(genCloneObj,type="missing",plot=T) I get NULL.
I'd really appreciate some help converting vcf to genclone.
1 answer
I've found a solution, using pegas withvcfR.
This causes another problem but it is easy to come up with a workaround. While reading vcf files with read.vcf the positions of the SNPs might not be read, so I get that information using getPOS and put that into the data frame created by pegas.
vcf<-read.vcf(vcf.file)
vcfR<-read.vcfR(vcf.file)
colnames(vcf)<-getPOS(vcfR)
genIndObj<-loci2genind(vcf,ploidy=1)
strata(genIndObj)<-strata.df
setPop(genIndObj)<-~pop/subPop
genCloneObj<-as.genclone
Log in to answer this question.