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_tableand_save_tracts_counts_table, which differ only in the values they tabulate and the output file’slabel.- 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, orNoneif not available.output_dir – Path to the directory where the file will be written.
output_filename_format (
str) – Theoutput_filename_formatstring 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, orNoneif no allosomes are present in the sample.predicted_allosome (
ndarray|None) – Predicted allosomal values from the optimal model parameters, orNoneif not available.allosome_label (
str|None) – The allosome identifier (e.g.'X'), used as the row label suffix. Required whenobserved_allosomeorpredicted_allosomeis provided.
- Return type:
None