FEV_KEGG.Robustness.Topology.Redundancy module

In this module robustness is reduced to the topological point of view. When doing so robustness equals redundancy. The term ‘robustness’ is treated as a special case of ‘flexibility’, meaning both are concepts of redundancy.

Definitions

If a key element is deleted from a graph, e.g. all enzymes realising a certain EC number are deleted from an organism’s genome:

‘Flexibility’ exists if the former substrates and/or products can still be (at least partially) metabolised via alternative paths, in their original respective direction. This does not mean the alternative paths have to include both, the orginal substrate and product, at the same time.

‘Robustness’ exists if the former substrates and products are (at least partially) still connected, in their original direction, albeit via alternative paths. This means the alternative paths have to include both, the orginal substrate and product, at the same time.

class FEV_KEGG.Robustness.Topology.Redundancy.Comparison(graphA: FEV_KEGG.Graph.Models.DirectedMultiGraph, graphB: FEV_KEGG.Graph.Models.DirectedMultiGraph)[source]

Bases: object

Compare redundancy between two graphs.

Parameters:
Variables:
classmethod fromCladePair(cladePair: FEV_KEGG.Evolution.Clade.CladePair, majorityPercentage=None)[source]

Compare redundancy between two clades’ core metabolisms.

Parameters:
  • cladePair (CladePair) – The pair of clades from which to extract the graph.
  • majorityPercentage (float, optional) – If None, use collective EC graph. If not None, use majority EC graph with majorityPercentage % majority.
Returns:

Return type:

Comparison

classmethod fromOrganismGroups(groupA: FEV_KEGG.KEGG.Organism.Group, groupB: FEV_KEGG.KEGG.Organism.Group, majorityPercentage=None)[source]

Compare redundancy between two groups’ core metabolisms.

Parameters:
  • groupA (Organism.Group) – First group from which to extract the graph.
  • groupB (Organism.Group) – Second group from which to extract the graph.
  • majorityPercentage (float, optional) – If None, use collective EC graph. If not None, use majority EC graph with majorityPercentage % majority.
Returns:

Return type:

Comparison

getAddedRedundancyKeys(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → Set[FEV_KEGG.Graph.Elements.Element][source]

Get keys which have become redundant from graph A to graph B.

This only counts keys which exist in both graphs.

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation. For target-/source-flexibility, only the paths for target/source nodes are reported, paths of the respective other node are ignored.
Returns:
Return type:Set[Element]
getAddedRedundancyKeysPathsForKey(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → Dict[FEV_KEGG.Graph.Elements.Element, Set[FEV_KEGG.Graph.Models.Path]][source]

Get alternative paths of keys which have become redundant from graph A to graph B.

This only counts keys which exist in both graphs.

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation. For target-/source-flexibility, only the paths for target/source nodes are reported, paths of the respective other node are ignored.
Returns:Set of alternative paths belonging to a key which has become redundant, keyed by this key.
Return type:Dict[Element, Set[Path]]
getAddedRedundancyPaths(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → Set[FEV_KEGG.Graph.Models.Path][source]

Get all alternative paths which have been added from graph A to graph B.

This counts all paths, no matter which key they provide redundancy for!

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation. For target-/source-flexibility, only the paths for target/source nodes are reported, paths of the respective other node are ignored.
Returns:Set of alternative paths which have been added in graph B.
Return type:Set[Path]
getAddedRedundancyRatio(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → float[source]

Get ratio of keys, which have become redundant from graph A to graph B, to all keys.

This only counts keys which exist in both graphs, for both ‘redundant keys’ and ‘all keys’.

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation. For target-/source-flexibility, only the paths for target/source nodes are reported, paths of the respective other node are ignored.
Returns:
Return type:float
getConservedRedundancyKeys(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → Set[FEV_KEGG.Graph.Elements.Element][source]

Get keys which have conserved redundancy from graph A to graph B.

This only counts keys which exist in both graphs. Beware, this only means there is some redundancy in A and B, not the exact same paths providing redundancy in A and B!

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation. For target-/source-flexibility, only the paths for target/source nodes are reported, paths of the respective other node are ignored.
Returns:
Return type:Set[Element]
getConservedRedundancyKeysPathsForKey(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → Dict[FEV_KEGG.Graph.Elements.Element, Tuple[Set[FEV_KEGG.Graph.Models.Path], Set[FEV_KEGG.Graph.Models.Path], Set[FEV_KEGG.Graph.Models.Path]]][source]

Get tuple of alternative paths of keys which have conserved redundancy from graph A to graph B.

This only counts keys which exist in both graphs. However, even if a key is redundant in both graphs, it does not have to be redundant due to the exact same paths. This is why the tuple has three sets, the first for paths which only exist only in A, the second for paths which exist in both, and the third for paths which exist only in B.

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation. For target-/source-flexibility, only the paths for target/source nodes are reported, paths of the respective other node are ignored.
Returns:Tuple of sets of alternative paths belonging to a key which conserved redundancy, keyed by this key. The first set of the tuple contains paths which only exists in graph A. The second set of the tuple contains paths which exist in both graphs. The third set of the tuple contains paths which only exists in graph B.
Return type:Dict[Element, Tuple[Set[Path], Set[Path], Set[Path]]]
getConservedRedundancyPaths(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → Set[FEV_KEGG.Graph.Models.Path][source]

Get all alternative paths which have been conserved between graph A and graph B.

This counts all paths, no matter which key they provide redundancy for!

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation. For target-/source-flexibility, only the paths for target/source nodes are reported, paths of the respective other node are ignored.
Returns:Set of alternative paths which are both in graph A and in graph B.
Return type:Set[Path]
getConservedRedundancyRatio(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → float[source]

Get ratio of keys, which have conserved redundancy from graph A to graph B, to all keys.

This only counts keys which exist in both graphs, for both ‘redundant keys’ and ‘all keys’.

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation. For target-/source-flexibility, only the paths for target/source nodes are reported, paths of the respective other node are ignored.
Returns:
Return type:float
getLostRedundancyKeys(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → Set[FEV_KEGG.Graph.Elements.Element][source]

Get keys which have lost redundancy from graph A to graph B.

This only counts keys which exist in both graphs.

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation. For target-/source-flexibility, only the paths for target/source nodes are reported, paths of the respective other node are ignored.
Returns:
Return type:Set[Element]
getLostRedundancyPaths(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → Set[FEV_KEGG.Graph.Models.Path][source]

Get all alternative paths which have been lost from graph A to graph B.

This counts all paths, no matter which key they provide redundancy for!

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation. For target-/source-flexibility, only the paths for target/source nodes are reported, paths of the respective other node are ignored.
Returns:Set of alternative paths which have been lost in graph B.
Return type:Set[Path]
getLostRedundancyPathsForKey(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → Dict[FEV_KEGG.Graph.Elements.Element, Set[FEV_KEGG.Graph.Models.Path]][source]

Get alternative paths of keys which have lost redundancy from graph A to graph B.

This only counts keys which exist in both graphs.

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation. For target-/source-flexibility, only the paths for target/source nodes are reported, paths of the respective other node are ignored.
Returns:Set of alternative paths belonging to a key which lost redundancy, keyed by this key.
Return type:Dict[Element, Set[Path]]
getLostRedundancyRatio(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → float[source]

Get ratio of keys, which have lost redundancy from graph A to graph B, to all keys.

This only counts keys which exist in both graphs, for both ‘redundant keys’ and ‘all keys’.

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation. For target-/source-flexibility, only the paths for target/source nodes are reported, paths of the respective other node are ignored.
Returns:
Return type:float
class FEV_KEGG.Robustness.Topology.Redundancy.ContributionComparison(comparison: FEV_KEGG.Robustness.Topology.Redundancy.Comparison, specialKeysA: Set[FEV_KEGG.Graph.Elements.Element], specialKeysB: Set[FEV_KEGG.Graph.Elements.Element])[source]

Bases: object

Compare contribution to redundancy between two graphs.

Allows to answer the question how much certain key elements contribute to certain comparing aspects of the flexibility/robustness of two graphs. Special keys will usually differ between the two graphs, however, they are also allowed to be the same set.

Parameters:
  • comparison (Comparison) – You first have to calculate a comparison object using your two graphs.
  • specialKeysA (Set[Element]) – Set of key elements of graph A in comparison viewed to be somehow special. One type of special could be ‘neofunctionalised’.
  • specialKeysB (Set[Element]) – Set of key elements of graph B in comparison viewed to be somehow special. One type of special could be ‘neofunctionalised’.
Variables:
getAddedRedundancyKeyContributionRatio(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → float[source]

Get ratio of contribution to rendundancy of keys, which have become redundant.

This only counts keys which exist in both graphs. The ratio is to the number of redundant keys, not to all keys.

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation.
Returns:Ratio of contribution to redundant keys, which have become redundant from graph A to graph B, and for which a special key contributes to redundancy.
Return type:float
getConservedRedundancyKeyContributionRatio(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → float[source]

Get ratio of contribution to rendundancy of keys, which have conserved redundancy.

A or B may have a special key on an alternative path of a redundant key, for the key to be counted here. It is not necessary, that both A and B have such a special key. This only counts keys which exist in both graphs. The ratio is to the number of redundant keys, not to all keys.

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation.
Returns:Ratio of contribution to redundant keys, which have conserved redundancy from graph A to graph B, and for which a special key contributes to redundancy.
Return type:float
getContributedAddedRedundancyKeysForSpecial(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → Dict[FEV_KEGG.Graph.Elements.Element, Set[FEV_KEGG.Graph.Elements.Element]][source]

Get keys, which have become redundant, for which a special key contributes to redundancy.

This only counts keys which exist in both graphs.

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation.
Returns:Sets of key elements, which have become redundant from graph A to graph B, and which have a redundant path that contains a special key, keyed by the special key. All of these paths (except for maybe one) exist only in B.
Return type:Dict[Element, Set[Element]]
getContributedAddedRedundancyPaths(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → Set[FEV_KEGG.Graph.Models.MarkedPath][source]

Get all alternative paths which have become redundant, and have a special key on them.

This counts all paths, no matter which key they provide redundancy for!

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation. For target-/source-flexibility, only the paths for target/source nodes are reported, paths of the respective other node are ignored.
Returns:Set of alternative paths which have become redundant from graph A to graph B.
Return type:Set[MarkedPath]
getContributedAddedRedundancyPathsForKey(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → Dict[FEV_KEGG.Graph.Elements.Element, Set[FEV_KEGG.Graph.Models.MarkedPath]][source]

Get alternative paths of keys which have become redundant, and have a special key on them.

This only counts keys which exist in both graphs.

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation. For target-/source-flexibility, only the paths for target/source nodes are reported, paths of the respective other node are ignored.
Returns:Set of alternative marked paths belonging to a key which has become redundant from graph A to graph B, keyed by this key.
Return type:Dict[Element, Set[MarkedPath]]
getContributedConservedRedundancyKeysForSpecial(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → Dict[FEV_KEGG.Graph.Elements.Element, Set[FEV_KEGG.Graph.Elements.Element]][source]

Get keys, which have conserved redundancy, for which a special key contributes to redundancy.

A or B may have a special key on an alternative path of a redundant key, for the key to be reported here. It is not necessary, that both A and B have such a special key. This only counts keys which exist in both graphs.

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation.
Returns:Sets of key elements, which have conserved redundancy from graph A to graph B, and which have a redundant path that contains a special key, keyed by the special key. All of these paths may exist in only A, only B, or in both. One occurence is enough to be reported here.
Return type:Dict[Element, Set[Element]]
getContributedConservedRedundancyPaths(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → Set[FEV_KEGG.Graph.Models.MarkedPath][source]

Get all alternative paths which have been conserved, and have a special key on them.

This counts all paths, no matter which key they provide redundancy for!

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation. For target-/source-flexibility, only the paths for target/source nodes are reported, paths of the respective other node are ignored.
Returns:Set of alternative paths which have been conserved from graph A to graph B.
Return type:Set[MarkedPath]
getContributedConservedRedundancyPathsForKey(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → Dict[FEV_KEGG.Graph.Elements.Element, Tuple[Set[FEV_KEGG.Graph.Models.MarkedPath], Set[FEV_KEGG.Graph.Models.MarkedPath], Set[FEV_KEGG.Graph.Models.MarkedPath]]][source]

Get alternative paths of keys which have conserved redundancy, and have a special key on them.

This only counts keys which exist in both graphs. However, even if a key is redundant in both graphs, it does not have to be redundant due to the exact same paths. This is why the tuple has three sets, the first for paths which only exist only in A, the second for paths which exist in both, and the third for paths which exist only in B.

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation. For target-/source-flexibility, only the paths for target/source nodes are reported, paths of the respective other node are ignored.
Returns:Tuple of sets of alternative marked paths belonging to a key which conserved redundancy from graph A to graph B, keyed by this key. The first set of the tuple contains paths which only exists in graph A. The second set of the tuple contains paths which exist in both graphs. The third set of the tuple contains paths which only exists in graph B.
Return type:Dict[Element, Tuple[Set[MarkedPath], Set[MarkedPath], Set[MarkedPath]]]
getContributedLostRedundancyKeysForSpecial(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → Dict[FEV_KEGG.Graph.Elements.Element, Set[FEV_KEGG.Graph.Elements.Element]][source]

Get keys, which have lost redundancy, for which a special key contributes to redundancy.

This only counts keys which exist in both graphs.

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation.
Returns:Sets of key elements, which have lost redundancy from graph A to graph B, and which have a redundant path that contains a special key, keyed by the special key. All of these paths (except for maybe one) exist only in A.
Return type:Dict[Element, Set[Element]]
getContributedLostRedundancyPaths(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → Set[FEV_KEGG.Graph.Models.MarkedPath][source]

Get all alternative paths which have been lost, and have a special key on them.

This counts all paths, no matter which key they provide redundancy for!

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation. For target-/source-flexibility, only the paths for target/source nodes are reported, paths of the respective other node are ignored.
Returns:Set of alternative paths which have been lost from graph A to graph B.
Return type:Set[MarkedPath]
getContributedLostRedundancyPathsForKey(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → Dict[FEV_KEGG.Graph.Elements.Element, Set[FEV_KEGG.Graph.Models.MarkedPath]][source]

Get alternative paths of keys which have lost redundancy, and have a special key on them.

This only counts keys which exist in both graphs.

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation. For target-/source-flexibility, only the paths for target/source nodes are reported, paths of the respective other node are ignored.
Returns:Set of alternative marked paths belonging to a key which lost redundancy from graph A to graph B, keyed by this key.
Return type:Dict[Element, Set[MarkedPath]]
getLostRedundancyKeyContributionRatio(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → float[source]

Get ratio of contribution to rendundancy of keys, which have lost redundancy.

This only counts keys which exist in both graphs. The ratio is to the number of redundant keys, not to all keys.

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation.
Returns:Ratio of contribution to redundant keys, which have lost redundancy from graph A to graph B, and for which a special key contributes to redundancy.
Return type:float
class FEV_KEGG.Robustness.Topology.Redundancy.Flexibility(graph: FEV_KEGG.Graph.Models.DirectedMultiGraph, onlyLargestComponent=False)[source]

Bases: object

Flexibility metrics for a graph.

Parameters:
  • graph (DirectedMultiGraph) – The graph to be measured for its flexibility.
  • onlyLargestComponent (bool, optional) – If True, reduce graph to its largest component before measuring robustness.
Variables:
  • self.redundantPathsTupleForEdgeForKey (Dict[Element, Dict[Tuple[Element, Element], Tuple[Set[Path], Set[Path]]]]) – Each key element in graph pointing to a pseudo-set (dictionary.keys()) of its edges, represented by a tuple of both participating nodes. Each edge points to a set of paths, which would provide redundancy for this edge if it (or the whole key element) were to be removed.
  • self.sumKeys (int) – Sum of all individual key elements in graph.
  • = 0 (self.sumEdges) – Sum of all edges in graph.
  • self.sumPaths (int) – Sum of all paths providing redundancy for edges.
self.sumNonRedundantKeys : int
Sum of keys which, if removed, have not a single redundant edge. An edge is only redundant if it has redundant paths for both its source and its target node.
self.sumPartiallyRedundantKeys : int
Sum of keys which, if removed, have redundant edges, but not all of them are redundant. An edge is only redundant if it has redundant paths for both its source and its target node.
self.sumRedundantKeys : int
Sum of keys which, if removed, have only redundant edges. An edge is only redundant if it has redundant paths for both its source and its target node.
self.sumNonTargetRedundantKeys : int
Sum of keys which, if removed, have not a single target-redundant edge. An edge is target-redundant if it has redundant paths for its target node.
self.sumPartiallyTargetRedundantKeys : int
Sum of keys which, if removed, have target-redundant edges, but not all of them are target-redundant. An edge is target-redundant if it has redundant paths for its target node.
self.sumTargetRedundantKeys : int
Sum of keys which, if removed, have only target-redundant edges. An edge is target-redundant if it has redundant paths for its target node.
self.sumNonSourceRedundantKeys : int
Sum of keys which, if removed, have not a single source-redundant edge. An edge is source-redundant if it has redundant paths for its source node.
self.sumPartiallySourceRedundantKeys : int
Sum of keys which, if removed, have source-redundant edges, but not all of them are source-redundant. An edge is source-redundant if it has redundant paths for its source node.
self.sumSourceRedundantKeys : int
Sum of keys which, if removed, have only source-redundant edges. An edge is source-redundant if it has redundant paths for its source node.
self.nonRedundantKeys : Set[Element]
Set of key elements which, if removed, have not a single redundant edge. An edge is only redundant if it has redundant paths for both its source and its target node.
self.partiallyRedundantKeys : Set[Element]
Set of key elements which, if removed, have redundant edges, but not all of them are redundant. An edge is only redundant if it has redundant paths for both its source and its target node.
self.redundantKeys : Set[Element]
Set of key elements which, if removed, have only redundant edges. An edge is only redundant if it has redundant paths for both its source and its target node.
self.nonTargetRedundantKeys : Set[Element]
Set of key elements which, if removed, have not a single target-redundant edge. An edge is target-redundant if it has redundant paths for its target node.
self.partiallyTargetRedundantKeys : Set[Element]
Set of key elements which, if removed, have target-redundant edges, but not all of them are target-redundant. An edge is target-redundant if it has redundant paths for its target node.
self.targetRedundantKeys : Set[Element]
Set of key elements which, if removed, have only target-redundant edges. An edge is target-redundant if it has redundant paths for its target node.
self.nonSourceRedundantKeys : Set[Element]
Set of key elements which, if removed, have not a single source-redundant edge. An edge is source-redundant if it has redundant paths for its source node.
self.partiallySourceRedundantKeys : Set[Element]
Set of key elements which, if removed, have source-redundant edges, but not all of them are source-redundant. An edge is source-redundant if it has redundant paths for its source node.
self.sourceRedundantKeys : Set[Element]
Set of key elements which, if removed, have only source-redundant edges. An edge is source-redundant if it has redundant paths for its source node.
self.paths : Set[Path]
Set of all paths which act as redundancy for edges when a key has been removed.
self.targetPaths : Set[Path]
Set of all paths which act as redundancy for the target node of edges when a key has been removed.
self.sourcePaths : Set[Path]
Set of all paths which act as redundancy for the source node of edges when a key has been removed.
self.redundantKeysRatio : float
Ratio of the sum of redundant key elements to the sum of all key elements. An edge is only redundant if it has redundant paths for both its source and its target node.
self.partiallyRedundantKeysRatio : float
Ratio of the sum of partially redundant key elements to the sum of all key elements. An edge is only redundant if it has redundant paths for both its source and its target node.
self.nonRedundantKeysRatio : float
Ratio of the sum of non-redundant key elements to the sum of all key elements. An edge is only redundant if it has redundant paths for both its source and its target node.
self.targetRedundantKeysRatio : float
Ratio of the sum of target-redundant key elements to the sum of all key elements. An edge is target-redundant if it has redundant paths for its target node.
self.partiallyTargetRedundantKeysRatio : float
Ratio of the sum of partially target-redundant key elements to the sum of all key elements. An edge is target-redundant if it has redundant paths for its target node.
self.nonTargetRedundantKeysRatio : float
Ratio of the sum of non-target-redundant key elements to the sum of all key elements. An edge is target-redundant if it has redundant paths for its target node.
self.sourceRedundantKeysRatio : float
Ratio of the sum of target-redundant key elements to the sum of all key elements. An edge is source-redundant if it has redundant paths for its source node.
self.partiallySourceRedundantKeysRatio : float
Ratio of the sum of partially target-redundant key elements to the sum of all key elements. An edge is source-redundant if it has redundant paths for its source node.
self.nonSourceRedundantKeysRatio : float
Ratio of the sum of non-target-redundant key elements to the sum of all key elements. An edge is source-redundant if it has redundant paths for its source node.
partiallyRedundantKeyPaths
partiallySourceRedundantKeyPaths
partiallyTargetRedundantKeyPaths
paths
redundantKeyPaths
sourceRedundantKeyPaths
sumPaths
targetRedundantKeyPaths
class FEV_KEGG.Robustness.Topology.Redundancy.FlexibilityContribution(flexibility: FEV_KEGG.Robustness.Topology.Redundancy.Flexibility, specialKeys: Dict[str, Set[FEV_KEGG.Graph.Elements.Element]])[source]

Bases: object

Contribution to flexibility accountable to edges with specialKeys.

Allows to answer the question how much certain key elements contribute to the flexibility of a graph.

Parameters:
  • flexibility (Flexibility) –
  • specialKeys (Set[Element]) – Set of key elements viewed to be somehow special. One type of special could be ‘neofunctionalised’.
Variables:
  • self.flexibility (Flexibility) –
  • self.sumSpecialKeys (int) – Sum of special keys passed.
  • self.sumPathsWithSpecialKeys (int) – Sum of alternative paths with a special key on it.
  • self.sumRedundantKeysWithSpecialKeyOnPaths (int) – Sum of redundant keys which have a special key on an alternative path.
  • self.sumPartiallyRedundantKeysWithSpecialKeyOnPaths (int) – Sum of partially redundant keys which have a special key on an alternative path.
  • self.sumTargetRedundantKeysWithSpecialKeyOnPaths (int) – Sum of target-redundant keys which have a special key on an alternative path.
  • self.sumPartiallyTargetRedundantKeysWithSpecialKeyOnPaths (int) – Sum of partially target-redundant keys which have a special key on an alternative path.
  • self.sumSourceRedundantKeysWithSpecialKeyOnPaths (int) – Sum of source-redundant keys which have a special key on an alternative path.
  • self.sumPartiallySourceRedundantKeysWithSpecialKeyOnPaths (int) – Sum of partially source-redundant keys which have a special key on an alternative path.
self.pathsWithSpecialKeys : Set[MarkedPath]
Set of redundant paths with special keys on them.
self.targetPathsWithSpecialKeys : Set[MarkedPath]
Set of target-redundant paths with special keys on them.
self.sourcePathsWithSpecialKeys : Set[MarkedPath]
Set of source-redundant paths with special keys on them.
self.redundantKeySpecialKeysOnPaths : Dict[Element, Set[Element]]
Sets of special keys which are on an alternative path of a redundant key, keyed by the key.
self.partiallyRedundantKeySpecialKeysOnPaths : Dict[Element, Set[Element]
Sets of special keys which are on an alternative path of a partially redundant key, keyed by the key.
self.targetRedundantKeySpecialKeysOnPaths : Dict[Element, Set[Element]]
Sets of special keys which are on an alternative path of a target-redundant key, keyed by the key.
self.partiallyTargetRedundantKeySpecialKeysOnPaths : Dict[Element, Set[Element]
Sets of special keys which are on an alternative path of a partially target-redundant key, keyed by the key.
self.sourceRedundantKeySpecialKeysOnPaths : Dict[Element, Set[Element]]
Sets of special keys which are on an alternative path of a source-redundant key, keyed by the key.
self.partiallySourceRedundantKeySpecialKeysOnPaths : Dict[Element, Set[Element]
Sets of special keys which are on an alternative path of a partially source-redundant key, keyed by the key.
self.specialKeyOnRedundantKeysPaths : Dict[Element, Set[Element]]
Sets of redundant keys which have an alternative path with a special key on it, keyed by the special key.
self.specialKeyOnPartiallyRedundantKeysPaths : Dict[Element, Set[Element]]
Sets of partially redundant keys which have an alternative path with a special key on it, keyed by the special key.
self.specialKeyOnTargetRedundantKeysPaths : Dict[Element, Set[Element]]
Sets of target-redundant keys which have an alternative path with a special key on it, keyed by the special key.
self.specialKeyOnPartiallyTargetRedundantKeysPaths : Dict[Element, Set[Element]]
Sets of partially target-redundant keys which have an alternative path with a special key on it, keyed by the special key.
self.specialKeyOnSourceRedundantKeysPaths : Dict[Element, Set[Element]]
Sets of source-redundant keys which have an alternative path with a special key on it, keyed by the special key.
self.specialKeyOnPartiallySourceRedundantKeysPaths : Dict[Element, Set[Element]]
Sets of partially source-redundant keys which have an alternative path with a special key on it, keyed by the special key.
self.pathsWithSpecialKeyRatio : float
Ratio of the sum of paths with a special key on it to the sum of all paths.
self.redundantKeysWithSpecialKeyOnPathsRatio : float
Ratio of the sum of redundant keys with a special key on its paths to the sum of all redundant keys.
self.partiallyRedundantKeysWithSpecialKeyOnPathsRatio : float
Ratio of the sum of partially redundant keys with a special key on its paths to the sum of all partially redundant keys.
self.targetRedundantKeysWithSpecialKeyOnPathsRatio : float
Ratio of the sum of target-redundant keys with a special key on its paths to the sum of all target-redundant keys.
self.partiallyTargetRedundantKeysWithSpecialKeyOnPathsRatio : float
Ratio of the sum of partially target-redundant keys with a special key on its paths to the sum of all partially target-redundant keys.
self.sourceRedundantKeysWithSpecialKeyOnPathsRatio : float
Ratio of the sum of source-redundant keys with a special key on its paths to the sum of all source-redundant keys.
self.partiallySourceRedundantKeysWithSpecialKeyOnPathsRatio : float
Ratio of the sum of partially source-redundant keys with a special key on its paths to the sum of all partially source-redundant keys.
class FEV_KEGG.Robustness.Topology.Redundancy.Redundancy(graph: FEV_KEGG.Graph.Models.DirectedMultiGraph, onlyLargestComponent=False, onlyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = None)[source]

Bases: object

Redundancy metrics, consisting of Flexibility and class:Robustness.

The most important metrics are realised as methods.

Parameters:
  • graph (DirectedMultiGraph) – The graph to calculate flexibility and robustness metrics for.
  • onlyLargestComponent (bool, optional) – If True, reduce graph to its largest component before measuring redundancy.
  • onlyType (RedundancyType, optional) – If give, only metrics for this type of redundancy are actually calculated. Requests for metrics of another type of redundancy will raise an error!
Variables:

Warning

The underlying algorithms have a rather high memory-complexity. This is fine for small graphs, i.e. substance-EC graphs of the core metabolism. But for bigger graphs, i.e. substance-enzyme graphs of the core metabolism, memory consumption can easily exceed 16 GiB. Be sure to have swap space available!

getRedundancyPaths(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → Set[FEV_KEGG.Graph.Models.Path][source]

Get all paths providing redundancy.

This always includes partial redundancy, use getRedundancyPathsForKey() if you want to differentiate.

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation. For target-/source-flexibility, only the paths for target/source nodes are reported, paths of the respective other node are ignored.
Returns:
Return type:Set[Path]
Raises:ValueError – If onlyType was given in the contructor, but metrics of another type of redundancy are to be returned here.
getRedundancyPathsForKey(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → Dict[FEV_KEGG.Graph.Elements.Element, Set[FEV_KEGG.Graph.Models.Path]][source]

Get paths providing redundancy, keyed by the key element they provide redundancy for.

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation. For target-/source-flexibility, only the paths for target/source nodes are reported, paths of the respective other node are ignored.
Returns:
Return type:Dict[Element, Set[Path]]
Raises:ValueError – If onlyType was given in the contructor, but metrics of another type of redundancy are to be returned here.
getRedundancyRatio(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → float[source]

Get ratio of redundant keys to all keys.

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation.
Returns:
Return type:float
Raises:ValueError – If onlyType was given in the contructor, but metrics of another type of redundancy are to be returned here.
getRedundantKeys(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → Set[FEV_KEGG.Graph.Elements.Element][source]

Get redundant key elements.

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation.
Returns:
Return type:Set[Element]
Raises:ValueError – If onlyType was given in the contructor, but metrics of another type of redundancy are to be returned here.
class FEV_KEGG.Robustness.Topology.Redundancy.RedundancyContribution(redundancy: FEV_KEGG.Robustness.Topology.Redundancy.Redundancy, specialKeys: Set[FEV_KEGG.Graph.Elements.Element])[source]

Bases: object

Contribution to redundancy, consisting of Flexibility and class:Robustness, accountable to edges with specialKeys.

Allows to answer the question how much certain key elements contribute to the flexibility/robustness of a graph.

Parameters:
  • redundancy (Redundancy) –
  • specialKeys (Set[Element]) – Set of key elements viewed to be somehow special. One type of special could be ‘neofunctionalised’.
Variables:
classmethod fromGraph(graph: FEV_KEGG.Graph.Models.DirectedMultiGraph, specialKeys: Set[FEV_KEGG.Graph.Elements.Element])[source]

Create RedundancyContribution object from graph.

Parameters:
Returns:

Return type:

RedundancyContribution

getContributedKeysForSpecial(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → Dict[FEV_KEGG.Graph.Elements.Element, Set[FEV_KEGG.Graph.Elements.Element]][source]

Get keys for which a special key contributes to redundancy.

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation.
Returns:Sets of key elements which have a redundant path that contains a special key, keyed by the special key.
Return type:Dict[Element, Set[Element]]
Raises:ValueError – If onlyType was given in the contructor of the underlying redundancy object, but metrics of another type of redundancy are to be returned here.
getContributedPaths(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → Set[FEV_KEGG.Graph.Models.MarkedPath][source]

Get all paths on which any special key contributes to redundancy.

This always includes partial redundancy, use getContributedPathsForKey() if you want to differentiate.

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation. For target-/source-flexibility, only the paths for target/source nodes are reported, paths of the respective other node are ignored.
Returns:Set of marked redundant paths that contain a special key.
Return type:Set[MarkedPath]
Raises:ValueError – If onlyType was given in the contructor of the underlying redundancy object, but metrics of another type of redundancy are to be returned here.
getContributedPathsForKey(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → Dict[FEV_KEGG.Graph.Elements.Element, Set[FEV_KEGG.Graph.Models.MarkedPath]][source]

Get paths on which any special key contributes to redundancy, keyed by the key element they provide redundancy for.

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation. For target-/source-flexibility, only the paths for target/source nodes are reported, paths of the respective other node are ignored.
Returns:Set of marked redundant paths that contain any special key, keyed by the key element they provide redundancy for.
Return type:Dict[Element, Set[MarkedPath]]
Raises:ValueError – If onlyType was given in the contructor of the underlying redundancy object, but metrics of another type of redundancy are to be returned here.
getContributingSpecialForKey(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → Dict[FEV_KEGG.Graph.Elements.Element, Set[FEV_KEGG.Graph.Elements.Element]][source]

Get special keys which contribute to redundancy of a key.

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation.
Returns:Sets of special key elements which contribute to a redundant path of a key, keyed by that key.
Return type:Dict[Element, Set[Element]]
Raises:ValueError – If onlyType was given in the contructor of the underlying redundancy object, but metrics of another type of redundancy are to be returned here.
getKeyContributionRatio(redundancyType: FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType = <RedundancyType.ROBUSTNESS: [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]>) → float[source]

Get ratio of contribution to keys’ redundancy, to all keys.

Parameters:redundancyType (RedundancyType) – Type of redundancy to use for computation.
Returns:Ratio of redundant keys which have a special key on at least one of their alternative paths.
Return type:float
Raises:ValueError – If onlyType was given in the contructor of the underlying redundancy object, but metrics of another type of redundancy are to be returned here.
class FEV_KEGG.Robustness.Topology.Redundancy.RedundancyType[source]

Bases: enum.Enum

Type of a redundancy.

Redundancy comes in many forms, some are defined here as constants pointing to their realising classes.

FLEXIBILITY = [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Flexibility'>, 0]

Flexibility exists if the former substrates and/or products can still be metabolised via alternative paths, in their original respective direction. This does not mean the alternative paths have to include both, the orginal substrate and product, at the same time.

Type:If a key element is deleted from a graph, e.g. all enzymes realising a certain EC number are deleted from an organism’s genome
FLEXIBILITY_BOTH = [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Flexibility'>, 2]

This combines the results of both FLEXIBILITY and FLEXIBILITY_PARTIAL.

FLEXIBILITY_PARTIAL = [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Flexibility'>, 1]

This is the same as FLEXIBILITY, but only one of the edges of a key has to be redundant, not all its edges at once. This does not include the results of FLEXIBILITY!

ROBUSTNESS = [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]

Robustness exists if the former substrates and products are still connected, in their original direction, albeit via alternative paths. This means the alternative paths have to include both, the orginal substrate and product, at the same time.

This means robustness is a sub-type of FLEXIBILITY. Only some flexible edges are also robust. Robustness and flexibility have an inheritance relation.

Type:If a key element is deleted from a graph, e.g. all enzymes realising a certain EC number are deleted from an organism’s genome
ROBUSTNESS_BOTH = [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 2]

This combines the results of both ROBUSTNESS and ROBUSTNESS_PARTIAL.

ROBUSTNESS_PARTIAL = [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 1]

This is the same as ROBUSTNESS, but only one of the edges of a key has to be redundant, not all its edges at once. This does not include the results of ROBUSTNESS!

SOURCE_FLEXIBILITY = [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Flexibility'>, 6]

This is a super-type of FLEXIBILITY, where only the source node of each edge has to have redundant paths (leaving from it), for the whole edge to be counted as redundant. It does not matter whether the target node also has redundant paths. Only some source-flexible edges are also flexible, in fact exactly the ones which are also target-flexible. This means that combining target-flexibility with source-flexibility yields flexibility, they have a composition relation.

SOURCE_FLEXIBILITY_BOTH = [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Flexibility'>, 8]

This combines the results of both SOURCE_FLEXIBILITY and SOURCE_FLEXIBILITY_PARTIAL.

SOURCE_FLEXIBILITY_PARTIAL = [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Flexibility'>, 7]

This is the same as SOURCE_FLEXIBILITY, but only one of the edges of a key has to be redundant, not all its edges at once. This does not include the results of SOURCE_FLEXIBILITY!

TARGET_FLEXIBILITY = [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Flexibility'>, 3]

This is a super-type of FLEXIBILITY, where only the target node of each edge has to have redundant paths (leading to it), for the whole edge to be counted as redundant. It does not matter whether the source node also has redundant paths. Only some target-flexible edges are also flexible, in fact exactly the ones which are also source-flexible. This means that combining target-flexibility with source-flexibility yields flexibility, they have a composition relation.

TARGET_FLEXIBILITY_BOTH = [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Flexibility'>, 5]

This combines the results of both TARGET_FLEXIBILITY and TARGET_FLEXIBILITY_PARTIAL.

TARGET_FLEXIBILITY_PARTIAL = [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Flexibility'>, 4]

This is the same as TARGET_FLEXIBILITY, but only one of the edges of a key has to be redundant, not all its edges at once. This does not include the results of TARGET_FLEXIBILITY!

default = [<class 'FEV_KEGG.Robustness.Topology.Redundancy.Robustness'>, 0]

Defaults to robustness, which is (currently) the most picky measure of redundancy. If you absolutely have to over-simplify the question of redundancy, use this default redundancy type. Robustness was chosen as default, because it seems wise not to break the graph when dealing with incomplete datasets. Which can only be prevented (to the extent of our knowledge) by using the more narrow definition of ‘robustness’, not the broader ‘flexibility’, because the difference of ‘flexibility’ minus ‘robustness’ leaves the cases where the graph breaks, but source and/or target are still redundant.

class FEV_KEGG.Robustness.Topology.Redundancy.Robustness(graph: FEV_KEGG.Graph.Models.DirectedMultiGraph, onlyLargestComponent=False)[source]

Bases: object

Robustness metrics for a graph.

If a key element is deleted from a graph, e.g. all enzymes (edges from substrate [edge source] to product [edge target]) realising a certain EC number (key) are deleted from an organism’s genome: ‘Robustness’ exists if the former edges’ sources and targets are (at least partially) still connected, in their original direction, albeit via alternative paths. This means the alternative paths have to include both, the orginal source and target, at the same time.

Parameters:
  • graph (DirectedMultiGraph) – The graph to be measured for its robustness.
  • onlyLargestComponent (bool, optional) – If True, reduce graph to its largest component before measuring robustness.
Variables:
  • self.redundantPathsForEdgeForKey (Dict[Element, Dict[Tuple[Element, Element], Set[Path]]]) – Each key element in graph pointing to a psuedo-set (dictionary.keys()) of its edges, represented by a tuple of both participating nodes. Each edge points to a set of paths, which would provide redundancy for this edge if it (or the whole key element) were to be removed.
  • self.sumKeys (int) – Sum of all individual key elements in graph.
  • self.sumBreakingKeys (int) – Sum of keys which cause the graph to break when removed, i.e. which have not a single edge with redundant paths between the same source and target nodes.
  • self.sumPartiallyRedundantKeys (int) – Sum of keys which, if removed, have redundant edges, but not all of them are redundant.
  • self.sumRedundantKeys (int) – Sum of keys which, if removed, have only redundant edges.
  • = 0 (self.sumEdges) – Sum of all edges in graph.
  • self.sumBreakingEdges (int) – Sum of edges which, if removed, cause the graph to break, because they are not redundant.
  • self.sumRedundantEdges (int) – Sum of edges which, if removed, still have other redundant edges between the same source and target nodes.
  • self.sumPaths (int) – Sum of all paths providing redundancy for edges.
  • self.partiallyRedundantKeyPathCounts (Dict[Element, int]) – Edge key element pointing to the number of redundant paths it can be replaced with, although only partially. This is possible if the edge key occurs in multiple edges connecting more than two different nodes.
  • self.redundantKeyPathCounts (Dict[Element, int]) – Edge key element pointing to the number of redundant paths it can be replaced with.
  • self.redundantEdgePathCounts (Dict[Tuple[Element, Element, Element], int]) – Full edge tuples including nodes AND the key element, pointing to the number of redundant paths it can be replaced with.
  • self.nonRedundantKeys (Set[Element]) – Set of key elements which cause the graph to break when removed, i.e. which have not a single edge with redundant paths between the same source and target nodes.
  • self.partiallyRedundantKeys (Set[Element]) – Set of key elements which, if removed, have redundant edges, but not all of them are redundant.
  • self.redundantKeys (Set[Element]) – Set of key elements which, if removed, have only redundant edges.
  • self.nonRedundantEdges (Set[Tuple[Element, Element, Element]]) – Set of edge tuples including nodes AND the key element, which cause the graph to break, because they have no redundant path.
  • self.redundantEdges (Set[Tuple[Element, Element, Element]]) – Set of edge tuples including nodes AND the key element, which have redundant paths.
  • self.paths (Set[Path]) – Set of all paths which act as redundancy for edges when a key has been removed.
  • self.partiallyRedundantKeyPaths (Dict[Element, Set[Path]]) – Edge key element pointing to the set of redundant paths it can be replaced with, although only partially. This is possible if the edge key occurs in multiple edges connecting more than two different nodes.
  • self.redundantKeyPaths (Dict[Element, Set[Path]]) – Edge key element pointing to the set of redundant paths it can be replaced with.
  • self.redundantEdgesRatio (float) – Ratio of the sum of redundant edges to the sum of all edges.
  • self.nonRedundantEdgesRatio (float) – Ratio of the sum of nonRedundant edges to the sum of all edges.
  • self.redundantKeysRatio (float) – Ratio of the sum of redundant key elements to the sum of all key elements.
  • self.partiallyRedundantKeysRatio (float) – Ratio of the sum of partially redundant key elements to the sum of all key elements.
  • self.nonRedundantKeysRatio (float) – Ratio of the sum of non-redundant key elements to the sum of all key elements.
classmethod fromClade(clade: FEV_KEGG.Evolution.Clade.Clade, majorityPercentage=None)[source]

Robustness metrics for a clade core metabolism.

Parameters:
  • clade (Clade) – The clade from which to extract the graph.
  • majorityPercentage (float, optional) – If None, use collective EC graph. If not None, use majority EC graph with majorityPercentage % majority.
Returns:

Return type:

Robustness

classmethod fromOrganismGroup(group: FEV_KEGG.KEGG.Organism.Group, majorityPercentage=None)[source]

Robustness metrics for a group core metabolism.

Parameters:
  • group (Organism.Group) – The group from which to extract the graph.
  • majorityPercentage (float, optional) – If None, use collective EC graph. If not None, use majority EC graph with majorityPercentage % majority.
Returns:

Return type:

Robustness

partiallyRedundantKeyPaths
partiallyRedundantKeys
redundantEdges
redundantKeyPaths
redundantKeys
class FEV_KEGG.Robustness.Topology.Redundancy.RobustnessContribution(robustness: FEV_KEGG.Robustness.Topology.Redundancy.Robustness, specialKeys: Set[FEV_KEGG.Graph.Elements.Element])[source]

Bases: object

Contribution to robustness accountable to edges with specialKeys.

Allows to answer the question how much certain key elements contribute to the robustness of a graph.

Parameters:
  • robustness (Robustness) –
  • specialKeys (Set[Element]) – Set of key elements viewed to be somehow special. One type of special could be ‘neofunctionalised’.
Variables:
  • self.robustness (Robustness) –
  • self.sumSpecialKeys (int) – Sum of special keys passed.
  • self.sumRedundantKeysWithSpecialKeyOnPaths (int) – Sum of redundant keys which have a special key on an alternative path.
  • self.sumPartiallyRedundantKeysWithSpecialKeyOnPaths (int) – Sum of partially redundant keys which have a special key on an alternative path.
  • self.sumPathsWithSpecialKeys (int) – Sum of alternative paths with a special key on it.
  • self.pathsWithSpecialKeys (Set[MarkedPath]) – Set of paths with special keys on them.
  • self.redundantKeySpecialKeysOnPaths (Dict[Element, Set[Element]]) – Sets of special keys which are on an alternative path of a redundant key, keyed by the key.
  • self.partiallyRedundantKeySpecialKeysOnPaths (Dict[Element, Set[Element]) – Sets of special keys which are on an alternative path of a partially redundant key, keyed by the key.
  • self.specialKeyOnRedundantKeysPaths (Dict[Element, Set[Element]]) – Sets of redundant keys which have an alternative path with a special key on it, keyed by the special key.
  • self.specialKeyOnPartiallyRedundantKeysPaths (Dict[Element, Set[Element]]) – Sets of partially redundant keys which have an alternative path with a special key on it, keyed by the special key.
  • self.pathsWithSpecialKeyRatio (float) – Ratio of the sum of paths with a special key on it to the sum of all paths.
  • self.redundantKeysWithSpecialKeyOnPathsRatio (float) – Ratio of the sum of redundant keys with a special key on its paths to the sum of all redundant keys.
  • self.partiallyRedundantKeysWithSpecialKeyOnPathsRatio (float) – Ratio of the sum of partially redundant keys with a special key on its paths to the sum of all partially redundant keys.
  • self.redundantKeyPathsWithSpecialKey (Dict[Element, Set[MarkedPath]]) – Redundant key element pointing to the set of marked redundant paths it can be replaced with, which contain a special key.
  • self.partiallyRedundantKeyPathsWithSpecialKey (Dict[Element, Set[MarkedPath]]) – Partially redundant key element pointing to the set of marked redundant paths it can be replaced with, which contain a special key.