ClusterSystems#

class panorama.systems.system.ClusterSystems(identifier, *systems)#

Bases: object

Represents a cluster of systems that are considered homologous or functionally equivalent across different pangenomes.

ID#

Unique identifier for the cluster.

Type:

int

_systems_getter#

Dictionary mapping (pangenome name, system ID) to System instances.

Type:

Dict[Tuple[str, str], System]

__getitem__(key)#

Retrieves a system by its (pangenome name, system ID) key.

Parameters:

key (Tuple[str, str]) – The lookup key.

Returns:

System – The system corresponding to the key.

Raises:

KeyError – If the key does not exist.

Return type:

System

__init__(identifier, *systems)#

Initializes a ClusterSystems object and adds provided systems.

Parameters:
  • identifier (int) – The identifier for the system cluster.

  • *systems (System) – Variable number of systems to add initially.

__setitem__(key, value)#

Inserts a system into the cluster.

Parameters:
  • key (Tuple[str, str]) – Tuple containing (pangenome name, system ID).

  • value (System) – The system instance to insert.

Raises:

KeyError – If the key already exists in the cluster.

add(system)#

Adds a system to the cluster.

Parameters:

system (System) – The system to add.

Raises:
  • AssertionError – If the input is not a System instance.

  • KeyError – If a system with the same key already exists in the cluster.

Return type:

None

get(system_id, pangenome_name)#

Retrieves a system from the cluster using its system ID and pangenome name.

Parameters:
  • system_id (str) – ID of the system.

  • pangenome_name (str) – Name of the pangenome.

Returns:

System – The system object.

Raises:
  • AssertionError – If system_id is not a string.

  • KeyError – If the system is not found in the cluster.

Return type:

System

pangenomes()#

Returns the list of all pangenome names represented in the cluster.

Returns:

List[str] – List of pangenome names.

Return type:

List[str]

property systems: Generator[System, None, None]#

Generator yielding all systems in the cluster.

Returns:

Generator[System, None, None] – Systems in the cluster.