ben18785 / Selection_simulations

Simulating Wright-Fisher, Moran and Yule processes.
1 stars 1 forks source link

Create simulators for each model in paper #2

Closed ben18785 closed 5 years ago

ben18785 commented 5 years ago
ben18785 commented 5 years ago

Armand's response on email:

Now, is the new scheme WF? I THINK so. But I am having a hard time wrapping my head around exactly the way the two schemes differ. But consider condition 1. If there is no selection, then, you just pick a parent at random from the population to give the child’s phenotype — unless it is a mutant. That’s WF. All that WF needs is that the (1) the population size remain constant (2) you pick ONLY parents who lived in the previous generation (3) you replace all the parents with offspring.

In Moran you replace only one parent and individuals of any age can be parents. And in Yule you just add one child without killing any parents and, again, individuals of any age can be parents.

ben18785 commented 5 years ago

@Armand1, yes, I think that currently the process is WF.

Armand1 commented 5 years ago

@ben18785 I am trying the Moran and Yule simulators prior to handing them to James to run on the HPC. Moran works fine, but Yule not.

At Line 51 I get

Error in py_call_impl(callable, dots$args, dots$keywords) : ValueError: a and p must have same size

Unclear what they are, but I think a and p are perhaps number of generations and population size. I have tried various values, but I think what we want is Yule to start with just 1 individual and then expand from there. Suggestions?

ben18785 commented 5 years ago

Not sure I understand you in terms of function arguments. The function to run Yule is as follows:

YuleRun(aNumGenerations, aPopSize, aMu0, aBeta, aMax)

In your case, aPopSize should be 1; and aMax=1. It runs the Yule process for aNumGenerations, starting at a population size of 1. aMax is just the starting max possible variant id, which is only relevant for larger initial population sizes.

Does that make sense?

On 30 Dec 2018, at 18:58, Armand1 notifications@github.com wrote:

@ben18785 I am trying the Moran and Yule simulators prior to handing them to James to run on the HPC. Moran works fine, but Yule not.

At Line 51 I get

Error in py_call_impl(callable, dots$args, dots$keywords) : ValueError: a and p must have same size

Unclear what they are, but I think a and p are perhaps number of generations and population size. I have tried various values, but I think what we want is Yule to start with just 1 individual and then expand from there. Suggestions?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

Armand1 commented 5 years ago

Kinda. But the fact remains that you gave me one script, in which I have to switch out what comes after Models$... to make it work (either WrightFisherRun, MoranRun or YuleRun). They all have the same four arguments.

In the R script I can set them. For Yule i do this:

general population parameters

num_generations <- 100
pop_size <- 1
mu <- 0.001
selection <- -0.01

AND:
aDF_short <- Models$YuleRun(as.integer(num_generations), as.integer(pop_size), mu, selection, as.integer(pop_size))

And it fails with the above error. Moran and WF do not. Any idea?

Check it out! Github knows R notebook formatting

ben18785 commented 5 years ago

Not yet. Let me have a look when I'm back at a computer. Sorry for the inconvenience.

On 30 Dec 2018, at 22:46, Armand1 notifications@github.com wrote:

Kinda. But the fact remains that you gave me one script, in which I have to switch out what comes after Models$... to make it work (either WrightFisherRun, MoranRun or YuleRun). They all have the same four arguments.

In the R script I can set them. For Yule i do this:

general population parameters

num_generations <- 100 pop_size <- 1 mu <- 0.001 selection <- -0.01

AND: aDF_short <- Models$YuleRun(as.integer(num_generations), as.integer(pop_size), mu, selection, as.integer(pop_size))

And it fails with the above error. Moran and WF do not. Any idea? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.