dae package

Subpackages

Submodules

dae.person_filters module

class dae.person_filters.CriteriaFilter(criteria: str, values: Collection)[source]

Bases: PersonFilter

Filter individuals based on given criteria and their values.

apply(families: FamiliesData, roles: List[str] | None = None) Set[str][source]

Return a set of person ids for individuals matching the filter.

class dae.person_filters.FamilyFilter(person_filter: PersonFilter)[source]

Bases: PersonFilter

Apply a given PersonFilter, but collect a set of family ids instead.

apply(*args, **kwargs) Set[str][source]
apply_to_df(df: DataFrame) DataFrame[source]
class dae.person_filters.PersonFilter[source]

Bases: object

Generic interface for a filter working on FamiliesData objects.

apply(families: FamiliesData, roles: List[str] | None = None) Set[str][source]
apply_to_df(df: DataFrame) DataFrame[source]
class dae.person_filters.PersonFilterRange(criteria: str, values: Collection)[source]

Bases: CriteriaFilter

Filter based on a range of values.

apply_to_df(df: DataFrame) DataFrame[source]
class dae.person_filters.PersonFilterSet(criteria: str, values: Collection)[source]

Bases: CriteriaFilter

Filter based on a specific set of values.

apply_to_df(df: DataFrame) DataFrame[source]
class dae.person_filters.PhenoFilter(criteria: str, values: Collection, phenotype_data: PhenotypeData)[source]

Bases: CriteriaFilter

Filter using a phenotype measure as criteria.

apply(families: FamiliesData, roles: List[str] | None = None) Set[str][source]

Return a set of person ids for individuals matching the filter.

class dae.person_filters.PhenoFilterRange(measure: Measure, values: Collection, phenotype_data: PhenotypeData)[source]

Bases: PhenoFilter, PersonFilterRange

Filter based on a range of phenotype measure values.

class dae.person_filters.PhenoFilterSet(measure: Measure, values: Collection, phenotype_data: PhenotypeData)[source]

Bases: PhenoFilter, PersonFilterSet

Filter based on a specific set of phenotype measure values.

dae.person_filters.make_pedigree_filter(pedigree_filter: dict) PersonFilter[source]

Create a PersonFilter based on a dict config.

dae.person_filters.make_pheno_filter(pheno_filter: dict, phenotype_data: PhenotypeData) PersonFilter[source]

Create a PhenoFilter based on a dict config.

dae.person_sets module

Provide classes for grouping of individuals by some criteria.

This module provides functionality for grouping individuals from a study or study group into various sets based on what value they have in a given mapping.

class dae.person_sets.ChildrenBySex(male: set[tuple[str, str]], female: set[tuple[str, str]], unspecified: set[tuple[str, str]])[source]

Bases: object

Statistics about children in a PersonSet.

female: set[tuple[str, str]]
male: set[tuple[str, str]]
unspecified: set[tuple[str, str]]
class dae.person_sets.ChildrenStats(male: int, female: int, unspecified: int)[source]

Bases: object

Statistics about children in a PersonSet.

female: int
male: int
property total: int
unspecified: int
class dae.person_sets.PSCQuery(collection_id: str, selected_person_sets: set[str])[source]

Bases: object

Person set collection query.

collection_id: str
selected_person_sets: set[str]
class dae.person_sets.PersonSet(psid: str, name: str, values: list[str], color: str, persons: dict[tuple[str, str], dae.pedigrees.family.Person])[source]

Bases: object

Set of individuals mapped to a common value in the source.

static from_json(json: dict[str, Any], families: FamiliesData) PersonSet[source]

Construct person set from a JSON dict.

get_children() list[dae.pedigrees.family.Person][source]

Return all children in the person set.

get_children_by_sex() ChildrenBySex[source]

Return all children in the person set splitted by sex.

get_children_count() int[source]
get_children_stats() ChildrenStats[source]

Return statistics about children in the person set.

get_parents() Generator[Person, None, None][source]
to_json() dict[str, Any][source]
class dae.person_sets.PersonSetCollection(pscid: str, name: str, config: dict[str, Any], sources: list[Source], person_sets: dict[str, PersonSet], default: PersonSet, families: FamiliesData)[source]

Bases: object

The collection of all possible person sets in a given source.

class Source(sfrom: 'str', ssource: 'str')[source]

Bases: object

sfrom: str
ssource: str
collect_person_collection_attributes(person: Person, pheno_db: PhenotypeData | None) FrozenSet[str][source]

Collect all configured attributes for a Person.

static combine(collections: list[dae.person_sets.PersonSetCollection], families: FamiliesData) PersonSetCollection[source]

Combine a list of PersonSetCollection objects into a single one.

config_json() dict[str, Any][source]

Produce a JSON configuration for this PersonSetCollection object.

domain_json() dict[str, Any][source]

Produce a JSON to represent domain of this PersonSetCollection.

static from_families(psc_config: dict[str, Any], families_data: FamiliesData, pheno_db: PhenotypeData | None = None) PersonSetCollection[source]

Produce a PersonSetCollection from a config and pedigree.

static from_json(data: dict[str, Any], families: FamiliesData) PersonSetCollection[source]

Construct person sets collection from json serialization.

static get_person_color(person: Person, person_set_collection: PersonSetCollection) str[source]

Get the hex color value for a Person in a PersonSetCollection.

get_person_set(person_id: tuple[str, str]) PersonSet | None[source]
get_person_set_of_person(fpid: tuple[str, str]) PersonSet | None[source]

Retrieve the PersonSet associated with the given person identifier.

Args:
fpid (tuple[str, str]): The person identifier consisting of two

strings - family ID and person ID.

Returns:
Optional[PersonSet]: The PersonSet associated with the given

person identifier, or None if not found.

get_stats() dict[str, dict[str, int]][source]

Return a dictionary with statistics for each PersonSet.

The statistics are a dictionary containing the amount of parents and children in the set.

is_pedigree_only() bool[source]
static merge_configs(person_set_collections: list[dae.person_sets.PersonSetCollection]) Box[source]

Merge the configurations of a list of PersonSetCollection objects.

Only supports merging PersonSetCollection objects with matching ids. The method will not merge the PersonSet objects’ values.

static remove_empty_person_sets(person_set_collection: PersonSetCollection) PersonSetCollection[source]

Remove all empty person sets in a PersonSetCollection in place.

to_json() dict[str, Any][source]

Serialize a person sets collection to a json format.

Module contents