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#

Estimated optimal parameters#

parameter

value

REUR

0.7761012264333649

REUR_sex_bias

-0.05303212914746569

t1

8.895377411131673

RAFR

0.8890068469215221

RAFR_sex_bias

-0.1468716941048096

t2

7.895146772459589

REUR2

0.14776311014694268

REUR2_sex_bias

0.12725446172261767

t3

5.613175750350681

targetpop_AMR_rate

0.22389877356663512

targetpop_AMR_sex_bias

0.05303212914746553

likelihood -984.792

Optimal migration matrices#

../../_images/ASW_three_pulses_migration_matrices.png

Tract length histograms#

Autosomal admixture#

Autosomal tract length distribution

X chromosome admixture#

X chromosome tract length distribution
------------------------------------------------------------------------------------------------

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.988    , array([ 0.799832   ,  0          ,  8.9677     ,  0.862766   ,  0          ,  7.86731    ,  0.163378   ,  0          ,  4.172      ]), Autosomes
90      , -754.075    , array([ 0.799554   ,  0          ,  8.86422    ,  0.862304   ,  0          ,  7.79487    ,  0.158522   ,  0          ,  4.26852    ]), Autosomes
120     , -741.187    , array([ 0.798853   ,  0          ,  8.8562     ,  0.86245    ,  0          ,  7.83376    ,  0.155356   ,  0          ,  4.34122    ]), Autosomes
150     , -736.076    , array([ 0.79869    ,  0          ,  8.85239    ,  0.862337   ,  0          ,  7.83677    ,  0.153857   ,  0          ,  4.36243    ]), Autosomes
180     , -730.957    , array([ 0.798378   ,  0          ,  8.85387    ,  0.862418   ,  0          ,  7.84584    ,  0.152382   ,  0          ,  4.38542    ]), Autosomes
210     , -728.91     , array([ 0.798218   ,  0          ,  8.85175    ,  0.862466   ,  0          ,  7.84813    ,  0.151785   ,  0          ,  4.39421    ]), Autosomes
240     , -728.359    , array([ 0.798168   ,  0          ,  8.85209    ,  0.862476   ,  0          ,  7.84874    ,  0.151622   ,  0          ,  4.39653    ]), Autosomes
267     , -727.967    , array([ 0.798133   ,  0          ,  8.85206    ,  0.86249    ,  0          ,  7.84919    ,  0.15151    ,  0          ,  4.39848    ]), 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.88099e+29 , array([ 0.779609   ,  0          ,  9.36916    ,  0.880349   ,  0          ,  8.08261    ,  0.175867   ,  0          ,  4.56606    ]), OOB (oob=-0.008880994467493242)
90      , -782.985    , array([ 0.779233   ,  0          ,  9.32987    ,  0.88006    ,  0          ,  8.06248    ,  0.175331   ,  0          ,  4.531      ]), Autosomes
120     , -782.245    , array([ 0.779294   ,  0          ,  9.32994    ,  0.880073   ,  0          ,  8.06688    ,  0.175255   ,  0          ,  4.53332    ]), Autosomes
125     , -782.196    , array([ 0.779286   ,  0          ,  9.33022    ,  0.880075   ,  0          ,  8.06638    ,  0.175247   ,  0          ,  4.53333    ]), 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      , -743.15     , array([ 0.781623   ,  0          ,  9.14081    ,  0.890049   ,  0          ,  7.78659    ,  0.163378   ,  0          ,  5.1662     ]), Autosomes
120     , -695.095    , array([ 0.779123   ,  0          ,  8.89513    ,  0.890753   ,  0          ,  7.89171    ,  0.150329   ,  0          ,  5.29191    ]), Autosomes
150     , -691.131    , array([ 0.778492   ,  0          ,  8.89193    ,  0.890419   ,  0          ,  7.89174    ,  0.149796   ,  0          ,  5.33087    ]), Autosomes
180     , -690.395    , array([ 0.778445   ,  0          ,  8.89305    ,  0.890339   ,  0          ,  7.89194    ,  0.14968    ,  0          ,  5.33893    ]), Autosomes
210     , -689.757    , array([ 0.778358   ,  0          ,  8.89213    ,  0.890298   ,  0          ,  7.89196    ,  0.14955    ,  0          ,  5.34505    ]), Autosomes
219     , -689.681    , array([ 0.778347   ,  0          ,  8.89207    ,  0.890292   ,  0          ,  7.8919     ,  0.149535   ,  0          ,  5.34577    ]), 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 |     -727.967 |       0.7981 |             0 |        8.852 |       0.8625 |             0 |        7.849 |       0.1515 |              0 |        4.398
  2 |     -782.196 |       0.7793 |             0 |         9.33 |       0.8801 |             0 |        8.066 |       0.1752 |              0 |        4.533
  3 |     -689.681 |       0.7783 |             0 |        8.892 |       0.8903 |             0 |        7.892 |       0.1495 |              0 |        5.346
-------------------------------------------------------------------------------------------------------------------------------------------------------------
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.7783 |       0.02386 |        8.892 |       0.8903 |        0.1089 |        7.892 |       0.1495 |         0.1564 |        5.346
  2 |       0.7783 |       0.03926 |        8.892 |       0.8903 |       0.09324 |        7.892 |       0.1495 |         0.1598 |        5.346
  3 |       0.7783 |       0.01977 |        8.892 |       0.8903 |       0.08574 |        7.892 |       0.1495 |          0.152 |        5.346
----------------------------------------------------------------------------------------------------------------------------------------------

Optimization run #1

Iter.    Log-likelihood  Model parameters        Transmission
-------------------------------------------------------------
30      , -218.454    , array([ 0.778347   ,  0.00683885 ,  8.89207    ,  0.890292   ,  0.0448319  ,  7.8919     ,  0.149535   ,  0.15339    ,  5.34577    ]), Female allosomes
30      , -96.2267    , array([ 0.778347   ,  0.00683885 ,  8.89207    ,  0.890292   ,  0.0448319  ,  7.8919     ,  0.149535   ,  0.15339    ,  5.34577    ]), Male allosomes
60      , -216.848    , array([ 0.778347   , -0.0156092  ,  8.89207    ,  0.890292   , -0.025931   ,  7.8919     ,  0.149535   ,  0.146663   ,  5.34577    ]), Female allosomes
60      , -96.3496    , array([ 0.778347   , -0.0156092  ,  8.89207    ,  0.890292   , -0.025931   ,  7.8919     ,  0.149535   ,  0.146663   ,  5.34577    ]), Male allosomes
90      , -215.319    , array([ 0.778347   , -0.0355815  ,  8.89207    ,  0.890292   , -0.0973322  ,  7.8919     ,  0.149535   ,  0.139914   ,  5.34577    ]), Female allosomes
90      , -96.4831    , array([ 0.778347   , -0.0355815  ,  8.89207    ,  0.890292   , -0.0973322  ,  7.8919     ,  0.149535   ,  0.139914   ,  5.34577    ]), Male allosomes
119     , -215.022    , array([ 0.778347   , -0.0371605  ,  8.89207    ,  0.890292   , -0.112213   ,  7.8919     ,  0.149535   ,  0.137376   ,  5.34577    ]), Female allosomes
119     , -96.5086    , array([ 0.778347   , -0.0371605  ,  8.89207    ,  0.890292   , -0.112213   ,  7.8919     ,  0.149535   ,  0.137376   ,  5.34577    ]), Male allosomes
Optimization completed.
-----------------------

Optimization run #2

Iter.    Log-likelihood  Model parameters        Transmission
-------------------------------------------------------------
30      , -216.873    , array([ 0.778347   ,  0.00221027 ,  8.89207    ,  0.890292   , -0.0291373  ,  7.8919     ,  0.149535   ,  0.150877   ,  5.34577    ]), Female allosomes
30      , -96.3641    , array([ 0.778347   ,  0.00221027 ,  8.89207    ,  0.890292   , -0.0291373  ,  7.8919     ,  0.149535   ,  0.150877   ,  5.34577    ]), Male allosomes
60      , -215.104    , array([ 0.778347   , -0.019571   ,  8.89207    ,  0.890292   , -0.111949   ,  7.8919     ,  0.149535   ,  0.142389   ,  5.34577    ]), Female allosomes
60      , -96.518     , array([ 0.778347   , -0.019571   ,  8.89207    ,  0.890292   , -0.111949   ,  7.8919     ,  0.149535   ,  0.142389   ,  5.34577    ]), Male allosomes
74      , -215.102    , array([ 0.778347   , -0.0189596  ,  8.89207    ,  0.890292   , -0.112216   ,  7.8919     ,  0.149535   ,  0.142691   ,  5.34577    ]), Female allosomes
74      , -96.5193    , array([ 0.778347   , -0.0189596  ,  8.89207    ,  0.890292   , -0.112216   ,  7.8919     ,  0.149535   ,  0.142691   ,  5.34577    ]), Male allosomes
Optimization completed.
-----------------------

Optimization run #3

Iter.    Log-likelihood  Model parameters        Transmission
-------------------------------------------------------------
30      , -216.62     , array([ 0.778347   , -0.020516   ,  8.89207    ,  0.890292   , -0.0359852  ,  7.8919     ,  0.149535   ,  0.143518   ,  5.34577    ]), Female allosomes
30      , -96.3626    , array([ 0.778347   , -0.020516   ,  8.89207    ,  0.890292   , -0.0359852  ,  7.8919     ,  0.149535   ,  0.143518   ,  5.34577    ]), Male allosomes
60      , 1.91654e+26 , array([ 0.778347   , -0.0409716  ,  8.89207    ,  0.890292   , -0.112252   ,  7.8919     ,  0.149535   ,  0.1335     ,  5.34577    ]), OOB (oob=-1.9165436973000993e-06)
73      , -215.009    , array([ 0.778347   , -0.0408243  ,  8.89207    ,  0.890292   , -0.112194   ,  7.8919     ,  0.149535   ,  0.133364   ,  5.34577    ]), Female allosomes
73      , -96.4989    , array([ 0.778347   , -0.0408243  ,  8.89207    ,  0.890292   , -0.112194   ,  7.8919     ,  0.149535   ,  0.133364   ,  5.34577    ]), 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.531 |       0.7783 |      -0.03716 |        8.892 |       0.8903 |       -0.1122 |        7.892 |       0.1495 |         0.1374 |        5.346
  2 |     -311.621 |       0.7783 |      -0.01896 |        8.892 |       0.8903 |       -0.1122 |        7.892 |       0.1495 |         0.1427 |        5.346
  3 |     -311.507 |       0.7783 |      -0.04082 |        8.892 |       0.8903 |       -0.1122 |        7.892 |       0.1495 |         0.1334 |        5.346
-------------------------------------------------------------------------------------------------------------------------------------------------------------
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 = -1001.380190).
-----------------------------------------------------------------------------------------------------
Step 1 : Optimizing autosomal likelihood over parameters ['REUR', 't1', 'RAFR', 't2', 'REUR2', 't3'].
-----------------------------------------------------------------------------------------------------
Iter.    Log-likelihood  Model parameters        Transmission
-------------------------------------------------------------
30      , -686.061    , array([ 0.777995   , -0.0408243  ,  8.89727    ,  0.890044   , -0.112194   ,  7.89198    ,  0.149186   ,  0.133364   ,  5.41352    ]), Autosomes
49      , -685.901    , array([ 0.778004   , -0.0408243  ,  8.89173    ,  0.890018   , -0.112194   ,  7.89107    ,  0.149159   ,  0.133364   ,  5.41337    ]), 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
-------------------------------------------------------------
20      , -213.957    , array([ 0.778004   , -0.0408634  ,  8.89173    ,  0.890018   , -0.112342   ,  7.89107    ,  0.149159   ,  0.133347   ,  5.41337    ]), Female allosomes
20      , -96.5446    , array([ 0.778004   , -0.0408634  ,  8.89173    ,  0.890018   , -0.112342   ,  7.89107    ,  0.149159   ,  0.133347   ,  5.41337    ]), Male allosomes
Optimization completed.
-----------------------
Change in likelihood from -1001.380190 to -996.402319 after re-optimizing.

Re-optimization 2/5: re-optimizing starting from the current optimal parameters (likelihood = -996.402319).
-----------------------------------------------------------------------------------------------------
Step 1 : Optimizing autosomal likelihood over parameters ['REUR', 't1', 'RAFR', 't2', 'REUR2', 't3'].
-----------------------------------------------------------------------------------------------------
Iter.    Log-likelihood  Model parameters        Transmission
-------------------------------------------------------------
30      , -682.601    , array([ 0.77768    , -0.0408634  ,  8.89457    ,  0.889403   , -0.112342   ,  7.88242    ,  0.14876    ,  0.133347   ,  5.48473    ]), Autosomes
59      , -682.121    , array([ 0.777511   , -0.0408634  ,  8.89069    ,  0.889415   , -0.112342   ,  7.88222    ,  0.148657   ,  0.133347   ,  5.48712    ]), 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.621    , array([ 0.777511   , -0.0416137  ,  8.89069    ,  0.889415   , -0.116442   ,  7.88222    ,  0.148657   ,  0.131642   ,  5.48712    ]), Female allosomes
30      , -96.6187    , array([ 0.777511   , -0.0416137  ,  8.89069    ,  0.889415   , -0.116442   ,  7.88222    ,  0.148657   ,  0.131642   ,  5.48712    ]), Male allosomes
31      , -212.62     , array([ 0.777511   , -0.0416337  ,  8.89069    ,  0.889415   , -0.116516   ,  7.88222    ,  0.148657   ,  0.131634   ,  5.48712    ]), Female allosomes
31      , -96.6188    , array([ 0.777511   , -0.0416337  ,  8.89069    ,  0.889415   , -0.116516   ,  7.88222    ,  0.148657   ,  0.131634   ,  5.48712    ]), Male allosomes
Optimization completed.
-----------------------
Change in likelihood from -996.402319 to -991.355138 after re-optimizing.

Re-optimization 3/5: re-optimizing starting from the current optimal parameters (likelihood = -991.355138).
-----------------------------------------------------------------------------------------------------
Step 1 : Optimizing autosomal likelihood over parameters ['REUR', 't1', 'RAFR', 't2', 'REUR2', 't3'].
-----------------------------------------------------------------------------------------------------
Iter.    Log-likelihood  Model parameters        Transmission
-------------------------------------------------------------
30      , 4.36706e+29 , array([ 0.776919   , -0.0416337  ,  8.88879    ,  0.888798   , -0.116516   ,  7.89316    ,  0.148272   ,  0.131634   ,  5.55669    ]), OOB (oob=-0.004367056642902156)
55      , -679.593    , array([ 0.776912   , -0.0416337  ,  8.89114    ,  0.888759   , -0.116516   ,  7.89107    ,  0.148231   ,  0.131634   ,  5.55689    ]), 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
-------------------------------------------------------------
25      , -211.395    , array([ 0.776912   , -0.0421308  ,  8.89114    ,  0.888759   , -0.117552   ,  7.89107    ,  0.148231   ,  0.13265    ,  5.55689    ]), Female allosomes
25      , -96.7058    , array([ 0.776912   , -0.0421308  ,  8.89114    ,  0.888759   , -0.117552   ,  7.89107    ,  0.148231   ,  0.13265    ,  5.55689    ]), Male allosomes
Optimization completed.
-----------------------
Change in likelihood from -991.355138 to -987.696757 after re-optimizing.

Re-optimization 4/5: re-optimizing starting from the current optimal parameters (likelihood = -987.696757).
-----------------------------------------------------------------------------------------------------
Step 1 : Optimizing autosomal likelihood over parameters ['REUR', 't1', 'RAFR', 't2', 'REUR2', 't3'].
-----------------------------------------------------------------------------------------------------
Iter.    Log-likelihood  Model parameters        Transmission
-------------------------------------------------------------
30      , 2.92691e+29 , array([ 0.776344   , -0.0421308  ,  8.88808    ,  0.889007   , -0.117552   ,  7.89101    ,  0.147876   ,  0.13265    ,  5.6128     ]), OOB (oob=-0.0029269079004805576)
43      , -678.318    , array([ 0.776373   , -0.0421308  ,  8.89264    ,  0.889006   , -0.117552   ,  7.89207    ,  0.147916   ,  0.13265    ,  5.61318    ]), 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
-------------------------------------------------------------
28      , -210.619    , array([ 0.776373   , -0.0449862  ,  8.89264    ,  0.889006   , -0.126931   ,  7.89207    ,  0.147916   ,  0.131611   ,  5.61318    ]), Female allosomes
28      , -96.7347    , array([ 0.776373   , -0.0449862  ,  8.89264    ,  0.889006   , -0.126931   ,  7.89207    ,  0.147916   ,  0.131611   ,  5.61318    ]), Male allosomes
Optimization completed.
-----------------------
Change in likelihood from -987.696757 to -985.667941 after re-optimizing.

Re-optimization 5/5: re-optimizing starting from the current optimal parameters (likelihood = -985.667941).
-----------------------------------------------------------------------------------------------------
Step 1 : Optimizing autosomal likelihood over parameters ['REUR', 't1', 'RAFR', 't2', 'REUR2', 't3'].
-----------------------------------------------------------------------------------------------------
Iter.    Log-likelihood  Model parameters        Transmission
-------------------------------------------------------------
30      , -677.896    , array([ 0.776101   , -0.0449862  ,  8.89533    ,  0.888991   , -0.126931   ,  7.89455    ,  0.147763   ,  0.131611   ,  5.61318    ]), Autosomes
37      , -677.896    , array([ 0.776101   , -0.0449862  ,  8.89538    ,  0.889007   , -0.126931   ,  7.89515    ,  0.147763   ,  0.131611   ,  5.61318    ]), 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      , 1.63606e+27 , array([ 0.776101   , -0.053107   ,  8.89538    ,  0.889007   , -0.147007   ,  7.89515    ,  0.147763   ,  0.127221   ,  5.61318    ]), OOB (oob=-1.6360566486017802e-05)
36      , -210.146    , array([ 0.776101   , -0.0530321  ,  8.89538    ,  0.889007   , -0.146872   ,  7.89515    ,  0.147763   ,  0.127254   ,  5.61318    ]), Female allosomes
36      , -96.7642    , array([ 0.776101   , -0.0530321  ,  8.89538    ,  0.889007   , -0.146872   ,  7.89515    ,  0.147763   ,  0.127254   ,  5.61318    ]), Male allosomes
Optimization completed.
-----------------------
Change in likelihood from -985.667941 to -984.791501 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
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    -984.792 |       0.7761 |      -0.05303 |        8.895 |        0.889 |       -0.1469 |        7.895 |       0.1478 |         0.1273 |        5.613 |             0.2239 |                0.05303
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Parameters targetpop_AMR_rate, targetpop_AMR_sex_bias correspond to the dependent ancestry and were not free in the optimization.
Predicted autosome proportions: [0.22124259 0.021171   0.75758641]
Predicted allosome proportions: [0.230006   0.02256466 0.74742934]
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: (6 minutes 38.516 seconds)

Gallery generated by Sphinx-Gallery