<div dir="ltr"><div>Dear Zhian, <br></div><div><br></div><div>I calculate tne number of alleles per population with poppr. I get unexpected results and some weird behavior of the private_alleles function, so I would like to confirm I am understanding well what the function is doing and I am interpreting the results correctly. Thanks in advance for your help!</div><div><br></div><div>I have a genind object with 27 individuals and 12.498 loci (bi allelic data, 0/1).  I have 2 populations called M and P. <br></div><div>I calculate the nb of private alleles per population with </div><div>> pa.all<-private_alleles(<a href="http://derbo.gd" target="_blank">derbo.gd</a>,form=alleles~.,level="population",report="data.frame")</div><div><br></div><div> In the output I have 13072 rows, 6536 unique "alleles names" x 2 (M and P). Why don't I have all loci in my dataset ( I should have 24996 rows)??. Many of these alleles are not private in none of the two pops.. so it is not only the loci with private alleles. </div><div><br></div><div>For example, for  "1219:12:-" , population M has 4 private alleles.  Am I correct that this means there are 4 individuals of population M that hold a private allele at this locus? <br></div><div>  Â  Â  population Â  Â  Â  Â allele count</div><div>13 Â  Â  Â  Â  Â  Â  M Â  Â 588:43:+.1 Â  Â  0<br>14 Â  Â  Â  Â  Â  Â  P Â  Â 588:43:+.1 Â  Â  0<br>15 Â  Â  Â  Â  Â  Â  M Â  1086:34:-.1 Â  Â  0<br>16 Â  Â  Â  Â  Â  Â  P Â  1086:34:-.1 Â  Â  0<br>17 Â  Â  Â  Â  Â  Â  M Â  1219:12:-.1 Â  Â  4</div><div><br></div><div>Then, I count the number of population -private alleles across loci with<br></div><div><b>n.pAlleles</b><-pa.all%>%group_by(population)%>%summarise(sum(count))%>%as.data.frame  #count total nb of private alleles, loci pooled<br></div><div>> n.pAlleles<br>  population sum(count)<br>1 Â  Â  Â  Â  Â M Â  Â  Â  1648<br>2 Â  Â  Â  Â  Â P Â  Â  Â  1684</div><div><br></div><div>And I count the number of loci with population -private alleles with</div><div>pa.all1<-filter(pa.all, count !=0)    #remove loci with  of 0 p.a. <br><b>n.pLocus</b><-pa.all1 %>% count(population) %>%as.data.frame  #count per pop the nb of loci with at least 1 private allele<br></div><div>> n.pLocus<br>  population Â  n<br>1 Â  Â  Â  Â  Â M 864<br>2 Â  Â  Â  Â  Â P 742</div><div><br></div><div>I get very different results for the two measures, which I didn't expect. Am I interpreting well the results?<br></div><div><br></div><div>Also, I realised I get exactly the same results using "form =loci~." in the private_alleles function, but the first is much much faster. This is weird. I think in the two cases it gives me the number of alleles per population....  So I don't get what is " loci~ " for.<br></div><div><div><br></div><div>Thanks in advance for your advice, <br></div><div><br></div><div>All the best, <br></div><div><br></div><div><br></div></div><div>> <a href="http://derbo.gd" target="_blank">derbo.gd</a><br>/// GENIND OBJECT /////////<br> // 27 individuals; 12,498 loci; 24,996 alleles; size: 8.4 Mb<br> // Basic content<br>  Â @tab: Â 27 x 24996 matrix of allele counts<br>  Â @loc.n.all: number of alleles per locus (range: 2-2)<br>  Â @loc.fac: locus factor for the 24996 columns of @tab<br>  Â @all.names: list of allele names for each locus<br>  Â @ploidy: ploidy of each individual Â (range: 2-2)<br>  Â @type: Â codom<br>  Â @call: .local(x = x, i = i, j = j, drop = drop)<br><br> // Optional content<br>  Â @pop: population of each individual (group size range: 13-14)<br>> </div><div>> derbo.gd@loc.fac<br>  Â [1] 47:42:- Â  Â 47:42:- Â  Â 69:32:+ Â  Â 69:32:+ Â  Â 170:70:+ Â  170:70:+ Â  255:71:+ Â  255:71:+ Â  318:29:+ Â <br>  [10] 318:29:+ Â  413:44:- Â  413:44:- Â  447:82:+ Â  447:82:+ Â  471:26:+ Â  471:26:+ Â  541:74:- Â  541:74:- Â <br>  [19] 588:43:+ Â  588:43:+ Â  702:20:+ Â  702:20:+ Â  745:45:- Â  745:45:- Â  749:18:+ Â  749:18:+ Â  770:10:+ Â <br>  [28] 770:10:+ Â  854:6:+ Â  Â 854:6:+ Â  Â 1086:34:- Â 1086:34:- Â 1142:62:+ Â 1142:62:+ Â 1183:42:+ Â 1183:42:+ <br></div><div><br></div><div>> pa.all<-private_alleles(<a href="http://derbo.gd" target="_blank">derbo.gd</a>,form=alleles~.,level="population",report="data.frame")<br>> pa.all (alllele ~pop)<br>  Â  Â  population Â  Â  Â  Â allele count<br>1 Â  Â  Â  Â  Â  Â  Â M Â  Â  69:32:+.1 Â  Â  0<br>2 Â  Â  Â  Â  Â  Â  Â P Â  Â  69:32:+.1 Â  Â  0<br>3 Â  Â  Â  Â  Â  Â  Â M Â  Â 170:70:+.1 Â  Â  0<br>4 Â  Â  Â  Â  Â  Â  Â P Â  Â 170:70:+.1 Â  Â  0<br>5 Â  Â  Â  Â  Â  Â  Â M Â  Â 255:71:+.1 Â  Â  0<br>6 Â  Â  Â  Â  Â  Â  Â P Â  Â 255:71:+.1 Â  Â  0<br>7 Â  Â  Â  Â  Â  Â  Â M Â  Â 318:29:+.1 Â  Â  0<br>8 Â  Â  Â  Â  Â  Â  Â P Â  Â 318:29:+.1 Â  Â  0<br>9 Â  Â  Â  Â  Â  Â  Â M Â  Â 447:82:+.1 Â  Â  0<br>10 Â  Â  Â  Â  Â  Â  P Â  Â 447:82:+.1 Â  Â  0<br>11 Â  Â  Â  Â  Â  Â  M Â  Â 541:74:-.1 Â  Â  0<br>12 Â  Â  Â  Â  Â  Â  P Â  Â 541:74:-.1 Â  Â  0<br>13 Â  Â  Â  Â  Â  Â  M Â  Â 588:43:+.1 Â  Â  0<br>14 Â  Â  Â  Â  Â  Â  P Â  Â 588:43:+.1 Â  Â  0<br>15 Â  Â  Â  Â  Â  Â  M Â  1086:34:-.1 Â  Â  0<br>16 Â  Â  Â  Â  Â  Â  P Â  1086:34:-.1 Â  Â  0<br>17 Â  Â  Â  Â  Â  Â  M Â  1219:12:-.1 Â  Â  4</div><div><br></div><div><br></div><div><br></div><div>> pa.all (loci~pop)<br>  Â  Â  population Â  Â  Â  locus count<br>1 Â  Â  Â  Â  Â  Â  Â M Â  Â  69:32:+ Â  Â  0<br>2 Â  Â  Â  Â  Â  Â  Â P Â  Â  69:32:+ Â  Â  0<br>3 Â  Â  Â  Â  Â  Â  Â M Â  Â 170:70:+ Â  Â  0<br>4 Â  Â  Â  Â  Â  Â  Â P Â  Â 170:70:+ Â  Â  0<br>5 Â  Â  Â  Â  Â  Â  Â M Â  Â 255:71:+ Â  Â  0<br>6 Â  Â  Â  Â  Â  Â  Â P Â  Â 255:71:+ Â  Â  0<br>7 Â  Â  Â  Â  Â  Â  Â M Â  Â 318:29:+ Â  Â  0<br>8 Â  Â  Â  Â  Â  Â  Â P Â  Â 318:29:+ Â  Â  0<br>9 Â  Â  Â  Â  Â  Â  Â M Â  Â 447:82:+ Â  Â  0<br>10 Â  Â  Â  Â  Â  Â  P Â  Â 447:82:+ Â  Â  0<br>11 Â  Â  Â  Â  Â  Â  M Â  Â 541:74:- Â  Â  0<br>12 Â  Â  Â  Â  Â  Â  P Â  Â 541:74:- Â  Â  0<br>13 Â  Â  Â  Â  Â  Â  M Â  Â 588:43:+ Â  Â  0<br>14 Â  Â  Â  Â  Â  Â  P Â  Â 588:43:+ Â  Â  0<br>15 Â  Â  Â  Â  Â  Â  M Â  1086:34:- Â  Â  0<br>16 Â  Â  Â  Â  Â  Â  P Â  1086:34:- Â  Â  0<br>17 Â  Â  Â  Â  Â  Â  M Â  1219:12:- Â  Â  4<br><br></div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>----------------------------------------------------------</div>Amaranta Fontcuberta, assistante diplômée<div>Dept. Ã‰cologie et Ã‰volution</div><div>Université de Lausanne</div></div></div></div></div>