<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>