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

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


Dne Čt 6. srpna 2015 17:31:20, Paolo Momigliano napsal(a):
> Thanks for the tip,
> 
> unfortunately using the genind2loci function to convert does not help (i
> guess that does the same as as.loci?). i used the HWE.test function in

What was the error message? Hm, then the only idea (going back to Your error 
messages) is this: Are You really absolutely sure You have all vectors of same 
lengths? I mean specifically individual names, populations and all loci. How 
do You mark missing data? Are there individual/population/loci names? How do 
they look like? Does print(neu) say what You expect (number of loci and 
individuals)? And what about summary(neu) - missing data and other 
characteristics? Does print(neu, details=TRUE) look OK?

> adegenet too before, yet i understand that this function is not present
> anymore in the new adegenet and its functionality is supposed to be
> replaced by pegas hwe.test?
> 
> If i try to run HWE.est from adegenet i get this
> 
> > HWE.test(neu)
> 
> Error: could not find function "HWE.test"
> 
> or
> 
> > HWE.test.genind(neu)
> 
> As of adegenet_1.5-0, this function has been removed and is replaced by
> 'hw.test' in the package 'pegas'

Yes, I see. I haven't used newest adegenet much yet, so I missed that.

> Did anyone have the same problem?

Once I had problem with this function (I don't remember the error message) 
when I had too much missing data (~15% in some loci). After removal of those 
loci/individuals, it worked fine. But I guess this is not Your case now...

> Cheers
> 
> Paolo

Good luck,
Vojtěch

> On Thu, Aug 6, 2015 at 5:18 PM, Vojtěch Zeisek <vojta at trapa.cz> wrote:
> > 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/83cca2e1/attachment.sig>


More information about the adegenet-forum mailing list