<div dir="ltr">Hi Zhian, <div><br></div><div>thank you so much this worked perfectly.</div><div><br></div><div>Cheers</div><div><br></div><div>Paolo</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 7, 2015 at 1:52 AM, Zhian Kamvar <span dir="ltr"><<a href="mailto:kamvarz@science.oregonstate.edu" target="_blank">kamvarz@science.oregonstate.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This is due to an issue in pegas where it expects the alleles to be in numerical order for micro satellites.<br>
<br>
Until it's fixed, I have made a workaround here: <a href="https://gist.github.com/zkamvar/95af8adaf1b3f01a4995" rel="noreferrer" target="_blank">https://gist.github.com/zkamvar/95af8adaf1b3f01a4995</a><br>
<br>
Copy + paste the function into your R console and then use resort_microsat(myData) for the workaround.<br>
<br>
Cheers,<br>
Zhian<br>
<br>
> On Aug 6, 2015, at 03:00 , <a href="mailto:adegenet-forum-request@lists.r-forge.r-project.org">adegenet-forum-request@lists.r-forge.r-project.org</a> wrote:<br>
><br>
> Send adegenet-forum mailing list submissions to<br>
>       <a href="mailto:adegenet-forum@lists.r-forge.r-project.org">adegenet-forum@lists.r-forge.r-project.org</a><br>
><br>
> To subscribe or unsubscribe via the World Wide Web, visit<br>
>       <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum" rel="noreferrer" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum</a><br>
><br>
> or, via email, send a message with subject or body 'help' to<br>
>       <a href="mailto:adegenet-forum-request@lists.r-forge.r-project.org">adegenet-forum-request@lists.r-forge.r-project.org</a><br>
><br>
> You can reach the person managing the list at<br>
>       <a href="mailto:adegenet-forum-owner@lists.r-forge.r-project.org">adegenet-forum-owner@lists.r-forge.r-project.org</a><br>
><br>
> When replying, please edit your Subject line so it is more specific<br>
> than "Re: Contents of adegenet-forum digest..."<br>
><br>
><br>
> Today's Topics:<br>
><br>
>   1. Re: [adegenet forum] hw.test on genind object (Vojt?ch Zeisek)<br>
><br>
><br>
> ----------------------------------------------------------------------<br>
><br>
> Message: 1<br>
> Date: Thu, 06 Aug 2015 09:42:39 +0200<br>
> From: Vojt?ch Zeisek <<a href="mailto:vojta@trapa.cz">vojta@trapa.cz</a>><br>
> To: <a href="mailto:adegenet-forum@lists.r-forge.r-project.org">adegenet-forum@lists.r-forge.r-project.org</a><br>
> Subject: Re: [adegenet-forum] [adegenet forum] hw.test on genind<br>
>       object<br>
> Message-ID: <7057116.uogps0hNZK@veles><br>
> Content-Type: text/plain; charset="utf-8"<br>
><br>
> Dne ?t 6. srpna 2015 17:31:20, Paolo Momigliano napsal(a):<br>
<div><div class="h5">>> Thanks for the tip,<br>
>><br>
>> unfortunately using the genind2loci function to convert does not help (i<br>
>> guess that does the same as as.loci?). i used the HWE.test function in<br>
><br>
> What was the error message? Hm, then the only idea (going back to Your error<br>
> messages) is this: Are You really absolutely sure You have all vectors of same<br>
> lengths? I mean specifically individual names, populations and all loci. How<br>
> do You mark missing data? Are there individual/population/loci names? How do<br>
> they look like? Does print(neu) say what You expect (number of loci and<br>
> individuals)? And what about summary(neu) - missing data and other<br>
> characteristics? Does print(neu, details=TRUE) look OK?<br>
><br>
>> adegenet too before, yet i understand that this function is not present<br>
>> anymore in the new adegenet and its functionality is supposed to be<br>
>> replaced by pegas hwe.test?<br>
>><br>
>> If i try to run HWE.est from adegenet i get this<br>
>><br>
>>> HWE.test(neu)<br>
>><br>
>> Error: could not find function "HWE.test"<br>
>><br>
>> or<br>
>><br>
>>> HWE.test.genind(neu)<br>
>><br>
>> As of adegenet_1.5-0, this function has been removed and is replaced by<br>
>> 'hw.test' in the package 'pegas'<br>
><br>
> Yes, I see. I haven't used newest adegenet much yet, so I missed that.<br>
><br>
>> Did anyone have the same problem?<br>
><br>
> Once I had problem with this function (I don't remember the error message)<br>
> when I had too much missing data (~15% in some loci). After removal of those<br>
> loci/individuals, it worked fine. But I guess this is not Your case now...<br>
><br>
>> Cheers<br>
>><br>
>> Paolo<br>
><br>
> Good luck,<br>
</div></div>> Vojt?ch<br>
<span class="">><br>
>> On Thu, Aug 6, 2015 at 5:18 PM, Vojt?ch Zeisek <<a href="mailto:vojta@trapa.cz">vojta@trapa.cz</a>> wrote:<br>
>>> Hi<br>
>>><br>
</span>>>> Dne ?t 6. srpna 2015 17:00:53, Paolo Momigliano napsal(a):<br>
<div><div class="h5">>>>> Hi all,<br>
>>>><br>
>>>> i am having some real trouble with a very simple task: running hw.test<br>
>>><br>
>>> from<br>
>>><br>
>>>> pegas which is supposed to work with adegenet.<br>
>>>><br>
>>>> i tried importing my files both from genepop and fstat using the<br>
>>>> read.genepop and read.fstat functions:<br>
>>>><br>
>>>> below an example code<br>
>>>><br>
>>>> # load libraries<br>
>>>> library(adegenet)<br>
>>>> library(pegas)<br>
>>>><br>
>>>> # import data<br>
>>>> neu<-read.genepop("snp1.gen", ncode = 3L)<br>
>>><br>
>>> I use to use this function only with loci object (I use to start with<br>
>>> pegas'<br>
>>> read.loci function to import data), although man page says it should work<br>
>>> also<br>
>>> with genind. Might be You could try to convert Your genind object into<br>
>>> loci by<br>
>>> genind2loci function.<br>
>>><br>
>>>> # Calculate HWE for first pop<br>
>>>> HWE_Ning<-hw.test(neu[1:23,], B=100)<br>
>>>><br>
>>>> at which point, i get warnings:<br>
>>>>> There were 50 or more warnings (use warnings() to see the first 50)<br>
>>>>><br>
>>>>> warnings()<br>
>>>><br>
>>>> Warning messages:<br>
>>>> 1: In O - E : longer object length is not a multiple of shorter object<br>
>>>> length<br>
>>>><br>
>>>> 2: In (O - E)^2/E :<br>
>>>>  longer object length is not a multiple of shorter object length<br>
>>>><br>
>>>> 3: In O - E : longer object length is not a multiple of shorter object<br>
>>>> length<br>
>>>><br>
>>>> 4: In (O - E)^2/E :<br>
>>>>  longer object length is not a multiple of shorter object length<br>
>>>><br>
>>>> 5: In O - E : longer object length is not a multiple of shorter object<br>
>>>> length<br>
>>>><br>
>>>> 6: In (O - E)^2/E :<br>
>>>>  longer object length is not a multiple of shorter object length<br>
>>>><br>
>>>> 7: In O - E : longer object length is not a multiple of shorter object<br>
>>>> length<br>
>>>><br>
>>>> etc....<br>
>>>><br>
>>>> The hw.test function works just fine on the "nancycat" dataset from<br>
>>>> Adegenet . But it doesn't whenever i import a dataset. I know the<br>
>>><br>
>>> datasets<br>
>>><br>
>>>> are not corrupted, as i have carried out a lot of other analyses in<br>
>>>> adegenet and  diveRsity and never had a problem...<br>
>>>><br>
>>>> This problem persists if i try to convert the genind object using the<br>
>>>> as.loci function before running hw.test.<br>
>>>><br>
>>>> Do you have any suggestion?<br>
>>><br>
>>> Adegenet also has function HWE.test.genind. It works fine for me on genind<br>
>>> objects.<br>
>>> There is also function HWE.test in package genetics, but I haven't used it<br>
>>> myself.<br>
>>><br>
>>>> Thanks so much!<br>
>>>><br>
>>>> Paolo<br>
>>><br>
>>> HTH,<br>
</div></div>>>> Vojt?ch<br>
> --<br>
> Vojt?ch Zeisek<br>
<span class="">> <a href="http://trapa.cz/en/" rel="noreferrer" target="_blank">http://trapa.cz/en/</a><br>
><br>
> Department of Botany, Faculty of Science<br>
> Charles University in Prague<br>
</span>> Ben?tsk? 2, Prague, 12801, CZ<br>
<span class="">> <a href="http://botany.natur.cuni.cz/en/" rel="noreferrer" target="_blank">http://botany.natur.cuni.cz/en/</a><br>
><br>
> Institute of Botany, Academy of Science<br>
</span>> Z?mek 1, Pr?honice, 25243, CZ<br>
> <a href="http://www.ibot.cas.cz/en/" rel="noreferrer" target="_blank">http://www.ibot.cas.cz/en/</a><br>
><br>
> Czech Republic<br>
> -------------- next part --------------<br>
> A non-text attachment was scrubbed...<br>
> Name: signature.asc<br>
> Type: application/pgp-signature<br>
> Size: 473 bytes<br>
> Desc: This is a digitally signed message part.<br>
> URL: <<a href="http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20150806/83cca2e1/attachment-0001.sig" rel="noreferrer" target="_blank">http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20150806/83cca2e1/attachment-0001.sig</a>><br>
><br>
> ------------------------------<br>
<span class="">><br>
> _______________________________________________<br>
> adegenet-forum mailing list<br>
> <a href="mailto:adegenet-forum@lists.r-forge.r-project.org">adegenet-forum@lists.r-forge.r-project.org</a><br>
> <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum" rel="noreferrer" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum</a><br>
><br>
</span>> End of adegenet-forum Digest, Vol 84, Issue 2<br>
> *********************************************<br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
adegenet-forum mailing list<br>
<a href="mailto:adegenet-forum@lists.r-forge.r-project.org">adegenet-forum@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum" rel="noreferrer" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum</a><br>
</div></div></blockquote></div><br></div>