amova analysis by VCF file

720 views
Skip to first unread message

duguyiw...@163.com

unread,
Sep 4, 2018, 5:32:54 AM9/4/18
to poppr
dear poppr support:

    I have a vcf file and group list,when I want to analysis amova,it turns out NaN result I want to know why?

My code is
library("poppr")
library("vcfR")
vcf<-read.vcfR("/mnt/ilustre/users/tong.wang/Project/MJ20180320018-yaozhangxiu/evo20180814/step01.vcf-filter/pop.recode.vcf")
popdata<-read.table("/mnt/ilustre/users/tong.wang/Project/MJ20180320018-yaozhangxiu/group.list")
colnames(popdata)<-c("sampleID","groupID") # groupID i
g<-vcfR2genind(vcf)
g<-as.genclone(g)
ploidy(g)<-2
strata(g)<-data.frame(popdata)
setPop(g)<-~groupID
pop<-poppr(g)
amovacc<-poppr.amova(g3,~sampleID/groupID,clonecorrect=TRUE)

微信截图_20180904173221.png

I wander know why and how to fix it?

thank you!

Zhian Kamvar

unread,
Sep 4, 2018, 6:20:55 AM9/4/18
to duguyiw...@163.com, poppr
Hi,

The problem is that you are defining your samples as a hierarchical level. You should only need to specify ~groupID as the hierarchy in your AMOVA. If you have diploid individuals, poppr will calculate within-individual variance automatically with no need to specify that as part of the hierarchy.

hope that helps,
Zhian

--
You received this message because you are subscribed to the Google Groups "poppr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to poppr+un...@googlegroups.com.
To post to this group, send email to po...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/poppr/e58dab7f-a76f-4478-8a7c-f942a3c35c6f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Zhian Kamvar

unread,
Sep 4, 2018, 6:23:51 AM9/4/18
to duguyiw...@163.com, poppr
I'm going to post a reproduction of this situation here in case anyone ends up with the same error:

suppressPackageStartupMessages(library(poppr))
data(nancycats)
strata(nancycats) <- data.frame(POP = pop(nancycats), ID = indNames(nancycats))
poppr.amova(nancycats, ~POP/ID, quiet = TRUE)
#> Warning in is.euclid(xdist): Zero distance(s)
#> Distance matrix is non-euclidean.
#> Using quasieuclid correction method. See ?quasieuclid for details.
#> Warning in is.euclid(distmat): Zero distance(s)
#> $call
#> ade4::amova(samples = xtab, distances = xdist, structures = xstruct)
#>
#> $results
#>                            Df    Sum Sq   Mean Sq
#> Between POP                16  288.5021 18.031384
#> Between ID Within POP     220 1235.8990  5.617723
#> Between samples Within ID   0    0.0000       NaN
#> Within samples            237 1015.6256  4.285340
#> Total                     473 2540.0268  5.370035
#>
#> $componentsofcovariance
#>                                         Sigma   %
#> Variations  Between POP                   NaN NaN
#> Variations  Between ID Within POP         NaN NaN
#> Variations  Between samples Within ID     NaN NaN
#> Variations  Within samples            4.28534 NaN
#> Total variations                          NaN NaN
#>
#> $statphi
#>                   Phi
#> Phi-samples-total NaN
#> Phi-samples-ID    NaN
#> Phi-ID-POP        NaN
#> Phi-POP-total     NaN

Created on 2018-09-04 by the reprex package (v0.2.0).

duguyiw...@163.com

unread,
Sep 4, 2018, 6:55:12 AM9/4/18
to poppr
thanks for your reply soon thank you!

but Why My result is different between nanycat?

like

微信截图_20180904185342.png

but Mine is

微信截图_20180904185425.png


is there somethin I have missed?


thankyou!



在 2018年9月4日星期二 UTC+8下午6:23:51,Zhian Kamvar写道:

duguyiw...@163.com

unread,
Sep 4, 2018, 7:04:24 AM9/4/18
to poppr
by the way
all report about my data is:


微信截图_20180904190356.png



thank you


在 2018年9月4日星期二 UTC+8下午6:55:12,duguyiw...@163.com写道:

duguyiw...@163.com

unread,
Sep 4, 2018, 10:33:23 AM9/4/18
to poppr
I have already fix it by another way like this
library(pegas)
library(adegenet)
library(poppr)
info <- VCFloci("pop.recode.vcf")
popdata<-read.table("group.list")
SNP <- is.snp(info)
x <- length(which(SNP))
x <- read.vcf("amova/pop.recode.vcf", from = 1, to = x)
g<-loci2genind(x)
g<-as.genclone(g)
ploidy(g)<-2
strata(g)<-data.frame(popdata)
amovacc<-poppr.amova(g,~groupID/sampleID,dist=x.dist)

maybe loci2genind is different from vcfR2genind

thankyou!


在 2018年9月4日星期二 UTC+8下午6:23:51,Zhian Kamvar写道:
I'm going to post a reproduction of this situation here in case anyone ends up with the same error:
Reply all
Reply to author
Forward
0 new messages