Closed bodkan closed 7 months ago
How about letting the user specify lists of pairs of population labels like c("NEA", "AFR")
, then internally pulling the correct 0-based SLiM/tskit IDs for those populations out of the model
object, constructing the list of lists, and feeding it into ts$recapitate(..., migration_matrix = <here>)
that happens internally in ts_recapitate
?
I need to think about this more and I should also first read up on how msprime specifies these things.
Is this issue still pending? I have suggestions, if so.
Note that in SLiM 3.7 (and in GitHub now) subpopulations can be given a name
property, which is persisted in the population table in the tree sequence as metadata. So you should be able to refer to population names symbolically on the Python side.
@petrelharp: Yes, still pending. I had no time to think about it and would love to hear your thoughts.
@bhaller: This is great to hear! Thanks for letting me now about this. You're right, this should make it very easy to solve this. I will take a look at the appropriate slendr/pyslim/tskit/msprime/reticulate plumbing.
More generally, this is yet another feature that will significantly simplify the SLiM backend code, retiring this little helper function. 🙂 I will add this to my notes on the SLiM 3.7 transition which I'll deal with in one fell swoop in a single PR when SLiM 3.7 is out. Whenever that happens--I'm still in no rush with regards to that.
Whenever that happens--I'm still in no rush with regards to that.
You may not be in a rush, but I am. :-> It will be released before I go on vacation December 19th, if there is any way I can possibly make that happen. :->
Closing because coalescing lineages by specifying migration_matrix
has been superseded by providing a Demography
Python object directly a long while ago.
I had to add an emergency implementation of migration matrix for recapitation for an internal project. However, the Python way of specifying list-of-lists is supremely unidiomatic for R and also very inconvenient compared to other slendr interfaces which are much easier to use. There must be a more elegant way to do this which would leverage proper population names.