tracts.tracts_data.TractsData#

class TractsData(population, autosome_bins, autosome_data_mapped, allosome_bins=None, allosome_length=None, female_data_mapped=None, male_data_mapped=None, num_females=None, num_males=None)#

Bases: object

Observed tract-length histogram data for a population, mapped to a demographic model’s population ordering, for autosomes and (optionally) allosomes.

population#

The population providing chromosome lengths and sample sizes.

Type:

Population

autosome_bins#

Bin edges for the autosomal tract-length histogram.

Type:

np.ndarray

autosome_data_mapped#

Observed autosomal tract counts per population, indexed to match the demographic model’s population ordering.

Type:

list of list

allosome_bins#

Bin edges for the allosomal tract-length histogram. None if allosomal data is not available.

Type:

np.ndarray | None

allosome_length#

Length of the X chromosome in Morgans. None if allosomal data is not available.

Type:

float | None

female_data_mapped#

Observed X-chromosome tract counts for females per population, indexed to match the demographic model’s population ordering. None if allosomal data is not available.

Type:

list of list | None

male_data_mapped#

Observed X-chromosome tract counts for males per population, indexed to match the demographic model’s population ordering. None if allosomal data is not available.

Type:

list of list | None

num_females#

Number of female samples. None if allosomal data is not available.

Type:

int | None

num_males#

Number of male samples. None if allosomal data is not available.

Type:

int | None

allosome_bins: ndarray | None = None#
allosome_length: float | None = None#
autosome_bins: ndarray#
autosome_data_mapped: list#
female_data_mapped: list | None = None#
classmethod from_population(population, p_dict, npts, exclude_tracts_below_cM=0, include_allosomes=True)#

Extracts and maps tract-length histograms from a population, for autosomes and, if requested, allosomes.

Parameters:
  • population (Population) – The population to extract tract-length histograms from.

  • p_dict (dict) – A dictionary mapping population labels to their corresponding indices in the demographic model.

  • npts (int) – Number of bins for the tract-length histograms.

  • exclude_tracts_below_cM (float) – Minimum tract length in centimorgans to include in the histograms.

  • include_allosomes (bool) – Whether to also extract and map allosomal (X-chromosome) tract-length histograms. If False, allosome_bins and the other allosome-related attributes are left as None.

Returns:

The extracted and mapped tract-length histogram data.

Return type:

TractsData

property has_allosome_data: bool#

Whether allosomal tract-length data is available (allosome_bins is not None).

male_data_mapped: list | None = None#
num_females: int | None = None#
num_males: int | None = None#
population: Population#