Replies: 3 comments
-
Hello, @VivaswatS! I've not gone into detail in your code, but I can answer your questions:
It simulates the event 1 time unit ago, and we strongly suggest setting effective population sizes to be in actual numbers of individuals, so that everything is in real (i.e., unscaled) units; in which case one time unit is one generation. (However, I see you've set the
Well, I'm hoping this question is answered here: https://tskit.dev/msprime/docs/latest/demography.html#sec-demography-migration - but, I think the expression you have there is correct. I might also suggest simulating just one simulation with a longer sequence (and positive recombination rate), then just using |
Beta Was this translation helpful? Give feedback.
-
One minor point to add to @petrelharp's answer:
I would recommend against mixing the deprecated old-style PopulationConfiguration API here and the newer Demongraphy approach, as it will potentially do confusing things. For example, I don't think the |
Beta Was this translation helpful? Give feedback.
-
Thanks for that quick reply! It seems like I'm not overwriting the I agree that I shouldn't be mixing the two, so I'll switch over to specifying the Demography object separately. |
Beta Was this translation helpful? Give feedback.
-
Hello devs, thanks for the awesome software! I thought I'd post my methodology here and get feedback on the correctness of my approach and/or potential improvements. I'm using version
1.2.0
Sorry for the length of the post! The code to reproduce my simulations is presented at the end. Happy to provide more information.
I am currently working on a framework to model long-range migration events over a background of isolation-by-distance for a simple grid-like structure below (assuming equal population sizes in each deme & equal, symmetric migration rates between demes). Over this 8x10 grid, I add a long-range$s$ ) to destination ($d$ ) forward in time with some strength $c$ and at some time in the recent past $\tau$ , along the indicated arrow. I believe
MassMigration
event (pulse of individuals moving from source (MassMigration
is exactly the kind of behavior I want since: 1) I would like to keep the underlying migration rate map constant following the event, and 2) I want the source & destination demes to continue to exist as usual after the event.Now, I want to be able to model the expected pairwise coalescent times post admixture as a function of the equilibrium pairwise coalescent time (null with no admixture) and the two parameters,$c$ and $\tau$ .$1$ generation ago (and not $1/2N_e$ generations ago)?, 2) how does msprime simulate the movement of lineages between different demes from generation-to-generation given a migration matrix $M$ , where $M_{ij}$ is the expected number of individuals scaled by population size moving from deme $i$ to deme $j$ ? I am modeling the probability that a lineage in deme $i$ ends up in deme $j$ in $\tau$ generations as $\exp((M-\text{diag}(M1))\tau)$ (maybe this is wrong?)
To do this, I need to know: 1) does setting
time=1
inadd_mass_migration()
actually simulate a migration eventCurrently, my model produces unbiased estimates for all expected pairwise coalescent times for$c \in [0,1]$ and $\tau \approx 0$ (in simulations, I see time $=0.00001$ to capture this instantaneous pulse), but overestimates $T_{dd}$ only for $\tau \in {1, 2, \ldots}$ (see figure below for estimated vs simulated values for within-deme coalescent times). This makes me wonder whether I'm simulating what I'm supposed to be modeling (maybe there's a change in units I'm missing) and whether, my model for movement of lineages is correct. But, there's a very slight chance, I could be calculating the pairwise coalescent times from the tree sequences wrong, so I post the code at the end to see if there are any glaring errors.
I use the following code (runs in about ~30 seconds on my machine):
Then, I read the tree sequences back into python to construct the expected pairwise coalescent time matrix (takes about ~45 mins):
Beta Was this translation helpful? Give feedback.
All reactions