ctlab / GADMA

Genetic Algorithm for Demographic Model Analysis
Other
47 stars 14 forks source link

dadi code for 3 population model #65

Closed SamWittwer closed 2 years ago

SamWittwer commented 2 years ago

Hello @noscode

I have another question regarding GADMA, sorry for being such a high-maintenance user. The results are sort of making sense so I'm actually quite optimistic when looking at the plot for the best-performing model! I've successfully finished an initial run for a 3-population model but the dadi code generated by GADMA is unfortunately not working. But the results are starting to make sense so I'm actually quite optimistic when looking at the plot for the best-performing model! I've attached the model code (changed to .txt as github wouldn't let me attach it otherwise) best_logLL_model_dadi_code.py.txt

unfortunately, when I try to run this model code, it runs into an undefined variable _Nanc_size. Obviously this should be the ancestral population size according to the variable name. I've tried adding it using the value for Nanc at the end of the script but then the model crashes with a masked array when I run it like this.

I ran the model with split fractions enabled. Should I try rerunning it with this set to false? Or could this be a bug in the parsing of the dadi model code?

Cheers

Sam

noscode commented 2 years ago

Hello @SamWittwer,

Thank you very much for software usage and your feedback! That is also one small bug, but it is really small and easily fixed. The variable _Nanc_size that is missed should be equal to 1.0 (it is in genetic units, so relative to ancestral size). You have two options:

1) Change _Nanc_size everywhere in the file (it probably will be one line only) to 1.0 2) Put line Nanc_size = 1.0 at the beginning of model_func. It will be better to put it on the line 6 of the file.

This bug will be fixed in the next release!

Best regards, Ekaterina

SamWittwer commented 2 years ago

Hello @noscode

Awesome thank you, I greatly appreciate your support. You will definitely be listed in the acknowledgements for this paper given the constant questions from my side :-)

I do have another couple follow-up questions:

Thank you again for the support! Sam

noscode commented 2 years ago

Hi @SamWittwer!

1) Yes, time will be in generations. Migrations are a bit tricky: m12 means the number of individuals in population 1 that are from population 2. So it is migration 2-> 1 actually. 2) if the model has values equal to 0 then you can just remove them and got the same answer. You have perform additional runs (with migrations masks I think) if the values are not zero but very close to zero. Because in such case the result will differ. I think that is up to you.

Best regards, Ekaterina

SamWittwer commented 2 years ago

Awesome thanks, analyses are running again. Can't wait to get the results!