7.1.1.4.1.5. cobramod.visualization.items¶
Escher JSON-schema objects
This modules has all the JSON objects that can be seen in the original JSON schema for Escher.
The classes retain their original JSON names and attributes. - Node: Represents the nodes. They can be a metabolite or markers. They give the position of all dots in the canvas. - Segment: Represents the connections between nodes. - Reaction: Represents a reaction. They contain the needed segments for the visualization of the pathway.
7.1.1.4.1.5.1. Attributes¶
7.1.1.4.1.5.2. Exceptions¶
Simple Error that should be raised when a |
7.1.1.4.1.5.3. Classes¶
Dictionary that can include a pair (linked) dictionary. Both dictionaries |
|
Simple class that represent a node for the JSON schema of Escher. The |
|
Build a segment for th reaction object for JsonCobramod, which can be |
|
Simple class that represent a reaction for the JSON schema for Escher. A |
7.1.1.4.1.5.4. Module Contents¶
- exception cobramod.visualization.items.NodeAttributeError¶
Bases:
ExceptionSimple Error that should be raised when a
cobramod.visualization.Node()cannot identify its type.
- class cobramod.visualization.items.PairDictionary(pair=None, **kwargs)¶
Bases:
collections.UserDictDictionary that can include a pair (linked) dictionary. Both dictionaries cannot have the same keys. It is posible that only a dictionary is a PairDictionary, while the other a regular dictionary. The method :func:`cobramod.visualization.PairDictionary.set_pair’ sets the pair for the dictionary.
- Parameters:
pair (Optional[collections.UserDict])
- set_pair(pair)¶
Set new pair for the dictionary. If will search for conflicts and raise a FoundInPairError if both PairDictionary have common keys.
- Parameters:
pair (collections.UserDict)
- cobramod.visualization.items.debug_log¶
- class cobramod.visualization.items.Node(node_type, x, y, label_x=None, label_y=None, bigg_id='', name='', node_is_primary=False)¶
Bases:
collections.UserDictSimple class that represent a node for the JSON schema of Escher. The node type can be either a ‘metabolite’, ‘midmarker’ or a ‘multimarker’. Markers only need the arguments x and y. Check method
cobramod.visualization.items.Node.__init__()to see all the corresponding arguments.- Parameters:
- marker(node_type, x, y, **kwargs)¶
Sets the attribute of the dictionary if the dictionary belongs to a midmarker or multimarker. Arguments specified in __init__.
- metabolite(node_type, x, y, label_x, label_y, bigg_id='', name='', node_is_primary=False)¶
Returns a dictionary with the arguments if node_type correspond to metabolite. Arguments specified in __init__,
- class cobramod.visualization.items.Segment(*args, **kwargs)¶
Bases:
collections.UserDictBuild a segment for th reaction object for JsonCobramod, which can be later parsed into a proper JSON for Escher. A segment needs a starting position and and end-position. Additionally, the dots for the modification of the arrows (b1, b2) can be included.
- class cobramod.visualization.items.Reaction(*args, **kwargs)¶
Bases:
collections.UserDictSimple class that represent a reaction for the JSON schema for Escher. A Reaction have the Segment that give the position of the reaction in the canvas.
- Keyword Arguments:
name (str) – Name of the reaction.
bigg_id (str) – Identifier of the reactions. It does not have to be from the database BIGG.
reversibility (bool) – If reaction is reversible
label_y (float) – Position in y-axis for the label.
label_x (float) – Position in x-axis for the label.
gene_reaction_rule (str, optional) – Gene rules that specify involved genes.
genes (list, optional) – A list with the genes involved for that identifier. Each item has to be a dictionary with the keys ‘bigg_id’ and ‘name’
metabolites (list, optional) – A list with the metabolites involved. Each iteam has to be an dictionary with the keys ‘bigg_id’ and ‘coefficient’.
segments (PairDictionary, optional) – dictionary with
cobramod.visualization.items.Segment(). They represent the connections between nodes.
- add_metabolite(bigg_id, coefficient)¶
Add the identifier for a metabolite and its corresponding coefficient into the ‘metabolite’ key.
- add_segment(identifier, from_node_id, to_node_id)¶
Adds to the Reaction for given identifier a Segment. It will be visualized in Escher.