tracts.driver_utils.get_ancestry_proportions#
- get_ancestry_proportions(driver_spec, population, ancestor_labels, allosome_label)#
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.
- Parameters:
driver_spec (
InferenceConfig) – The configuration for the inference process, as specified in the driver file. Used to check whether allosomes are specified in the sample configuration.population (
Population) – The population for which to calculate ancestry proportions.ancestor_labels (
list[str]) – A list of ancestry labels for which to calculate the ancestry proportions.allosome_label (
str) – The label for the allosome to use when calculating allosome ancestry proportions. Only used if allosomes are specified in the driver file.
- Returns:
A tuple
(autosome_proportions, allosome_proportions), whereautosome_proportionsare the ancestry proportions calculated from autosomal data, averaged across all individuals in the population, andallosome_proportionsare the corresponding proportions calculated from allosomal data. Ifdriver_spec.samples.allosomesis empty,allosome_proportionsis an empty list.- Return type:
tuple[list[float], list[float]]