network_analysis#
- konnektor.network_analysis.network_analysis.get_component_connectivities(ligand_network: LigandNetwork, normalize: bool = False) dict[SmallMoleculeComponent, float | int]#
Calculate the connectivity for all nodes in the graph.
- Parameters:
ligand_network (LigandNetwork)
normalize (bool, optional) – If True, normalize each node’s connectivity by the total number of edges in the LigandNetwork, by default False.
- Returns:
Dict of nodes and their corresponding connectivity (int if normalize=False, otherwise float).
- Return type:
dict[SmallMoleculeComponent, float | int]
- konnektor.network_analysis.network_analysis.get_component_number_cycles(ligand_network: LigandNetwork, higher_bound: int = 4) dict[SmallMoleculeComponent, int | int64]#
Calculate the number of cycles each node is present in.
- Parameters:
ligand_network (LigandNetwork)
higher_bound (int, optional) – Largest cycle (by number of nodes) to be considered a “cycle” when counting, by default 4.
- Returns:
Dict of nodes (SmallMoleculeComponent) and their corresponding number of cycles counted.
- Return type:
dict[SmallMoleculeComponent, int|np.int64]
- konnektor.network_analysis.network_analysis.get_component_scores(ligand_network: LigandNetwork, normalize: bool = True) dict[SmallMoleculeComponent, float]#
Calculate the score for all nodes in the graph, where a node’s score is defined as the sum of the scores of all its edges.
- Parameters:
ligand_network (LigandNetwork)
normalize (bool, optional) – If True, normalize each node’s score by the total number of edges in the LigandNetwork, by default True.
- Returns:
Dict of nodes (SmallMoleculeComponent) and their corresponding scores.
- Return type:
dict[SmallMoleculeComponent, float]
- konnektor.network_analysis.network_analysis.get_is_connected(ligand_network: LigandNetwork) bool#
Check whether all nodes in the LigandNetwork are connected to each other, ignoring edge direction.
A False value indicates that either some nodes have no edges or that there are separate networks that do not link to each other.
Deprecated since version 0.4.0: This function is deprecated. Use the
.is_connected()method ofligand_networkinstead. See gufe.LigandNetwork docs for more details.- Parameters:
ligand_network (LigandNetwork)
- Returns:
True if the LigandNetwork is connected, otherwise False.
- Return type:
bool
- konnektor.network_analysis.network_analysis.get_network_cost(ligand_network: LigandNetwork) float#
Calculate the network cost based on summation of the edge costs, cost = 1 - score.
- Parameters:
ligand_network (LigandNetwork)
- Returns:
Summation of all edge costs in the LigandNetwork.
- Return type:
float
- konnektor.network_analysis.network_analysis.get_network_efficiency(ligand_network: LigandNetwork) float#
Calculate the network efficiency, defined as the network score normalized by the number of edges in the network.
- Parameters:
ligand_network (LigandNetwork)
- Returns:
Network efficiency score.
- Return type:
float
- konnektor.network_analysis.network_analysis.get_network_score(ligand_network: LigandNetwork) float#
Calculate the network score based on summation of the edge scores.
- Parameters:
ligand_network (LigandNetwork)
- Returns:
Summation of all edge scores in the LigandNetwork.
- Return type:
float
- konnektor.network_analysis.network_analysis.get_number_of_network_cycles(ligand_network: LigandNetwork, higher_bound: int = 3) int#
Calculate the number of cycles present in the network for cycles up to size higher_bound.
- Parameters:
ligand_network (LigandNetwork)
higher_bound (int, optional) – Largest number of nodes in cycle to count, by default 3.
- Returns:
Number of cycles of size <= higher_bound present in the LigandNetwork.
- Return type:
int
- konnektor.network_analysis.network_analysis.get_transformation_failure_robustness(ligand_network: LigandNetwork, failure_rate: float = 0.05, nrepeats: int = 100, seed: int | None = None) float64#
- Estimate the robustness of a LigandNetwork by:
Removing a number of edges corresponding to the percentage given by failure_rate.
Randomly repeating step 1 nrepeats times.
Average of the results of the repeats in step 2 for a result between 0 (was always disconnected) and 1 (never was disconnected).
- Parameters:
ligand_network (LigandNetwork)
failure_rate (float, optional) – Failure rate of edges to use in the estimation, by default 0.05.
nrepeats (int, optional) – Number of repeat samples to use in the estimation, by default 100.
seed (int | None, optional) – Seed to use for the random number generator, by default None.
- Returns:
Average probability that the network remained connected when failure_rate fraction of edges was removed. Between 0.0 (the network was always disconnected) and 1.0 (network was never disconnected).
- Return type:
np.float64