Amaranta Fontcuberta amaranta.fontcuberta at unil.ch
Tue Apr 28 13:16:36 CEST 2020

```Dear Zhian,

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

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.
I calculate the nb of private alleles per population with
> pa.all<-private_alleles(derbo.gd
,form=alleles~.,level="population",report="data.frame")

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.

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?
population        allele count
13             M    588:43:+.1     0
14             P    588:43:+.1     0
15             M   1086:34:-.1     0
16             P   1086:34:-.1     0
17             M   1219:12:-.1     4

Then, I count the number of population -private alleles across loci with
*n.pAlleles*<-pa.all%>%group_by(population)%>%summarise(sum(count))%>%as.data.frame
#count total nb of private alleles, loci pooled
> n.pAlleles
population sum(count)
1          M       1648
2          P       1684

And I count the number of loci with population -private alleles with
pa.all1<-filter(pa.all, count !=0)    #remove loci with  of 0 p.a.
*n.pLocus*<-pa.all1 %>% count(population) %>%as.data.frame  #count per pop
the nb of loci with at least 1 private allele
> n.pLocus
population   n
1          M 864
2          P 742

I get very different results for the two measures, which I didn't expect.
Am I interpreting well the results?

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.

All the best,

> derbo.gd
/// GENIND OBJECT /////////
// 27 individuals; 12,498 loci; 24,996 alleles; size: 8.4 Mb
// Basic content
@tab:  27 x 24996 matrix of allele counts
@loc.n.all: number of alleles per locus (range: 2-2)
@loc.fac: locus factor for the 24996 columns of @tab
@all.names: list of allele names for each locus
@ploidy: ploidy of each individual  (range: 2-2)
@type:  codom
@call: .local(x = x, i = i, j = j, drop = drop)

// Optional content
@pop: population of each individual (group size range: 13-14)
>
> derbo.gd at loc.fac
[1] 47:42:-    47:42:-    69:32:+    69:32:+    170:70:+   170:70:+
255:71:+   255:71:+   318:29:+
[10] 318:29:+   413:44:-   413:44:-   447:82:+   447:82:+   471:26:+
471:26:+   541:74:-   541:74:-
[19] 588:43:+   588:43:+   702:20:+   702:20:+   745:45:-   745:45:-
749:18:+   749:18:+   770:10:+
[28] 770:10:+   854:6:+    854:6:+    1086:34:-  1086:34:-  1142:62:+
1142:62:+  1183:42:+  1183:42:+

> pa.all<-private_alleles(derbo.gd
,form=alleles~.,level="population",report="data.frame")
> pa.all (alllele ~pop)
population        allele count
1              M     69:32:+.1     0
2              P     69:32:+.1     0
3              M    170:70:+.1     0
4              P    170:70:+.1     0
5              M    255:71:+.1     0
6              P    255:71:+.1     0
7              M    318:29:+.1     0
8              P    318:29:+.1     0
9              M    447:82:+.1     0
10             P    447:82:+.1     0
11             M    541:74:-.1     0
12             P    541:74:-.1     0
13             M    588:43:+.1     0
14             P    588:43:+.1     0
15             M   1086:34:-.1     0
16             P   1086:34:-.1     0
17             M   1219:12:-.1     4

> pa.all (loci~pop)
population       locus count
1              M     69:32:+     0
2              P     69:32:+     0
3              M    170:70:+     0
4              P    170:70:+     0
5              M    255:71:+     0
6              P    255:71:+     0
7              M    318:29:+     0
8              P    318:29:+     0
9              M    447:82:+     0
10             P    447:82:+     0
11             M    541:74:-     0
12             P    541:74:-     0
13             M    588:43:+     0
14             P    588:43:+     0
15             M   1086:34:-     0
16             P   1086:34:-     0
17             M   1219:12:-     4

----------------------------------------------------------
Amaranta Fontcuberta, assistante diplômée
Dept. Écologie et Évolution
Université de Lausanne
-------------- next part --------------
An HTML attachment was scrubbed...