dae.person_sets package
Subpackages
Submodules
dae.person_sets.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.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.person_sets.ChildrenStats(male: int, female: int, unspecified: int, parents: int)[source]
Bases:
object
Statistics about children in a PersonSet.
- female: int
- male: int
- parents: int
- property total: int
- unspecified: int
- class dae.person_sets.person_sets.PSCQuery(psc_id: str, selected_person_sets: set[str])[source]
Bases:
object
Person set collection query.
- psc_id: str
- selected_person_sets: set[str]
- class dae.person_sets.person_sets.PersonSet(psid: str, name: str, values: tuple[str, ...], color: str, persons: dict[tuple[str, str], 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_by_sex() ChildrenBySex [source]
Return all children in the person set splitted by sex.
- get_children_stats() ChildrenStats [source]
Return statistics about children in the person set.
- class dae.person_sets.person_sets.PersonSetCollection(config: PersonSetCollectionConfig, person_sets: dict[str, PersonSet], default: PersonSet, families: FamiliesData)[source]
Bases:
object
The collection of all possible person sets in a given source.
- collect_person_collection_attributes(person: Person, pheno_db: PhenotypeData | None) tuple[str, ...] [source]
Collect all configured attributes for a Person.
- static combine(collections: list[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: PersonSetCollectionConfig, families_data: FamiliesData, pheno_db: PhenotypeData | None = None) PersonSetCollection [source]
Produce a PersonSetCollection from a config and pedigree.
- 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_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.
- static merge_configs(person_set_collections: list[PersonSetCollection]) PersonSetCollectionConfig [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.
- query_fpids(query: PSCQuery) set[tuple[str, str]] | None [source]
Query the PersonSetCollection for the selected person sets.
- query_person_ids(query: PSCQuery) set[str] | None [source]
Query the PersonSetCollection for the selected person sets.
- static remove_empty_person_sets(person_set_collection: PersonSetCollection) PersonSetCollection [source]
Remove all empty person sets in a PersonSetCollection in place.
- class dae.person_sets.person_sets.PersonSetCollectionConfig(*, id: str, name: str, sources: list[SourceConfig], domain: list[PersonSetConfig], default: PersonSetConfig)[source]
Bases:
BaseModel
Configuration for a collection of person sets.
- default: PersonSetConfig
- domain: list[PersonSetConfig]
- id: str
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'default': FieldInfo(annotation=PersonSetConfig, required=True), 'domain': FieldInfo(annotation=list[PersonSetConfig], required=True), 'id': FieldInfo(annotation=str, required=True), 'name': FieldInfo(annotation=str, required=True), 'sources': FieldInfo(annotation=list[SourceConfig], required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- name: str
- sources: list[SourceConfig]
- class dae.person_sets.person_sets.PersonSetConfig(*, id: str, name: str, values: tuple[str, ...], color: str)[source]
Bases:
BaseModel
Configuration for a person set.
- color: str
- id: str
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'color': FieldInfo(annotation=str, required=True), 'id': FieldInfo(annotation=str, required=True), 'name': FieldInfo(annotation=str, required=True), 'values': FieldInfo(annotation=tuple[str, ...], required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- name: str
- values: tuple[str, ...]
- class dae.person_sets.person_sets.SourceConfig(*, from_: Literal['pedigree', 'phenodb'], source: str)[source]
Bases:
BaseModel
Configuration for a source.
- from_: Literal['pedigree', 'phenodb']
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'from_': FieldInfo(annotation=Literal['pedigree', 'phenodb'], required=True), 'source': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- source: str
- dae.person_sets.person_sets.parse_person_set_collection_config(psc_config: dict[str, Any]) PersonSetCollectionConfig [source]
Parse a person set collection configuration.
- dae.person_sets.person_sets.parse_person_set_collections_study_config(config: dict[str, Any]) dict[str, PersonSetCollectionConfig] [source]
Parse a person sets configuration.
- dae.person_sets.person_sets.parse_person_set_config(psc_id: str, domain: dict[str, Any]) PersonSetConfig [source]
Parse a person set configuration.
Module contents
- 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, parents: int)[source]
Bases:
object
Statistics about children in a PersonSet.
- female: int
- male: int
- parents: int
- property total: int
- unspecified: int
- class dae.person_sets.PSCQuery(psc_id: str, selected_person_sets: set[str])[source]
Bases:
object
Person set collection query.
- psc_id: str
- selected_person_sets: set[str]
- class dae.person_sets.PersonSet(psid: str, name: str, values: tuple[str, ...], color: str, persons: dict[tuple[str, str], 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_by_sex() ChildrenBySex [source]
Return all children in the person set splitted by sex.
- get_children_stats() ChildrenStats [source]
Return statistics about children in the person set.
- class dae.person_sets.PersonSetCollection(config: PersonSetCollectionConfig, person_sets: dict[str, PersonSet], default: PersonSet, families: FamiliesData)[source]
Bases:
object
The collection of all possible person sets in a given source.
- collect_person_collection_attributes(person: Person, pheno_db: PhenotypeData | None) tuple[str, ...] [source]
Collect all configured attributes for a Person.
- static combine(collections: list[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: PersonSetCollectionConfig, families_data: FamiliesData, pheno_db: PhenotypeData | None = None) PersonSetCollection [source]
Produce a PersonSetCollection from a config and pedigree.
- 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_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.
- static merge_configs(person_set_collections: list[PersonSetCollection]) PersonSetCollectionConfig [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.
- query_fpids(query: PSCQuery) set[tuple[str, str]] | None [source]
Query the PersonSetCollection for the selected person sets.
- query_person_ids(query: PSCQuery) set[str] | None [source]
Query the PersonSetCollection for the selected person sets.
- static remove_empty_person_sets(person_set_collection: PersonSetCollection) PersonSetCollection [source]
Remove all empty person sets in a PersonSetCollection in place.
- class dae.person_sets.PersonSetCollectionConfig(*, id: str, name: str, sources: list[SourceConfig], domain: list[PersonSetConfig], default: PersonSetConfig)[source]
Bases:
BaseModel
Configuration for a collection of person sets.
- default: PersonSetConfig
- domain: list[PersonSetConfig]
- id: str
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'default': FieldInfo(annotation=PersonSetConfig, required=True), 'domain': FieldInfo(annotation=list[PersonSetConfig], required=True), 'id': FieldInfo(annotation=str, required=True), 'name': FieldInfo(annotation=str, required=True), 'sources': FieldInfo(annotation=list[SourceConfig], required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- name: str
- sources: list[SourceConfig]
- class dae.person_sets.PersonSetConfig(*, id: str, name: str, values: tuple[str, ...], color: str)[source]
Bases:
BaseModel
Configuration for a person set.
- color: str
- id: str
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'color': FieldInfo(annotation=str, required=True), 'id': FieldInfo(annotation=str, required=True), 'name': FieldInfo(annotation=str, required=True), 'values': FieldInfo(annotation=tuple[str, ...], required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- name: str
- values: tuple[str, ...]
- class dae.person_sets.SourceConfig(*, from_: Literal['pedigree', 'phenodb'], source: str)[source]
Bases:
BaseModel
Configuration for a source.
- from_: Literal['pedigree', 'phenodb']
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid'}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'from_': FieldInfo(annotation=Literal['pedigree', 'phenodb'], required=True), 'source': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- source: str
- dae.person_sets.parse_person_set_collection_config(psc_config: dict[str, Any]) PersonSetCollectionConfig [source]
Parse a person set collection configuration.
- dae.person_sets.parse_person_set_collections_study_config(config: dict[str, Any]) dict[str, PersonSetCollectionConfig] [source]
Parse a person sets configuration.
- dae.person_sets.parse_person_set_config(psc_id: str, domain: dict[str, Any]) PersonSetConfig [source]
Parse a person set configuration.