Geneological Adam and Eve software

I apologize for the delayed response to all of this, given that I initiated the discussion!

Excellent feedback all around. I have some short and long-term goals with this:

  • Short term - we have a STEM day for local high school students and I think this would be an interesting way to show how computer science can inform theological discussions. I was hoping for a fully-functioning piece of software that I could use. I think that the starting point provided by @swamidass and refined by @Chris_Falter and others will give us enough to work with
  • Longer term - I am having my sophomore computer science II class (Java) read the Geneological Adam and Eve book and am thinking of having them code something up as a class project.
  • Longer term - I have two students in the honors program and I hope to inspire them to take up something like this for a senior thesis
  • Longest term - I would like to create an open source project that multiple interested parties could develop. This would require some research on my part to see what is out there and whether or not this would be a useful thing to do.

Thanks again for all the responses … you have answered all my questions.

3 Likes

That’s great. Any chance we can tempt you to move to python? If so, perhaps it could be a collaborative project.

At some point I want to do some serious modeling on these questions, and it would be great if this was up to the task.

Also I still reccomend looking into SLIM. It’s hard to get scalable models, and hooking to an existing system that to you modify is most likely to be successful.

Does WF enforce the notion that each parent had to have a different sex?

I will do that once I get spare cycles.

Agreed. This is the long-term effort I envision. We should select the technology that is up to the task.

Yes, I should have been more clear. I envision a collaborative project in Python (or whatever language we think is best). For the class project, we are locked in to Java and would be limited to a small class project in that particular course.

Does WF enforce the notion that each parent had to have a different sex?
The original WF model does not have sexes, and since each parent is chosen with replacement allows pedigrees that cannot have sexes assigned to individuals, even some self-fertilizations. If one instead designates F individuals as females and M as males (where F+M = N) and then chooses one female and one male as parents for the each individual, and does so with replacement after each offspring is produced, then monogamy is not enforced. Sewall Wright in the 1930s examined the effect of this on effective population sizes. For a model with monogamy, one instead groups the individuals randomly into pairs (thus ensuring that N/2 will be females and N/2 males) and then to produce each offspring we choose one of the pairs at random, and do so with replacement.
2 Likes

Hi Tim/Timothy/Professor-Darr,

I have created a public repo for pop gen collaborations on GitHub:

It contains a README.md, a LICENSE (Apache 2.0), and the monogamous Wright-Fisher simulation notebook. Please feel free to fork the repo for your own purposes; or if you would like to contribute to the public repo I created, you can do the standard fork > branch > edit/add/commit/push > create pull request trick.

Recently I have worked primarily on NLP projects, with a little graph algorithms and time-series analysis thrown in. However, I spend more time on team process engineering and prediction service implementations than on typical data science tasks. This is the result of my long background in software engineering and architecture, combined with these industry trends:

  1. Analytics and prediction models need to be integrated into IT infrastructure if they are to do any long-term good.
  2. The vast majority of data scientists get little to no training in engineering and IT, and the vast majority of engineering/IT types get little to no training in data science. So I am the rare data scientist that can bridge the disciplines to bring scalable, secure, maintainable prediction models to life for government agencies.

The role I play is often referred to as machine learning engineer, FWIW.

That’s great! Here are some resources you and your students might be interested in:

Blessings in 2022,
Chris

P.S. How do you prefer to be called on this forum?

2 Likes

I’ve written a lot of PySpark code and would love to contribute to the collaboration if you move toward that technology.

That’s what my implementation did.

What did they find?

That’s even easier to implement…

import numpy as np

N = 10000
generation = np.zeros(N)
generation[0] = 1

for x in xrange(num_generations):
  parent1 = np.take(generation, (np.rand(N) * N).floor())
  parent2 = np.take(generation, (np.rand(N) * N).floor())

  generation = parent1 + parent2 

  if np.alltrue(generation > 0 ):
    print("Generations to universal ancestor: ", x+1)
    break

  if np.alltrue(generation == 0):
    print("Generations till extinction: ", x +1)
    break

That if there are F females and M males each generation, the effective population size is 4FM/(F+M). So when F = N/2 and M = N/2, the effective population size is N. It is when one sex is in short supply that effective size is reduced.

2 Likes

I think you mean np.random.rand() rather than np.rand(). I get this error when I do it your way:

AttributeError: module 'numpy' has no attribute 'rand'

Also, np.take(generation, (np.random.rand(N) * N).floor()) doesn’t work because floor() returns a float, but np.take requires an int. For the sake of readers, here’s the equivalent LOC that works and is perhaps easier to understand:

np.take(generation, np.random.randint(low=0, high=N, size=N))

I’m sure you’d get this in 30 seconds once you sat down with a compiler, Joshua, but some Python tyros may be reading this on the forum.

Happy 2022,
Chris

2 Likes

That seems right. I did call it pseudo code :). When I have a moment I’ll go back and make the fix while crediting you. Thanks!

2 Likes

Please call me Tim!

1 Like

Thank you! We will work from your base.

1 Like

OK! :grin:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.