tracts.driver_utils.load_demographic_model_from_driver#

load_demographic_model_from_driver(driver_spec, script_dir, driver_path, allosome_label=None)#

Loads the demographic model based on the specifications in the driver file. The model is expected to be defined in a separate yaml file, whose path is specified in the driver file under “models.model_filename”. See online documentation for details on how to specify the model yaml file and its contents.

Parameters:
  • driver_spec (InferenceConfig) – The configuration for the inference process, as specified in the driver file.

  • script_dir (str | Path | None) – The directory containing the script.

  • driver_path (str) – The path to the driver yaml file.

  • allosome_label (str | None) – The label of the allosome chromosome, if any. This is used to determine whether allosomal admixture is modelled.

Returns:

A tuple (demographic_model, model_param_names, sex_bias_param_names, non_sex_bias_param_names), where:

  • demographic_model is the loaded demographic model, which can be either a ParametrizedDemography or a ParametrizedDemographySexBiased depending on whether allosomal admixture is modelled.

  • model_param_names is the list of all parameter names of demographic_model, in the order given by demographic_model.model_base_params.

  • sex_bias_param_names is the subset of model_param_names corresponding to sex-bias parameters.

  • non_sex_bias_param_names is the remaining subset of model_param_names, excluding sex-bias parameters.

Return type:

tuple[ParametrizedDemography | ParametrizedDemographySexBiased, list[str], list[str], list[str]]