tracts.phase_type_distribution.PhTDioecious#
- class PhTDioecious(migration_matrix_f, migration_matrix_m, rho_f, rho_m, X_chromosome=False, X_chromosome_male=False, sex_model='DC', TPED=0, setting_TP=None)#
Bases:
PhaseTypeDistributionA subclass of PhaseTypeDistribution providing the specific Phase-Type tools for the Dioecious Fine (DF) and Dioecious Coarse (DC) Markov approximations.
- X_chr#
Whether admixture is considered on the X chromosome. Set to the value given as input by the X_chromosome parameter.
- Type:
bool
- X_chr_male#
If X_chr is True, whether the sex of the individual at generation 0 is male. Set to the value given as input by the X_chromosome_male parameter. If not X_chr, this attribute is ignored.
- Type:
bool
- rho_f#
The female-specific recombination rate, given by the input parameter rho_f.
- rho_m#
The male-specific recombination rate, given by the input parameter rho_m.
- migration_matrix_f#
A transformed version of the female migration matrix given as input. For internal use only.
- Type:
npt.ArrayLike
- migration_matrix_m#
A transformed version of the male migration matrix given as input. For internal use only.
- Type:
npt.ArrayLike
- num_populations#
The number of populations considered in the demographic model.
- Type:
int
- num_generations#
The number of generations considered in the demographic model.
- Type:
int
- t0_proportions_f#
The ancestry proportion in the present population from each ancestry among all the haploid copies inherited from a female parent. For autosomes, computed using Eq. (F-27) in the manuscript. For the X chromosome, computing using the recursive equations (F-28) and (F-29) in the manuscript.
- Type:
npt.ArrayLike
- t0_proportions_m#
The ancestry proportion in the present population from each ancestry among all the haploid copies inherited from a male parent. For autosomes, computed using Eq. (F-27) in the manuscript. For the X chromosome, computing using the recursive equations (F-28) and (F-29) in the manuscript.
- Type:
npt.ArrayLike
- sex_model#
The Dioecious approximation that is being used. Taken from the input parameter sex_model, that is one in ‘DF’, ‘DC’.
- full_transition_matrix_f#
The intensity matrix S(f) of the Dioecious (Fine or Coarse) Markov Model. Corresponds to Eq. (EQ) and (EQ) in the manuscript for DF and DC respectively. This submodel corresponds to the maternally (s1=xi=f) inherited alleles.
- Type:
npt.ArrayLike
- full_transition_matrix_m#
Counterpart of full_transition_matrix_f for the paternally (s1=xi=m) inherited alleles.
- Type:
npt.ArrayLike
- alpha_list_f#
A list containing, for each ancestral population p, the initial state of the (DF or DC) Phase-Type distribution for the tract length of maternally (s1=xi=f) inherited alleles of population p. Correspond to Eq. (EQ) in the manuscript.
- Type:
list
- alpha_list_m#
Counterpart of alpha_list_f for the paternally (s1=xi=m) inherited alleles.
- Type:
list
- transition_matrices_f#
A list containing, for each ancestral population p, the submatrix of full_transition_matrix_f corresponding to transitions within p. It is used to compute the distribution of tract lengths of maternally (s1=xi=f) inherited alleles from population p.
- Type:
list
- transition_matrices_m#
Counterpart of transition_matrices_f for the paternally (s1=xi=m) inherited alleles.
- Type:
list
- S0_list_f#
A list containing the sum across columns of every transition matrix in transition_matrices_f.
- Type:
list
- S0_list_m#
Counterpart of S0_list_f for the paternally (s1=xi=m) inherited alleles.
- Type:
list
- inverse_S0_list_f#
A list containing the sum across columns of the inverse of every transition matrix in transition_matrices_f.
- Type:
list
- inverse_S0_list_m#
Counterpart of inverse_S0_list_f for the paternally (s1=xi=m) inherited alleles.
- Type:
list
- Parameters:
migration_matrix_f (npt.ArrayLike) – An array containing the female migration proportions from a discrete number of populations over the last generations. Each row is a time, each column is a population. Row zero corresponds to the current generation. T The (i,j) element of this matrix specifies the proportion of female individuals from the admixed population that are replaced by female individuals from population j at generation i. The migration rate at the last generation (migration_matrix_f[-1,:]) is the “founding generation” and should sum up to 1.
migration_matrix_m (npt.ArrayLike) – Counterpart of migration_matrix_f for male migration rates.
rho_f (float, default 1) – The female-specific recombination rate (positive real number).
rho_m (float, default 1) – The male-specific recombination rate (positive real number). For X chromosome admixture, this value is ignored and set to 0.
X_chromosome (bool, default False) – Whether admixture is considered on the X chromosome. If False, the model considers autosomal admixture.
X_chromosome_male (bool, default False) – If X_chromosome is True, whether the individual at generation 0 is a male. In that case, only maternally inherited alleles are taken into account. If not X_chromosome, set to False.
sex_model (default 'DC') – The Dioecious model to be considered. Takes the value ‘DF’ for Dioecious Fine and ‘DC’ for Dioecious Coarse.
TPED (int, default 0) – For internal use only.
setting_TP (default None) – For internal use only.
Notes
The Dioecious Coarse model (sex_model = ‘DC’) should be preferred over the Dioecious Fine model (sex_model = ‘DF’) due to its computational efficiency. Both models produce very similar or identical phase-type densities unless there is a strong sex bias in migration or recombination rates. For autosomal admixture, the Monoecious model should be used instead, for the same reasons, unless the sex bias is exceptionally strong.