dae.pedigrees package

Subpackages

Submodules

dae.pedigrees.drawing module

Classes and helpers for drawing pedigrees into a PDF file.

class dae.pedigrees.drawing.OffsetLayoutDrawer(layouts: List[Layout], x_offset: int = 0, y_offset: int = 0, show_family: bool = False)[source]

Bases: object

Class drawing a family pedigree using a prebuild family layout.

GAP = 2.0
draw(figure: Figure | None = None, title: str | None = None, tags: set[str] | None = None) Figure[source]

Draw family pedigree.

class dae.pedigrees.drawing.PDFLayoutDrawer(filename: str)[source]

Bases: object

Helper class for producing PDF file with multiple pedigrees.

add_page(figure: Figure, title: str | None = None) None[source]

Add a new page to the PDF file.

dae.pedigrees.families_data module

class dae.pedigrees.families_data.FamiliesData[source]

Bases: Mapping[str, Family]

Defines class for handling families in a study.

property broken_families: dict[str, Family]
static combine(first: FamiliesData, second: FamiliesData, forced: bool = True) FamiliesData[source]

Combine families from two families data objects.

copy() FamiliesData[source]

Build a copy of a families data object.

property families_by_type: dict[FamilyType, set[str]]

Build a dictionary of families by type.

families_of_persons(person_ids: set[str]) set[str][source]
static from_families(families: dict[str, Family]) FamiliesData[source]

Build families data from dictionary of families.

static from_family_persons(family_persons: dict[str, list[Person]]) FamiliesData[source]

Build a families data object from persons grouped by family.

static from_pedigree_df(ped_df: DataFrame) FamiliesData[source]

Build a families data object from a pedigree data frame.

get(k[, d]) D[k] if k in D, else d.  d defaults to None.[source]
items() a set-like object providing a view on D's items[source]
keys() a set-like object providing a view on D's keys[source]
property ped_df: DataFrame

Build a pedigree dataframe from a families data.

pedigree_samples() list[str][source]
persons_with_parents() list[Person][source]

Return list of persons with both parents.

persons_with_roles(roles: list[Role] | None = None, family_ids: Iterable[str] | None = None) list[Person][source]

Return list of persons matching the specified roles.

persons_without_parents() list[Person][source]

Return list of persons without parents.

property real_persons: dict[tuple[str, str], Person]

Return a subset of individuals that are not generated.

redefine() None[source]

Rebuild all families.

values() an object providing a view on D's values[source]
dae.pedigrees.families_data.merge_families(l_fam: Family, r_fam: Family, forced: bool = True) Family[source]

Merge two families into one.

dae.pedigrees.families_data.tag_families_data(families: FamiliesData) None[source]

dae.pedigrees.family module

Defines classes representing individuals and families.

class dae.pedigrees.family.Family(family_id: str)[source]

Bases: object

Defines class to represent a family.

add_members(persons: list[Person]) None[source]
property family_type: FamilyType

Calculate the type of the family.

static from_persons(persons: list[Person]) Family[source]

Create a family from list of persons.

static from_records(records: dict) Family[source]
property full_members: list[Person]
get_columns() list[str][source]

Collect list of columns for representing a family as data frame.

get_member(person_id: str) Person | None[source]
get_members_with_roles(roles: list[str | Role]) list[Person][source]
get_members_with_statuses(statuses: list[Status]) list[Person][source]
has_members() bool[source]
property members_ids: list[str]
property members_in_order: list[Person]

Return list of family members in the order of definition.

members_index(person_ids: Iterable[str]) list[int][source]
redefine() None[source]
property samples_index: tuple[int | None, ...]
set_tag(tag: FamilyTag) None[source]
property tag_labels: set[str]
property tags: set[FamilyTag]
to_json() dict[source]
property trios: dict[str, tuple[str, str, str]]

Split family into list of trios - child, mom and dad.

unset_tag(tag: FamilyTag) None[source]
class dae.pedigrees.family.FamilyTag(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: IntEnum

Enumeration of all available family tags.

AFFECTED_DAD = 7
AFFECTED_MOM = 8
AFFECTED_PRB = 9
AFFECTED_SIB = 10
CONTROL = 6
FEMALE_PRB = 16
MALE_PRB = 15
MISSING_DAD = 18
MISSING_MOM = 17
MULTIPLEX = 5
NUCLEAR = 1
QUAD = 2
SIMPLEX = 4
TRIO = 3
UNAFFECTED_DAD = 11
UNAFFECTED_MOM = 12
UNAFFECTED_PRB = 13
UNAFFECTED_SIB = 14
static all_labels() Iterable[str][source]
static all_tags() Iterable[FamilyTag][source]
static from_label(label: str) FamilyTag[source]
property label: str
class dae.pedigrees.family.FamilyType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Family types used in family structure filters.

MULTIGENERATIONAL = 3
MULTIPLEX = 5
OTHER = 6
QUAD = 2
SIMPLEX = 4
TRIO = 1
static from_name(name: str) FamilyType[source]

Construct family type from string.

class dae.pedigrees.family.Person(**attributes: Any)[source]

Bases: object

Class to represent an individual.

all_tag_labels() dict[str, bool][source]
diff(other: Any) list[source]

Collect difference between two individuals.

property family_bin: int | None
property generated: bool
get_attr(key: str, default: Any = None) Any[source]
has_attr(key: str) bool[source]
has_both_parents() bool[source]
has_dad() bool[source]
has_missing_parent() bool[source]
has_mom() bool[source]
has_no_parent() bool[source]
has_parent() bool[source]
has_tag(tag: FamilyTag) bool[source]
is_child() bool[source]
is_parent() bool[source]
property layout: str | None
property member_index: int
property missing: bool
property not_sequenced: bool
redefine() None[source]

Extract attributes and turns them into properties.

property role: Role | None
property sample_index: int | None
set_attr(key: str, value: Any) None[source]
set_tag(tag: FamilyTag) None[source]
property sex: Sex
property status: Status
property tags: set[FamilyTag]
to_json() dict[str, Any][source]
unset_tag(tag: FamilyTag) None[source]
dae.pedigrees.family.get_pedigree_column_names(column_names: set[str]) list[str][source]

Produce pedigree columns given available person or family attributes.

dae.pedigrees.family_role_builder module

Family members’ roles with respect to the proband.

class dae.pedigrees.family_role_builder.FamilyRoleBuilder(family: Family)[source]

Bases: object

Build roles of family members.

build_roles() None[source]

Build roles of all family members.

class dae.pedigrees.family_role_builder.Mating(mom_id: str, dad_id: str | None)[source]

Bases: object

Class to represent a mating unit.

static build_id(mom_id: str | None, dad_id: str | None) str[source]
static parents_id(person: Person) str[source]

dae.pedigrees.family_tag_builder module

Helper class for tagging families.

class dae.pedigrees.family_tag_builder.FamilyTagsBuilder[source]

Bases: object

Class used ot apply all tags to a family.

TAGS: dict[FamilyTag, Callable[[Family], bool]] = {FamilyTag.NUCLEAR: <function tag_nuclear_family>, FamilyTag.QUAD: <function tag_quad_family>, FamilyTag.TRIO: <function tag_trio_family>, FamilyTag.SIMPLEX: <function tag_simplex_family>, FamilyTag.MULTIPLEX: <function tag_multiplex_family>, FamilyTag.CONTROL: <function tag_control_family>, FamilyTag.AFFECTED_DAD: <function tag_affected_dad_family>, FamilyTag.AFFECTED_MOM: <function tag_affected_mom_family>, FamilyTag.AFFECTED_PRB: <function tag_affected_prb_family>, FamilyTag.AFFECTED_SIB: <function tag_affected_sib_family>, FamilyTag.UNAFFECTED_DAD: <function tag_unaffected_dad_family>, FamilyTag.UNAFFECTED_MOM: <function tag_unaffected_mom_family>, FamilyTag.UNAFFECTED_PRB: <function tag_unaffected_prb_family>, FamilyTag.UNAFFECTED_SIB: <function tag_unaffected_sib_family>, FamilyTag.MALE_PRB: <function tag_male_prb_family>, FamilyTag.FEMALE_PRB: <function tag_female_prb_family>, FamilyTag.MISSING_MOM: <function tag_missing_mom_family>, FamilyTag.MISSING_DAD: <function tag_missing_dad_family>}
add_tagger(tag: FamilyTag, tagger: Callable[[Family], bool]) None[source]
clear_tags(family: Family) None[source]
tag_family(family: Family) None[source]

Tag family with all available tags.

tag_family_type(family: Family) None[source]

Tag a family with family type tags - short and full.

dae.pedigrees.family_tag_builder.check_affected_dad_family(family: Family) bool[source]
dae.pedigrees.family_tag_builder.check_affected_mom_family(family: Family) bool[source]
dae.pedigrees.family_tag_builder.check_affected_prb_family(family: Family) bool[source]
dae.pedigrees.family_tag_builder.check_affected_sib_family(family: Family) bool[source]
dae.pedigrees.family_tag_builder.check_control_family(family: Family) bool[source]
dae.pedigrees.family_tag_builder.check_family_tags_query(family: Family, or_mode: bool, include_tags: set[FamilyTag], exclude_tags: set[FamilyTag]) bool[source]

Check if a family passes specified filters.

dae.pedigrees.family_tag_builder.check_female_prb_family(family: Family) bool[source]
dae.pedigrees.family_tag_builder.check_male_prb_family(family: Family) bool[source]
dae.pedigrees.family_tag_builder.check_missing_dad_family(family: Family) bool[source]
dae.pedigrees.family_tag_builder.check_missing_mom_family(family: Family) bool[source]
dae.pedigrees.family_tag_builder.check_multiplex_family(family: Family) bool[source]
dae.pedigrees.family_tag_builder.check_nuclear_family(family: Family) bool[source]

Check if the family is a nuclear family.

dae.pedigrees.family_tag_builder.check_quad_family(family: Family) bool[source]
dae.pedigrees.family_tag_builder.check_simplex_family(family: Family) bool[source]
dae.pedigrees.family_tag_builder.check_tag(family: Family, tag: FamilyTag) bool[source]
dae.pedigrees.family_tag_builder.check_trio_family(family: Family) bool[source]
dae.pedigrees.family_tag_builder.check_unaffected_dad_family(family: Family) bool[source]
dae.pedigrees.family_tag_builder.check_unaffected_mom_family(family: Family) bool[source]
dae.pedigrees.family_tag_builder.check_unaffected_prb_family(family: Family) bool[source]
dae.pedigrees.family_tag_builder.check_unaffected_sib_family(family: Family) bool[source]
dae.pedigrees.family_tag_builder.set_attr(family: Family, label: str, value: Any) None[source]
dae.pedigrees.family_tag_builder.set_tag(family: Family, tag: FamilyTag) None[source]
dae.pedigrees.family_tag_builder.tag_affected_dad_family(family: Family) bool[source]

Set affected dad family tag to the family.

dae.pedigrees.family_tag_builder.tag_affected_mom_family(family: Family) bool[source]

Set affected mom family tag to the family.

dae.pedigrees.family_tag_builder.tag_affected_prb_family(family: Family) bool[source]

Set affected proband family tag to the family.

dae.pedigrees.family_tag_builder.tag_affected_sib_family(family: Family) bool[source]

Set affected sibling family tag to the family.

dae.pedigrees.family_tag_builder.tag_control_family(family: Family) bool[source]

Set control family tag to the family.

dae.pedigrees.family_tag_builder.tag_female_prb_family(family: Family) bool[source]

Set female proband family tag to the family.

dae.pedigrees.family_tag_builder.tag_male_prb_family(family: Family) bool[source]

Set male proband family tag to the family.

dae.pedigrees.family_tag_builder.tag_missing_dad_family(family: Family) bool[source]

Set missing dad family tag to the family.

dae.pedigrees.family_tag_builder.tag_missing_mom_family(family: Family) bool[source]

Set missing mom family tag to the family.

dae.pedigrees.family_tag_builder.tag_multiplex_family(family: Family) bool[source]

Set multiplex family tag to the family.

dae.pedigrees.family_tag_builder.tag_nuclear_family(family: Family) bool[source]

Set nuclear family tag to the family.

dae.pedigrees.family_tag_builder.tag_quad_family(family: Family) bool[source]

Set quad family tag to the family.

dae.pedigrees.family_tag_builder.tag_simplex_family(family: Family) bool[source]

Set simplex family tag to the family.

dae.pedigrees.family_tag_builder.tag_trio_family(family: Family) bool[source]

Set trio family tag to the family.

dae.pedigrees.family_tag_builder.tag_unaffected_dad_family(family: Family) bool[source]

Set unaffected dad family tag to the family.

dae.pedigrees.family_tag_builder.tag_unaffected_mom_family(family: Family) bool[source]

Set unaffected mom family tag to the family.

dae.pedigrees.family_tag_builder.tag_unaffected_prb_family(family: Family) bool[source]

Set unaffected proband family tag to the family.

dae.pedigrees.family_tag_builder.tag_unaffected_sib_family(family: Family) bool[source]

Set unaffected sibling family tag to the family.

dae.pedigrees.family_tag_builder.unset_tag(family: Family, tag: FamilyTag) None[source]

dae.pedigrees.generate_families_cache module

dae.pedigrees.generate_families_cache.main(argv: list[str] | None = None, gpf_instance: GPFInstance | None = None) None[source]

Command line tool to create genotype groups families cache.

dae.pedigrees.layout module

Classes and helper functions to represent pedigree layout.

class dae.pedigrees.layout.IndividualWithCoordinates(individual: Individual, x: float = 0.0, y: float = 0.0, size: float = 21.0)[source]

Bases: object

Class to represent individuals with specified coordinates.

SIZE = 21.0
property x_center: float
property y_center: float
class dae.pedigrees.layout.Layout(intervals: list[IntervalForVertex] | None = None)[source]

Bases: object

Represents a layout of a connected component of a family.

class BBox(min_x, min_y, max_x, max_y)

Bases: tuple

max_x

Alias for field number 2

max_y

Alias for field number 3

min_x

Alias for field number 0

min_y

Alias for field number 1

apply_to_family(family: Family) None[source]

Store family layout as individuals attributes.

static from_family(family: Family, add_missing_members: bool = True) list[Layout][source]

Generate layout for each connected component of a family.

static from_family_layout(family: Family) Layout | None[source]

Construct layout for each connected component using layout data.

get_bbox() BBox[source]

Calculate the bounding box of a layout.

property id_to_position: dict[str, IndividualWithCoordinates]
property individuals_by_rank: dict[str, int]

Return a dictionary mapping individual person IDs to their rank.

The rank is determined by the order of individuals in the _individuals_by_rank list. The higher the rank, the higher the position in the list.

Returns:

A dictionary mapping individual person IDs to their rank.

scale(scale: float = 1.0) None[source]

Scale the layout.

translate(x_offset: float = 0.0, y_offset: float = 0.0) None[source]

Translate a layout.

class dae.pedigrees.layout.Line(x1: float, y1: float, x2: float, y2: float, curve_base_height: float | None = None)[source]

Bases: object

Class to represent lines connecting individuals.

curve_p0() tuple[float, float][source]
curve_p1() tuple[float, float][source]
curve_p2() tuple[float, float][source]
curve_p3() tuple[float, float][source]
curve_y_at(t: float) float[source]
property curved: bool
inverse_curve_p1() tuple[float, float][source]
inverse_curve_p2() tuple[float, float][source]
inverse_curve_y_at(t: float) float[source]
class dae.pedigrees.layout.Point(x: 'float', y: 'float')[source]

Bases: object

x: float
y: float
dae.pedigrees.layout.layout_parser(layout: str) dict[str, int | float] | None[source]

Parse layout string.

dae.pedigrees.loader module

Loader for pedigree files.

class dae.pedigrees.loader.FamiliesLoader(families_filename: str | Path | TextIO, **params: Any)[source]

Bases: CLILoader

Pedigree files loader.

static build_families_data_from_pedigree(ped_df: DataFrame, pedigree_params: dict[str, Any] | None = None) FamiliesData[source]

Build a families data object from a pedigree data frame.

static flexible_pedigree_read(pedigree_filepath: str | Path | TextIO, ped_sep: str = '\t', ped_no_header: bool = False, ped_no_role: bool = False, ped_family: str | int = 'familyId', ped_person: str | int = 'personId', ped_mom: str | int = 'momId', ped_dad: str | int = 'dadId', ped_sex: str | int = 'sex', ped_status: str | int = 'status', ped_role: str | int = 'role', ped_proband: str | int = 'proband', ped_layout: str | int = 'layout', ped_generated: str | int = 'generated', ped_not_sequenced: str | int = 'not_sequenced', ped_sample_id: str | int = 'sample_id', enums_as_values: bool = False, **kwargs: Any) DataFrame[source]

Read a pedigree from file.

load() FamiliesData[source]
static load_pedigree_file(pedigree_filename: str | Path | TextIO, pedigree_params: dict[str, Any] | None = None) FamiliesData[source]

Load a pedigree files and return FamiliesData object.

static load_simple_families_file(infile: str | Path | TextIO, ped_sep: str = '\t') FamiliesData[source]

Load a pedigree from a DAE simple family format file.

classmethod parse_cli_arguments(argv: Namespace, use_defaults: bool = False) tuple[list[str], dict[str, Any]][source]

Parse cli arguments.

static save_families(families: FamiliesData, filename: str | Path | TextIO) None[source]
static save_pedigree(families: FamiliesData, filename: str | Path | TextIO) None[source]

Save FamiliesData object into a pedigree file.

static to_tsv(families: FamiliesData) str[source]

Convert a FamiliesData object into a TSV string.

dae.pedigrees.pedigrees module

class dae.pedigrees.pedigrees.FamilyConnections(family: Family, id_to_individual: dict[str, Individual], id_to_mating_unit: dict[str, MatingUnit])[source]

Bases: object

Representation of connections between family members.

static add_missing_members(family: Family) None[source]

Construct missing family members.

add_ranks() None[source]

Calculate and add ranks to the family members.

connected_components() Iterator[Graph][source]
create_sandwich_instance() SandwichInstance[source]

Generate an Interval Graph Sandwich problem instance.

Based on https://academic.oup.com/bioinformatics/article-pdf/17/2/174/442086/170174.pdf Slightly modified to support people with multiple mates. :return: SandwichInstance

classmethod from_family(family: Family, add_missing_members: bool = True) FamilyConnections | None[source]

Build family connections object from a family.

get_graph() Graph[source]

Build a family graph.

get_individual(person_id: str) Individual | None[source]
get_individuals() set[Individual][source]
get_individuals_with_rank(rank: int) set[Individual][source]
get_mating_units() set[MatingUnit][source]
get_sibship_units() set[SibshipUnit][source]
is_connected() bool[source]
static is_valid_family(family: dict[str, MatingUnit]) bool[source]

Check if a family is valid.

max_rank() int[source]
property members: list[Person]
class dae.pedigrees.pedigrees.Individual(mating_units: list[MatingUnit] | None = None, member: Person | None = None, parents: MatingUnit | None = None, rank: int = -3673473456)[source]

Bases: IndividualGroup

Represents an individual and all connected members.

NO_RANK = -3673473456
add_rank(rank: int) None[source]

Calculate and set generation rank for each individual in a group.

are_mates(other_individual: Individual) bool[source]
are_siblings(other_individual: Individual) bool[source]
children_set() set[Individual][source]

Return set of children in the group.

individual_set() set[Individual][source]

Return set of individuals in the group.

is_individual() bool[source]
class dae.pedigrees.pedigrees.IndividualGroup[source]

Bases: ABC

Group of individuals connected to an individual.

abstract children_set() set[Individual][source]

Return set of children in the group.

generation_ranks() set[int][source]
abstract individual_set() set[Individual][source]

Return set of individuals in the group.

is_individual() bool[source]
class dae.pedigrees.pedigrees.Interval(left: float = 0.0, right: float = 1.0)[source]

Bases: object

Represents an interval between two points on a number line.

intersection(other: IntervalForVertex) Interval | None[source]

Compute the intersection of this interval with another interval.

Args:
other (IntervalForVertex): The other interval to compute the

intersection with.

Returns:
Optional[Interval]: The intersection interval if it exists,

None otherwise.

class dae.pedigrees.pedigrees.IntervalForVertex(vertex: IndividualGroup, left: float = 0.0, right: float = 1.0)[source]

Bases: Interval

Represents an interval associated with a vertex in a pedigree.

class dae.pedigrees.pedigrees.MatingUnit(mother: Individual, father: Individual, children: SibshipUnit | None = None)[source]

Bases: IndividualGroup

Gropu of individuals connected in a mating unit.

children_set() set[Individual][source]

Return set of children in the group.

individual_set() set[Individual][source]

Return set of individuals in the group.

other_parent(this_parent: Individual) Individual[source]
class dae.pedigrees.pedigrees.Realization(graph: Graph, forbidden_graph: Graph, intervals: list[IntervalForVertex] | None = None, domain: list[IndividualGroup] | None = None, max_width: int = 3, _cached_active_vertices: set[IndividualGroup] | None = None, _cached_maximal_set: set[IndividualGroup] | None = None, _graph_neighbors_cache: dict[IndividualGroup, set[IndividualGroup]] | None = None, _cached_dangling_set: set[IndividualGroup] | None = None, _cached_vertex_degree: dict[IndividualGroup, int] | None = None)[source]

Bases: object

Represents a realization in a pedigree graph.

Attributes:

graph (nx.Graph): The graph representing the pedigree. forbidden_graph (nx.Graph): The graph representing forbidden edges

in the pedigree.

intervals (Optional[list[IntervalForVertex]]): The intervals for each

vertex in the pedigree.

domain (Optional[list[IndividualGroup]]): The domain of the pedigree. max_width (int): The maximum width of the pedigree. _cached_active_vertices (Optional[set[IndividualGroup]]): Cached set of

active vertices.

_cached_maximal_set (Optional[set[IndividualGroup]]): Cached set of

maximal vertices.

_graph_neighbors_cache (

Optional[dict[IndividualGroup, set[IndividualGroup]]]): Cached neighbors of each vertex.

_cached_dangling_set (Optional[set[IndividualGroup]]): Cached set of

dangling vertices.

_cached_vertex_degree (Optional[dict[IndividualGroup, int]]): Cached

degree of each vertex.

can_extend(new_vertex: IndividualGroup) bool[source]

Determine whether a new vertex can be added to the pedigree.

Args:

new_vertex (IndividualGroup): The new vertex to be added.

Returns:

bool: True if the new vertex can be added, False otherwise.

copy() Realization[source]
dangling(vertex: IndividualGroup) set[IndividualGroup][source]
dangling_set() set[IndividualGroup][source]

Return a set of the dangling vertices in the pedigree graph.

Dangling vertices are vertices that have no outgoing edges.

Returns:

set[IndividualGroup]: A set of IndividualGroup objects representing the dangling vertices.

degree(vertex: IndividualGroup) int[source]

Calculate the degree of a vertex in the pedigree.

Parameters:

vertex (IndividualGroup): The vertex for which to calculate the degree.

Returns:

int: The degree of the vertex.

extend(vertex: IndividualGroup) bool[source]
force_extend(vertex: IndividualGroup) None[source]

Extend the pedigree by adding a new vertex.

Parameters: - vertex (IndividualGroup): The vertex to be added to the pedigree.

Returns: - None

get_active_vertex_edges(vertex: IndividualGroup) set[IndividualGroup][source]
get_active_vertices() set[IndividualGroup][source]

Return a set of active vertices in the domain.

Returns:

set[IndividualGroup]: A set of active vertices.

get_interval(vertex: IndividualGroup) IntervalForVertex[source]
get_maximal_set() set[IndividualGroup][source]

Return the maximal set of IndividualGroup objects in the domain.

If the maximal set has already been computed, it is returned from the cache. Otherwise, the maximal set is computed by iterating over the domain and checking if each IndividualGroup is maximal. The computed maximal set is then stored in the cache for future use.

Returns:

set[IndividualGroup]: The maximal set of IndividualGroup objects.

is_active_vertex(vertex: IndividualGroup) bool[source]
is_in_interval_order(v1_idx: int, v2_idx: int) bool[source]
is_maximal(index: int) bool[source]
class dae.pedigrees.pedigrees.SandwichInstance(vertices: set[IndividualGroup], required_graph: Graph, forbidden_graph: Graph)[source]

Bases: object

Represent a sandwich instance representing the pedigree.

Attributes:
vertices (set[IndividualGroup]): The set of vertices in the sandwich

instance.

required_graph (nx.Graph): The required graph representing the

connections between vertices.

forbidden_graph (nx.Graph): The forbidden graph representing the

forbidden connections between vertices.

static from_sets(all_vertices: set[IndividualGroup], required_set: set[tuple[IndividualGroup, IndividualGroup]], forbidden_set: set[tuple[IndividualGroup, IndividualGroup]]) SandwichInstance[source]

Create a SandwichInstance object.

Args:
all_vertices (set[IndividualGroup]): Set of all vertices in the

graph.

required_set (set[tuple[IndividualGroup, IndividualGroup]]): Set

of required edges.

forbidden_set (set[tuple[IndividualGroup, IndividualGroup]]): Set

of forbidden edges.

Returns:

SandwichInstance: The created SandwichInstance object.

class dae.pedigrees.pedigrees.SandwichSolver[source]

Bases: object

A class that provides methods for solving sandwich instances.

Methods: - solve(sandwich_instance: SandwichInstance):

Solves the given sandwich instance and returns a list of intervals for each vertex, or None if no solution is found.

  • try_solve(sandwich_instance: SandwichInstance)

    Tries to solve the given sandwich instance and returns a list of intervals for each vertex, or None if no solution is found.

static solve(sandwich_instance: SandwichInstance) list[IntervalForVertex] | None[source]

Solve the sandwich instance.

Args:

sandwich_instance (SandwichInstance): The sandwich instance to solve.

Returns:

Optional[list[IntervalForVertex]]: A list of intervals for each vertex if a solution is found, otherwise an empty list.

static try_solve(sandwich_instance: SandwichInstance) list[IntervalForVertex] | None[source]

Try to solve the sandwich instance by finding a realization.

Searchs for realization that satisfies the given constraints.

Args:

sandwich_instance (SandwichInstance): The sandwich instance to be solved.

Returns:

Optional[list[IntervalForVertex]]: A list of intervals for each vertex if a solution is found,otherwise None.

class dae.pedigrees.pedigrees.SibshipUnit(individuals: Iterable[Individual] | None = None)[source]

Bases: IndividualGroup

Group of individuals connected as siblings.

children_set() set[Any][source]

Return set of children in the group.

individual_set() set[Individual][source]

Return set of individuals in the group.

dae.pedigrees.pedigrees.copy_graph(graph: Graph) Graph[source]

dae.pedigrees.testing module

Defines tools usefull for testing families.

dae.pedigrees.testing.build_families_data(content: str) FamiliesData[source]
dae.pedigrees.testing.build_family(content: str) Family[source]

Module contents