tracts.driver_utils.save_ancestry_table#

save_ancestry_table(ancestor_labels, observed_autosome, predicted_autosome, output_dir, output_filename_format, label, observed_allosome=None, predicted_allosome=None, allosome_label=None)#

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

Shared by _save_ancestry_proportions_table and _save_tracts_counts_table, which differ only in the values they tabulate and the output file’s label.

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

  • observed_autosome (ndarray) – Observed autosomal values, one value per source population.

  • predicted_autosome (ndarray | None) – Predicted autosomal values 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).

  • label (str) – The {label} value used to build the output filename (e.g. "ancestry_proportions.txt").

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

  • predicted_allosome (ndarray | None) – Predicted allosomal values 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 or predicted_allosome is provided.

Return type:

None