thibautjombart / adegenet

adegenet: a R package for the multivariate analysis of genetic markers
167 stars 64 forks source link

minor allele frequency #82

Closed Carlo86 closed 9 years ago

Carlo86 commented 9 years ago

Hi all,

I would like to calculate the minor allele frequency for my data.

thibautjombart commented 9 years ago

Yep, should be simple enough. Will have a look.

thibautjombart commented 9 years ago

Something like this should work:

tapply(apply(tab(x, freq=TRUE),2,mean, na.rm=TRUE), locFac(x), function(e) sort(e,decreasing=TRUE)[2])

with x being your genind

thibautjombart commented 9 years ago

I had forgotten that there is a isPoly function. Added anyway as of 090c998a2a9