Tuesday, March 6, 2018

Another function to visualize the evolution of a polygenic quantitative trait in R

Yesterday evening I posted about some new functions for computing multilocus and multiallelic Hardy-Weinberg frequencies, and for showing the phenotypic distribution expected for polygenic quantitative traits determined by many loci.

I also developed a function, phenotype.selection, which shows nicely how selection can result in a change in mean that is well beyond the original range of the phenotype, even in the complete absence of mutation.

The code update corresponding to this new functionality can be viewed here.

To get it, I recommend just installing PopGen from GitHub:


Here's an example of how the function might be used:


FYI, since it is not possible to embed animations in knitted HTML, I first made the .gif using ImageMagick called from within R as follows:

system("ImageMagick convert -delay 10 -loop 0 *.png 6Mar18-post.gif")

then I embedded it manually.

No comments:

Post a Comment