tracts.driver_utils#
Functions
Builds the message announcing that |
|
Builds the message announcing that step 2 has no free sex-bias parameters to optimize, listing which fixing mechanism (ancestry proportions vs. user-provided values) accounts for each fixed sex-bias parameter. |
|
|
Returns the default (pre-narrowing) admissible bounds for |
|
Compute which parameter columns should be shown in starting-parameter tables. |
|
Creates a new driver specification for re-optimization, using the optimal parameters from a previous optimization as the starting parameters for the new optimization. |
Returns the male-suffixed founder event for |
|
|
Build the user-readable optimization subtitle for the active run phase. |
When switching the implicit population, the population that was previously implicit becomes an explicit, directly-optimized parameter in the new demographic model, with no starting value specified in the driver file (it was never optimized before, so the user never had to provide one), taken from the optimal remainder values computed at the end of the previous optimization (see |
|
|
Normalize outputs from multi-initialization optimization runs. |
|
|
|
Prints and logs each message, unconditionally. |
Prints the final optimal parameter values and the corresponding likelihood, along with any derived parameters for the remainder (dependent) ancestry. |
|
|
Prints and logs a table of each model parameter's effective admissibility bounds (i.e. after any narrowing from the driver file's |
|
Print the optimization subtitle (always) and starting-parameter table (optional) for a run. |
|
Print starting-parameter information before optimization runs begin. |
Permutes observed ancestry proportions computed under |
|
|
Writes a fixed-width text table of observed and predicted ancestry proportions (for autosomes and, optionally, allosomes) to the output directory. |
|
When step 2 used allosomal data only ( |
|
Print per-run optimization results and select the best run. |
|
Builds a genetic model and driver specification identical to the given ones, except with the sex-bias parameters in |
|
Checks that the final optimal parameters are compatible will well-defined migration matrices. |
Checks whether any of the final optimal parameters is close to a user-narrowed admissible bound (see |
|
Checks whether the optimal sex-bias parameters have values at the border of the feasible region, up to a pre-specified tolerance. |
|
|
Validates that the population labels in the data correspond to the model population labels. |
|
Checks that the number of starting parameters matches the number of model parameters and prints a message about the starting parameters setup. |
Collapse repeated identical starting-parameter sets to a single repetition. |
|
|
Computes physical starting parameters to optimize from. |
|
Compute derived parameters for the 'remainder' (dependent) ancestry in each parametrized population. |
|
Validates the admixture models specified in the driver file and returns the models for autosomes and allosomes. |
Checks whether any of the boundary-violating sex-bias parameter names in |
|
|
Computes and reports the observed ancestry proportions for a population, based on autosomal data and, if allosomes are specified in the driver file, allosomal data as well. |
|
Derives a demographic model's free base parameter names, split into sex-bias and non-sex-bias subsets, straight from its |
Computes and logs the predicted ancestry proportions for the optimal parameters. |
|
Computes and logs the starting ancestry proportions for each set of starting parameters. |
|
|
Computes a function that takes in optimizer parameters, converts them to physical parameters using the model's parameter handler, and returns the violation score for those parameters. |
|
Computes a function that takes in optimizer parameters, converts them to physical parameters using the model's parameter handler, and returns the migration matrices for those parameters. |
Checks whether any sex-bias parameters are free (not fixed by ancestry proportions or value) in the demographic model. |
|
|
Loads the demographic model based on the specifications in the driver file. |
|
Loads the driver file and validates that it contains all required parameters for the inference. |
|
Loads the population data based on the specifications in the driver file. |
|
Locates the file path for a given filename by searching in multiple locations. |
|
Creates output graphs to compare data and the theoretical tract length distribution inferred by the model. |
|
Parses a chromosome specification and returns a list of chromosome numbers. |
|
Parses the individual filenames based on the provided format and locates their paths. |
|
Narrows each model parameter's admissible bounds according to the |
|
Produces starting parameters for optimization in physical units. |
|
Stacked bar chart of ancestry proportions in ADMIXTURE style. |
|
|
|
Sets up fixed parameters in the demographic model based on the specifications in the driver file. |
Classes
|
Configuration for the inference process. |
|
Bundles the file-location and ancestry-proportion context needed to reload a demographic model from its driver/model YAML files (e.g. when the implicit population changes and the founder-event structure has to be re-parsed), so that functions needing this context take one parameter instead of five. |
|
Configuration for the demographic and admixture models used in the inference. |
|
Configuration for the optimization process used in the inference. |
|
Configuration for the output of the inference process. |
|
Optional lower/upper admissibility bounds for model parameters, specified as |
|
Configuration for the samples used in the inference. |
|
Configuration for the starting parameters used in the optimization. |