Skip to content

Pathway

pathway

Pathway Value Object

Represents a KEGG metabolic pathway.

Classes

Pathway dataclass

Pathway(id: str, name: str)

Value Object for KEGG metabolic pathway.

Parameters:

Name Type Description Default
id str

Pathway identifier (e.g., 'map00010')

required
name str

Descriptive pathway name (e.g., 'Glycolysis / Gluconeogenesis')

required

Raises:

Type Description
ValueError

If ID or name are empty

Notes

Pathways are immutable and uniquely identified by ID.

Functions
__post_init__
__post_init__()

Validates pathway fields.

Raises:

Type Description
ValueError

If ID or name are invalid.

Source code in src/domain/value_objects/pathway.py
def __post_init__(self):
    """
    Validates pathway fields.

    Raises
    ------
    ValueError
        If ID or name are invalid.
    """
    if not self.id or not self.id.strip():
        raise ValueError("Pathway ID cannot be empty")

    if not self.name or not self.name.strip():
        raise ValueError("Pathway name cannot be empty")
__str__
__str__() -> str

Returns string representation of pathway.

Returns:

Type Description
str

Pathway name.

Source code in src/domain/value_objects/pathway.py
def __str__(self) -> str:
    """
    Returns string representation of pathway.

    Returns
    -------
    str
        Pathway name.
    """
    return self.name
__repr__
__repr__() -> str

Returns debug representation of pathway.

Returns:

Type Description
str

Representation in format "Pathway('id', 'name')".

Source code in src/domain/value_objects/pathway.py
def __repr__(self) -> str:
    """
    Returns debug representation of pathway.

    Returns
    -------
    str
        Representation in format "Pathway('id', 'name')".
    """
    return f"Pathway('{self.id}', '{self.name}')"
__hash__
__hash__() -> int

Hash based on pathway ID.

Returns:

Type Description
int

Hash of the ID.

Source code in src/domain/value_objects/pathway.py
def __hash__(self) -> int:
    """
    Hash based on pathway ID.

    Returns
    -------
    int
        Hash of the ID.
    """
    return hash(self.id)