Hi Ryan and all wonderful dadi community,
I have 1D models on two populations, one of them follows a two-epoch model and the other a three-epoch. I am trying to integrate these into a 2D split model to calculate the time of the split between the populations. So here are my questions:
1. Do I need to integrate the 1D models in the first place? Or Just a simple split model would do the trick? I am not sure if recent demographic events would affect the way dadi calculates past events.
2. Assuming that I have to do it, how would I have to specify the time of each event? For example, let's assume that at a time T1 in the past they were split. Then population 1 started going through a bottleneck. Following, population 2 started going through a bottleneck which lasts until today. Finally, population 1 recovers.
def split_three_epoch(params, ns, pts):
"""
Population size change after split with two periods of migration after size change.
nu1: Size of population 1 after split
nu1b: bottleneck of pop1
nu1a: Final size of population 1.
nu2: Size of population 2 after split.
nu2a: Final size of poulation size 2.
F1: Inbreeding in population 1.
F2: Inbreeding in population 2.
T1: Time of split (in units of 2*Na generations)
T2: Start of bottleneck (population 1)
T3: Start of bottleneck (population 2)
T4: Recovery (population 1)
"""
nu1, nu2, nu1a, nu1b, nu2a, F1, F2, T1, T2, T3, T4= params
xx = dadi.Numerics.default_grid(pts)
phi = dadi.PhiManip.phi_1D(xx)
phi = dadi.PhiManip.phi_1D_to_2D(xx, phi)
phi = dadi.Integration.two_pops(phi, xx, T1, nu1=nu1, nu2=nu2) # sizes after split
phi = dadi.Integration.two_pops(phi, xx, T2, nu1=nu1b, nu2=nu2) # start of bottleneck pop1
phi = dadi.Integration.two_pops(phi, xx, T3, nu1=nu1b, nu2=nu2a) # start of bottleneck pop2
phi = dadi.Integration.two_pops(phi, xx, T4, nu1=nu1a, nu2=nu2a) # recovery pop1
fs = dadi.Spectrum.from_phi_inbreeding(phi, ns, (xx, xx), (F1, F2), (2, 2))
return fs
So to calculate the total time since the split I would have to add up T1+T2+T3+T4? Or is time calculated separately for the two branches after the split? My tests so far show that this is not the case. Finally, would I need to use an if... statement and modify the model accordingly in case e.g. the bottleneck of population 2 came after the recovery of population 1?
Thank you,
Panagiotis