molpopgen / fwdpp

fwdpp is a C++ template library for implementing efficient forward-time population genetic simulations
http://fwdpp.readthedocs.io
GNU General Public License v3.0
27 stars 11 forks source link

Make sample_diploid more generic #15

Closed molpopgen closed 6 years ago

molpopgen commented 9 years ago

The current model in the main library is the standard Wright-Fisher model of a population with no separate sexes, and selection is implicitly soft selection.

This is fixable by extending the current sample_diploid to take a set of "rules" abstracting:

  1. How fitnesses are calculated
  2. How parents are chosen
  3. Updating some (user-defined) properties of offspring based on the properties of the parents.

In 0.3.1, I included an overload of sample_diploid in fwdpp/experimental/sample_diploid.hpp that allows for these custom rules. I included experimental_examples/sex_limited_ind.cc to show how custom rules may be constructed in order to implement a model with separate sexes and sex-specific effects of mutations on fitness.

These ideas will be merged into the main library once I am satisfied that:

  1. The API is ok
  2. Performance is not adversely affects for the standard Wright-Fisher model.

Testing so far suggests that that performance is unaffected, meaning that the API is the main question.

Ideally, this enhancement will be provided for all overloads of sample_diploid at the same time in a future release of the library.

molpopgen commented 6 years ago

This is best done in specific programs. Evolving best practices in fwdpy11 show what can be done. No need for fwdpp to do everything.