tracts.driver_utils._save_ancestry_proportions_table#

_save_ancestry_proportions_table(ancestor_labels, observed_autosome_proportions, predicted_autosome_proportions, output_dir, output_filename_format, observed_allosome_proportions=None, predicted_allosome_proportions=None, allosome_label=None)#

Writes a fixed-width text table of observed and predicted ancestry proportions (for autosomes and, optionally, allosomes) to the output directory.

Parameters:
  • ancestor_labels – Ordered iterable of source-population names (columns of the table).

  • observed_autosome_proportions (ndarray) – Observed autosomal ancestry proportions, one value per source population.

  • predicted_autosome_proportions (ndarray | None) – Predicted autosomal ancestry proportions from the optimal model parameters, or None if not available.

  • output_dir – Path to the directory where the file will be written.

  • output_filename_format (str) – The output_filename_format string from the driver file (must contain a {label} placeholder).

  • observed_allosome_proportions (ndarray | None) – Observed allosomal ancestry proportions, or None if no allosomes are present in the sample.

  • predicted_allosome_proportions (ndarray | None) – Predicted allosomal ancestry proportions from the optimal model parameters, or None if not available.

  • allosome_label (str | None) – The allosome identifier (e.g. 'X'), used as the row label suffix. Required when observed_allosome_proportions or predicted_allosome_proportions is provided.

Return type:

None