R: poppr: Problems converting vcf to genclone object
1
0
Entering edit mode
4.4 years ago
ozankiratli ▴ 150

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.

R poppr genind genclone • 1.9k views
ADD COMMENT
4
Entering edit mode
4.4 years ago
ozankiratli ▴ 150

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
ADD COMMENT

Login before adding your answer.

Traffic: 2150 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6