Question: R: poppr: Problems converting vcf to genclone object
0
gravatar for evolozzy
6 months ago by
evolozzy40
University of Pennsylvania
evolozzy40 wrote:

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.

genclone genind poppr R • 276 views
ADD COMMENTlink modified 6 months ago • written 6 months ago by evolozzy40
1
gravatar for evolozzy
6 months ago by
evolozzy40
University of Pennsylvania
evolozzy40 wrote:

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 COMMENTlink written 6 months ago by evolozzy40
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1671 users visited in the last hour
_