[adegenet-forum] [adegenet forum] hw.test on genind object

Vojtěch Zeisek vojta at trapa.cz
Thu Aug 6 09:18:25 CEST 2015


Hi

Dne Čt 6. srpna 2015 17:00:53, Paolo Momigliano napsal(a):
> Hi all,
> 
> i am having some real trouble with a very simple task: running hw.test from
> pegas which is supposed to work with adegenet.
> 
> i tried importing my files both from genepop and fstat using the
> read.genepop and read.fstat functions:
> 
> below an example code
> 
> # load libraries
> library(adegenet)
> library(pegas)
> 
> # import data
> neu<-read.genepop("snp1.gen", ncode = 3L)

I use to use this function only with loci object (I use to start with pegas' 
read.loci function to import data), although man page says it should work also 
with genind. Might be You could try to convert Your genind object into loci by 
genind2loci function.

> # Calculate HWE for first pop
> HWE_Ning<-hw.test(neu[1:23,], B=100)
> 
> at which point, i get warnings:
> >There were 50 or more warnings (use warnings() to see the first 50)
> >
> > warnings()
> 
> Warning messages:
> 1: In O - E : longer object length is not a multiple of shorter object
> length
> 2: In (O - E)^2/E :
>   longer object length is not a multiple of shorter object length
> 3: In O - E : longer object length is not a multiple of shorter object
> length
> 4: In (O - E)^2/E :
>   longer object length is not a multiple of shorter object length
> 5: In O - E : longer object length is not a multiple of shorter object
> length
> 6: In (O - E)^2/E :
>   longer object length is not a multiple of shorter object length
> 7: In O - E : longer object length is not a multiple of shorter object
> length
> 
> etc....
> 
> The hw.test function works just fine on the "nancycat" dataset from
> Adegenet . But it doesn't whenever i import a dataset. I know the datasets
> are not corrupted, as i have carried out a lot of other analyses in
> adegenet and  diveRsity and never had a problem...
> 
> This problem persists if i try to convert the genind object using the
> as.loci function before running hw.test.
> 
> Do you have any suggestion?

Adegenet also has function HWE.test.genind. It works fine for me on genind 
objects.
There is also function HWE.test in package genetics, but I haven't used it 
myself.

> Thanks so much!
> 
> Paolo

HTH,
Vojtěch

-- 
Vojtěch Zeisek
http://trapa.cz/en/

Department of Botany, Faculty of Science
Charles University in Prague
Benátská 2, Prague, 12801, CZ
http://botany.natur.cuni.cz/en/

Institute of Botany, Academy of Science
Zámek 1, Průhonice, 25243, CZ
http://www.ibot.cas.cz/en/

Czech Republic
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20150806/be14b3aa/attachment.sig>


More information about the adegenet-forum mailing list