Note
Go to the end to download the full example code.
ASW inference - Three pulses model#
This example implements inference for the ASW population under a three pulses model of admixture, using the tracts package. Inference is performed using autosomal and X chromosome data, allowing for the specification of sex-biased admixture.
To implement this example, we use the following driver file:
samples:
directory: ../ASW_TrioPhased
individual_names: [
"NA19625","NA19700","NA19701","NA19703","NA19704","NA19707","NA19711","NA19712","NA19713","NA19818","NA19819",
"NA19834","NA19835","NA19900","NA19901","NA19904","NA19908","NA19909","NA19913","NA19914","NA19916","NA19917",
"NA19920","NA19921","NA19922","NA19923","NA19982","NA19984","NA20126","NA20127","NA20274","NA20276","NA20278",
"NA20281","NA20282","NA20287","NA20289","NA20291","NA20294","NA20296","NA20298","NA20299","NA20314","NA20317",
"NA20318","NA20320","NA20321","NA20332","NA20334","NA20339","NA20340","NA20342","NA20346","NA20348","NA20351",
"NA20355","NA20356","NA20357","NA20359","NA20362","NA20412"]
male_names : [
"NA19700","NA19703","NA19711","NA19818","NA19834","NA19900","NA19904","NA19908","NA19916","NA19920",
"NA19922","NA19982","NA19984","NA20126","NA20278","NA20281","NA20291","NA20298","NA20318","NA20340",
"NA20342","NA20346","NA20348","NA20351","NA20356","NA20362"] #see Readme_dataprocessing.md for how this was generated
filename_format: "{name}_{label}_final.bed"
labels: [A, B] #If this field is omitted, 'A' and 'B' will be used by default
chromosomes: 1-22 #The chromosomes to use for analysis. Can be specified as a list or a range
allosomes: [X]
models:
model_filename: ../models/ppx_xxp_pxx.yaml
ad_model_autosomes: M
ad_model_allosomes: DC
start_params:
t1: 9.65:10.25
REUR: 0.78:0.82
RAFR: 0.87:0.91
REUR2: 0.18:0.22
t2: 6.60:7.20
t3: 3.18:3.78
REUR_sex_bias: 0.00:0.04
REUR2_sex_bias: 0.12:0.16
RAFR_sex_bias: 0.07:0.11
optim:
repetitions: 3
seed: 100
maximum_iterations: 1000
npts: 50
exclude_tracts_below_cm: 2
unknown_labels_for_smoothing: ["UNK", "centromere","miscall"] # segments with these labels will be smoother over, that is, will be filled with neighbouring ancestries up to their midpoints.
n_reoptimizations: 5
rerun_optimization_on_boundaries: False
output:
output_directory: ./output_three_pulses/
log_filename: 'ASW_three_pulses.log'
verbose_log: 1
verbose_screen: 30
log_scale: True
Complete results from this analysis are saved in the output directory specified in the driver file. Below, we display the optimal parameters estimated from this analysis, as well as the plots illustrating the inferred tract length distributions, compared to the observed histograms, for every source population and chromosome type (autosomes and X chromosome).
Optimal parameters#
parameter |
value |
|---|---|
REUR |
0.778929382286156 |
REUR_sex_bias |
-0.02430744447404265 |
t1 |
8.85786226090348 |
RAFR |
0.889672013014297 |
RAFR_sex_bias |
-0.07818643113801149 |
t2 |
7.683286672855759 |
REUR2 |
0.15279640784277027 |
REUR2_sex_bias |
0.13440014472248274 |
t3 |
5.579620210712479 |
targetpop_AMR_rate |
0.22107061771384395 |
targetpop_AMR_sex_bias |
0.024307444474042778 |
likelihood -1000.46 |
Optimal migration matrices#
Tract length histograms#
Autosomal admixture#
X chromosome admixture#
------------------------------------------------------------------------------------------------
Running tracts 2.0 with driver file: /home/runner/work/tracts/tracts/example/documentation_examples/ASW/ASW_three_pulses.yaml
------------------------------------------------------------------------------------------------
Results will be written to: output_three_pulses.
Using log file: output_three_pulses/ASW_three_pulses.log.
excluding_tracts_below set to 2.0 cM.
Re-optimization will be performed until convergence or maximum 5 times.
Ancestries: EUR, AMR, AFR
Data autosome proportions: [0.19578862 0.03825495 0.76595643]
Data allosome proportions: [0.16839124 0.03818939 0.79341937]
Model parameters and bounds:
--------------------------------------------
Parameter | Lower bound | Upper bound
--------------------------------------------
REUR | 1e-09 | 1
REUR_sex_bias | -1 | 1
t1 | 1 | inf
RAFR | 1e-09 | 1
RAFR_sex_bias | -1 | 1
t2 | 1 | inf
REUR2 | 1e-09 | 1
REUR2_sex_bias | -1 | 1
t3 | 1 | inf
--------------------------------------------
Multiple starting parameters will be generated and used for multiple optimization runs.
-----------------------------------------------------------------------------------------------------
Step 1 : Optimizing autosomal likelihood over parameters ['REUR', 't1', 'RAFR', 't2', 'REUR2', 't3'].
-----------------------------------------------------------------------------------------------------
Starting parameters for step 1 optimization
---------------------------------------------------------------------------------------------
Run | REUR | t1 | RAFR | t2 | REUR2 | t3
---------------------------------------------------------------------------------------------
1 | 0.8134 | 9.823 | 0.8717 | 6.958 | 0.2116 | 3.593
2 | 0.7876 | 9.821 | 0.8952 | 6.96 | 0.2014 | 3.481
3 | 0.8108 | 10.25 | 0.9091 | 6.793 | 0.2145 | 3.595
---------------------------------------------------------------------------------------------
Optimization run #1
Iter. Log-likelihood Model parameters Transmission
-------------------------------------------------------------
30 , -933.463 , array([ 0.80861 , 0 , 9.57567 , 0.866292 , 0 , 7.72335 , 0.198146 , 0 , 3.79732 ]), Autosomes
60 , -779.853 , array([ 0.799754 , 0 , 8.9698 , 0.862695 , 0 , 7.87187 , 0.163314 , 0 , 4.17552 ]), Autosomes
90 , -742.558 , array([ 0.7974 , 0 , 8.84747 , 0.861901 , 0 , 7.79303 , 0.15557 , 0 , 4.31534 ]), Autosomes
120 , -732.714 , array([ 0.796018 , 0 , 8.8449 , 0.861821 , 0 , 7.81078 , 0.151905 , 0 , 4.37199 ]), Autosomes
150 , -726.865 , array([ 0.795899 , 0 , 8.84616 , 0.861896 , 0 , 7.81126 , 0.151155 , 0 , 4.38691 ]), Autosomes
180 , -729.192 , array([ 0.795836 , 0 , 8.84502 , 0.8619 , 0 , 7.81114 , 0.150938 , 0 , 4.39022 ]), Autosomes
Step 1: COBYLA converged after 186 objective evaluations: the trust-region radius reached its final value (rhoend).
186 , -726.15 , array([ 0.795837 , 0 , 8.84508 , 0.861899 , 0 , 7.81111 , 0.150944 , 0 , 4.39011 ]), Autosomes
Optimization completed.
-----------------------
Optimization run #2
Iter. Log-likelihood Model parameters Transmission
-------------------------------------------------------------
30 , -967.579 , array([ 0.783935 , 0 , 9.61598 , 0.887778 , 0 , 7.65685 , 0.196863 , 0 , 3.88934 ]), Autosomes
60 , 8.8805e+29 , array([ 0.779609 , 0 , 9.36916 , 0.880349 , 0 , 8.08261 , 0.175867 , 0 , 4.56606 ]), OOB (oob=-0.008880504726082039)
90 , -782.594 , array([ 0.779067 , 0 , 9.32897 , 0.880026 , 0 , 8.0654 , 0.175399 , 0 , 4.53029 ]), Autosomes
Step 1: COBYLA converged after 106 objective evaluations: the trust-region radius reached its final value (rhoend).
106 , -782.416 , array([ 0.779094 , 0 , 9.32818 , 0.880056 , 0 , 8.06366 , 0.175376 , 0 , 4.53081 ]), Autosomes
Optimization completed.
-----------------------
Optimization run #3
Iter. Log-likelihood Model parameters Transmission
-------------------------------------------------------------
30 , -1082.08 , array([ 0.805637 , 0 , 10.2417 , 0.901986 , 0 , 7.13088 , 0.208554 , 0 , 4.15649 ]), Autosomes
60 , -877.956 , array([ 0.796973 , 0 , 10.0229 , 0.895134 , 0 , 7.62327 , 0.192105 , 0 , 4.79459 ]), Autosomes
90 , -736.223 , array([ 0.786944 , 0 , 8.93671 , 0.890876 , 0 , 7.65469 , 0.163594 , 0 , 5.21678 ]), Autosomes
120 , -716.534 , array([ 0.785517 , 0 , 8.88734 , 0.88942 , 0 , 7.70886 , 0.158704 , 0 , 5.28167 ]), Autosomes
150 , -705.305 , array([ 0.783164 , 0 , 8.87386 , 0.888866 , 0 , 7.72475 , 0.156052 , 0 , 5.35343 ]), Autosomes
180 , -702.093 , array([ 0.78274 , 0 , 8.86537 , 0.888727 , 0 , 7.7253 , 0.155141 , 0 , 5.37543 ]), Autosomes
Step 1: COBYLA converged after 208 objective evaluations: the trust-region radius reached its final value (rhoend).
208 , -700.264 , array([ 0.782418 , 0 , 8.86303 , 0.888666 , 0 , 7.72604 , 0.1546 , 0 , 5.3861 ]), Autosomes
Optimization completed.
-----------------------
In Step 1: Results from multiple optimization runs with different starting parameters:
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Run | LogLik | REUR | REUR_sex_bias | t1 | RAFR | RAFR_sex_bias | t2 | REUR2 | REUR2_sex_bias | t3
-------------------------------------------------------------------------------------------------------------------------------------------------------------
1 | -726.15 | 0.7958 | 0 | 8.845 | 0.8619 | 0 | 7.811 | 0.1509 | 0 | 4.39
2 | -782.416 | 0.7791 | 0 | 9.328 | 0.8801 | 0 | 8.064 | 0.1754 | 0 | 4.531
3 | -700.264 | 0.7824 | 0 | 8.863 | 0.8887 | 0 | 7.726 | 0.1546 | 0 | 5.386
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Selecting best parameters from step 1 and proceeding to step 2 optimization.
----------------------------------------------------------------------------------------------------------------
Step 2 : Optimizing allosomal likelihood over parameters : ['REUR_sex_bias', 'RAFR_sex_bias', 'REUR2_sex_bias'].
----------------------------------------------------------------------------------------------------------------
Starting parameters for step 2 optimization (non-sex-bias parameters are fixed to the best step 1 estimates).
----------------------------------------------------------------------------------------------------------------------------------------------
Run | REUR | REUR_sex_bias | t1 | RAFR | RAFR_sex_bias | t2 | REUR2 | REUR2_sex_bias | t3
----------------------------------------------------------------------------------------------------------------------------------------------
1 | 0.7824 | 0.02386 | 8.863 | 0.8887 | 0.05895 | 7.726 | 0.1546 | 0.1564 | 5.386
2 | 0.7824 | 0.03926 | 8.863 | 0.8887 | 0.04324 | 7.726 | 0.1546 | 0.1598 | 5.386
3 | 0.7824 | 0.01977 | 8.863 | 0.8887 | 0.03574 | 7.726 | 0.1546 | 0.152 | 5.386
----------------------------------------------------------------------------------------------------------------------------------------------
Optimization run #1
Iter. Log-likelihood Model parameters Transmission
-------------------------------------------------------------
30 , -215.124 , array([ 0.782418 , -0.0167567 , 8.86303 , 0.888666 , -0.0614771 , 7.72604 , 0.1546 , 0.138873 , 5.3861 ]), Female allosomes
30 , -96.7941 , array([ 0.782418 , -0.0167567 , 8.86303 , 0.888666 , -0.0614771 , 7.72604 , 0.1546 , 0.138873 , 5.3861 ]), Male allosomes
Step 2: COBYLA converged after 53 objective evaluations: the trust-region radius reached its final value (rhoend).
53 , -214.911 , array([ 0.782418 , -0.0191164 , 8.86303 , 0.888666 , -0.0719011 , 7.72604 , 0.1546 , 0.134619 , 5.3861 ]), Female allosomes
53 , -96.8058 , array([ 0.782418 , -0.0191164 , 8.86303 , 0.888666 , -0.0719011 , 7.72604 , 0.1546 , 0.134619 , 5.3861 ]), Male allosomes
Optimization completed.
-----------------------
Optimization run #2
Iter. Log-likelihood Model parameters Transmission
-------------------------------------------------------------
30 , 4.98524e+28 , array([ 0.782418 , -0.00426299 , 8.86303 , 0.888666 , -0.0754412 , 7.72604 , 0.1546 , 0.140266 , 5.3861 ]), OOB (oob=-0.0004985242796256006)
Step 2: COBYLA converged after 55 objective evaluations: the trust-region radius reached its final value (rhoend).
55 , -214.987 , array([ 0.782418 , -0.00393895 , 8.86303 , 0.888666 , -0.0719176 , 7.72604 , 0.1546 , 0.140515 , 5.3861 ]), Female allosomes
55 , -96.8204 , array([ 0.782418 , -0.00393895 , 8.86303 , 0.888666 , -0.0719176 , 7.72604 , 0.1546 , 0.140515 , 5.3861 ]), Male allosomes
Optimization completed.
-----------------------
Optimization run #3
Iter. Log-likelihood Model parameters Transmission
-------------------------------------------------------------
30 , -214.994 , array([ 0.782418 , -0.0262948 , 8.86303 , 0.888666 , -0.0656992 , 7.72604 , 0.1546 , 0.133148 , 5.3861 ]), Female allosomes
30 , -96.7887 , array([ 0.782418 , -0.0262948 , 8.86303 , 0.888666 , -0.0656992 , 7.72604 , 0.1546 , 0.133148 , 5.3861 ]), Male allosomes
Step 2: COBYLA converged after 53 objective evaluations: the trust-region radius reached its final value (rhoend).
53 , -214.894 , array([ 0.782418 , -0.0225281 , 8.86303 , 0.888666 , -0.0718925 , 7.72604 , 0.1546 , 0.135482 , 5.3861 ]), Female allosomes
53 , -96.8086 , array([ 0.782418 , -0.0225281 , 8.86303 , 0.888666 , -0.0718925 , 7.72604 , 0.1546 , 0.135482 , 5.3861 ]), Male allosomes
Optimization completed.
-----------------------
In Step 2: Results from multiple optimization runs with different starting parameters:
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Run | LogLik | REUR | REUR_sex_bias | t1 | RAFR | RAFR_sex_bias | t2 | REUR2 | REUR2_sex_bias | t3
-------------------------------------------------------------------------------------------------------------------------------------------------------------
1 | -311.717 | 0.7824 | -0.01912 | 8.863 | 0.8887 | -0.0719 | 7.726 | 0.1546 | 0.1346 | 5.386
2 | -311.807 | 0.7824 | -0.003939 | 8.863 | 0.8887 | -0.07192 | 7.726 | 0.1546 | 0.1405 | 5.386
3 | -311.702 | 0.7824 | -0.02253 | 8.863 | 0.8887 | -0.07189 | 7.726 | 0.1546 | 0.1355 | 5.386
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Selecting best parameters from step 2.
Step 2 used allosomal data only. Final likelihood is evaluated on autosomal + allosomal data at the selected optimal parameters.
--------------------------------------------------------------------------------------------------
Launching re-optimization until convergence is achieved or 5 re-optimizations have been performed.
--------------------------------------------------------------------------------------------------
Re-optimization 1/5: re-optimizing starting from the current optimal parameters (likelihood = -1012.257204).
-----------------------------------------------------------------------------------------------------
Step 1 : Optimizing autosomal likelihood over parameters ['REUR', 't1', 'RAFR', 't2', 'REUR2', 't3'].
-----------------------------------------------------------------------------------------------------
Iter. Log-likelihood Model parameters Transmission
-------------------------------------------------------------
30 , -698.192 , array([ 0.781987 , -0.0225281 , 8.8703 , 0.888706 , -0.0718925 , 7.74517 , 0.154274 , 0.135482 , 5.45309 ]), Autosomes
60 , -697.277 , array([ 0.781816 , -0.0225281 , 8.86619 , 0.888712 , -0.0718925 , 7.74487 , 0.153995 , 0.135482 , 5.45713 ]), Autosomes
Step 1: COBYLA converged after 66 objective evaluations: the trust-region radius reached its final value (rhoend).
66 , -697.277 , array([ 0.781815 , -0.0225281 , 8.86619 , 0.888705 , -0.0718925 , 7.74494 , 0.153995 , 0.135482 , 5.45712 ]), Autosomes
Optimization completed.
-----------------------
----------------------------------------------------------------------------------------------------------------
Step 2 : Optimizing allosomal likelihood over parameters : ['REUR_sex_bias', 'RAFR_sex_bias', 'REUR2_sex_bias'].
----------------------------------------------------------------------------------------------------------------
Iter. Log-likelihood Model parameters Transmission
-------------------------------------------------------------
Step 2: COBYLA converged after 26 objective evaluations: the trust-region radius reached its final value (rhoend).
26 , -213.915 , array([ 0.781815 , -0.0226884 , 8.86619 , 0.888705 , -0.0726984 , 7.74494 , 0.153995 , 0.135362 , 5.45712 ]), Female allosomes
26 , -96.834 , array([ 0.781815 , -0.0226884 , 8.86619 , 0.888705 , -0.0726984 , 7.74494 , 0.153995 , 0.135362 , 5.45712 ]), Male allosomes
Optimization completed.
-----------------------
Change in likelihood from -1012.257204 to -1008.025078 after re-optimizing.
Re-optimization 2/5: re-optimizing starting from the current optimal parameters (likelihood = -1008.025078).
-----------------------------------------------------------------------------------------------------
Step 1 : Optimizing autosomal likelihood over parameters ['REUR', 't1', 'RAFR', 't2', 'REUR2', 't3'].
-----------------------------------------------------------------------------------------------------
Iter. Log-likelihood Model parameters Transmission
-------------------------------------------------------------
30 , 2.06584e+29 , array([ 0.781353 , -0.0226884 , 8.85705 , 0.888648 , -0.0726984 , 7.70219 , 0.153608 , 0.135362 , 5.51914 ]), OOB (oob=-0.002065839173524431)
Step 1: COBYLA converged after 56 objective evaluations: the trust-region radius reached its final value (rhoend).
56 , -695.387 , array([ 0.781375 , -0.0226884 , 8.8591 , 0.888683 , -0.0726984 , 7.70061 , 0.153659 , 0.135362 , 5.52096 ]), Autosomes
Optimization completed.
-----------------------
----------------------------------------------------------------------------------------------------------------
Step 2 : Optimizing allosomal likelihood over parameters : ['REUR_sex_bias', 'RAFR_sex_bias', 'REUR2_sex_bias'].
----------------------------------------------------------------------------------------------------------------
Iter. Log-likelihood Model parameters Transmission
-------------------------------------------------------------
Step 2: COBYLA converged after 25 objective evaluations: the trust-region radius reached its final value (rhoend).
25 , -213.127 , array([ 0.781375 , -0.0231401 , 8.8591 , 0.888683 , -0.0741579 , 7.70061 , 0.153659 , 0.135067 , 5.52096 ]), Female allosomes
25 , -96.8646 , array([ 0.781375 , -0.0231401 , 8.8591 , 0.888683 , -0.0741579 , 7.70061 , 0.153659 , 0.135067 , 5.52096 ]), Male allosomes
Optimization completed.
-----------------------
Change in likelihood from -1008.025078 to -1005.376921 after re-optimizing.
Re-optimization 3/5: re-optimizing starting from the current optimal parameters (likelihood = -1005.376921).
-----------------------------------------------------------------------------------------------------
Step 1 : Optimizing autosomal likelihood over parameters ['REUR', 't1', 'RAFR', 't2', 'REUR2', 't3'].
-----------------------------------------------------------------------------------------------------
Iter. Log-likelihood Model parameters Transmission
-------------------------------------------------------------
30 , -693.257 , array([ 0.779953 , -0.0231401 , 8.85958 , 0.889295 , -0.0741579 , 7.69463 , 0.15335 , 0.135067 , 5.57084 ]), Autosomes
60 , -692.97 , array([ 0.779893 , -0.0231401 , 8.8598 , 0.889334 , -0.0741579 , 7.69459 , 0.153255 , 0.135067 , 5.57137 ]), Autosomes
Step 1: COBYLA converged after 61 objective evaluations: the trust-region radius reached its final value (rhoend).
61 , -692.952 , array([ 0.779895 , -0.0231401 , 8.85888 , 0.889333 , -0.0741579 , 7.6937 , 0.153254 , 0.135067 , 5.57137 ]), Autosomes
Optimization completed.
-----------------------
----------------------------------------------------------------------------------------------------------------
Step 2 : Optimizing allosomal likelihood over parameters : ['REUR_sex_bias', 'RAFR_sex_bias', 'REUR2_sex_bias'].
----------------------------------------------------------------------------------------------------------------
Iter. Log-likelihood Model parameters Transmission
-------------------------------------------------------------
Step 2: COBYLA converged after 25 objective evaluations: the trust-region radius reached its final value (rhoend).
25 , -212.705 , array([ 0.779895 , -0.0234902 , 8.85888 , 0.889333 , -0.0754201 , 7.6937 , 0.153254 , 0.134893 , 5.57137 ]), Female allosomes
25 , -96.8383 , array([ 0.779895 , -0.0234902 , 8.85888 , 0.889333 , -0.0754201 , 7.6937 , 0.153254 , 0.134893 , 5.57137 ]), Male allosomes
Optimization completed.
-----------------------
Change in likelihood from -1005.376921 to -1002.494314 after re-optimizing.
Re-optimization 4/5: re-optimizing starting from the current optimal parameters (likelihood = -1002.494314).
-----------------------------------------------------------------------------------------------------
Step 1 : Optimizing autosomal likelihood over parameters ['REUR', 't1', 'RAFR', 't2', 'REUR2', 't3'].
-----------------------------------------------------------------------------------------------------
Iter. Log-likelihood Model parameters Transmission
-------------------------------------------------------------
30 , -691.989 , array([ 0.779247 , -0.0234902 , 8.85888 , 0.889633 , -0.0754201 , 7.68656 , 0.153091 , 0.134893 , 5.57917 ]), Autosomes
60 , 2.79504e+28 , array([ 0.779196 , -0.0234902 , 8.85776 , 0.889649 , -0.0754201 , 7.68674 , 0.153023 , 0.134893 , 5.57929 ]), OOB (oob=-0.0002795041798382414)
Step 1: COBYLA converged after 73 objective evaluations: the trust-region radius reached its final value (rhoend).
73 , -691.761 , array([ 0.779191 , -0.0234902 , 8.85833 , 0.889649 , -0.0754201 , 7.68658 , 0.153021 , 0.134893 , 5.57953 ]), Autosomes
Optimization completed.
-----------------------
----------------------------------------------------------------------------------------------------------------
Step 2 : Optimizing allosomal likelihood over parameters : ['REUR_sex_bias', 'RAFR_sex_bias', 'REUR2_sex_bias'].
----------------------------------------------------------------------------------------------------------------
Iter. Log-likelihood Model parameters Transmission
-------------------------------------------------------------
30 , -212.677 , array([ 0.779191 , -0.024135 , 8.85833 , 0.889649 , -0.0774948 , 7.68658 , 0.153021 , 0.134516 , 5.57953 ]), Female allosomes
30 , -96.8112 , array([ 0.779191 , -0.024135 , 8.85833 , 0.889649 , -0.0774948 , 7.68658 , 0.153021 , 0.134516 , 5.57953 ]), Male allosomes
Step 2: COBYLA converged after 30 objective evaluations: the trust-region radius reached its final value (rhoend).
Optimization completed.
-----------------------
Change in likelihood from -1002.494314 to -1001.247254 after re-optimizing.
Re-optimization 5/5: re-optimizing starting from the current optimal parameters (likelihood = -1001.247254).
-----------------------------------------------------------------------------------------------------
Step 1 : Optimizing autosomal likelihood over parameters ['REUR', 't1', 'RAFR', 't2', 'REUR2', 't3'].
-----------------------------------------------------------------------------------------------------
Iter. Log-likelihood Model parameters Transmission
-------------------------------------------------------------
30 , 4.62608e+27 , array([ 0.778976 , -0.0241495 , 8.85785 , 0.889676 , -0.077542 , 7.684 , 0.152839 , 0.134509 , 5.58039 ]), OOB (oob=-4.626082701730816e-05)
Step 1: COBYLA stopped after 46 objective evaluations without converging: Did not converge to a solution satisfying the constraints. See `maxcv` for magnitude of violation. (status 4).
46 , -690.989 , array([ 0.778929 , -0.0241495 , 8.85786 , 0.889672 , -0.077542 , 7.68329 , 0.152796 , 0.134509 , 5.57962 ]), Autosomes
Optimization completed.
-----------------------
----------------------------------------------------------------------------------------------------------------
Step 2 : Optimizing allosomal likelihood over parameters : ['REUR_sex_bias', 'RAFR_sex_bias', 'REUR2_sex_bias'].
----------------------------------------------------------------------------------------------------------------
Iter. Log-likelihood Model parameters Transmission
-------------------------------------------------------------
Step 2: COBYLA converged after 24 objective evaluations: the trust-region radius reached its final value (rhoend).
24 , -212.672 , array([ 0.778929 , -0.0243074 , 8.85786 , 0.889672 , -0.0781864 , 7.68329 , 0.152796 , 0.1344 , 5.57962 ]), Female allosomes
24 , -96.7973 , array([ 0.778929 , -0.0243074 , 8.85786 , 0.889672 , -0.0781864 , 7.68329 , 0.152796 , 0.1344 , 5.57962 ]), Male allosomes
Optimization completed.
-----------------------
Change in likelihood from -1001.247254 to -1000.457032 after re-optimizing.
Convergence not achieved after 5 repetitions. Stopping re-optimization.
Final parameters and corresponding likelihood computed on autosomal + allosomal data:
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
LogLik | REUR | REUR_sex_bias | t1 | RAFR | RAFR_sex_bias | t2 | REUR2 | REUR2_sex_bias | t3 | targetpop_AMR_rate | targetpop_AMR_sex_bias
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-1000.46 | 0.7789 | -0.02431 | 8.858 | 0.8897 | -0.07819 | 7.683 | 0.1528 | 0.1344 | 5.58 | 0.2211 | 0.02431
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Parameters targetpop_AMR_rate, targetpop_AMR_sex_bias correspond to the dependent ancestry and were not free in the optimization.
Predicted autosome proportions: [0.22568982 0.02065482 0.75365536]
Predicted allosome proportions: [0.23364534 0.02121727 0.74513739]
Results saved to : output_three_pulses
{'destination_dir': PosixPath('/home/runner/work/tracts/tracts/docs/source/auto_examples/ASW/output_three_pulses'), 'table_file': PosixPath('/home/runner/work/tracts/tracts/docs/source/auto_examples/ASW/output_three_pulses/ASW_three_pulses_optimal_parameters.txt')}
import sys
from pathlib import Path
from tracts.driver import run_tracts
# Read files automatically for online documentation
sys.path.append('.')
script_dir = Path.cwd()
driver_filename = script_dir / "ASW_three_pulses.yaml"
run_tracts(
driver_filename=str(driver_filename),
script_dir=str(script_dir),
)
Total running time of the script: (5 minutes 3.201 seconds)