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

Zhian Kamvar kamvarz at science.oregonstate.edu
Thu Aug 6 17:52:08 CEST 2015


This is due to an issue in pegas where it expects the alleles to be in numerical order for micro satellites.

Until it's fixed, I have made a workaround here: https://gist.github.com/zkamvar/95af8adaf1b3f01a4995

Copy + paste the function into your R console and then use resort_microsat(myData) for the workaround.

Cheers,
Zhian

> On Aug 6, 2015, at 03:00 , adegenet-forum-request at lists.r-forge.r-project.org wrote:
> 
> Send adegenet-forum mailing list submissions to
> 	adegenet-forum at lists.r-forge.r-project.org
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum
> 
> or, via email, send a message with subject or body 'help' to
> 	adegenet-forum-request at lists.r-forge.r-project.org
> 
> You can reach the person managing the list at
> 	adegenet-forum-owner at lists.r-forge.r-project.org
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of adegenet-forum digest..."
> 
> 
> Today's Topics:
> 
>   1. Re: [adegenet forum] hw.test on genind object (Vojt?ch Zeisek)
> 
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Thu, 06 Aug 2015 09:42:39 +0200
> From: Vojt?ch Zeisek <vojta at trapa.cz>
> To: adegenet-forum at lists.r-forge.r-project.org
> Subject: Re: [adegenet-forum] [adegenet forum] hw.test on genind
> 	object
> Message-ID: <7057116.uogps0hNZK at veles>
> Content-Type: text/plain; charset="utf-8"
> 
> 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-0001.sig>
> 
> ------------------------------
> 
> _______________________________________________
> adegenet-forum mailing list
> adegenet-forum at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum
> 
> End of adegenet-forum Digest, Vol 84, Issue 2
> *********************************************



More information about the adegenet-forum mailing list