<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Dear Thibaut,<br><br>Thanks for looking into this, and I apologize for not being clearer in my original posting. &nbsp;The results you obtained are correct - although the first individual (Nph0001) is missing from what you posted, but I assume that that is something minor. &nbsp;However, I do not get the results that you did. &nbsp;I get:<br><br><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span>Nph0001<span class="Apple-tab-span" style="white-space: pre; ">        </span>Nph0003<span class="Apple-tab-span" style="white-space: pre; ">        </span>Nph0004<span class="Apple-tab-span" style="white-space: pre; ">        </span>Nph0005<br>Nph0001<span class="Apple-tab-span" style="white-space: pre; ">        </span>1<span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span>0.0<span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span>0.0<span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span>0<br>Nph0003<span class="Apple-tab-span" style="white-space: pre; ">        </span>0<span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span>1.0<span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span>0.5<span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span>0<br>Nph0004<span class="Apple-tab-span" style="white-space: pre; ">        </span>0<span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span>0.5<span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span>1<span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span>0<br>Nph0005<span class="Apple-tab-span" style="white-space: pre; ">        </span>0<span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span>0.0<span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span>0.0<span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span><span class="Apple-tab-span" style="white-space: pre; ">        </span>1<span class="Apple-tab-span" style="white-space: pre; ">        </span>&nbsp;&nbsp;<br><br>Upon further inspection, it looks like it (the propShared function) is not detecting the delimiter between my two alleles at each locus, and instead is lumping them together for the comparisons. What's tricky is that it detects them properly in the genind class...<br><br><blockquote type="cite">x$all.names<br></blockquote>$L1<br>&nbsp;&nbsp;1 &nbsp;&nbsp;&nbsp;&nbsp;2 &nbsp;&nbsp;&nbsp;&nbsp;3&nbsp;<br>"119" "121" "123"&nbsp;<br><br>$L2<br>&nbsp;&nbsp;1 &nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;<br>"191" "197"&nbsp;<br><br>$L3<br>&nbsp;&nbsp;1 &nbsp;&nbsp;&nbsp;&nbsp;2 &nbsp;&nbsp;&nbsp;&nbsp;3 &nbsp;&nbsp;&nbsp;&nbsp;4 &nbsp;&nbsp;&nbsp;&nbsp;5 &nbsp;&nbsp;&nbsp;&nbsp;6&nbsp;<br>"195" "197" "199" "201" "203" "205"&nbsp;<br><br>...but when I export the data, the two alleles at each locus are lumped together:<br><br><blockquote type="cite">tab &lt;- genind2df(x)<br></blockquote><blockquote type="cite">tab<br></blockquote>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;L1 &nbsp;&nbsp;&nbsp;&nbsp;L2 &nbsp;&nbsp;&nbsp;&nbsp;L3 &nbsp;&nbsp;&nbsp;&nbsp;L4 &nbsp;&nbsp;&nbsp;&nbsp;L5 &nbsp;&nbsp;&nbsp;&nbsp;L6 &nbsp;&nbsp;&nbsp;&nbsp;L7 &nbsp;&nbsp;&nbsp;&nbsp;L8 &nbsp;&nbsp;&nbsp;&nbsp;L9<br>Nph0001 119123 191197 199201 138140 099099 173175 136136 168170 144144<br>Nph0003 119121 191191 203203 136144 097099 159169 132132 &nbsp;&nbsp;&lt;NA&gt; 146150<br>Nph0004 119121 191191 203203 136136 097097 159171 132132 158160 146152<br><br>Also, the results from propShared(x) that I get are consistent with the alleles being lumped together for each locus.<br><br>So, it looks like the issue I am having is that the alleles appear to be delimited properly when read into the genind class, but then that delimitation seems to disappear in the propShared function.<br><br>Since you did not get that same problem, I assume that it has something to do with how I am reading the file in (although the genind class seems correct). &nbsp;I will keep looking into it.<br><br>Thanks again for your help.<br><br>Sincerely,<br>Tim Frasier &nbsp;<br><br><br><br>On 2010-08-13, at 8:40 AM, Jombart, Thibaut wrote:<br><br><blockquote type="cite">Dear Tim,&nbsp;<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Issues are always possible, but it would be nice if you could point out a particular case where calculations are 'clearly wrong'. For now it is not clear to me that the function is wrong. It works with the example dataset, and it works with the first rows of your dataset too:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">tab &lt;- genind2df(x)<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">tab<br></blockquote></blockquote><blockquote type="cite">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;X119 X123 X191 X197 X199 X201 X138 X140 X099 X099.1 X173 X175 X136<br></blockquote><blockquote type="cite">Nph0003 &nbsp;119 &nbsp;121 &nbsp;191 &nbsp;191 &nbsp;203 &nbsp;203 &nbsp;136 &nbsp;144 &nbsp;097 &nbsp;&nbsp;&nbsp;099 &nbsp;159 &nbsp;169 &nbsp;132<br></blockquote><blockquote type="cite">Nph0004 &nbsp;119 &nbsp;121 &nbsp;191 &nbsp;191 &nbsp;203 &nbsp;203 &nbsp;136 &nbsp;136 &nbsp;097 &nbsp;&nbsp;&nbsp;097 &nbsp;159 &nbsp;171 &nbsp;132<br></blockquote><blockquote type="cite">Nph0005 &nbsp;119 &nbsp;119 &nbsp;191 &nbsp;191 &nbsp;203 &nbsp;203 &nbsp;132 &nbsp;138 &nbsp;097 &nbsp;&nbsp;&nbsp;099 &nbsp;159 &nbsp;161 &nbsp;132<br></blockquote><blockquote type="cite">Nph0007 &lt;NA&gt; &lt;NA&gt; &nbsp;191 &nbsp;191 &nbsp;201 &nbsp;205 &nbsp;136 &nbsp;136 &nbsp;097 &nbsp;&nbsp;&nbsp;099 &nbsp;159 &nbsp;159 &nbsp;132<br></blockquote><blockquote type="cite">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;X136.1 X168 X170 X144 X144.1<br></blockquote><blockquote type="cite">Nph0003 &nbsp;&nbsp;&nbsp;132 &lt;NA&gt; &lt;NA&gt; &nbsp;146 &nbsp;&nbsp;&nbsp;150<br></blockquote><blockquote type="cite">Nph0004 &nbsp;&nbsp;&nbsp;132 &nbsp;158 &nbsp;160 &nbsp;146 &nbsp;&nbsp;&nbsp;152<br></blockquote><blockquote type="cite">Nph0005 &nbsp;&nbsp;&nbsp;132 &nbsp;160 &nbsp;160 &nbsp;146 &nbsp;&nbsp;&nbsp;148<br></blockquote><blockquote type="cite">Nph0007 &nbsp;&nbsp;&nbsp;134 &nbsp;158 &nbsp;160 &nbsp;148 &nbsp;&nbsp;&nbsp;150<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">propShared(x)<br></blockquote></blockquote><blockquote type="cite">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Nph0003 &nbsp;&nbsp;Nph0004 &nbsp;&nbsp;Nph0005 &nbsp;&nbsp;Nph0007<br></blockquote><blockquote type="cite">Nph0003 1.0000000 0.7500000 0.6875000 0.5714286<br></blockquote><blockquote type="cite">Nph0004 0.7500000 1.0000000 0.6111111 0.5625000<br></blockquote><blockquote type="cite">Nph0005 0.6875000 0.6111111 1.0000000 0.4375000<br></blockquote><blockquote type="cite">Nph0007 0.5714286 0.5625000 0.4375000 1.0000000<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">mean(tab[1,]==tab[2,], na.rm=TRUE) &nbsp;# OK<br></blockquote></blockquote><blockquote type="cite">[1] 0.75&nbsp;<br></blockquote><blockquote type="cite"><blockquote type="cite">mean(tab[1,]==tab[3,], na.rm=TRUE) # OK<br></blockquote></blockquote><blockquote type="cite">[1] 0.6875<br></blockquote><blockquote type="cite"><blockquote type="cite">mean(tab[1,]==tab[4,], na.rm=TRUE) # OK<br></blockquote></blockquote><blockquote type="cite">[1] 0.5714286<br></blockquote><blockquote type="cite"><blockquote type="cite">mean(tab[2,]==tab[3,], na.rm=TRUE) # OK<br></blockquote></blockquote><blockquote type="cite">[1] 0.6111111<br></blockquote><blockquote type="cite"><blockquote type="cite">mean(tab[2,]==tab[4,], na.rm=TRUE) # OK<br></blockquote></blockquote><blockquote type="cite">[1] 0.5625<br></blockquote><blockquote type="cite"><blockquote type="cite">mean(tab[3,]==tab[4,], na.rm=TRUE) #OK<br></blockquote></blockquote><blockquote type="cite">[1] 0.4375<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">All these results are right. Obviously the proportion of shared alleles is computed for sampled loci only; for instance, for proportion of shared alleles between individuals 1 and 2 equates 12/16, and not 12/18.&nbsp;<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Can you please provide a sample of code illustrating an issue in the calculations?<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Best<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Thibaut.<br></blockquote><blockquote type="cite">________________________________________<br></blockquote><blockquote type="cite">From:&nbsp;<a href="mailto:adegenet-forum-bounces@lists.r-forge.r-project.org">adegenet-forum-bounces@lists.r-forge.r-project.org</a>&nbsp;[adegenet-forum-bounces@lists.r-forge.r-project.org] On Behalf Of Timothy Frasier [timothy.frasier@SMU.CA]<br></blockquote><blockquote type="cite">Sent: 12 August 2010 15:15<br></blockquote><blockquote type="cite">To:&nbsp;<a href="mailto:adegenet-forum@lists.r-forge.r-project.org">adegenet-forum@lists.r-forge.r-project.org</a><br></blockquote><blockquote type="cite">Subject: [adegenet-forum] propShared problems<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Hi,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I am trying to use the propShared function, and realized that there is an issue with the calculation - the results are clearly not calculating the proportion of shared alleles properly. &nbsp;I browsed through both the R and C code to try to find the issue, but nothing immediately jumped out at me. &nbsp;I will keep looking, but thought that you could likely find and fix it faster than I could.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I've attached a small example data set that I am working with (35 individuals typed at 9 microsatellite loci). &nbsp;Its size is good because it is easy to calculate the proportion of shared alleles manually and then compare that to the results obtained from the propShared function.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Thanks for your help!<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Sincerely,<br></blockquote><blockquote type="cite">Tim Frasier<br></blockquote><blockquote type="cite"><br></blockquote><br>~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>Timothy R. Frasier<br>Department of Biology<br>Saint Mary's University<br>923 Robie Street<br>Halifax, NS B3H 3C3<br>Canada<br>E-mail:&nbsp;<a href="mailto:timothy.frasier@smu.ca">timothy.frasier@smu.ca</a><br>Tel: (902) 491-6382<br>~~~~~~~~~~~~~~~~~~~~~~~~~~~<br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>~~~~~~~~~~~~~~~~~~~~~~~~~~~</div><div>Timothy R. Frasier</div><div>Department of Biology</div><div>Saint Mary's University</div><div>923 Robie Street</div><div>Halifax, NS B3H 3C3</div><div>Canada</div><div>E-mail: <a href="mailto:timothy.frasier@smu.ca">timothy.frasier@smu.ca</a></div><div>Tel: (902) 491-6382</div><div>~~~~~~~~~~~~~~~~~~~~~~~~~~~</div><div><br></div></div></span><br class="Apple-interchange-newline"></div></span><br class="Apple-interchange-newline"></span><br class="Apple-interchange-newline">
</div>
<br></body></html>