Module dadi.Polyploidy.auto_demographics

Functions

def bottlegrowth(params, ns, pts)
Expand source code
def bottlegrowth(params, ns, pts):
    """
    Bottlegrowth model of autotetraploid formation where the 
    autotetraploid population starts with size nuWGD and 
    grows exponentially to a size of nuF
    
    Parameters:
        params (tuple): (T_WGD, nuWGD, nuF)

            - T_WGD: Time in the past at which the WGD occurred, creating the  
               autotetraploid population (in units of 2*Na generations).

            - nuWGD: Ratio of autotetraploid population immediately after WGD
                to ancestral diploid population size (ratio of *census* sizes).

            - nuF: Ratio of contemporary autotetraploid population
                to ancestral diploid population size (ratio of *census* sizes).
        ns (tuple): Sample sizes (n1,).
        pts (int): Number of grid points to use in integration.

    Returns:
        fs (Spectrum): The resulting frequency spectrum.
    """
    T_WGD, nuWGD, nuF = params
    nu_f = lambda t: nuWGD*numpy.exp(numpy.log(nuF/nuWGD) * t/T_WGD)
    autoflag = PolyInt.PloidyType.AUTO
    xx = Numerics.default_grid(pts)
    phi = PhiManip.phi_1D(xx)
    phi = PolyInt.one_pop(phi, xx, T_WGD, nu=nu_f, ploidyflag=autoflag)
    fs = Spectrum.from_phi(phi, ns, (xx,))
    return fs

Bottlegrowth model of autotetraploid formation where the autotetraploid population starts with size nuWGD and grows exponentially to a size of nuF

Parameters

params (tuple): (T_WGD, nuWGD, nuF)

- T_WGD: Time in the past at which the WGD occurred, creating the  
   autotetraploid population (in units of 2*Na generations).

- nuWGD: Ratio of autotetraploid population immediately after WGD
    to ancestral diploid population size (ratio of *census* sizes).

- nuF: Ratio of contemporary autotetraploid population
    to ancestral diploid population size (ratio of *census* sizes).

ns (tuple): Sample sizes (n1,). pts (int): Number of grid points to use in integration.

Returns

fs (Spectrum): The resulting frequency spectrum.

def bottlegrowth_asym_mig_w_dips(params, ns, pts)
Expand source code
def bottlegrowth_asym_mig_w_dips(params, ns, pts):
    """
    Two population model of autotetraploid formation where the 
    autotetraploid population splits and maintains a size of nu_auto.

    Parameters:
        params (tuple): (T_WGD, nuB, nuF, m12, m21)

            - T_WGD: Time in the past at which the WGD occurred, creating the  
               autotetraploid population (in units of 2*Na generations).

            - nuB: Ratio of bottlenecked autotetraploid to ancestral diploid population size s
               (ratio of *census* sizes).

            - nuF: Ratio of final or contemporary autotetraploid to ancestral diploid population size 
               (ratio of *census* sizes).

            - m12: migration rate from pop 2 (auotetraploids) into pop 1 (diploids) (2*Na*m12)

            - m21: migration rate from pop 1 (diploids) into pop 2 (auotetraploids) (2*Na*m21)
        ns (tuple): Sample sizes (n1, n2).
        pts (int): Number of grid points to use in integration.

    Returns:
        fs (Spectrum): The resulting frequency spectrum.

    Raises:
        ValueError: If `params` does not contain the expected number of elements.
    """
    T_WGD, nuB, nuF, m12, m21 = params

    autoflag = PolyInt.PloidyType.AUTO

    xx = Numerics.default_grid(pts)
    phi = PhiManip.phi_1D(xx)
    phi = PhiManip.phi_1D_to_2D(xx, phi)
    
    # set up the nu_func for only the auotetraploid population
    nu_func = lambda t: nuB*numpy.exp(numpy.log(nuF/nuB)* t/T_WGD)
    
    # Note: here, we set pop1 = dips and pop2 = autos
    phi = PolyInt.two_pops(phi, xx, T_WGD, nu2=nu_func, m12=m12, m21=m21, ploidyflag2=autoflag)
    
    fs = Spectrum.from_phi(phi, ns, (xx,xx))
    return fs

Two population model of autotetraploid formation where the autotetraploid population splits and maintains a size of nu_auto.

Parameters

params (tuple): (T_WGD, nuB, nuF, m12, m21)

- T_WGD: Time in the past at which the WGD occurred, creating the  
   autotetraploid population (in units of 2*Na generations).

- nuB: Ratio of bottlenecked autotetraploid to ancestral diploid population size s
   (ratio of *census* sizes).

- nuF: Ratio of final or contemporary autotetraploid to ancestral diploid population size 
   (ratio of *census* sizes).

- m12: migration rate from pop 2 (auotetraploids) into pop 1 (diploids) (2*Na*m12)

- m21: migration rate from pop 1 (diploids) into pop 2 (auotetraploids) (2*Na*m21)

ns (tuple): Sample sizes (n1, n2). pts (int): Number of grid points to use in integration.

Returns

fs (Spectrum): The resulting frequency spectrum.

Raises

ValueError
If params does not contain the expected number of elements.
def bottlegrowth_dip_size_change(params, ns, pts)
Expand source code
def bottlegrowth_dip_size_change(params, ns, pts):
    """
    Two population model of autotetraploid formation where the 
    autotetraploid population splits and maintains a size of nu_auto.

    Parameters:
        params (tuple): (T_WGD, T_dip, nuB, nuF, nu_dip)

            - T_WGD: Time between the WGD and diploid size change (in units of 2*Na generations).

            - T_dip: Time in the past at which the diploid population changes size
                (in units of 2*Na generations).

            - nuB: Ratio of bottlenecked autotetraploid to ancestral diploid population size s
               (ratio of *census* sizes).

            - nuF: Ratio of final or contemporary autotetraploid to ancestral diploid population size 
               (ratio of *census* sizes).

            - nu_dip: Ratio of contemporary diploid population to ancestral diploid population size

        ns (tuple): Sample sizes (n1, n2).
        pts (int): Number of grid points to use in integration.

    Returns:
        fs (Spectrum): The resulting frequency spectrum.

    Raises:
        ValueError: If `params` does not contain the expected number of elements.
    """
    T_WGD, T_dip, nuB, nuF, nu_dip = params

    return bottlegrowth_dip_size_change_asym_mig((T_WGD, T_dip, nuB, nuF, nu_dip, 0, 0), ns, pts)

Two population model of autotetraploid formation where the autotetraploid population splits and maintains a size of nu_auto.

Parameters

params (tuple): (T_WGD, T_dip, nuB, nuF, nu_dip)

- T_WGD: Time between the WGD and diploid size change (in units of 2*Na generations).

- T_dip: Time in the past at which the diploid population changes size
    (in units of 2*Na generations).

- nuB: Ratio of bottlenecked autotetraploid to ancestral diploid population size s
   (ratio of *census* sizes).

- nuF: Ratio of final or contemporary autotetraploid to ancestral diploid population size 
   (ratio of *census* sizes).

- nu_dip: Ratio of contemporary diploid population to ancestral diploid population size

ns (tuple): Sample sizes (n1, n2). pts (int): Number of grid points to use in integration.

Returns

fs (Spectrum): The resulting frequency spectrum.

Raises

ValueError
If params does not contain the expected number of elements.
def bottlegrowth_dip_size_change_asym_mig(params, ns, pts)
Expand source code
def bottlegrowth_dip_size_change_asym_mig(params, ns, pts):
    """
    Two population model of autotetraploid formation where the 
    autotetraploid population splits and maintains a size of nu_auto.

    Parameters:
        params (tuple): (T_WGD, T_dip, nuB, nuF, nu_dip, m12, m21)

            - T_WGD: Time between the WGD and diploid size change (in units of 2*Na generations).

            - T_dip: Time in the past at which the diploid population changes size
                (in units of 2*Na generations).

            - nuB: Ratio of bottlenecked autotetraploid to ancestral diploid population size s
               (ratio of *census* sizes).

            - nuF: Ratio of final or contemporary autotetraploid to ancestral diploid population size 
               (ratio of *census* sizes).

            - nu_dip: Ratio of contemporary diploid population to ancestral diploid population size

            - m12: migration rate from pop 2 (auotetraploids) into pop 1 (diploids) (2*Na*m12)

            - m21: migration rate from pop 1 (diploids) into pop 2 (auotetraploids) (2*Na*m21)
        ns (tuple): Sample sizes (n1, n2).
        pts (int): Number of grid points to use in integration.

    Returns:
        fs (Spectrum): The resulting frequency spectrum.

    Raises:
        ValueError: If `params` does not contain the expected number of elements.
    """
    T_WGD, T_dip, nuB, nuF, nu_dip, m12, m21 = params

    autoflag = PolyInt.PloidyType.AUTO

    xx = Numerics.default_grid(pts)
    phi = PhiManip.phi_1D(xx)
    phi = PhiManip.phi_1D_to_2D(xx, phi)
    
    T_total = T_WGD + T_dip
    # set up the nu_func for only the auotetraploid population
    nu_func = lambda t: nuB*numpy.exp(numpy.log(nuF/nuB)* t/T_total)
    
    # Note: here, we set pop1 = dips and pop2 = autos
    # integrate from the WGD to dip size change
    phi = PolyInt.two_pops(phi, xx, T_WGD, nu2=nu_func, m12=m12, m21=m21, ploidyflag2=autoflag)
    # integrate from dip size change to the present
    phi = PolyInt.two_pops(phi, xx, T_total, nu1=nu_dip, nu2=nu_func, m12=m12, m21=m21, ploidyflag2=autoflag, initial_t = T_WGD)

    fs = Spectrum.from_phi(phi, ns, (xx,xx))
    return fs

Two population model of autotetraploid formation where the autotetraploid population splits and maintains a size of nu_auto.

Parameters

params (tuple): (T_WGD, T_dip, nuB, nuF, nu_dip, m12, m21)

- T_WGD: Time between the WGD and diploid size change (in units of 2*Na generations).

- T_dip: Time in the past at which the diploid population changes size
    (in units of 2*Na generations).

- nuB: Ratio of bottlenecked autotetraploid to ancestral diploid population size s
   (ratio of *census* sizes).

- nuF: Ratio of final or contemporary autotetraploid to ancestral diploid population size 
   (ratio of *census* sizes).

- nu_dip: Ratio of contemporary diploid population to ancestral diploid population size

- m12: migration rate from pop 2 (auotetraploids) into pop 1 (diploids) (2*Na*m12)

- m21: migration rate from pop 1 (diploids) into pop 2 (auotetraploids) (2*Na*m21)

ns (tuple): Sample sizes (n1, n2). pts (int): Number of grid points to use in integration.

Returns

fs (Spectrum): The resulting frequency spectrum.

Raises

ValueError
If params does not contain the expected number of elements.
def bottlegrowth_dip_size_change_mig(params, ns, pts)
Expand source code
def bottlegrowth_dip_size_change_mig(params, ns, pts):
    """
    Two population model of autotetraploid formation where the 
    autotetraploid population splits and maintains a size of nu_auto.

    Parameters:
        params (tuple): (T_WGD, T_dip, nuB, nuF, nu_dip, m)

            - T_WGD: Time between the WGD and diploid size change (in units of 2*Na generations).

            - T_dip: Time in the past at which the diploid population changes size
                (in units of 2*Na generations).

            - nuB: Ratio of bottlenecked autotetraploid to ancestral diploid population size s
               (ratio of *census* sizes).

            - nuF: Ratio of final or contemporary autotetraploid to ancestral diploid population size 
               (ratio of *census* sizes).

            - nu_dip: Ratio of contemporary diploid population to ancestral diploid population size

            - m: symmetric migration rate between the two populations (2*Na*m)
        ns (tuple): Sample sizes (n1, n2).
        pts (int): Number of grid points to use in integration.

    Returns:
        fs (Spectrum): The resulting frequency spectrum.

    Raises:
        ValueError: If `params` does not contain the expected number of elements.
    """
    T_WGD, T_dip, nuB, nuF, nu_dip, m = params

    return bottlegrowth_dip_size_change_asym_mig((T_WGD, T_dip, nuB, nuF, nu_dip, m, m), ns, pts)

Two population model of autotetraploid formation where the autotetraploid population splits and maintains a size of nu_auto.

Parameters

params (tuple): (T_WGD, T_dip, nuB, nuF, nu_dip, m)

- T_WGD: Time between the WGD and diploid size change (in units of 2*Na generations).

- T_dip: Time in the past at which the diploid population changes size
    (in units of 2*Na generations).

- nuB: Ratio of bottlenecked autotetraploid to ancestral diploid population size s
   (ratio of *census* sizes).

- nuF: Ratio of final or contemporary autotetraploid to ancestral diploid population size 
   (ratio of *census* sizes).

- nu_dip: Ratio of contemporary diploid population to ancestral diploid population size

- m: symmetric migration rate between the two populations (2*Na*m)

ns (tuple): Sample sizes (n1, n2). pts (int): Number of grid points to use in integration.

Returns

fs (Spectrum): The resulting frequency spectrum.

Raises

ValueError
If params does not contain the expected number of elements.
def bottlegrowth_mig_w_dips(params, ns, pts)
Expand source code
def bottlegrowth_mig_w_dips(params, ns, pts):
    """
    Two population model of autotetraploid formation where the 
    autotetraploid population splits and maintains a size of nu_auto.

    Parameters:
        params (tuple): (T_WGD, nuB, nuF, m)

            - T_WGD: Time in the past at which the WGD occurred, creating the  
               autotetraploid population (in units of 2*Na generations).

            - nuB: Ratio of bottlenecked autotetraploid to ancestral diploid population size s
               (ratio of *census* sizes).

            - nuF: Ratio of final or contemporary autotetraploid to ancestral diploid population size 
               (ratio of *census* sizes).

            - m: symmetric migration rate between the two populations (2*Na*m)
        ns (tuple): Sample sizes (n1, n2).
        pts (int): Number of grid points to use in integration.

    Returns:
        fs (Spectrum): The resulting frequency spectrum.

    Raises:
        ValueError: If `params` does not contain the expected number of elements.
    """
    T_WGD, nuB, nuF, m = params

    return bottlegrowth_asym_mig_w_dips((T_WGD, nuB, nuF, m, m), ns, pts)

Two population model of autotetraploid formation where the autotetraploid population splits and maintains a size of nu_auto.

Parameters

params (tuple): (T_WGD, nuB, nuF, m)

- T_WGD: Time in the past at which the WGD occurred, creating the  
   autotetraploid population (in units of 2*Na generations).

- nuB: Ratio of bottlenecked autotetraploid to ancestral diploid population size s
   (ratio of *census* sizes).

- nuF: Ratio of final or contemporary autotetraploid to ancestral diploid population size 
   (ratio of *census* sizes).

- m: symmetric migration rate between the two populations (2*Na*m)

ns (tuple): Sample sizes (n1, n2). pts (int): Number of grid points to use in integration.

Returns

fs (Spectrum): The resulting frequency spectrum.

Raises

ValueError
If params does not contain the expected number of elements.
def bottlegrowth_w_dips(params, ns, pts)
Expand source code
def bottlegrowth_w_dips(params, ns, pts):
    """
    Two population model of autotetraploid formation where the 
    autotetraploid population splits and maintains a size of nu_auto.

    Parameters:
        params (tuple): (T_WGD, nuB, nuF)

            - T_WGD: Time in the past at which the WGD occurred, creating the  
               autotetraploid population (in units of 2*Na generations).

            - nuB: Ratio of bottlenecked autotetraploid to ancestral diploid population size s
               (ratio of *census* sizes).

            - nuF: Ratio of final or contemporary autotetraploid to ancestral diploid population size 
               (ratio of *census* sizes).

        ns (tuple): Sample sizes (n1, n2).
        pts (int): Number of grid points to use in integration.

    Returns:
        fs (Spectrum): The resulting frequency spectrum.

    Raises:
        ValueError: If `params` does not contain the expected number of elements.
    """
    T_WGD, nuB, nuF = params

    return bottlegrowth_asym_mig_w_dips((T_WGD, nuB, nuF, 0, 0), ns, pts)

Two population model of autotetraploid formation where the autotetraploid population splits and maintains a size of nu_auto.

Parameters

params (tuple): (T_WGD, nuB, nuF)

- T_WGD: Time in the past at which the WGD occurred, creating the  
   autotetraploid population (in units of 2*Na generations).

- nuB: Ratio of bottlenecked autotetraploid to ancestral diploid population size s
   (ratio of *census* sizes).

- nuF: Ratio of final or contemporary autotetraploid to ancestral diploid population size 
   (ratio of *census* sizes).

ns (tuple): Sample sizes (n1, n2). pts (int): Number of grid points to use in integration.

Returns

fs (Spectrum): The resulting frequency spectrum.

Raises

ValueError
If params does not contain the expected number of elements.
def bottleneck_asym_mig_w_dips(params, ns, pts)
Expand source code
def bottleneck_asym_mig_w_dips(params, ns, pts):
    """
    Two population model of autotetraploid formation with subsequent migration where the 
    autotetraploid population splits and maintains a bottlenecked size of nu_auto.
    
    Parameters:
        params (tuple): (T_WGD, nu_auto, m12, m21)

            - T_WGD: Time in the past at which the WGD occurred, creating the  
               autotetraploid population (in units of 2*Na generations).

            - nu_auto: Ratio of contemporary autotetraploid to ancestral diploid population size 
               (ratio of *census* sizes).

            - m12: migration rate from pop 2 (auotetraploids) into pop 1 (diploids) (2*Na*m12)

            - m21: migration rate from pop 1 (diploids) into pop 2 (auotetraploids) (2*Na*m21)
        ns (tuple): Sample sizes (n1, n2).
        pts (int): Number of grid points to use in integration.

    Returns:
        fs (Spectrum): The resulting frequency spectrum.

    Raises:
        ValueError: If `params` does not contain the expected number of elements.
    """
    T_WGD, nu_auto, m12, m21 = params

    autoflag = PolyInt.PloidyType.AUTO

    xx = Numerics.default_grid(pts)
    phi = PhiManip.phi_1D(xx)
    phi = PhiManip.phi_1D_to_2D(xx, phi)

    # Note: here, we set pop1 = dips and pop2 = autos
    # integrate from the WGD to the present
    phi = PolyInt.two_pops(phi, xx, T_WGD, nu2=nu_auto, m12=m12, m21=m21,
                           ploidyflag2=autoflag)
    
    fs = Spectrum.from_phi(phi, ns, (xx,xx)) 
    return fs

Two population model of autotetraploid formation with subsequent migration where the autotetraploid population splits and maintains a bottlenecked size of nu_auto.

Parameters

params (tuple): (T_WGD, nu_auto, m12, m21)

- T_WGD: Time in the past at which the WGD occurred, creating the  
   autotetraploid population (in units of 2*Na generations).

- nu_auto: Ratio of contemporary autotetraploid to ancestral diploid population size 
   (ratio of *census* sizes).

- m12: migration rate from pop 2 (auotetraploids) into pop 1 (diploids) (2*Na*m12)

- m21: migration rate from pop 1 (diploids) into pop 2 (auotetraploids) (2*Na*m21)

ns (tuple): Sample sizes (n1, n2). pts (int): Number of grid points to use in integration.

Returns

fs (Spectrum): The resulting frequency spectrum.

Raises

ValueError
If params does not contain the expected number of elements.
def bottleneck_mig_w_dips(params, ns, pts)
Expand source code
def bottleneck_mig_w_dips(params, ns, pts):
    """
    Two population model of autotetraploid formation with subsequent migration where the 
    autotetraploid population splits and maintains a bottlenecked size of nu_auto.
    
    Parameters:
        params (tuple): (T_WGD, nu_auto, m)

            - T_WGD: Time in the past at which the WGD occurred, creating the  
               autotetraploid population (in units of 2*Na generations).

            - nu_auto: Ratio of contemporary autotetraploid to ancestral diploid population size 
               (ratio of *census* sizes).

            - m: symmetric migration rate between the two populations (2*Na*m)
        ns (tuple): Sample sizes (n1, n2).
        pts (int): Number of grid points to use in integration.

    Returns:
        fs (Spectrum): The resulting frequency spectrum.

    Raises:
        ValueError: If `params` does not contain the expected number of elements.
    """
    T_WGD, nu_auto, m = params

    return bottleneck_asym_mig_w_dips((T_WGD, nu_auto, m, m), ns, pts)

Two population model of autotetraploid formation with subsequent migration where the autotetraploid population splits and maintains a bottlenecked size of nu_auto.

Parameters

params (tuple): (T_WGD, nu_auto, m)

- T_WGD: Time in the past at which the WGD occurred, creating the  
   autotetraploid population (in units of 2*Na generations).

- nu_auto: Ratio of contemporary autotetraploid to ancestral diploid population size 
   (ratio of *census* sizes).

- m: symmetric migration rate between the two populations (2*Na*m)

ns (tuple): Sample sizes (n1, n2). pts (int): Number of grid points to use in integration.

Returns

fs (Spectrum): The resulting frequency spectrum.

Raises

ValueError
If params does not contain the expected number of elements.
def bottleneck_w_dips(params, ns, pts)
Expand source code
def bottleneck_w_dips(params, ns, pts):
    """
    Two population model of autotetraploid formation where the 
    autotetraploid population splits and maintains a bottlenecked size of nu_auto.
    
    Parameters:
        params (tuple): (T_WGD, nu_auto)

            - T_WGD: Time in the past at which the WGD occurred, creating the  
               autotetraploid population (in units of 2*Na generations).

            - nu_auto: Ratio of contemporary autotetraploid to ancestral diploid population size 
               (ratio of *census* sizes).
        ns (tuple): Sample sizes (n1, n2).
        pts (int): Number of grid points to use in integration.

    Returns:
        fs (Spectrum): The resulting frequency spectrum.

    Raises:
        ValueError: If `params` does not contain the expected number of elements.
    """
    T_WGD, nu_auto = params
    return bottleneck_asym_mig_w_dips((T_WGD, nu_auto, 0, 0), ns, pts)

Two population model of autotetraploid formation where the autotetraploid population splits and maintains a bottlenecked size of nu_auto.

Parameters

params (tuple): (T_WGD, nu_auto)

- T_WGD: Time in the past at which the WGD occurred, creating the  
   autotetraploid population (in units of 2*Na generations).

- nu_auto: Ratio of contemporary autotetraploid to ancestral diploid population size 
   (ratio of *census* sizes).

ns (tuple): Sample sizes (n1, n2). pts (int): Number of grid points to use in integration.

Returns

fs (Spectrum): The resulting frequency spectrum.

Raises

ValueError
If params does not contain the expected number of elements.
def snm(notused, ns, pts, theta0=1)
Expand source code
def snm(notused, ns, pts, theta0=1):
    """
    ns = (n1,)

    Standard neutral model for a single autotetraploid population.
    """
    xx = Numerics.default_grid(pts)
    phi = PhiManip_supp.phi_1D_autotet(xx, theta0=theta0)
    fs = Spectrum.from_phi(phi, ns, (xx,))
    return fs

ns = (n1,)

Standard neutral model for a single autotetraploid population.

def three_epoch(params, ns, pts)
Expand source code
def three_epoch(params, ns, pts):
    """
    Three epoch model of autotetraploid formation where the 
    autotetraploid population splits, maintains a size of nuWGD for T_WGD, 
    and then changes size again to nu_c for a period of TF.
    This is similar to having a bottleneck for some period and then recover after the bottleneck.
    
    Parameters:
        params (tuple): (T_WGD, TF, nuWGD, nuF)

            - T_WGD: Time length between the WGD event and second size change, creating the  
               autotetraploid population (in units of 2*Na generations).

            - TF: Time in the past at which the second epoch begins.

            - nuWGD: Ratio of initial autotetraploid population (during first epoch)
                 to ancestral diploid population size (ratio of *census* sizes).

            - nuF: Ratio of contemporary autotetraploid population (during second epoch)
                 to ancestral diploid population size (ratio of *census* sizes).
        ns (tuple): Sample sizes (n1,).
        pts (int): Number of grid points to use in integration.

    Returns:
        fs (Spectrum): The resulting frequency spectrum.
    """
    T_WGD, TF, nuWGD, nuF  = params
    autoflag = PolyInt.PloidyType.AUTO
    xx = Numerics.default_grid(pts)
    phi = PhiManip.phi_1D(xx)
    phi = PolyInt.one_pop(phi, xx, T_WGD, nu=nuWGD, ploidyflag=autoflag)
    phi = PolyInt.one_pop(phi, xx, TF, nu=nuF, ploidyflag=autoflag)
    fs = Spectrum.from_phi(phi, ns, (xx,))
    return fs

Three epoch model of autotetraploid formation where the autotetraploid population splits, maintains a size of nuWGD for T_WGD, and then changes size again to nu_c for a period of TF. This is similar to having a bottleneck for some period and then recover after the bottleneck.

Parameters

params (tuple): (T_WGD, TF, nuWGD, nuF)

- T_WGD: Time length between the WGD event and second size change, creating the  
   autotetraploid population (in units of 2*Na generations).

- TF: Time in the past at which the second epoch begins.

- nuWGD: Ratio of initial autotetraploid population (during first epoch)
     to ancestral diploid population size (ratio of *census* sizes).

- nuF: Ratio of contemporary autotetraploid population (during second epoch)
     to ancestral diploid population size (ratio of *census* sizes).

ns (tuple): Sample sizes (n1,). pts (int): Number of grid points to use in integration.

Returns

fs (Spectrum): The resulting frequency spectrum.

def two_epoch(params, ns, pts)
Expand source code
def two_epoch(params, ns, pts):
    """
    Two epoch model of autotetraploid formation where the 
    autotetraploid population splits and maintains a size of nu.
    
    Parameters:
        params (tuple): (T_WGD, nu)

            - T_WGD: Time in the past at which the WGD occurred, creating the  
               autotetraploid population (in units of 2*Na generations).

            - nu: Ratio of contemporary autotetraploid to ancestral diploid population size 
               (ratio of *census* sizes).
        ns (tuple): Sample sizes (n1,).
        pts (int): Number of grid points to use in integration.

    Returns:
        fs (Spectrum): The resulting frequency spectrum.
    """
    T_WGD, nu = params
    autoflag = PolyInt.PloidyType.AUTO
    xx = Numerics.default_grid(pts)
    phi = PhiManip.phi_1D(xx)
    phi = PolyInt.one_pop(phi, xx, T_WGD, nu=nu, ploidyflag=autoflag)
    fs = Spectrum.from_phi(phi, ns, (xx,))
    return fs

Two epoch model of autotetraploid formation where the autotetraploid population splits and maintains a size of nu.

Parameters

params (tuple): (T_WGD, nu)

- T_WGD: Time in the past at which the WGD occurred, creating the  
   autotetraploid population (in units of 2*Na generations).

- nu: Ratio of contemporary autotetraploid to ancestral diploid population size 
   (ratio of *census* sizes).

ns (tuple): Sample sizes (n1,). pts (int): Number of grid points to use in integration.

Returns

fs (Spectrum): The resulting frequency spectrum.