Module dadi.Demographics1D
Single population demographic models.
Functions
def bottlegrowth(params, ns, pts)-
Expand source code
def bottlegrowth_1d(params, ns, pts): """ Instantanous size change followed by exponential growth. params = (nuB,nuF,T) ns = (n1,) nuB: Ratio of population size after instantanous change to ancient population size nuF: Ratio of contemporary to ancient population size T: Time in the past at which instantaneous change happened and growth began (in units of 2*Na generations) n1: Number of samples in resulting Spectrum pts: Number of grid points to use in integration. """ nuB,nuF,T = params xx = Numerics.default_grid(pts) phi = PhiManip.phi_1D(xx) nu_func = lambda t: nuB*numpy.exp(numpy.log(nuF/nuB) * t/T) phi = Integration.one_pop(phi, xx, T, nu_func) fs = Spectrum.from_phi(phi, ns, (xx,)) return fsInstantanous size change followed by exponential growth.
params = (nuB,nuF,T) ns = (n1,)
nuB: Ratio of population size after instantanous change to ancient population size nuF: Ratio of contemporary to ancient population size T: Time in the past at which instantaneous change happened and growth began (in units of 2*Na generations) n1: Number of samples in resulting Spectrum pts: Number of grid points to use in integration.
def bottlegrowth_1d(params, ns, pts)-
Expand source code
def bottlegrowth_1d(params, ns, pts): """ Instantanous size change followed by exponential growth. params = (nuB,nuF,T) ns = (n1,) nuB: Ratio of population size after instantanous change to ancient population size nuF: Ratio of contemporary to ancient population size T: Time in the past at which instantaneous change happened and growth began (in units of 2*Na generations) n1: Number of samples in resulting Spectrum pts: Number of grid points to use in integration. """ nuB,nuF,T = params xx = Numerics.default_grid(pts) phi = PhiManip.phi_1D(xx) nu_func = lambda t: nuB*numpy.exp(numpy.log(nuF/nuB) * t/T) phi = Integration.one_pop(phi, xx, T, nu_func) fs = Spectrum.from_phi(phi, ns, (xx,)) return fsInstantanous size change followed by exponential growth.
params = (nuB,nuF,T) ns = (n1,)
nuB: Ratio of population size after instantanous change to ancient population size nuF: Ratio of contemporary to ancient population size T: Time in the past at which instantaneous change happened and growth began (in units of 2*Na generations) n1: Number of samples in resulting Spectrum pts: Number of grid points to use in integration.
def growth(params, ns, pts)-
Expand source code
def growth(params, ns, pts): """ Exponential growth beginning some time ago. params = (nu,T) ns = (n1,) nu: Ratio of contemporary to ancient population size T: Time in the past at which growth began (in units of 2*Na generations) n1: Number of samples in resulting Spectrum pts: Number of grid points to use in integration. """ nu,T = params xx = Numerics.default_grid(pts) phi = PhiManip.phi_1D(xx) nu_func = lambda t: numpy.exp(numpy.log(nu) * t/T) phi = Integration.one_pop(phi, xx, T, nu_func) fs = Spectrum.from_phi(phi, ns, (xx,)) return fsExponential growth beginning some time ago.
params = (nu,T) ns = (n1,)
nu: Ratio of contemporary to ancient population size T: Time in the past at which growth began (in units of 2*Na generations) n1: Number of samples in resulting Spectrum pts: Number of grid points to use in integration.
def snm(notused, ns, pts)-
Expand source code
def snm_1d(notused, ns, pts): """ Standard neutral model. ns = (n1,) n1: Number of samples in resulting Spectrum pts: Number of grid points to use in integration. """ xx = Numerics.default_grid(pts) phi = PhiManip.phi_1D(xx) fs = Spectrum.from_phi(phi, ns, (xx,)) return fsStandard neutral model.
ns = (n1,)
n1: Number of samples in resulting Spectrum pts: Number of grid points to use in integration.
def snm_1d(notused, ns, pts)-
Expand source code
def snm_1d(notused, ns, pts): """ Standard neutral model. ns = (n1,) n1: Number of samples in resulting Spectrum pts: Number of grid points to use in integration. """ xx = Numerics.default_grid(pts) phi = PhiManip.phi_1D(xx) fs = Spectrum.from_phi(phi, ns, (xx,)) return fsStandard neutral model.
ns = (n1,)
n1: Number of samples in resulting Spectrum pts: Number of grid points to use in integration.
def three_epoch(params, ns, pts)-
Expand source code
def three_epoch(params, ns, pts): """ params = (nuB,nuF,TB,TF) ns = (n1,) nuB: Ratio of bottleneck population size to ancient pop size nuF: Ratio of contemporary to ancient pop size TB: Length of bottleneck (in units of 2*Na generations) TF: Time since bottleneck recovery (in units of 2*Na generations) n1: Number of samples in resulting Spectrum pts: Number of grid points to use in integration. """ nuB,nuF,TB,TF = params xx = Numerics.default_grid(pts) phi = PhiManip.phi_1D(xx) phi = Integration.one_pop(phi, xx, TB, nuB) phi = Integration.one_pop(phi, xx, TF, nuF) fs = Spectrum.from_phi(phi, ns, (xx,)) return fsparams = (nuB,nuF,TB,TF) ns = (n1,)
nuB: Ratio of bottleneck population size to ancient pop size nuF: Ratio of contemporary to ancient pop size TB: Length of bottleneck (in units of 2Na generations) TF: Time since bottleneck recovery (in units of 2Na generations)
n1: Number of samples in resulting Spectrum pts: Number of grid points to use in integration.
def three_epoch_inbreeding(params, ns, pts)-
Expand source code
def three_epoch_inbreeding(params, ns, pts): """ params = (nuB,nuF,TB,TF,F) ns = (n1,) nuB: Ratio of bottleneck population size to ancient pop size nuF: Ratio of contemporary to ancient pop size TB: Length of bottleneck (in units of 2*Na generations) TF: Time since bottleneck recovery (in units of 2*Na generations) F: Inbreeding coefficent n1: Number of samples in resulting Spectrum pts: Number of grid points to use in integration. """ nuB,nuF,TB,TF,F = params xx = Numerics.default_grid(pts) phi = PhiManip.phi_1D(xx) phi = Integration.one_pop(phi, xx, TB, nuB) phi = Integration.one_pop(phi, xx, TF, nuF) fs = Spectrum.from_phi_inbreeding(phi, ns, (xx,), (F,), (2,)) return fsparams = (nuB,nuF,TB,TF,F) ns = (n1,)
nuB: Ratio of bottleneck population size to ancient pop size nuF: Ratio of contemporary to ancient pop size TB: Length of bottleneck (in units of 2Na generations) TF: Time since bottleneck recovery (in units of 2Na generations) F: Inbreeding coefficent
n1: Number of samples in resulting Spectrum pts: Number of grid points to use in integration.
def two_epoch(params, ns, pts)-
Expand source code
def two_epoch(params, ns, pts): """ Instantaneous size change some time ago. params = (nu,T) ns = (n1,) nu: Ratio of contemporary to ancient population size T: Time in the past at which size change happened (in units of 2*Na generations) n1: Number of samples in resulting Spectrum pts: Number of grid points to use in integration. """ nu,T = params xx = Numerics.default_grid(pts) phi = PhiManip.phi_1D(xx) phi = Integration.one_pop(phi, xx, T, nu) fs = Spectrum.from_phi(phi, ns, (xx,)) return fsInstantaneous size change some time ago.
params = (nu,T) ns = (n1,)
nu: Ratio of contemporary to ancient population size T: Time in the past at which size change happened (in units of 2*Na generations) n1: Number of samples in resulting Spectrum pts: Number of grid points to use in integration.