diff --git a/bigraph_viz/__init__.py b/bigraph_viz/__init__.py index 80d6991..6acf92f 100644 --- a/bigraph_viz/__init__.py +++ b/bigraph_viz/__init__.py @@ -1,3 +1,11 @@ -from bigraph_viz.plot import plot_bigraph, plot_flow, plot_multitimestep -from bigraph_viz.dict_utils import pp, pf, schema_state_to_dict -from bigraph_viz.convert import convert_vivarium_composite +import pprint +from bigraph_viz.diagram import plot_bigraph +from bigraph_viz.dict_utils import replace_regex_recursive +from bigraph_schema import TypeSystem + + +pretty = pprint.PrettyPrinter(indent=2) + + +def pf(x): + return pretty.pformat(x) diff --git a/bigraph_viz/convert.py b/bigraph_viz/convert.py index f60c411..3c705f1 100644 --- a/bigraph_viz/convert.py +++ b/bigraph_viz/convert.py @@ -6,7 +6,7 @@ import copy -from bigraph_viz import plot_bigraph, pp +from bigraph_viz import plot_bigraph from bigraph_viz.dict_utils import deep_merge, absolute_path, nest_path diff --git a/bigraph_viz/diagram.py b/bigraph_viz/diagram.py index 3ee4869..a74c74d 100644 --- a/bigraph_viz/diagram.py +++ b/bigraph_viz/diagram.py @@ -3,17 +3,36 @@ """ import os from bigraph_schema import TypeSystem, Edge -from bigraph_viz.plot import absolute_path, make_label, check_if_path_in_removed_nodes +from bigraph_viz.plot_old import absolute_path, make_label, check_if_path_in_removed_nodes import graphviz -PROCESS_SCHEMA_KEYS = ['config', 'address', 'interval', 'inputs', 'outputs'] +PROCESS_SCHEMA_KEYS = [ + 'config', + 'address', + 'interval', + 'inputs', + 'outputs', + 'instance', +] +REMOVE_KEYS = ['global_time'] + +updated_path_type = { + '_type': 'path', + '_inherit': 'list[string]~string', + # '_apply': apply_path +} step_type = { '_type': 'step', '_inherit': 'edge', 'address': 'string', + # '_default': { + # 'inputs': {}, + # 'outputs': {}}, + # '_inputs': 'string~tuple', + # '_outputs': 'string~tuple', 'config': 'schema'} @@ -22,6 +41,30 @@ '_inherit': 'step', 'interval': 'float'} +def plot_edges(graph, edge, port_labels, port_label_size, state_node_spec): + process_path = edge['edge_path'] + process_name = str(process_path) + target_path = edge['target_path'] + port = edge['port'] + target_name = str(target_path) + + # place it in the graph + if target_name not in graph.body: # is the source node already in the graph? + label = make_label(target_path[-1]) + graph.node(target_name, label=label, **state_node_spec) + + # port label + label = '' + if port_labels: + label = make_label(port) + + with graph.subgraph(name=process_name) as c: + c.edge( + target_name, process_name, + label=label, + labelloc="t", + fontsize=port_label_size) + def get_graph_wires(schema, wires, graph_dict, schema_key, edge_path, port): @@ -32,18 +75,34 @@ def get_graph_wires(schema, wires, graph_dict, schema_key, edge_path, port): graph_dict = get_graph_wires( subschema, subwire, graph_dict, schema_key, edge_path, port) else: # this is a disconnected port - graph_dict['disconnected_hyper_edges'].append({ - 'edge_path': edge_path, - 'port': port, - 'type': schema_key}) + if schema_key == 'inputs': + graph_dict['disconnected_input_edges'].append({ + 'edge_path': edge_path, + 'port': port, + 'type': schema_key}) + elif schema_key == 'outputs': + graph_dict['disconnected_output_edges'].append({ + 'edge_path': edge_path, + 'port': port, + 'type': schema_key}) + else: + raise Exception(f'invalid schema key {schema_key}') elif isinstance(wires, dict): for port, subwire in wires.items(): subschema = schema.get(port, schema) graph_dict = get_graph_wires( subschema, subwire, graph_dict, schema_key, edge_path, port) - elif isinstance(wires, (list, tuple)): + elif isinstance(wires, (list, tuple, str)): + if isinstance(wires, str): + wires = [wires] target_path = absolute_path(edge_path[:-1], tuple(wires)) # TODO -- make sure this resolves ".." - graph_dict['hyper_edges'].append({ + if schema_key == 'inputs': + edge_key = 'input_edges' + elif schema_key == 'outputs': + edge_key = 'output_edges' + else: + raise Exception(f'invalid schema key {schema_key}') + graph_dict[edge_key].append({ 'edge_path': edge_path, 'target_path': target_path, 'port': port, @@ -64,18 +123,23 @@ def get_graph_dict( retain_type_keys=False, retain_process_keys=False, remove_nodes=None, + show_process_schema_keys=None, ): path = path or () top_state = top_state or state remove_nodes = remove_nodes or [] + show_process_schema_keys = show_process_schema_keys or [] + removed_process_keys = list(set(PROCESS_SCHEMA_KEYS) - set(show_process_schema_keys)) # initialize bigraph graph_dict = graph_dict or { 'state_nodes': [], 'process_nodes': [], 'place_edges': [], - 'hyper_edges': [], - 'disconnected_hyper_edges': [], + 'input_edges': [], + 'output_edges': [], + 'disconnected_input_edges': [], + 'disconnected_output_edges': [], 'bridges': [], } @@ -97,7 +161,7 @@ def get_graph_dict( is_edge = core.check('edge', value) if is_edge: # this is a process/edge node - if key in PROCESS_SCHEMA_KEYS and not retain_process_keys: + if key in removed_process_keys and not retain_process_keys: continue graph_dict['process_nodes'].append(node_spec) @@ -115,6 +179,8 @@ def get_graph_dict( output_schema, output_wires, graph_dict, schema_key='outputs', edge_path=subpath, port=()) else: # this is a state node + if key in REMOVE_KEYS: + continue if not isinstance(value, dict): # this is a leaf node node_spec['value'] = value node_spec['type'] = schema.get(key, {}).get('_type') @@ -125,7 +191,7 @@ def get_graph_dict( if isinstance(value, dict): # get subgraph if is_edge: - removed_process_schema_keys = [subpath + (schema_key,) for schema_key in PROCESS_SCHEMA_KEYS] + removed_process_schema_keys = [subpath + (schema_key,) for schema_key in removed_process_keys] remove_nodes.extend(removed_process_schema_keys) graph_dict = get_graph_dict( @@ -164,9 +230,16 @@ def get_graphviz_fig( show_types=False, port_labels=True, port_label_size='10pt', + invisible_edges=False, + remove_process_place_edges=False, + node_border_colors=None, + node_fill_colors=None, + node_groups=False, ): """make a graphviz figure from a graph_dict""" + node_groups = node_groups or [] node_names = [] + invisible_edges = invisible_edges or [] # node specs state_node_spec = { @@ -223,64 +296,83 @@ def get_graphviz_fig( # place edges graph.attr('edge', arrowhead='none', penwidth='2') for edge in graph_dict['place_edges']: - graph.attr('edge', style='filled') + + # show edge or not + show_edge = True + if remove_process_place_edges and edge['child'] in process_paths: + show_edge = False + elif edge in invisible_edges: + show_edge = False + + if show_edge: + graph.attr('edge', style='filled') + else: + graph.attr('edge', style='invis') + parent_node = str(edge['parent']) child_node = str(edge['child']) graph.edge(parent_node, child_node) - # hyper edges - for edge in graph_dict['hyper_edges']: + # input edges + for edge in graph_dict['input_edges']: + graph.attr('edge', **input_edge_spec) + plot_edges(graph, edge, port_labels, port_label_size, state_node_spec) + + # output edges + for edge in graph_dict['output_edges']: + graph.attr('edge', **output_edge_spec) + plot_edges(graph, edge, port_labels, port_label_size, state_node_spec) + + # disconnected input edges + for edge in graph_dict['disconnected_input_edges']: process_path = edge['edge_path'] - process_name = str(process_path) - target_path = edge['target_path'] port = edge['port'] - edge_type = edge['type'] # input or output - target_name = str(target_path) - - # place it in the graph - if target_name not in graph.body: # is the source node already in the graph? - label = make_label(target_path[-1]) - graph.node(target_name, label=label, **state_node_spec) - - if edge_type == 'inputs': - graph.attr('edge', **input_edge_spec) - elif edge_type == 'outputs': - graph.attr('edge', **output_edge_spec) - else: - graph.attr('edge', **hyper_edge_spec) - with graph.subgraph(name=process_name) as c: - if port_labels: - label = make_label(port) - c.edge(target_name, process_name, label=label, labelloc="t", fontsize=port_label_size) - else: - c.edge(target_name, process_name) - # disconnected hyper edges - graph.attr('edge', **hyper_edge_spec) - for edge in graph_dict['disconnected_hyper_edges']: + # add invisible node for port + node_name2 = str(absolute_path(process_path, port)) + graph.node(node_name2, label='', style='invis', width='0') + edge['target_path'] = node_name2 + + graph.attr('edge', **input_edge_spec) + plot_edges(graph, edge, port_labels, port_label_size, state_node_spec) + + # disconnected output edges + for edge in graph_dict['disconnected_output_edges']: process_path = edge['edge_path'] - process_name = str(process_path) port = edge['port'] - edge_type = edge['type'] # input or output # add invisible node for port node_name2 = str(absolute_path(process_path, port)) graph.node(node_name2, label='', style='invis', width='0') - - # add the edge - if edge_type == 'inputs': - graph.attr('edge', **input_edge_spec) - elif edge_type == 'outputs': - graph.attr('edge', **output_edge_spec) - else: - graph.attr('edge', **hyper_edge_spec) - with graph.subgraph(name=process_name) as c: - if port_labels: - label = make_label(port) - c.edge(node_name2, process_name, label=label, labelloc="t", fontsize=port_label_size - ) - else: - c.edge(node_name2, process_name) + edge['target_path'] = node_name2 + + graph.attr('edge', **output_edge_spec) + plot_edges(graph, edge, port_labels, port_label_size, state_node_spec) + + # grouped nodes + for group in node_groups: + group_name = str(group) + with graph.subgraph(name=group_name) as c: + c.attr(rank='same') + previous_node = None + for path in group: + node_name = str(path) + if node_name in node_names: + c.node(node_name) + if previous_node: + # out them in the order declared in the group + c.edge(previous_node, node_name, style='invis', ordering='out') + previous_node = node_name + else: + print(f'node {node_name} not in graph') + + # formatting + if node_border_colors: + for node_name, color in node_border_colors.items(): + graph.node(str(node_name), color=color) + if node_fill_colors: + for node_name, color in node_fill_colors.items(): + graph.node(str(node_name), color=color, style='filled') return graph @@ -304,13 +396,14 @@ def plot_bigraph( label_margin='0.05', # show_process_schema=False, # collapse_processes=False, - # node_border_colors=None, - # node_fill_colors=None, - # node_groups=False, + node_border_colors=None, + node_fill_colors=None, + node_groups=False, remove_nodes=None, - # invisible_edges=False, + invisible_edges=False, # mark_top=False, - # remove_process_place_edges=False, + remove_process_place_edges=False, + show_process_schema_keys=['interval'], ): # get kwargs dict and remove plotting-specific kwargs kwargs = locals() @@ -322,12 +415,13 @@ def plot_bigraph( filename = kwargs.pop('filename') print_source = kwargs.pop('print_source') remove_nodes = kwargs.pop('remove_nodes') - # show_process_schema = kwargs.pop('show_process_schema') + show_process_schema_keys = kwargs.pop('show_process_schema_keys') # set defaults if none provided core = core or TypeSystem() schema = schema or {} + core.register('path', updated_path_type) if not core.exists('step'): core.register('step', step_type) if not core.exists('process'): @@ -341,6 +435,7 @@ def plot_bigraph( state=state, core=core, remove_nodes=remove_nodes, + show_process_schema_keys=show_process_schema_keys, ) # make a figure @@ -432,10 +527,85 @@ def test_bio_schema(): } }} - plot_bigraph(b, filename='bioschema') + plot_bigraph(b, filename='bioschema', show_process_schema_keys=[]) +def test_input_output(): + flat_composite_spec = { + 'store1.1': 'float', + 'store1.2': 'int', + 'process1': { + '_type': 'process', + 'outputs': { + 'port1': ['store1.1'], + 'port2': ['store1.2'], + } + }, + 'process2': { + '_type': 'process', + '_inputs': { + 'port1': 'any', + 'port2': 'any', + }, + 'inputs': { + 'port1': ['store1.1'], + 'port2': ['store1.2'], + } + }, + } + plot_bigraph(flat_composite_spec, rankdir='RL', filename='flat_composite') + +def test_multi_processes(): + process_schema = { + '_type': 'process', + '_inputs': { + 'port1': 'Any', + }, + '_outputs': { + 'port2': 'Any' + }, + } + processes_spec = { + 'process1': process_schema, + 'process2': process_schema, + 'process3': process_schema, + } + plot_bigraph(processes_spec, rankdir='BT', filename='multiple_processes') + +def test_nested_processes(): + nested_composite_spec = { + 'store1': { + 'store1.1': 'float', + 'store1.2': 'int', + 'process1': { + '_type': 'process', + 'inputs': { + 'port1': ['store1.1'], + 'port2': ['store1.2'], + } + }, + 'process2': { + '_type': 'process', + 'outputs': { + 'port1': ['store1.1'], + 'port2': ['store1.2'], + } + }, + }, + 'process3': { + '_type': 'process', + 'inputs': { + 'port1': ['store1'], + } + } + } + plot_bigraph(nested_composite_spec, + # **plot_settings, + filename='nested_composite') if __name__ == '__main__': - # test_diagram_plot() + test_diagram_plot() test_bio_schema() + test_input_output() + test_multi_processes() + test_nested_processes() \ No newline at end of file diff --git a/bigraph_viz/plot.py b/bigraph_viz/plot_old.py similarity index 100% rename from bigraph_viz/plot.py rename to bigraph_viz/plot_old.py diff --git a/bigraph_viz/test.py b/bigraph_viz/test.py deleted file mode 100644 index 088bf99..0000000 --- a/bigraph_viz/test.py +++ /dev/null @@ -1,480 +0,0 @@ -""" -===================== -Tests for bigraph-viz -===================== -""" - -from bigraph_viz import plot_bigraph, plot_flow, plot_multitimestep, pp -from bigraph_viz.dict_utils import schema_state_to_dict, compose, pf - - -# testing functions -plot_settings_test = { - 'remove_process_place_edges': True, - 'show_values': True, - 'show_types': True, - 'dpi': '250', - 'out_dir': 'out' -} - - -def test_noschemakeys(): - simple_store_spec = { - 'store1': 1.0, - } - plot_bigraph(simple_store_spec, **plot_settings_test, filename='store_nokeys') - - -def test_simple_spec(): - simple_store_spec = { - 'store1': { - '_value': 1.0, - '_type': 'float', - }, - } - plot_bigraph(simple_store_spec, **plot_settings_test, filename='simple_store') - - -def test_composite_spec(): - composite_spec = { - 'store1': { - 'store1.1': { - '_value': 1.1, - '_type': 'float' - }, - 'store1.2': { - '_value': 2, - '_type': 'int' - }, - 'process1': { - '_inputs': { - 'port1': {'_type': 'type'}, - 'port2': {'_type': 'type'}, - }, - '_wires': { - 'port1': 'store1.1', - 'port2': 'store1.2', - } - }, - }, - 'process3': { - '_wires': { - 'port1': 'store1' - } - } # TODO -- wires without ports should not work. - } - plot_bigraph(composite_spec, **plot_settings_test, filename='nested_composite') - - -def test_disconnected_process_spec(): - # disconnected processes - process_schema = { - '_ports': { - 'port1': {'_type': 'type'}, - 'port2': {'_type': 'type'} - } - } - process_spec = { - 'process1': process_schema, - 'process2': process_schema, - 'process3': process_schema, - } - plot_bigraph(process_spec, **plot_settings_test, rankdir='BT', filename='disconnected_processes') - - -nested_processes = { - 'cell': { - 'membrane': { - 'transporters': {'_type': 'concentrations'}, - 'lipids': {'_type': 'concentrations'}, - 'transmembrane transport': { - '_value': { - '_process': 'transport URI', - '_config': {'parameter': 1} - }, - '_wires': { - 'transporters': 'transporters', - 'internal': ['..', 'cytoplasm', 'metabolites']}, - '_ports': { - 'transporters': {'_type': 'concentrations'}, - 'internal': {'_type': 'concentrations'}, - 'external': {'_type': 'concentrations'} - } - } - }, - 'cytoplasm': { - 'metabolites': { - '_value': 1.1, - '_type': 'concentrations' - }, - 'ribosomal complexes': { - '_value': 2.2, - '_type': 'concentrations' - }, - 'transcript regulation complex': { - '_value': 0.01, - '_type': 'concentrations', - 'transcripts': { - '_value': 0.1, - '_type': 'concentrations' - } - }, - 'translation': { - '_wires': { - 'p1': 'ribosomal complexes', - 'p2': ['transcript regulation complex', 'transcripts']}}}, - 'nucleoid': { - 'chromosome': { - 'genes': 'sequences' - } - } - } -} - - -def test_nested_spec(): - plot_bigraph(nested_processes, **plot_settings_test, filename='nested_processes') - - -def test_composite_process_spec(): - composite_process_spec = { - 'composite_process': { - 'store1.1': { - '_value': 1.1, '_type': 'float' - }, - 'store1.2': { - '_value': 2, '_type': 'int' - }, - 'process1': { - '_ports': { - 'port1': 'type', - 'port2': 'type', - }, - '_wires': { - 'port1': 'store1.1', - 'port2': 'store1.2', - } - }, - 'process2': { - '_ports': { - 'port1': {'_type': 'type'}, - 'port2': {'_type': 'type'}, - }, - '_wires': { - 'port1': 'store1.1', - 'port2': 'store1.2', - } - }, - '_ports': { - 'port1': {'_type': 'type'}, - 'port2': {'_type': 'type'}, - }, - '_tunnels': { - 'port1': 'store1.1', - 'port2': 'store1.2', - } - } - } - plot_bigraph(composite_process_spec, - **plot_settings_test, - filename='composite_process' - ) - - -def test_merging(): - - cell_structure1 = { - 'cell': { - 'membrane': { - 'transporters': {'_type': 'concentrations'}, - 'lipids': {'_type': 'concentrations'}, - }, - 'cytoplasm': { - 'metabolites': { - '_value': 1.1, '_type': 'concentrations' - }, - 'ribosomal complexes': { - '_value': 2.2, '_type': 'concentrations' - }, - 'transcript regulation complex': { - '_value': 0.01, '_type': 'concentrations', - 'transcripts': { - '_value': 0.1, '_type': 'concentrations' - }, - }, - }, - 'nucleoid': { - 'chromosome': { - 'genes': 'sequences' - } - } - } - } - - # add processes - transport_process = { - 'transmembrane transport': { - '_wires': { - 'transporters': 'transporters', - 'internal': ['..', 'cytoplasm', 'metabolites'], - } - } - } - translation_process = { - 'translation': { - '_wires': { - 'p1': 'ribosomal complexes', - 'p2': ['transcript regulation complex', 'transcripts'], - } - } - } - cell_with_transport1 = compose(cell_structure1, node=transport_process, path=('cell', 'membrane')) - cell_with_transport2 = compose(cell_with_transport1, node=translation_process, path=('cell', 'cytoplasm')) - - print('BEFORE') - print(pf(cell_with_transport2['cell']['membrane']['transmembrane transport']['_wires'])) - plot_bigraph(cell_with_transport2) - print('AFTER') - print(pf(cell_with_transport2['cell']['membrane']['transmembrane transport']['_wires'])) - - -def test_schema_value_to_dict(): - schema = { - 'store1': { - 'store1.1': 'float', - 'store1.2': 'int' - } - } - value = { - 'store1': { - 'store1.1': 1.1, - 'store1.2': 2 - } - } - expected = { - 'store1': { - 'store1.1': { - '_value': 1.1, - '_type': 'float' - }, - 'store1.2': { - '_value': 2, - '_type': 'int' - } - } - } - - schema_state_dict = schema_state_to_dict(schema, value) - assert schema_state_dict == expected - - schema = { - 'store1': { - 'store1.1': 'float', - 'store1.2': 'int', - 'process1': { - '_ports': { - 'port1': 'type', - 'port2': 'type', - }, - }, - 'process2': { - '_ports': { - 'port1': 'type', - 'port2': 'type', - }, - }, - }, - 'process3': {} - } - state = { - 'store1': { - 'store1.1': 1.1, - 'store1.2': 2, - 'process1': { - '_wires': { - 'port1': 'store1.1', - 'port2': 'store1.2', - } - }, - 'process2': { - '_wires': { - 'port1': 'store1.1', - 'port2': 'store1.2', - } - }, - }, - 'process3': { - '_wires': { - 'port1': 'store1', - } - } - } - schema_state_dict = schema_state_to_dict(schema, state) - pp(schema_state_dict) - - -def test_flow(): - process_schema = { - '_type': 'step_process', - '_ports': { - 'port1': {'_type': 'type'}, - 'port2': {'_type': 'type'}}} - - flow_spec = { - 'step1': { - '_depends_on': [], - **process_schema}, - 'step2': { - '_depends_on': 'step1', - **process_schema}, - 'step3': { - '_depends_on': [], - **process_schema}, - 'step4': { - '_depends_on': ['step2', 'step3'], - **process_schema}} - plot_flow(flow_spec, out_dir='out', filename='flow') - - -def test_multitimestep(): - process_spec = { - 'process1': { - '_ports': {'port1': {'_type': 'type'}}, - '_wires': {'port1': 'state1'}, - '_sync_step': 1.0, - }, - 'process2': { - '_ports': {'port1': {'_type': 'type'}}, - '_wires': {'port1': 'state1'}, - '_sync_step': 0.5, - }, - # 'process3': { - # '_ports': {'port1': {'_type': 'type'}}, - # '_wires': {'port1': 'state1'}, - # '_sync_step': 0.4, - # }, - } - plot_multitimestep(process_spec, total_time=3, out_dir='out', filename='multitimestep') - - -def test_multitimestep2(): - process_spec2 = { - 'A': { - 'process1': { - '_ports': {'port1': {'_type': 'type'}}, - '_wires': {'port1': 'B'}, - '_sync_step': 1.0, - }, - }, - 'process2': { - '_ports': { - 'port1': {'_type': 'type'}, - 'port2': {'_type': 'type'}}, - '_wires': { - 'port1': ['A', 'B'], - 'port2': 'C', - }, - '_sync_step': 0.5, - }, - 'process3': { - '_ports': {'port1': {'_type': 'type'}}, - '_wires': {'port1': 'C'}, - '_sync_step': 0.6, - }, - 'D': { - 'process4': { - '_ports': {'port1': {'_type': 'type'}}, - '_wires': {'port1': ['..', 'A', 'B']}, - '_sync_step': 0.8, - }, - } - } - plot_multitimestep(process_spec2, total_time=4, out_dir='out', filename='multitimestep_2') - - -def test_color_format(): - nested_composite_spec = { - 'store1': { - 'store1.1': { - '_value': 1.1, - '_type': 'float', - }, - 'store1.2': { - '_value': 2, - '_type': 'int', - }, - 'process1': { - '_ports': { - 'port1': {'_type': 'type'}, - 'port2': {'_type': 'type'}, - }, - '_wires': { - 'port1': 'store1.1', - 'port2': 'store1.2', - } - }, - 'process2': { - '_ports': { - 'port1': {'_type': 'type'}, - 'port2': {'_type': 'type'}, - }, - '_wires': { - 'port1': 'store1.1', - 'port2': 'store1.2', - } - }, - }, - 'process3': { - '_wires': { - 'port1': 'store1', - } - } - } - plot_settings = {'out_dir': 'out'} - plot_settings['node_border_colors'] = { - ('store1', 'store1.1'): 'blue' - } - plot_settings['node_fill_colors'] = { - ('store1', 'store1.2'): 'red' - } - plot_bigraph(nested_composite_spec, **plot_settings, filename='node_colors') - - -def test_undeclared_nodes(): - instance = { - 'process1': { - 'process_location': '0-000-00000-0', - 'update_method': 'KiSAO id', - '_wires': { - 'port A': 'a', - } - } - } - plot_bigraph( - instance, dpi='250', out_dir='out', filename='undeclared_nodes') - plot_bigraph( - instance, show_values=True, show_types=True, dpi='250', out_dir='out', filename='undeclared_nodes_types') - - -def test_collapse_nodes(): - plot_bigraph(nested_processes, - **plot_settings_test, - collapse_processes=True, - filename='nested_processes_collapsed') - - -if __name__ == '__main__': - # test_noschemakeys() - # test_simple_spec() - # test_composite_spec() - # test_disconnected_process_spec() - # test_nested_spec() - # test_composite_process_spec() - # test_merging() - # # test_schema_value_to_dict() - # test_flow() - # test_multitimestep() - # test_multitimestep2() - # test_color_format() - # test_undeclared_nodes() - test_collapse_nodes() diff --git a/notebooks/basics.ipynb b/notebooks/basics.ipynb index 40f3b64..9d4033b 100644 --- a/notebooks/basics.ipynb +++ b/notebooks/basics.ipynb @@ -35,8 +35,9 @@ "name": "stdout", "output_type": "stream", "text": [ - "bigraph-schema==0.0.17\n", - "bigraph-viz==0.0.30\n" + "-e git+https://github.com/vivarium-collective/bigraph-schema.git@179fd0debf76555d4126c77da30a649fb4f19d1b#egg=bigraph_schema\n", + "-e git+https://github.com/vivarium-collective/bigraph-viz.git@846f9a2bfd4f601146f9143a7f5bf2c80e559393#egg=bigraph_viz\n", + "-e git+https://github.com/vivarium-collective/process-bigraph.git@06705156de3ad9a0f50da9025103d4a4c3710223#egg=process_bigraph\n" ] } ], @@ -63,10 +64,12 @@ }, "outputs": [], "source": [ - "from bigraph_viz import plot_bigraph, plot_flow, plot_multitimestep, pf\n", - "from bigraph_viz.dict_utils import replace_regex_recursive\n", + "# from bigraph_viz import plot_bigraph, plot_flow, plot_multitimestep, pf\n", + "from bigraph_viz import plot_bigraph, replace_regex_recursive, TypeSystem\n", "\n", - "plot_settings = {'remove_process_place_edges': True}\n", + "plot_settings = {\n", + " 'remove_process_place_edges': True\n", + "}\n", "save_images = False\n", "if save_images:\n", " plot_settings.update({'out_dir': 'out','dpi': '250'})" @@ -99,32 +102,38 @@ "tags": [] }, "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Writing out/simple_store\n" + ] + }, { "data": { "image/svg+xml": [ "\n", "\n", - "\n", "\n", - "\n", - "\n", + "\n", + "\n", "bigraph\n", - "\n", + "\n", "\n", "\n", "('store1',)\n", - "\n", - "store1\n", - "1.0\n", + "\n", + "store1: 1.0\n", "\n", "\n", "\n" ], "text/plain": [ - "" + "" ] }, "execution_count": 3, @@ -153,32 +162,39 @@ "id": "f3e5fa71-7ffc-4a8f-a1a0-dc547c886f84", "metadata": {}, "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Writing out/store\n" + ] + }, { "data": { "image/svg+xml": [ "\n", "\n", - "\n", "\n", - "\n", - "\n", + "\n", + "\n", "bigraph\n", - "\n", + "\n", "\n", "\n", "('store1',)\n", - "\n", - "store1\n", - "1.0::float\n", + "\n", + "store1\n", + "[float]\n", "\n", "\n", "\n" ], "text/plain": [ - "" + "" ] }, "execution_count": 4, @@ -211,97 +227,104 @@ "id": "0f3f0824-f89d-4c6e-830e-2c5a321f7b33", "metadata": {}, "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Writing out/hierarchy\n" + ] + }, { "data": { "image/svg+xml": [ "\n", "\n", - "\n", "\n", - "\n", - "\n", + "\n", + "\n", "bigraph\n", - "\n", + "\n", "\n", "\n", "('store1',)\n", - "\n", - "store1\n", + "\n", + "store1\n", "\n", "\n", "\n", "('store1', 'store1.1')\n", - "\n", - "store1.1\n", + "\n", + "store1.1\n", "\n", "\n", "\n", "('store1',)->('store1', 'store1.1')\n", - "\n", + "\n", "\n", "\n", "\n", "('store1', 'store1.2')\n", - "\n", - "store1.2\n", + "\n", + "store1.2\n", "\n", "\n", "\n", "('store1',)->('store1', 'store1.2')\n", - "\n", + "\n", "\n", "\n", "\n", "('store1', 'store1.1', 'store1.1.1')\n", - "\n", - "store1.1.1\n", + "\n", + "store1.1.1\n", "\n", "\n", "\n", "('store1', 'store1.1')->('store1', 'store1.1', 'store1.1.1')\n", - "\n", + "\n", "\n", "\n", "\n", "('store1', 'store1.1', 'store1.1.2')\n", - "\n", - "store1.1.2\n", + "\n", + "store1.1.2\n", "\n", "\n", "\n", "('store1', 'store1.1')->('store1', 'store1.1', 'store1.1.2')\n", - "\n", + "\n", "\n", "\n", "\n", "('store1', 'store1.1', 'store1.1.3')\n", - "\n", - "store1.1.3\n", + "\n", + "store1.1.3\n", "\n", "\n", "\n", "('store1', 'store1.1')->('store1', 'store1.1', 'store1.1.3')\n", - "\n", + "\n", "\n", "\n", "\n", "('store1', 'store1.1', 'store1.1.3', 'store1.1.3.1')\n", - "\n", - "store1.1.3.1\n", + "\n", + "store1.1.3.1\n", "\n", "\n", "\n", "('store1', 'store1.1', 'store1.1.3')->('store1', 'store1.1', 'store1.1.3', 'store1.1.3.1')\n", - "\n", + "\n", "\n", "\n", "\n" ], "text/plain": [ - "" + "" ] }, "execution_count": 5, @@ -348,47 +371,54 @@ "id": "7c74237b-0d66-4e8f-a8ca-79174fadad8b", "metadata": {}, "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Writing out/process\n" + ] + }, { "data": { "image/svg+xml": [ "\n", "\n", - "\n", "\n", - "\n", - "\n", + "\n", + "\n", "bigraph\n", - "\n", + "\n", "\n", "\n", "('process1',)\n", - "\n", - "process1\n", + "\n", + "process1\n", "\n", - "\n", - "\n", + "\n", + "\n", "\n", - "('process1', 'port1')->('process1',)\n", - "\n", - "\n", - "port1\n", + "('process1', 'p', 'o', 'r', 't', '1')->('process1',)\n", + "\n", + "\n", + "port1\n", "\n", - "\n", - "\n", + "\n", + "\n", "\n", - "('process1', 'port2')->('process1',)\n", - "\n", - "\n", - "port2\n", + "('process1', 'p', 'o', 'r', 't', '2')->('process1',)\n", + "\n", + "\n", + "port2\n", "\n", "\n", "\n" ], "text/plain": [ - "" + "" ] }, "execution_count": 6, @@ -398,10 +428,9 @@ ], "source": [ "process_spec = {\n", - " '_type': 'python_process',\n", " 'process1': {\n", " '_type': 'edge',\n", - " '_ports': {\n", + " '_inputs': {\n", " 'port1': 'Any',\n", " 'port2': 'Any',\n", " },\n", @@ -424,91 +453,131 @@ "id": "8c2457a3-fc47-4850-8b9e-9ee98e81567d", "metadata": {}, "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Writing out/multiple_processes\n" + ] + }, { "data": { "image/svg+xml": [ "\n", "\n", - "\n", "\n", - "\n", - "\n", + "\n", + "\n", "bigraph\n", - "\n", - "\n", + "\n", + "\n", "\n", - "('process1',)\n", - "\n", - "process1\n", + "('process1', 'interval')\n", + "\n", + "interval\n", "\n", - "\n", + "\n", "\n", - "('process2',)\n", - "\n", - "process2\n", + "('process2', 'interval')\n", + "\n", + "interval\n", "\n", - "\n", + "\n", "\n", - "('process3',)\n", - "\n", - "process3\n", + "('process3', 'interval')\n", + "\n", + "interval\n", "\n", - "\n", - "\n", + "\n", + "\n", + "('process1',)\n", + "\n", + "process1\n", + "\n", + "\n", "\n", - "('process1', 'port1')->('process1',)\n", - "\n", - "\n", - "port1\n", + "('process1',)->('process1', 'interval')\n", + "\n", + "\n", + "\n", + "\n", + "('process2',)\n", + "\n", + "process2\n", "\n", - "\n", - "\n", + "\n", "\n", - "('process1', 'port2')->('process1',)\n", - "\n", - "\n", - "port2\n", + "('process2',)->('process2', 'interval')\n", + "\n", "\n", - "\n", - "\n", + "\n", + "\n", + "('process3',)\n", + "\n", + "process3\n", + "\n", + "\n", "\n", - "('process2', 'port1')->('process2',)\n", - "\n", - "\n", - "port1\n", + "('process3',)->('process3', 'interval')\n", + "\n", "\n", - "\n", - "\n", + "\n", + "\n", "\n", - "('process2', 'port2')->('process2',)\n", - "\n", - "\n", - "port2\n", + "('process1', 'p', 'o', 'r', 't', '1')->('process1',)\n", + "\n", + "\n", + "port1\n", "\n", - "\n", - "\n", + "\n", + "\n", "\n", - "('process3', 'port1')->('process3',)\n", - "\n", - "\n", - "port1\n", + "('process2', 'p', 'o', 'r', 't', '1')->('process2',)\n", + "\n", + "\n", + "port1\n", "\n", - "\n", - "\n", + "\n", + "\n", "\n", - "('process3', 'port2')->('process3',)\n", - "\n", - "\n", - "port2\n", + "('process3', 'p', 'o', 'r', 't', '1')->('process3',)\n", + "\n", + "\n", + "port1\n", + "\n", + "\n", + "\n", + "\n", + "('process1', 'p', 'o', 'r', 't', '2')->('process1',)\n", + "\n", + "\n", + "port2\n", + "\n", + "\n", + "\n", + "\n", + "('process2', 'p', 'o', 'r', 't', '2')->('process2',)\n", + "\n", + "\n", + "port2\n", + "\n", + "\n", + "\n", + "\n", + "('process3', 'p', 'o', 'r', 't', '2')->('process3',)\n", + "\n", + "\n", + "port2\n", "\n", "\n", "\n" ], "text/plain": [ - "" + "" ] }, "execution_count": 7, @@ -518,11 +587,13 @@ ], "source": [ "process_schema = {\n", - " '_type': 'python_process',\n", - " '_ports': {\n", + " '_type': 'process',\n", + " '_inputs': {\n", " 'port1': 'Any',\n", + " },\n", + " '_outputs': {\n", " 'port2': 'Any'\n", - " }\n", + " },\n", "}\n", "\n", "processes_spec = {\n", @@ -548,70 +619,77 @@ "id": "a6ecad5d-8948-4636-910c-79284a3e8679", "metadata": {}, "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Writing out/wires\n" + ] + }, { "data": { "image/svg+xml": [ "\n", "\n", - "\n", "\n", - "\n", - "\n", + "\n", + "\n", "bigraph\n", - "\n", + "\n", "\n", "\n", "('node1',)\n", - "\n", - "node1\n", + "\n", + "node1\n", "\n", "\n", "\n", "('process1',)\n", - "\n", - "process1\n", + "\n", + "process1\n", "\n", "\n", "\n", "('node1',)->('process1',)\n", - "\n", - "\n", - "port1\n", + "\n", + "\n", + "port1\n", "\n", "\n", "\n", "('node2',)\n", - "\n", - "node2\n", + "\n", + "node2\n", "\n", "\n", "\n", "('node2',)->('process1',)\n", - "\n", - "\n", - "port2\n", + "\n", + "\n", + "port2\n", "\n", "\n", "\n", "('node3',)\n", - "\n", - "node3\n", + "\n", + "node3\n", "\n", "\n", "\n", "('node3',)->('process1',)\n", - "\n", - "\n", - "port3\n", + "\n", + "\n", + "port3\n", "\n", "\n", "\n" ], "text/plain": [ - "" + "" ] }, "execution_count": 8, @@ -622,19 +700,19 @@ "source": [ "connected_process_spec = {\n", " 'process1': {\n", - " '_type': 'process',\n", - " '_ports': {\n", + " '_type': 'edge',\n", + " '_inputs': {\n", " 'port1': 'float',\n", " 'port2': 'int',\n", " 'port3': 'int',\n", " },\n", - " 'wires': {\n", - " 'port1': 'node1',\n", - " 'port2': 'node2',\n", - " 'port3': 'node3',\n", + " 'inputs': {\n", + " 'port1': ['node1'],\n", + " 'port2': ['node2'],\n", + " 'port3': ['node3'],\n", " }\n", " },\n", - " 'node1': 'float',\n", + " 'node1': 'float', # TODO -- shouldn't these fill?\n", " 'node2': 'int',\n", " 'node3': 'int',\n", "}\n", @@ -673,77 +751,106 @@ "id": "781a84e6-bbe2-4708-b441-47efc611b46f", "metadata": {}, "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Writing out/flat_composite\n" + ] + }, { "data": { "image/svg+xml": [ "\n", "\n", - "\n", "\n", - "\n", - "\n", + "\n", + "\n", "bigraph\n", - "\n", + "\n", "\n", "\n", "('store1.1',)\n", - "\n", - "store1.1\n", + "\n", + "store1.1\n", "\n", "\n", - "\n", + "\n", "('process1',)\n", - "\n", - "process1\n", + "\n", + "process1\n", "\n", "\n", - "\n", + "\n", "('store1.1',)->('process1',)\n", - "\n", - "\n", - "port1\n", + "\n", + "\n", + "port1\n", "\n", "\n", - "\n", + "\n", "('process2',)\n", - "\n", - "process2\n", + "\n", + "process2\n", "\n", "\n", "\n", "('store1.1',)->('process2',)\n", - "\n", - "\n", - "port1\n", + "\n", + "\n", + "port1\n", "\n", "\n", "\n", "('store1.2',)\n", - "\n", - "store1.2\n", + "\n", + "store1.2\n", "\n", "\n", - "\n", + "\n", "('store1.2',)->('process1',)\n", - "\n", - "\n", - "port2\n", + "\n", + "\n", + "port2\n", "\n", "\n", "\n", "('store1.2',)->('process2',)\n", - "\n", - "\n", - "port2\n", + "\n", + "\n", + "port2\n", + "\n", + "\n", + "\n", + "('process1', 'interval')\n", + "\n", + "interval\n", + "\n", + "\n", + "\n", + "('process2', 'interval')\n", + "\n", + "interval\n", + "\n", + "\n", + "\n", + "('process1',)->('process1', 'interval')\n", + "\n", + "\n", + "\n", + "\n", + "('process2',)->('process2', 'interval')\n", + "\n", "\n", "\n", "\n" ], "text/plain": [ - "" + "" ] }, "execution_count": 9, @@ -756,17 +863,17 @@ " 'store1.1': 'float',\n", " 'store1.2': 'int',\n", " 'process1': {\n", - " '_type': 'python_process:temporal',\n", - " 'wires': {\n", - " 'port1': 'store1.1',\n", - " 'port2': 'store1.2',\n", + " '_type': 'process',\n", + " 'outputs': {\n", + " 'port1': ['store1.1'],\n", + " 'port2': ['store1.2'],\n", " }\n", " },\n", " 'process2': {\n", - " '_type': 'python_process:temporal',\n", - " 'wires': {\n", - " 'port1': 'store1.1',\n", - " 'port2': 'store1.2',\n", + " '_type': 'process',\n", + " 'inputs': {\n", + " 'port1': ['store1.1'],\n", + " 'port2': ['store1.2'],\n", " }\n", " },\n", "}\n", @@ -788,108 +895,134 @@ "id": "701e759d-7f9b-41bb-911c-a8208c892462", "metadata": {}, "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Writing out/nested_composite\n" + ] + }, { "data": { "image/svg+xml": [ "\n", "\n", - "\n", "\n", - "\n", - "\n", + "\n", + "\n", "bigraph\n", - "\n", + "\n", "\n", "\n", "('store1',)\n", - "\n", - "store1\n", + "\n", + "store1\n", "\n", "\n", "\n", "('store1', 'store1.1')\n", - "\n", - "store1.1\n", + "\n", + "store1.1\n", "\n", "\n", "\n", "('store1',)->('store1', 'store1.1')\n", - "\n", + "\n", "\n", "\n", "\n", "('store1', 'store1.2')\n", - "\n", - "store1.2\n", + "\n", + "store1.2\n", "\n", "\n", "\n", "('store1',)->('store1', 'store1.2')\n", - "\n", + "\n", "\n", "\n", - "\n", + "\n", "('store1', 'process1')\n", - "\n", - "process1\n", + "\n", + "process1\n", "\n", "\n", + "\n", + "('store1',)->('store1', 'process1')\n", + "\n", + "\n", "\n", - "\n", + "\n", "('store1', 'process2')\n", - "\n", - "process2\n", + "\n", + "process2\n", "\n", "\n", + "\n", + "('store1',)->('store1', 'process2')\n", + "\n", + "\n", "\n", - "\n", + "\n", "('process3',)\n", - "\n", - "process3\n", + "\n", + "process3\n", "\n", "\n", - "\n", + "\n", "('store1',)->('process3',)\n", - "\n", - "\n", - "port1\n", + "\n", + "\n", + "port1\n", "\n", "\n", - "\n", + "\n", "('store1', 'store1.1')->('store1', 'process1')\n", - "\n", - "\n", - "port1\n", + "\n", + "\n", + "port1\n", "\n", "\n", - "\n", + "\n", "('store1', 'store1.1')->('store1', 'process2')\n", - "\n", - "\n", - "port1\n", + "\n", + "\n", + "port1\n", "\n", "\n", - "\n", + "\n", "('store1', 'store1.2')->('store1', 'process1')\n", - "\n", - "\n", - "port2\n", + "\n", + "\n", + "port2\n", "\n", "\n", - "\n", + "\n", "('store1', 'store1.2')->('store1', 'process2')\n", - "\n", - "\n", - "port2\n", + "\n", + "\n", + "port2\n", + "\n", + "\n", + "\n", + "('process3', 'interval')\n", + "\n", + "interval\n", + "\n", + "\n", + "\n", + "('process3',)->('process3', 'interval')\n", + "\n", "\n", "\n", "\n" ], "text/plain": [ - "" + "" ] }, "execution_count": 10, @@ -903,28 +1036,30 @@ " 'store1.1': 'float',\n", " 'store1.2': 'int',\n", " 'process1': {\n", - " '_type': 'python_process:temporal',\n", - " 'wires': {\n", - " 'port1': 'store1.1',\n", - " 'port2': 'store1.2',\n", + " '_type': 'process',\n", + " 'inputs': {\n", + " 'port1': ['store1.1'],\n", + " 'port2': ['store1.2'],\n", " }\n", " },\n", " 'process2': {\n", - " '_type': 'python_process:temporal',\n", - " 'wires': {\n", - " 'port1': 'store1.1',\n", - " 'port2': 'store1.2',\n", + " '_type': 'process',\n", + " 'outputs': {\n", + " 'port1': ['store1.1'],\n", + " 'port2': ['store1.2'],\n", " }\n", " },\n", " },\n", " 'process3': {\n", - " '_type': 'python_process:temporal',\n", - " 'wires': {\n", - " 'port1': 'store1',\n", + " '_type': 'process',\n", + " 'inputs': {\n", + " 'port1': ['store1'],\n", " }\n", " }\n", "}\n", - "plot_bigraph(nested_composite_spec, **plot_settings, filename='nested_composite')" + "plot_bigraph(nested_composite_spec, \n", + " # **plot_settings, \n", + " filename='nested_composite')" ] }, { @@ -942,126 +1077,236 @@ "id": "638c5dc7-4cfd-46e4-b66a-8c42ca98ff1d", "metadata": {}, "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Writing out/composite_process\n" + ] + }, { "data": { "image/svg+xml": [ "\n", "\n", - "\n", "\n", - "\n", - "\n", + "\n", + "\n", "bigraph\n", - "\n", - "\n", + "\n", + "\n", "\n", + "('composite_process',)\n", + "\n", + "composite_process\n", + "\n", + "\n", + "\n", "('composite_process', 'store1.1')\n", - "\n", - "store1.1\n", + "\n", + "store1.1\n", + "\n", + "\n", + "\n", + "('composite_process',)->('composite_process', 'store1.1')\n", + "\n", + "\n", + "\n", + "\n", + "('composite_process', 'store1.2')\n", + "\n", + "store1.2\n", + "\n", + "\n", + "\n", + "('composite_process',)->('composite_process', 'store1.2')\n", + "\n", "\n", "\n", "\n", "('composite_process', 'process1')\n", - "\n", - "process1\n", + "\n", + "process1\n", "\n", - "\n", - "\n", - "('composite_process', 'store1.1')->('composite_process', 'process1')\n", - "\n", - "\n", - "port1\n", + "\n", + "\n", + "('composite_process',)->('composite_process', 'process1')\n", + "\n", "\n", "\n", - "\n", + "\n", "('composite_process', 'process2')\n", - "\n", - "process2\n", + "\n", + "process2\n", "\n", - "\n", - "\n", - "('composite_process', 'store1.1')->('composite_process', 'process2')\n", - "\n", - "\n", - "port1\n", + "\n", + "\n", + "('composite_process',)->('composite_process', 'process2')\n", + "\n", "\n", - "\n", - "\n", - "('composite_process', 'store1.2')\n", - "\n", - "store1.2\n", + "\n", + "\n", + "('composite_process', 'process1', 'outputs')\n", + "\n", + "outputs\n", + "\n", + "\n", + "\n", + "('composite_process', 'process1')->('composite_process', 'process1', 'outputs')\n", + "\n", + "\n", + "\n", + "\n", + "('composite_process', 'process1', 'inputs')\n", + "\n", + "inputs\n", + "\n", + "\n", + "\n", + "('composite_process', 'process1')->('composite_process', 'process1', 'inputs')\n", + "\n", "\n", - "\n", + "\n", + "\n", + "('composite_process', 'process1', 'address')\n", + "\n", + "address\n", + "\n", + "\n", + "\n", + "('composite_process', 'process1')->('composite_process', 'process1', 'address')\n", + "\n", + "\n", + "\n", + "\n", + "('composite_process', 'process1', 'config')\n", + "\n", + "config\n", + "\n", + "\n", "\n", - "('composite_process', 'store1.2')->('composite_process', 'process1')\n", - "\n", - "\n", - "port2\n", + "('composite_process', 'process1')->('composite_process', 'process1', 'config')\n", + "\n", "\n", - "\n", - "\n", - "('composite_process', 'store1.2')->('composite_process', 'process2')\n", - "\n", - "\n", - "port2\n", + "\n", + "\n", + "('composite_process', 'process1', 'interval')\n", + "\n", + "interval\n", "\n", - "\n", - "\n", - "('composite_process',)\n", - "\n", - "\n", - "composite_process\n", + "\n", + "\n", + "('composite_process', 'process1')->('composite_process', 'process1', 'interval')\n", + "\n", "\n", - "\n", + "\n", + "\n", + "('composite_process', 'process1', 'outputs', 'port1')\n", + "\n", + "port1\n", + "\n", + "\n", "\n", - "('composite_process',)->('composite_process', 'store1.1')\n", - "\n", + "('composite_process', 'process1', 'outputs')->('composite_process', 'process1', 'outputs', 'port1')\n", + "\n", "\n", - "\n", - "\n", - "('composite_process',)->('composite_process', 'store1.1')\n", - "\n", - "\n", - "tunnel port1\n", + "\n", + "\n", + "('composite_process', 'process1', 'outputs', 'port2')\n", + "\n", + "port2\n", "\n", - "\n", + "\n", "\n", - "('composite_process',)->('composite_process', 'store1.2')\n", - "\n", + "('composite_process', 'process1', 'outputs')->('composite_process', 'process1', 'outputs', 'port2')\n", + "\n", "\n", - "\n", + "\n", + "\n", + "('composite_process', 'process2', 'outputs')\n", + "\n", + "outputs\n", + "\n", + "\n", + "\n", + "('composite_process', 'process2')->('composite_process', 'process2', 'outputs')\n", + "\n", + "\n", + "\n", + "\n", + "('composite_process', 'process2', 'inputs')\n", + "\n", + "inputs\n", + "\n", + "\n", + "\n", + "('composite_process', 'process2')->('composite_process', 'process2', 'inputs')\n", + "\n", + "\n", + "\n", + "\n", + "('composite_process', 'process2', 'address')\n", + "\n", + "address\n", + "\n", + "\n", "\n", - "('composite_process',)->('composite_process', 'store1.2')\n", - "\n", - "\n", - "tunnel port2\n", + "('composite_process', 'process2')->('composite_process', 'process2', 'address')\n", + "\n", "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('composite_process', 'port1')->('composite_process',)\n", - "\n", - "\n", - "port1\n", + "\n", + "\n", + "('composite_process', 'process2', 'config')\n", + "\n", + "config\n", "\n", - "\n", - "\n", - "\n", - "('composite_process', 'port2')->('composite_process',)\n", - "\n", - "\n", - "port2\n", + "\n", + "\n", + "('composite_process', 'process2')->('composite_process', 'process2', 'config')\n", + "\n", + "\n", + "\n", + "\n", + "('composite_process', 'process2', 'interval')\n", + "\n", + "interval\n", + "\n", + "\n", + "\n", + "('composite_process', 'process2')->('composite_process', 'process2', 'interval')\n", + "\n", + "\n", + "\n", + "\n", + "('composite_process', 'process2', 'outputs', 'port1')\n", + "\n", + "port1\n", + "\n", + "\n", + "\n", + "('composite_process', 'process2', 'outputs')->('composite_process', 'process2', 'outputs', 'port1')\n", + "\n", + "\n", + "\n", + "\n", + "('composite_process', 'process2', 'outputs', 'port2')\n", + "\n", + "port2\n", + "\n", + "\n", + "\n", + "('composite_process', 'process2', 'outputs')->('composite_process', 'process2', 'outputs', 'port2')\n", + "\n", "\n", "\n", "\n" ], "text/plain": [ - "" + "" ] }, "execution_count": 11, @@ -1072,33 +1317,36 @@ "source": [ "composite_process_spec = {\n", " 'composite_process': {\n", - " 'store1.1': 'Any',\n", - " 'store1.2': 'Any',\n", + " 'store1.1': 'any',\n", + " 'store1.2': 'any',\n", " 'process1': {\n", - " '_type': 'python_process:temporal',\n", - " 'wires': {\n", + " '_type': 'process',\n", + " 'outputs': {\n", " 'port1': 'store1.1',\n", " 'port2': 'store1.2',\n", " }\n", " },\n", " 'process2': {\n", - " '_type': 'python_process:temporal',\n", - " 'wires': {\n", + " '_type': 'process',\n", + " 'outputs': {\n", " 'port1': 'store1.1',\n", " 'port2': 'store1.2',\n", " }\n", " },\n", - " '_ports': {\n", - " 'port1': 'Any', \n", - " 'port2': 'Any', \n", - " },\n", - " '_tunnels': {\n", - " 'port1': 'store1.1',\n", - " 'port2': 'store1.2',\n", - " }\n", + " # '_inputs': {\n", + " # 'port1': 'Any', \n", + " # 'port2': 'Any', \n", + " # },\n", + " # '_tunnels': {\n", + " # 'port1': 'store1.1',\n", + " # 'port2': 'store1.2',\n", + " # }\n", " }\n", "}\n", - "plot_bigraph(composite_process_spec, **plot_settings, filename='composite_process')" + "\n", + "plot_bigraph(\n", + " composite_process_spec, \n", + " **plot_settings, filename='composite_process')" ] }, { @@ -1129,319 +1377,75 @@ "id": "48975890-06a4-462a-9b1d-6bddd51779fe", "metadata": {}, "source": [ - "### Multi-timestepping\n", - "\n", - "Temporal processes can be run by multi-timestepping, with each process updating the state according to its `sync_state` state, which it can update adaptively." - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "id": "f0eff7b0-f0e2-4d56-8b16-ef0fc1ce5aba", - "metadata": {}, - "outputs": [ - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "flow\n", - "\n", - "\n", - "\n", - "('temporal<br/>process2',)\n", - "\n", - "temporal\n", - "process2\n", - "\n", - "\n", - "\n", - "('temporal<br/>process2',) 1.0\n", - "\n", - "1.0\n", - "\n", - "\n", - "\n", - "('temporal<br/>process2',)->('temporal<br/>process2',) 1.0\n", - "\n", - "\n", - "\n", - "\n", - "('temporal<br/>process2',) 2.0\n", - "\n", - "2.0\n", - "\n", - "\n", - "\n", - "('temporal<br/>process2',) 1.0->('temporal<br/>process2',) 2.0\n", - "\n", - "\n", - "\n", - "\n", - "('state',)\n", - "\n", - "state\n", - "\n", - "\n", - "\n", - "('temporal<br/>process2',) 1.0->('state',)\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('temporal<br/>process2',) end\n", - "\n", - "\n", - "\n", - "\n", - "('temporal<br/>process2',) 2.0->('temporal<br/>process2',) end\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('temporal<br/>process2',) 2.0->('state',)\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('temporal<br/>process1',)\n", - "\n", - "temporal\n", - "process1\n", - "\n", - "\n", - "\n", - "('temporal<br/>process1',) 0.5\n", - "\n", - "0.5\n", - "\n", - "\n", - "\n", - "('temporal<br/>process1',)->('temporal<br/>process1',) 0.5\n", - "\n", - "\n", - "\n", - "\n", - "('temporal<br/>process1',) 1.0\n", - "\n", - "1.0\n", - "\n", - "\n", - "\n", - "('temporal<br/>process1',) 0.5->('temporal<br/>process1',) 1.0\n", - "\n", - "\n", - "\n", - "\n", - "('temporal<br/>process1',) 0.5->('state',)\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('temporal<br/>process1',) 1.5\n", - "\n", - "1.5\n", - "\n", - "\n", - "\n", - "('temporal<br/>process1',) 1.0->('temporal<br/>process1',) 1.5\n", - "\n", - "\n", - "\n", - "\n", - "('temporal<br/>process1',) 1.0->('state',)\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('temporal<br/>process1',) 2.0\n", - "\n", - "2.0\n", - "\n", - "\n", - "\n", - "('temporal<br/>process1',) 1.5->('temporal<br/>process1',) 2.0\n", - "\n", - "\n", - "\n", - "\n", - "('temporal<br/>process1',) 1.5->('state',)\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('temporal<br/>process1',) end\n", - "\n", - "\n", - "\n", - "\n", - "('temporal<br/>process1',) 2.0->('temporal<br/>process1',) end\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('temporal<br/>process1',) 2.0->('state',)\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 13, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "multitimestep_spec = {\n", - " 'temporal process2': {\n", - " '_ports': {'port1': 'Any'},\n", - " 'wires': {'port1': 'state'},\n", - " '_sync_step': 1.0,\n", - " },\n", - " 'temporal process1': {\n", - " '_ports': {'port1': 'Any'},\n", - " 'wires': {'port1': 'state'},\n", - " '_sync_step': 0.5,\n", - " },\n", - "}\n", - "multitimestep_spec = replace_regex_recursive(multitimestep_spec)\n", - "plot_multitimestep(multitimestep_spec, total_time=2.0, **plot_settings2, filename='multitimestep')" - ] - }, - { - "cell_type": "markdown", - "id": "a00cf677-ebac-4309-8ac9-a5b2855724af", - "metadata": {}, - "source": [ - "### Flows\n", - "\n", - "A directed acyclic graph (DAG) – a type of workflow that declares the dependencies between processes. A flow run is not temporal, and the order is entirely based on dependencies. It can triggered between time steps, running the steps in the order as determined by their dependencies." - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "id": "db45c99b-b97b-47bc-a73e-c669882f3969", - "metadata": {}, - "outputs": [ - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "flow\n", - "\n", - "\n", - "\n", - "('step1',)\n", - "\n", - "step1\n", - "\n", - "\n", - "\n", - "('step2',)\n", - "\n", - "step2\n", - "\n", - "\n", - "\n", - "('step1',)->('step2',)\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('step4',)\n", - "\n", - "step4\n", - "\n", - "\n", - "\n", - "('step2',)->('step4',)\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('step3',)\n", - "\n", - "step3\n", - "\n", - "\n", - "\n", - "('step3',)->('step4',)\n", - "\n", - "\n", - "\n", - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 14, - "metadata": {}, - "output_type": "execute_result" - } - ], + "### Multi-timestepping\n", + "\n", + "Temporal processes can be run by multi-timestepping, with each process updating the state according to its `sync_state` state, which it can update adaptively." + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "f0eff7b0-f0e2-4d56-8b16-ef0fc1ce5aba", + "metadata": {}, + "outputs": [], "source": [ - "flow = {\n", - " 'step1': {\n", - " '_type': 'step_process',\n", - " '_ports': {},\n", - " '_depends_on': [], \n", - " },\n", - " 'step2': {\n", - " '_type': 'step_process',\n", - " '_ports': {},\n", - " '_depends_on': 'step1', \n", - " },\n", - " 'step3': {\n", - " '_type': 'step_process',\n", - " '_ports': {},\n", - " '_depends_on': [], \n", - " },\n", - " 'step4': {\n", - " '_type': 'step_process',\n", - " '_ports': {},\n", - " '_depends_on': ['step2', 'step3'], \n", - " },\n", - "}\n", + "# multitimestep_spec = {\n", + "# 'temporal process2': {\n", + "# '_ports': {'port1': 'Any'},\n", + "# 'wires': {'port1': 'state'},\n", + "# '_sync_step': 1.0,\n", + "# },\n", + "# 'temporal process1': {\n", + "# '_ports': {'port1': 'Any'},\n", + "# 'wires': {'port1': 'state'},\n", + "# '_sync_step': 0.5,\n", + "# },\n", + "# }\n", + "# multitimestep_spec = replace_regex_recursive(multitimestep_spec)\n", + "# plot_multitimestep(multitimestep_spec, total_time=2.0, **plot_settings2, filename='multitimestep')" + ] + }, + { + "cell_type": "markdown", + "id": "a00cf677-ebac-4309-8ac9-a5b2855724af", + "metadata": {}, + "source": [ + "### Flows\n", + "\n", + "A directed acyclic graph (DAG) – a type of workflow that declares the dependencies between processes. A flow run is not temporal, and the order is entirely based on dependencies. It can triggered between time steps, running the steps in the order as determined by their dependencies." + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "db45c99b-b97b-47bc-a73e-c669882f3969", + "metadata": {}, + "outputs": [], + "source": [ + "# flow = {\n", + "# 'step1': {\n", + "# '_type': 'step_process',\n", + "# '_ports': {},\n", + "# '_depends_on': [], \n", + "# },\n", + "# 'step2': {\n", + "# '_type': 'step_process',\n", + "# '_ports': {},\n", + "# '_depends_on': 'step1', \n", + "# },\n", + "# 'step3': {\n", + "# '_type': 'step_process',\n", + "# '_ports': {},\n", + "# '_depends_on': [], \n", + "# },\n", + "# 'step4': {\n", + "# '_type': 'step_process',\n", + "# '_ports': {},\n", + "# '_depends_on': ['step2', 'step3'], \n", + "# },\n", + "# }\n", "\n", - "plot_flow(flow, **plot_settings2, filename='flow')" + "# plot_flow(flow, **plot_settings2, filename='flow')" ] }, { @@ -1472,591 +1476,598 @@ "tags": [] }, "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Writing out/cell_hierarchy\n" + ] + }, { "data": { "image/svg+xml": [ "\n", "\n", - "\n", "\n", - "\n", - "\n", + "\n", + "\n", "bigraph\n", - "\n", + "\n", "\n", "\n", "('cell',)\n", - "\n", - "cell\n", + "\n", + "cell\n", "\n", "\n", "\n", "('cell', 'cytoplasm')\n", - "\n", - "cytoplasm\n", + "\n", + "cytoplasm\n", "\n", "\n", "\n", "('cell',)->('cell', 'cytoplasm')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus')\n", - "\n", - "nucleus\n", + "\n", + "nucleus\n", "\n", "\n", "\n", "('cell',)->('cell', 'nucleus')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'secretory<br/>organelles')\n", - "\n", - "secretory\n", - "organelles\n", + "\n", + "secretory\n", + "organelles\n", "\n", "\n", "\n", "('cell', 'cytoplasm')->('cell', 'cytoplasm', 'secretory<br/>organelles')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles')\n", - "\n", - "cytoplasmic\n", - "organelles\n", + "\n", + "cytoplasmic\n", + "organelles\n", "\n", "\n", "\n", "('cell', 'cytoplasm')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'transcriptional<br/>regulation<br/>complex<br/>family')\n", - "\n", - "transcriptional\n", - "regulation\n", - "complex\n", - "family\n", + "\n", + "transcriptional\n", + "regulation\n", + "complex\n", + "family\n", "\n", "\n", "\n", "('cell', 'cytoplasm')->('cell', 'cytoplasm', 'transcriptional<br/>regulation<br/>complex<br/>family')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'secretory<br/>organelles', 'transmembrane<br/>transport<br/>systems')\n", - "\n", - "transmembrane\n", - "transport\n", - "systems\n", + "\n", + "transmembrane\n", + "transport\n", + "systems\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'secretory<br/>organelles')->('cell', 'cytoplasm', 'secretory<br/>organelles', 'transmembrane<br/>transport<br/>systems')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'secretory<br/>organelles', 'transmembrane<br/>transport<br/>systems', 'ion<br/>transmembrane<br/>transport<br/>systems')\n", - "\n", - "ion\n", - "transmembrane\n", - "transport\n", - "systems\n", + "\n", + "ion\n", + "transmembrane\n", + "transport\n", + "systems\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'secretory<br/>organelles', 'transmembrane<br/>transport<br/>systems')->('cell', 'cytoplasm', 'secretory<br/>organelles', 'transmembrane<br/>transport<br/>systems', 'ion<br/>transmembrane<br/>transport<br/>systems')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles')\n", - "\n", - "subgroup\n", - "of\n", - "cytoplasmic\n", - "organelles\n", + "\n", + "subgroup\n", + "of\n", + "cytoplasmic\n", + "organelles\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'metabolic<br/>organelles')\n", - "\n", - "metabolic\n", - "organelles\n", + "\n", + "metabolic\n", + "organelles\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'metabolic<br/>organelles')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family')\n", - "\n", - "ribonucleoprotein\n", - "complex\n", - "family\n", + "\n", + "ribonucleoprotein\n", + "complex\n", + "family\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'metabolic<br/>organelles', 'subgroup<br/>of<br/>metabolic<br/>organelles')\n", - "\n", - "subgroup\n", - "of\n", - "metabolic\n", - "organelles\n", + "\n", + "subgroup\n", + "of\n", + "metabolic\n", + "organelles\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'metabolic<br/>organelles')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'metabolic<br/>organelles', 'subgroup<br/>of<br/>metabolic<br/>organelles')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'metabolic<br/>organelles', 'mitochondrion')\n", - "\n", - "mitochondrion\n", + "\n", + "mitochondrion\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'metabolic<br/>organelles')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'metabolic<br/>organelles', 'mitochondrion')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'RNA<br/>processing<br/>complex<br/>1')\n", - "\n", - "RNA\n", - "processing\n", - "complex\n", - "1\n", + "\n", + "RNA\n", + "processing\n", + "complex\n", + "1\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'RNA<br/>processing<br/>complex<br/>1')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community')\n", - "\n", - "ribosome\n", - "biogenesis\n", - "community\n", + "\n", + "ribosome\n", + "biogenesis\n", + "community\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'RNA<br/>processing<br/>complex<br/>1', 'RNA<br/>splicing<br/>complex<br/>1')\n", - "\n", - "RNA\n", - "splicing\n", - "complex\n", - "1\n", + "\n", + "RNA\n", + "splicing\n", + "complex\n", + "1\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'RNA<br/>processing<br/>complex<br/>1')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'RNA<br/>processing<br/>complex<br/>1', 'RNA<br/>splicing<br/>complex<br/>1')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome')\n", - "\n", - "ribosome\n", + "\n", + "ribosome\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'nucleic<br/>acid<br/>binding<br/>complex')\n", - "\n", - "nucleic\n", - "acid\n", - "binding\n", - "complex\n", + "\n", + "nucleic\n", + "acid\n", + "binding\n", + "complex\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'nucleic<br/>acid<br/>binding<br/>complex')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit')\n", - "\n", - "ribosomal\n", - "subunit\n", + "\n", + "ribosomal\n", + "subunit\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'mitochondirial<br/>large<br/>ribosomal<br/>subunit')\n", - "\n", - "mitochondirial\n", - "large\n", - "ribosomal\n", - "subunit\n", + "\n", + "mitochondirial\n", + "large\n", + "ribosomal\n", + "subunit\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'mitochondirial<br/>large<br/>ribosomal<br/>subunit')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'mito-cyto<br/>ribosomal<br/>cluster')\n", - "\n", - "mito-cyto\n", - "ribosomal\n", - "cluster\n", + "\n", + "mito-cyto\n", + "ribosomal\n", + "cluster\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'mito-cyto<br/>ribosomal<br/>cluster')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'cotranslational<br/>protein<br/>targeting<br/>to<br/>membrane<br/>system')\n", - "\n", - "cotranslational\n", - "protein\n", - "targeting\n", - "to\n", - "membrane\n", - "system\n", + "\n", + "cotranslational\n", + "protein\n", + "targeting\n", + "to\n", + "membrane\n", + "system\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'cotranslational<br/>protein<br/>targeting<br/>to<br/>membrane<br/>system')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'ribosomal<br/>complex<br/>5')\n", - "\n", - "ribosomal\n", - "complex\n", - "5\n", + "\n", + "ribosomal\n", + "complex\n", + "5\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'ribosomal<br/>complex<br/>5')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'ribosomal<br/>complex<br/>2')\n", - "\n", - "ribosomal\n", - "complex\n", - "2\n", + "\n", + "ribosomal\n", + "complex\n", + "2\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'ribosomal<br/>complex<br/>2')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'transcriptional<br/>regulation<br/>complex<br/>family', 'transcriptional<br/>regulation<br/>complexes')\n", - "\n", - "transcriptional\n", - "regulation\n", - "complexes\n", + "\n", + "transcriptional\n", + "regulation\n", + "complexes\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'transcriptional<br/>regulation<br/>complex<br/>family')->('cell', 'cytoplasm', 'transcriptional<br/>regulation<br/>complex<br/>family', 'transcriptional<br/>regulation<br/>complexes')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'DNA<br/>metabolic<br/>assembly')\n", - "\n", - "DNA\n", - "metabolic\n", - "assembly\n", + "\n", + "DNA\n", + "metabolic\n", + "assembly\n", "\n", "\n", "\n", "('cell', 'nucleus')->('cell', 'nucleus', 'DNA<br/>metabolic<br/>assembly')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>lumen')\n", - "\n", - "nuclear\n", - "lumen\n", + "\n", + "nuclear\n", + "lumen\n", "\n", "\n", "\n", "('cell', 'nucleus')->('cell', 'nucleus', 'nuclear<br/>lumen')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>body')\n", - "\n", - "nuclear\n", - "body\n", + "\n", + "nuclear\n", + "body\n", "\n", "\n", "\n", "('cell', 'nucleus')->('cell', 'nucleus', 'nuclear<br/>body')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nucleo-plasm<br/>1')\n", - "\n", - "nucleo-plasm\n", - "1\n", + "\n", + "nucleo-plasm\n", + "1\n", "\n", "\n", "\n", "('cell', 'nucleus')->('cell', 'nucleus', 'nucleo-plasm<br/>1')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nucleo-plasm<br/>2')\n", - "\n", - "nucleo-plasm\n", - "2\n", + "\n", + "nucleo-plasm\n", + "2\n", "\n", "\n", "\n", "('cell', 'nucleus')->('cell', 'nucleus', 'nucleo-plasm<br/>2')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>transcriptional<br/>speckle')\n", - "\n", - "nuclear\n", - "transcriptional\n", - "speckle\n", + "\n", + "nuclear\n", + "transcriptional\n", + "speckle\n", "\n", "\n", "\n", "('cell', 'nucleus')->('cell', 'nucleus', 'nuclear<br/>transcriptional<br/>speckle')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus')\n", - "\n", - "nucleolus\n", + "\n", + "nucleolus\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>lumen')->('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>lumen', 'nuclear<br/>splicing<br/>speckle')\n", - "\n", - "nuclear\n", - "splicing\n", - "speckle\n", + "\n", + "nuclear\n", + "splicing\n", + "speckle\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>lumen')->('cell', 'nucleus', 'nuclear<br/>lumen', 'nuclear<br/>splicing<br/>speckle')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'ribonucleprotein<br/>complex<br/>family')\n", - "\n", - "ribonucleprotein\n", - "complex\n", - "family\n", + "\n", + "ribonucleprotein\n", + "complex\n", + "family\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus')->('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'ribonucleprotein<br/>complex<br/>family')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'RNA<br/>processing<br/>complex<br/>family')\n", - "\n", - "RNA\n", - "processing\n", - "complex\n", - "family\n", + "\n", + "RNA\n", + "processing\n", + "complex\n", + "family\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus')->('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'RNA<br/>processing<br/>complex<br/>family')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'splicosomal<br/>complex<br/>family')\n", - "\n", - "splicosomal\n", - "complex\n", - "family\n", + "\n", + "splicosomal\n", + "complex\n", + "family\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus')->('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'splicosomal<br/>complex<br/>family')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'RNA<br/>processing<br/>complex<br/>family', 'RNA<br/>processing<br/>complex<br/>1')\n", - "\n", - "RNA\n", - "processing\n", - "complex\n", - "1\n", + "\n", + "RNA\n", + "processing\n", + "complex\n", + "1\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'RNA<br/>processing<br/>complex<br/>family')->('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'RNA<br/>processing<br/>complex<br/>family', 'RNA<br/>processing<br/>complex<br/>1')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'RNA<br/>processing<br/>complex<br/>family', 'RNA<br/>splicing<br/>complex<br/>family')\n", - "\n", - "RNA\n", - "splicing\n", - "complex\n", - "family\n", + "\n", + "RNA\n", + "splicing\n", + "complex\n", + "family\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'RNA<br/>processing<br/>complex<br/>family')->('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'RNA<br/>processing<br/>complex<br/>family', 'RNA<br/>splicing<br/>complex<br/>family')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family')\n", - "\n", - "chromosome\n", - "organization\n", - "complex\n", - "family\n", + "\n", + "chromosome\n", + "organization\n", + "complex\n", + "family\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nucleo-plasm<br/>1')->('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family', 'chromatin<br/>organization<br/>complex<br/>family')\n", - "\n", - "chromatin\n", - "organization\n", - "complex\n", - "family\n", + "\n", + "chromatin\n", + "organization\n", + "complex\n", + "family\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family')->('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family', 'chromatin<br/>organization<br/>complex<br/>family')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family', 'chromatin<br/>organization<br/>complex<br/>family', 'HAT<br/>complex<br/>family')\n", - "\n", - "HAT\n", - "complex\n", - "family\n", + "\n", + "HAT\n", + "complex\n", + "family\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family', 'chromatin<br/>organization<br/>complex<br/>family')->('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family', 'chromatin<br/>organization<br/>complex<br/>family', 'HAT<br/>complex<br/>family')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family', 'chromatin<br/>organization<br/>complex<br/>family', 'HAT<br/>complex<br/>family', 'NuA4<br/>HAT<br/>complex')\n", - "\n", - "NuA4\n", - "HAT\n", - "complex\n", + "\n", + "NuA4\n", + "HAT\n", + "complex\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family', 'chromatin<br/>organization<br/>complex<br/>family', 'HAT<br/>complex<br/>family')->('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family', 'chromatin<br/>organization<br/>complex<br/>family', 'HAT<br/>complex<br/>family', 'NuA4<br/>HAT<br/>complex')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nucleo-plasm<br/>2', 'chromatin<br/>regulation<br/>complex')\n", - "\n", - "chromatin\n", - "regulation\n", - "complex\n", + "\n", + "chromatin\n", + "regulation\n", + "complex\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nucleo-plasm<br/>2')->('cell', 'nucleus', 'nucleo-plasm<br/>2', 'chromatin<br/>regulation<br/>complex')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>transcriptional<br/>speckle', 'negative<br/>regulation<br/>of<br/>RNA<br/>biosynthesis<br/>process')\n", - "\n", - "negative\n", - "regulation\n", - "of\n", - "RNA\n", - "biosynthesis\n", - "process\n", + "\n", + "negative\n", + "regulation\n", + "of\n", + "RNA\n", + "biosynthesis\n", + "process\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>transcriptional<br/>speckle')->('cell', 'nucleus', 'nuclear<br/>transcriptional<br/>speckle', 'negative<br/>regulation<br/>of<br/>RNA<br/>biosynthesis<br/>process')\n", - "\n", + "\n", "\n", "\n", "\n" ], "text/plain": [ - "" + "" ] }, "execution_count": 15, @@ -2166,777 +2177,949 @@ "tags": [] }, "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Writing out/cell_hierarchy_functions\n" + ] + }, { "data": { "image/svg+xml": [ "\n", "\n", - "\n", "\n", - "\n", - "\n", + "\n", + "\n", "bigraph\n", - "\n", + "\n", "\n", "\n", "('cell',)\n", - "\n", - "cell\n", + "\n", + "cell\n", "\n", "\n", "\n", "('cell', 'cytoplasm')\n", - "\n", - "cytoplasm\n", + "\n", + "cytoplasm\n", "\n", "\n", - "\n", + "\n", "('cell',)->('cell', 'cytoplasm')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus')\n", - "\n", - "nucleus\n", + "\n", + "nucleus\n", "\n", "\n", - "\n", + "\n", "('cell',)->('cell', 'nucleus')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'transcription')\n", - "\n", - "transcription\n", + "\n", + "transcription\n", "\n", "\n", + "\n", + "('cell',)->('cell', 'transcription')\n", + "\n", + "\n", "\n", - "\n", + "\n", "('cell', 'translation')\n", - "\n", - "translation\n", + "\n", + "translation\n", "\n", "\n", + "\n", + "('cell',)->('cell', 'translation')\n", + "\n", + "\n", "\n", - "\n", + "\n", "('cell', 'metabolism')\n", - "\n", - "metabolism\n", + "\n", + "metabolism\n", "\n", "\n", + "\n", + "('cell',)->('cell', 'metabolism')\n", + "\n", + "\n", "\n", - "\n", + "\n", "('cell', 'cell<br/>cycle')\n", - "\n", - "cell\n", - "cycle\n", + "\n", + "cell\n", + "cycle\n", "\n", "\n", + "\n", + "('cell',)->('cell', 'cell<br/>cycle')\n", + "\n", + "\n", "\n", - "\n", + "\n", "('cell', 'signalling')\n", - "\n", - "signalling\n", + "\n", + "signalling\n", "\n", "\n", + "\n", + "('cell',)->('cell', 'signalling')\n", + "\n", + "\n", "\n", - "\n", + "\n", "('cell', 'protein<br/>transport')\n", - "\n", - "protein\n", - "transport\n", + "\n", + "protein\n", + "transport\n", "\n", "\n", + "\n", + "('cell',)->('cell', 'protein<br/>transport')\n", + "\n", + "\n", "\n", - "\n", + "\n", "('cell', 'RNA<br/>processing')\n", - "\n", - "RNA\n", - "processing\n", + "\n", + "RNA\n", + "processing\n", "\n", "\n", + "\n", + "('cell',)->('cell', 'RNA<br/>processing')\n", + "\n", + "\n", "\n", "\n", "('cell', 'cytoplasm', 'secretory<br/>organelles')\n", - "\n", - "secretory\n", - "organelles\n", + "\n", + "secretory\n", + "organelles\n", "\n", "\n", "\n", "('cell', 'cytoplasm')->('cell', 'cytoplasm', 'secretory<br/>organelles')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles')\n", - "\n", - "cytoplasmic\n", - "organelles\n", + "\n", + "cytoplasmic\n", + "organelles\n", "\n", "\n", "\n", "('cell', 'cytoplasm')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'transcriptional<br/>regulation<br/>complex<br/>family')\n", - "\n", - "transcriptional\n", - "regulation\n", - "complex\n", - "family\n", + "\n", + "transcriptional\n", + "regulation\n", + "complex\n", + "family\n", "\n", "\n", "\n", "('cell', 'cytoplasm')->('cell', 'cytoplasm', 'transcriptional<br/>regulation<br/>complex<br/>family')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'secretory<br/>organelles', 'transmembrane<br/>transport<br/>systems')\n", - "\n", - "transmembrane\n", - "transport\n", - "systems\n", + "\n", + "transmembrane\n", + "transport\n", + "systems\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'secretory<br/>organelles')->('cell', 'cytoplasm', 'secretory<br/>organelles', 'transmembrane<br/>transport<br/>systems')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'secretory<br/>organelles')->('cell', 'protein<br/>transport')\n", - "\n", - "\n", - "secretory\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'secretory<br/>organelles', 'transmembrane<br/>transport<br/>systems', 'ion<br/>transmembrane<br/>transport<br/>systems')\n", - "\n", - "ion\n", - "transmembrane\n", - "transport\n", - "systems\n", + "\n", + "ion\n", + "transmembrane\n", + "transport\n", + "systems\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'secretory<br/>organelles', 'transmembrane<br/>transport<br/>systems')->('cell', 'cytoplasm', 'secretory<br/>organelles', 'transmembrane<br/>transport<br/>systems', 'ion<br/>transmembrane<br/>transport<br/>systems')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'secretory<br/>organelles', 'transmembrane<br/>transport<br/>systems')->('cell', 'signalling')\n", - "\n", - "\n", - "transport\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'secretory<br/>organelles', 'transmembrane<br/>transport<br/>systems')->('cell', 'protein<br/>transport')\n", - "\n", - "\n", - "transmembrane\n", - "transport\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'secretory<br/>organelles', 'transmembrane<br/>transport<br/>systems', 'ion<br/>transmembrane<br/>transport<br/>systems')->('cell', 'metabolism')\n", - "\n", - "\n", - "ion\n", - "transport\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles')\n", - "\n", - "subgroup\n", - "of\n", - "cytoplasmic\n", - "organelles\n", + "\n", + "subgroup\n", + "of\n", + "cytoplasmic\n", + "organelles\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'metabolic<br/>organelles')\n", - "\n", - "metabolic\n", - "organelles\n", + "\n", + "metabolic\n", + "organelles\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'metabolic<br/>organelles')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family')\n", - "\n", - "ribonucleoprotein\n", - "complex\n", - "family\n", + "\n", + "ribonucleoprotein\n", + "complex\n", + "family\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'metabolic<br/>organelles', 'subgroup<br/>of<br/>metabolic<br/>organelles')\n", - "\n", - "subgroup\n", - "of\n", - "metabolic\n", - "organelles\n", + "\n", + "subgroup\n", + "of\n", + "metabolic\n", + "organelles\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'metabolic<br/>organelles')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'metabolic<br/>organelles', 'subgroup<br/>of<br/>metabolic<br/>organelles')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'metabolic<br/>organelles', 'mitochondrion')\n", - "\n", - "mitochondrion\n", + "\n", + "mitochondrion\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'metabolic<br/>organelles')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'metabolic<br/>organelles', 'mitochondrion')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'metabolic<br/>organelles')->('cell', 'metabolism')\n", - "\n", - "\n", - "organelles\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'metabolic<br/>organelles', 'mitochondrion')->('cell', 'metabolism')\n", - "\n", - "\n", - "mitochondrion\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'RNA<br/>processing<br/>complex<br/>1')\n", - "\n", - "RNA\n", - "processing\n", - "complex\n", - "1\n", + "\n", + "RNA\n", + "processing\n", + "complex\n", + "1\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'RNA<br/>processing<br/>complex<br/>1')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community')\n", - "\n", - "ribosome\n", - "biogenesis\n", - "community\n", + "\n", + "ribosome\n", + "biogenesis\n", + "community\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'RNA<br/>processing<br/>complex<br/>1', 'RNA<br/>splicing<br/>complex<br/>1')\n", - "\n", - "RNA\n", - "splicing\n", - "complex\n", - "1\n", + "\n", + "RNA\n", + "splicing\n", + "complex\n", + "1\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'RNA<br/>processing<br/>complex<br/>1')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'RNA<br/>processing<br/>complex<br/>1', 'RNA<br/>splicing<br/>complex<br/>1')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome')\n", - "\n", - "ribosome\n", + "\n", + "ribosome\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'nucleic<br/>acid<br/>binding<br/>complex')\n", - "\n", - "nucleic\n", - "acid\n", - "binding\n", - "complex\n", + "\n", + "nucleic\n", + "acid\n", + "binding\n", + "complex\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'nucleic<br/>acid<br/>binding<br/>complex')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit')\n", - "\n", - "ribosomal\n", - "subunit\n", + "\n", + "ribosomal\n", + "subunit\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome')->('cell', 'translation')\n", - "\n", - "\n", - "ribosomes\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'mitochondirial<br/>large<br/>ribosomal<br/>subunit')\n", - "\n", - "mitochondirial\n", - "large\n", - "ribosomal\n", - "subunit\n", + "\n", + "mitochondirial\n", + "large\n", + "ribosomal\n", + "subunit\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'mitochondirial<br/>large<br/>ribosomal<br/>subunit')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'mito-cyto<br/>ribosomal<br/>cluster')\n", - "\n", - "mito-cyto\n", - "ribosomal\n", - "cluster\n", + "\n", + "mito-cyto\n", + "ribosomal\n", + "cluster\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'mito-cyto<br/>ribosomal<br/>cluster')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'cotranslational<br/>protein<br/>targeting<br/>to<br/>membrane<br/>system')\n", - "\n", - "cotranslational\n", - "protein\n", - "targeting\n", - "to\n", - "membrane\n", - "system\n", + "\n", + "cotranslational\n", + "protein\n", + "targeting\n", + "to\n", + "membrane\n", + "system\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'cotranslational<br/>protein<br/>targeting<br/>to<br/>membrane<br/>system')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'ribosomal<br/>complex<br/>5')\n", - "\n", - "ribosomal\n", - "complex\n", - "5\n", + "\n", + "ribosomal\n", + "complex\n", + "5\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'ribosomal<br/>complex<br/>5')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'ribosomal<br/>complex<br/>2')\n", - "\n", - "ribosomal\n", - "complex\n", - "2\n", + "\n", + "ribosomal\n", + "complex\n", + "2\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'ribosomal<br/>complex<br/>2')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'cotranslational<br/>protein<br/>targeting<br/>to<br/>membrane<br/>system')->('cell', 'protein<br/>transport')\n", - "\n", - "\n", - "cotranslation\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'nucleic<br/>acid<br/>binding<br/>complex')->('cell', 'transcription')\n", - "\n", - "\n", - "nucleic\n", - "acids\n", + "\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'transcriptional<br/>regulation<br/>complex<br/>family', 'transcriptional<br/>regulation<br/>complexes')\n", - "\n", - "transcriptional\n", - "regulation\n", - "complexes\n", + "\n", + "transcriptional\n", + "regulation\n", + "complexes\n", "\n", "\n", "\n", "('cell', 'cytoplasm', 'transcriptional<br/>regulation<br/>complex<br/>family')->('cell', 'cytoplasm', 'transcriptional<br/>regulation<br/>complex<br/>family', 'transcriptional<br/>regulation<br/>complexes')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'transcriptional<br/>regulation<br/>complex<br/>family', 'transcriptional<br/>regulation<br/>complexes')->('cell', 'transcription')\n", - "\n", - "\n", - "regulation\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'transcriptional<br/>regulation<br/>complex<br/>family', 'transcriptional<br/>regulation<br/>complexes')->('cell', 'signalling')\n", - "\n", - "\n", - "trancript\n", - "regulation\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'DNA<br/>metabolic<br/>assembly')\n", - "\n", - "DNA\n", - "metabolic\n", - "assembly\n", + "\n", + "DNA\n", + "metabolic\n", + "assembly\n", "\n", "\n", "\n", "('cell', 'nucleus')->('cell', 'nucleus', 'DNA<br/>metabolic<br/>assembly')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>lumen')\n", - "\n", - "nuclear\n", - "lumen\n", + "\n", + "nuclear\n", + "lumen\n", "\n", "\n", "\n", "('cell', 'nucleus')->('cell', 'nucleus', 'nuclear<br/>lumen')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>body')\n", - "\n", - "nuclear\n", - "body\n", + "\n", + "nuclear\n", + "body\n", "\n", "\n", "\n", "('cell', 'nucleus')->('cell', 'nucleus', 'nuclear<br/>body')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nucleo-plasm<br/>1')\n", - "\n", - "nucleo-plasm\n", - "1\n", + "\n", + "nucleo-plasm\n", + "1\n", "\n", "\n", "\n", "('cell', 'nucleus')->('cell', 'nucleus', 'nucleo-plasm<br/>1')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nucleo-plasm<br/>2')\n", - "\n", - "nucleo-plasm\n", - "2\n", + "\n", + "nucleo-plasm\n", + "2\n", "\n", "\n", "\n", "('cell', 'nucleus')->('cell', 'nucleus', 'nucleo-plasm<br/>2')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>transcriptional<br/>speckle')\n", - "\n", - "nuclear\n", - "transcriptional\n", - "speckle\n", + "\n", + "nuclear\n", + "transcriptional\n", + "speckle\n", "\n", "\n", "\n", "('cell', 'nucleus')->('cell', 'nucleus', 'nuclear<br/>transcriptional<br/>speckle')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'DNA<br/>metabolic<br/>assembly')->('cell', 'cell<br/>cycle')\n", - "\n", - "\n", - "DNA\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus')\n", - "\n", - "nucleolus\n", + "\n", + "nucleolus\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>lumen')->('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>lumen', 'nuclear<br/>splicing<br/>speckle')\n", - "\n", - "nuclear\n", - "splicing\n", - "speckle\n", + "\n", + "nuclear\n", + "splicing\n", + "speckle\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>lumen')->('cell', 'nucleus', 'nuclear<br/>lumen', 'nuclear<br/>splicing<br/>speckle')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'ribonucleprotein<br/>complex<br/>family')\n", - "\n", - "ribonucleprotein\n", - "complex\n", - "family\n", + "\n", + "ribonucleprotein\n", + "complex\n", + "family\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus')->('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'ribonucleprotein<br/>complex<br/>family')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'RNA<br/>processing<br/>complex<br/>family')\n", - "\n", - "RNA\n", - "processing\n", - "complex\n", - "family\n", + "\n", + "RNA\n", + "processing\n", + "complex\n", + "family\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus')->('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'RNA<br/>processing<br/>complex<br/>family')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'splicosomal<br/>complex<br/>family')\n", - "\n", - "splicosomal\n", - "complex\n", - "family\n", + "\n", + "splicosomal\n", + "complex\n", + "family\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus')->('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'splicosomal<br/>complex<br/>family')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'RNA<br/>processing<br/>complex<br/>family', 'RNA<br/>processing<br/>complex<br/>1')\n", - "\n", - "RNA\n", - "processing\n", - "complex\n", - "1\n", + "\n", + "RNA\n", + "processing\n", + "complex\n", + "1\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'RNA<br/>processing<br/>complex<br/>family')->('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'RNA<br/>processing<br/>complex<br/>family', 'RNA<br/>processing<br/>complex<br/>1')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'RNA<br/>processing<br/>complex<br/>family', 'RNA<br/>splicing<br/>complex<br/>family')\n", - "\n", - "RNA\n", - "splicing\n", - "complex\n", - "family\n", + "\n", + "RNA\n", + "splicing\n", + "complex\n", + "family\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'RNA<br/>processing<br/>complex<br/>family')->('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'RNA<br/>processing<br/>complex<br/>family', 'RNA<br/>splicing<br/>complex<br/>family')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'RNA<br/>processing<br/>complex<br/>family')->('cell', 'transcription')\n", - "\n", - "\n", - "RNA\n", - "processing\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'RNA<br/>processing<br/>complex<br/>family')->('cell', 'RNA<br/>processing')\n", - "\n", - "\n", - "processing\n", - "complex\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family')\n", - "\n", - "chromosome\n", - "organization\n", - "complex\n", - "family\n", + "\n", + "chromosome\n", + "organization\n", + "complex\n", + "family\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nucleo-plasm<br/>1')->('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family', 'chromatin<br/>organization<br/>complex<br/>family')\n", - "\n", - "chromatin\n", - "organization\n", - "complex\n", - "family\n", + "\n", + "chromatin\n", + "organization\n", + "complex\n", + "family\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family')->('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family', 'chromatin<br/>organization<br/>complex<br/>family')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family')->('cell', 'cell<br/>cycle')\n", - "\n", - "\n", - "chromosome\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family', 'chromatin<br/>organization<br/>complex<br/>family', 'HAT<br/>complex<br/>family')\n", - "\n", - "HAT\n", - "complex\n", - "family\n", + "\n", + "HAT\n", + "complex\n", + "family\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family', 'chromatin<br/>organization<br/>complex<br/>family')->('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family', 'chromatin<br/>organization<br/>complex<br/>family', 'HAT<br/>complex<br/>family')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family', 'chromatin<br/>organization<br/>complex<br/>family')->('cell', 'cell<br/>cycle')\n", - "\n", - "\n", - "chromatin\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family', 'chromatin<br/>organization<br/>complex<br/>family', 'HAT<br/>complex<br/>family', 'NuA4<br/>HAT<br/>complex')\n", - "\n", - "NuA4\n", - "HAT\n", - "complex\n", + "\n", + "NuA4\n", + "HAT\n", + "complex\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family', 'chromatin<br/>organization<br/>complex<br/>family', 'HAT<br/>complex<br/>family')->('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family', 'chromatin<br/>organization<br/>complex<br/>family', 'HAT<br/>complex<br/>family', 'NuA4<br/>HAT<br/>complex')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nucleo-plasm<br/>2', 'chromatin<br/>regulation<br/>complex')\n", - "\n", - "chromatin\n", - "regulation\n", - "complex\n", + "\n", + "chromatin\n", + "regulation\n", + "complex\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nucleo-plasm<br/>2')->('cell', 'nucleus', 'nucleo-plasm<br/>2', 'chromatin<br/>regulation<br/>complex')\n", - "\n", + "\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>transcriptional<br/>speckle', 'negative<br/>regulation<br/>of<br/>RNA<br/>biosynthesis<br/>process')\n", - "\n", - "negative\n", - "regulation\n", - "of\n", - "RNA\n", - "biosynthesis\n", - "process\n", + "\n", + "negative\n", + "regulation\n", + "of\n", + "RNA\n", + "biosynthesis\n", + "process\n", "\n", "\n", "\n", "('cell', 'nucleus', 'nuclear<br/>transcriptional<br/>speckle')->('cell', 'nucleus', 'nuclear<br/>transcriptional<br/>speckle', 'negative<br/>regulation<br/>of<br/>RNA<br/>biosynthesis<br/>process')\n", - "\n", + "\n", + "\n", + "\n", + "\n", + "('cell', 'transcription', 'outputs')\n", + "\n", + "outputs\n", + "\n", + "\n", + "\n", + "('cell', 'transcription')->('cell', 'transcription', 'outputs')\n", + "\n", + "\n", + "\n", + "\n", + "('cell', 'transcription', 'outputs', 'RNA<br/>processing')\n", + "\n", + "RNA\n", + "processing\n", + "\n", + "\n", + "\n", + "('cell', 'transcription', 'outputs')->('cell', 'transcription', 'outputs', 'RNA<br/>processing')\n", + "\n", + "\n", + "\n", + "\n", + "('cell', 'transcription', 'outputs', 'regulation')\n", + "\n", + "regulation\n", + "\n", + "\n", + "\n", + "('cell', 'transcription', 'outputs')->('cell', 'transcription', 'outputs', 'regulation')\n", + "\n", + "\n", + "\n", + "\n", + "('cell', 'transcription', 'outputs', 'nucleic<br/>acids')\n", + "\n", + "nucleic\n", + "acids\n", + "\n", + "\n", + "\n", + "('cell', 'transcription', 'outputs')->('cell', 'transcription', 'outputs', 'nucleic<br/>acids')\n", + "\n", "\n", - "\n", + "\n", + "\n", + "('cell', 'transcription', 'outputs', 'negative<br/>regulation')\n", + "\n", + "negative\n", + "regulation\n", + "\n", + "\n", + "\n", + "('cell', 'transcription', 'outputs')->('cell', 'transcription', 'outputs', 'negative<br/>regulation')\n", + "\n", + "\n", + "\n", + "\n", + "('cell', 'translation', 'outputs')\n", + "\n", + "outputs\n", + "\n", + "\n", + "\n", + "('cell', 'translation')->('cell', 'translation', 'outputs')\n", + "\n", + "\n", + "\n", + "\n", + "('cell', 'translation', 'outputs', 'ribosomes')\n", + "\n", + "ribosomes\n", + "\n", + "\n", + "\n", + "('cell', 'translation', 'outputs')->('cell', 'translation', 'outputs', 'ribosomes')\n", + "\n", + "\n", + "\n", + "\n", + "('cell', 'metabolism', 'outputs')\n", + "\n", + "outputs\n", + "\n", + "\n", + "\n", + "('cell', 'metabolism')->('cell', 'metabolism', 'outputs')\n", + "\n", + "\n", + "\n", + "\n", + "('cell', 'metabolism', 'outputs', 'organelles')\n", + "\n", + "organelles\n", + "\n", + "\n", + "\n", + "('cell', 'metabolism', 'outputs')->('cell', 'metabolism', 'outputs', 'organelles')\n", + "\n", + "\n", + "\n", + "\n", + "('cell', 'metabolism', 'outputs', 'mitochondrion')\n", + "\n", + "mitochondrion\n", + "\n", + "\n", + "\n", + "('cell', 'metabolism', 'outputs')->('cell', 'metabolism', 'outputs', 'mitochondrion')\n", + "\n", + "\n", + "\n", + "\n", + "('cell', 'metabolism', 'outputs', 'ion<br/>transport')\n", + "\n", + "ion\n", + "transport\n", + "\n", + "\n", + "\n", + "('cell', 'metabolism', 'outputs')->('cell', 'metabolism', 'outputs', 'ion<br/>transport')\n", + "\n", + "\n", + "\n", + "\n", + "('cell', 'cell<br/>cycle', 'outputs')\n", + "\n", + "outputs\n", + "\n", + "\n", + "\n", + "('cell', 'cell<br/>cycle')->('cell', 'cell<br/>cycle', 'outputs')\n", + "\n", + "\n", + "\n", + "\n", + "('cell', 'cell<br/>cycle', 'outputs', 'DNA')\n", + "\n", + "DNA\n", + "\n", + "\n", + "\n", + "('cell', 'cell<br/>cycle', 'outputs')->('cell', 'cell<br/>cycle', 'outputs', 'DNA')\n", + "\n", + "\n", + "\n", + "\n", + "('cell', 'cell<br/>cycle', 'outputs', 'chromosome')\n", + "\n", + "chromosome\n", + "\n", + "\n", "\n", - "('cell', 'nucleus', 'nuclear<br/>transcriptional<br/>speckle', 'negative<br/>regulation<br/>of<br/>RNA<br/>biosynthesis<br/>process')->('cell', 'transcription')\n", - "\n", - "\n", - "negative\n", - "regulation\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'translation', 'membrane')->('cell', 'translation')\n", - "\n", - "\n", - "membrane\n", + "('cell', 'cell<br/>cycle', 'outputs')->('cell', 'cell<br/>cycle', 'outputs', 'chromosome')\n", + "\n", + "\n", + "\n", + "\n", + "('cell', 'cell<br/>cycle', 'outputs', 'chromatin')\n", + "\n", + "chromatin\n", + "\n", + "\n", + "\n", + "('cell', 'cell<br/>cycle', 'outputs')->('cell', 'cell<br/>cycle', 'outputs', 'chromatin')\n", + "\n", + "\n", + "\n", + "\n", + "('cell', 'signalling', 'outputs')\n", + "\n", + "outputs\n", + "\n", + "\n", + "\n", + "('cell', 'signalling')->('cell', 'signalling', 'outputs')\n", + "\n", + "\n", + "\n", + "\n", + "('cell', 'signalling', 'outputs', 'transport')\n", + "\n", + "transport\n", + "\n", + "\n", + "\n", + "('cell', 'signalling', 'outputs')->('cell', 'signalling', 'outputs', 'transport')\n", + "\n", + "\n", + "\n", + "\n", + "('cell', 'signalling', 'outputs', 'trancript<br/>regulation')\n", + "\n", + "trancript\n", + "regulation\n", + "\n", + "\n", + "\n", + "('cell', 'signalling', 'outputs')->('cell', 'signalling', 'outputs', 'trancript<br/>regulation')\n", + "\n", + "\n", + "\n", + "\n", + "('cell', 'protein<br/>transport', 'outputs')\n", + "\n", + "outputs\n", + "\n", + "\n", + "\n", + "('cell', 'protein<br/>transport')->('cell', 'protein<br/>transport', 'outputs')\n", + "\n", + "\n", + "\n", + "\n", + "('cell', 'protein<br/>transport', 'outputs', 'transmembrane<br/>transport')\n", + "\n", + "transmembrane\n", + "transport\n", + "\n", + "\n", + "\n", + "('cell', 'protein<br/>transport', 'outputs')->('cell', 'protein<br/>transport', 'outputs', 'transmembrane<br/>transport')\n", + "\n", + "\n", + "\n", + "\n", + "('cell', 'protein<br/>transport', 'outputs', 'secretory')\n", + "\n", + "secretory\n", + "\n", + "\n", + "\n", + "('cell', 'protein<br/>transport', 'outputs')->('cell', 'protein<br/>transport', 'outputs', 'secretory')\n", + "\n", + "\n", + "\n", + "\n", + "('cell', 'protein<br/>transport', 'outputs', 'cotranslation')\n", + "\n", + "cotranslation\n", + "\n", + "\n", + "\n", + "('cell', 'protein<br/>transport', 'outputs')->('cell', 'protein<br/>transport', 'outputs', 'cotranslation')\n", + "\n", + "\n", + "\n", + "\n", + "('cell', 'RNA<br/>processing', 'outputs')\n", + "\n", + "outputs\n", + "\n", + "\n", + "\n", + "('cell', 'RNA<br/>processing')->('cell', 'RNA<br/>processing', 'outputs')\n", + "\n", + "\n", + "\n", + "\n", + "('cell', 'RNA<br/>processing', 'outputs', 'processing<br/>complex')\n", + "\n", + "processing\n", + "complex\n", + "\n", + "\n", + "\n", + "('cell', 'RNA<br/>processing', 'outputs')->('cell', 'RNA<br/>processing', 'outputs', 'processing<br/>complex')\n", + "\n", "\n", "\n", "\n" ], "text/plain": [ - "" + "" ] }, "execution_count": 17, @@ -2948,13 +3131,13 @@ "import copy\n", "\n", "transcription_process = {\n", - " '_ports': {\n", + " '_outputs': {\n", " 'RNA processing': 'Any',\n", " 'regulation': 'Any',\n", " 'nucleic acids': 'Any',\n", " 'negative regulation': 'Any'\n", " },\n", - " 'wires': {\n", + " 'outputs': {\n", " 'RNA processing': [\n", " 'nucleus', 'nuclear lumen', 'nucleolus', 'RNA processing complex family'],\n", " 'regulation': [\n", @@ -2968,11 +3151,11 @@ "}\n", "\n", "translation_process = {\n", - " '_ports': {\n", + " '_outputs': {\n", " 'ribosomes': 'Any',\n", " 'membrane': 'Any'\n", " },\n", - " 'wires': {\n", + " 'outputs': {\n", " 'ribosomes': [\n", " 'cytoplasm', 'cytoplasmic organelles', 'subgroup of cytoplasmic organelles', 'ribonucleoprotein complex family', 'ribosome biogenesis community', 'ribosome'],\n", " # 'membrane': ['],\n", @@ -2980,12 +3163,12 @@ "}\n", "\n", "metabolism_process = {\n", - " '_ports': {\n", + " '_outputs': {\n", " 'organelles': 'Any',\n", " 'mitochondrion': 'Any',\n", " 'ion transport': 'Any',\n", " },\n", - " 'wires': {\n", + " 'outputs': {\n", " 'organelles': [\n", " 'cytoplasm', 'cytoplasmic organelles', 'subgroup of cytoplasmic organelles', 'metabolic organelles', ],\n", " 'mitochondrion': [\n", @@ -2996,12 +3179,12 @@ "}\n", "\n", "cell_cycle_process = {\n", - " '_ports': {\n", + " '_outputs': {\n", " 'DNA': 'Any',\n", " 'chromosome': 'Any',\n", " 'chromatin': 'Any',\n", " },\n", - " 'wires': { \n", + " 'outputs': { \n", " 'DNA': ['nucleus', 'DNA metabolic assembly'],\n", " 'chromosome': ['nucleus', 'nucleo-plasm 1', 'chromosome organization complex family',],\n", " 'chromatin': ['nucleus', 'nucleo-plasm 1', 'chromosome organization complex family', 'chromatin organization complex family'],\n", @@ -3009,11 +3192,11 @@ "}\n", "\n", "signalling_process = {\n", - " '_ports': {\n", + " '_outputs': {\n", " 'transport': 'Any',\n", " 'trancript regulation': 'Any',\n", " },\n", - " 'wires': { \n", + " 'outputs': { \n", " 'transport': [\n", " 'cytoplasm', 'secretory organelles', 'transmembrane transport systems'],\n", " 'trancript regulation': [\n", @@ -3022,12 +3205,12 @@ "}\n", "\n", "protein_transport_process = {\n", - " '_ports': {\n", + " '_outputs': {\n", " 'transmembrane transport': 'Any',\n", " 'secretory': 'Any',\n", " 'cotranslation': 'Any',\n", " },\n", - " 'wires': { \n", + " 'outputs': { \n", " 'transmembrane transport': [\n", " 'cytoplasm', 'secretory organelles', 'transmembrane transport systems'],\n", " 'secretory': [\n", @@ -3039,10 +3222,10 @@ "}\n", "\n", "rna_processing_process = {\n", - " '_ports': {\n", + " '_outputs': {\n", " 'processing complex': 'Any',\n", " },\n", - " 'wires': { \n", + " 'outputs': { \n", " 'processing complex': [\n", " 'nucleus', 'nuclear lumen', 'nucleolus', 'RNA processing complex family'],\n", " }\n", @@ -3077,55 +3260,62 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 23, "id": "fe3008ad-498e-449f-8521-6ea29fd903f1", "metadata": { "tags": [] }, "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Writing out/hypothesized_mechanism\n" + ] + }, { "data": { "image/svg+xml": [ "\n", "\n", - "\n", "\n", - "\n", - "\n", + "\n", + "\n", "bigraph\n", - "\n", + "\n", "\n", "\n", "('hypothesized<br/>mechanism',)\n", - "\n", - "hypothesized\n", - "mechanism\n", + "\n", + "hypothesized\n", + "mechanism\n", "\n", "\n", "\n", "\n", "('hypothesized<br/>mechanism', '1')->('hypothesized<br/>mechanism',)\n", - "\n", - "\n", + "\n", + "\n", "\n", "\n", "\n", "\n", "('hypothesized<br/>mechanism', '2')->('hypothesized<br/>mechanism',)\n", - "\n", - "\n", + "\n", + "\n", "\n", "\n", "\n" ], "text/plain": [ - "" + "" ] }, - "execution_count": 18, + "execution_count": 23, "metadata": {}, "output_type": "execute_result" } @@ -3133,7 +3323,8 @@ "source": [ "new_process = {\n", " 'hypothesized mechanism': {\n", - " '_ports': {\n", + " '_type': 'step',\n", + " '_inputs': {\n", " '1': 'Any',\n", " '2': 'Any',\n", " }\n", @@ -3163,220 +3354,45 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 25, "id": "b39417ce-d9a1-4985-abce-ce22df816897", "metadata": { "tags": [] }, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "Writing out/cell\n" + "ename": "RecursionError", + "evalue": "maximum recursion depth exceeded while calling a Python object", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mRecursionError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[25], line 52\u001b[0m\n\u001b[1;32m 50\u001b[0m core\u001b[38;5;241m.\u001b[39mregister(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mconcentrations\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mfloat\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 51\u001b[0m cell_struct_func2 \u001b[38;5;241m=\u001b[39m replace_regex_recursive(cell_struct_func)\n\u001b[0;32m---> 52\u001b[0m \u001b[43mplot_bigraph\u001b[49m\u001b[43m(\u001b[49m\u001b[43mcell_struct_func2\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcore\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcore\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mremove_process_place_edges\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mout_dir\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mout\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfilename\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mcell\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/code/bigraph-viz/bigraph_viz/diagram.py:433\u001b[0m, in \u001b[0;36mplot_bigraph\u001b[0;34m(state, schema, core, out_dir, filename, file_format, size, node_label_size, show_values, show_types, port_labels, port_label_size, rankdir, print_source, dpi, label_margin, node_border_colors, node_fill_colors, node_groups, remove_nodes, invisible_edges, remove_process_place_edges, show_process_schema_keys)\u001b[0m\n\u001b[1;32m 430\u001b[0m schema, state \u001b[38;5;241m=\u001b[39m core\u001b[38;5;241m.\u001b[39mcomplete(schema, state)\n\u001b[1;32m 432\u001b[0m \u001b[38;5;66;03m# parse out the network\u001b[39;00m\n\u001b[0;32m--> 433\u001b[0m graph_dict \u001b[38;5;241m=\u001b[39m \u001b[43mget_graph_dict\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 434\u001b[0m \u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 435\u001b[0m \u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstate\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 436\u001b[0m \u001b[43m \u001b[49m\u001b[43mcore\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcore\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 437\u001b[0m \u001b[43m \u001b[49m\u001b[43mremove_nodes\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mremove_nodes\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 438\u001b[0m \u001b[43m \u001b[49m\u001b[43mshow_process_schema_keys\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mshow_process_schema_keys\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 439\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 441\u001b[0m \u001b[38;5;66;03m# make a figure\u001b[39;00m\n\u001b[1;32m 442\u001b[0m graph \u001b[38;5;241m=\u001b[39m get_graphviz_fig(graph_dict, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n", + "File \u001b[0;32m~/code/bigraph-viz/bigraph_viz/diagram.py:197\u001b[0m, in \u001b[0;36mget_graph_dict\u001b[0;34m(schema, state, core, graph_dict, path, top_state, retain_type_keys, retain_process_keys, remove_nodes, show_process_schema_keys)\u001b[0m\n\u001b[1;32m 194\u001b[0m removed_process_schema_keys \u001b[38;5;241m=\u001b[39m [subpath \u001b[38;5;241m+\u001b[39m (schema_key,) \u001b[38;5;28;01mfor\u001b[39;00m schema_key \u001b[38;5;129;01min\u001b[39;00m removed_process_keys]\n\u001b[1;32m 195\u001b[0m remove_nodes\u001b[38;5;241m.\u001b[39mextend(removed_process_schema_keys)\n\u001b[0;32m--> 197\u001b[0m graph_dict \u001b[38;5;241m=\u001b[39m \u001b[43mget_graph_dict\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 198\u001b[0m \u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mschema\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 199\u001b[0m \u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvalue\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 200\u001b[0m \u001b[43m \u001b[49m\u001b[43mcore\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcore\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 201\u001b[0m \u001b[43m \u001b[49m\u001b[43mgraph_dict\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mgraph_dict\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 202\u001b[0m \u001b[43m \u001b[49m\u001b[43mpath\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msubpath\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 203\u001b[0m \u001b[43m \u001b[49m\u001b[43mtop_state\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtop_state\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 204\u001b[0m \u001b[43m \u001b[49m\u001b[43mremove_nodes\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mremove_nodes\u001b[49m\n\u001b[1;32m 205\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 207\u001b[0m \u001b[38;5;66;03m# get the place edge\u001b[39;00m\n\u001b[1;32m 208\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m node \u001b[38;5;129;01min\u001b[39;00m value\u001b[38;5;241m.\u001b[39mkeys():\n", + "File \u001b[0;32m~/code/bigraph-viz/bigraph_viz/diagram.py:197\u001b[0m, in \u001b[0;36mget_graph_dict\u001b[0;34m(schema, state, core, graph_dict, path, top_state, retain_type_keys, retain_process_keys, remove_nodes, show_process_schema_keys)\u001b[0m\n\u001b[1;32m 194\u001b[0m removed_process_schema_keys \u001b[38;5;241m=\u001b[39m [subpath \u001b[38;5;241m+\u001b[39m (schema_key,) \u001b[38;5;28;01mfor\u001b[39;00m schema_key \u001b[38;5;129;01min\u001b[39;00m removed_process_keys]\n\u001b[1;32m 195\u001b[0m remove_nodes\u001b[38;5;241m.\u001b[39mextend(removed_process_schema_keys)\n\u001b[0;32m--> 197\u001b[0m graph_dict \u001b[38;5;241m=\u001b[39m \u001b[43mget_graph_dict\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 198\u001b[0m \u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mschema\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 199\u001b[0m \u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvalue\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 200\u001b[0m \u001b[43m \u001b[49m\u001b[43mcore\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcore\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 201\u001b[0m \u001b[43m \u001b[49m\u001b[43mgraph_dict\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mgraph_dict\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 202\u001b[0m \u001b[43m \u001b[49m\u001b[43mpath\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msubpath\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 203\u001b[0m \u001b[43m \u001b[49m\u001b[43mtop_state\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtop_state\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 204\u001b[0m \u001b[43m \u001b[49m\u001b[43mremove_nodes\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mremove_nodes\u001b[49m\n\u001b[1;32m 205\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 207\u001b[0m \u001b[38;5;66;03m# get the place edge\u001b[39;00m\n\u001b[1;32m 208\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m node \u001b[38;5;129;01min\u001b[39;00m value\u001b[38;5;241m.\u001b[39mkeys():\n", + " \u001b[0;31m[... skipping similar frames: get_graph_dict at line 197 (2951 times)]\u001b[0m\n", + "File \u001b[0;32m~/code/bigraph-viz/bigraph_viz/diagram.py:197\u001b[0m, in \u001b[0;36mget_graph_dict\u001b[0;34m(schema, state, core, graph_dict, path, top_state, retain_type_keys, retain_process_keys, remove_nodes, show_process_schema_keys)\u001b[0m\n\u001b[1;32m 194\u001b[0m removed_process_schema_keys \u001b[38;5;241m=\u001b[39m [subpath \u001b[38;5;241m+\u001b[39m (schema_key,) \u001b[38;5;28;01mfor\u001b[39;00m schema_key \u001b[38;5;129;01min\u001b[39;00m removed_process_keys]\n\u001b[1;32m 195\u001b[0m remove_nodes\u001b[38;5;241m.\u001b[39mextend(removed_process_schema_keys)\n\u001b[0;32m--> 197\u001b[0m graph_dict \u001b[38;5;241m=\u001b[39m \u001b[43mget_graph_dict\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 198\u001b[0m \u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mschema\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 199\u001b[0m \u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mvalue\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 200\u001b[0m \u001b[43m \u001b[49m\u001b[43mcore\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcore\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 201\u001b[0m \u001b[43m \u001b[49m\u001b[43mgraph_dict\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mgraph_dict\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 202\u001b[0m \u001b[43m \u001b[49m\u001b[43mpath\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msubpath\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 203\u001b[0m \u001b[43m \u001b[49m\u001b[43mtop_state\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtop_state\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 204\u001b[0m \u001b[43m \u001b[49m\u001b[43mremove_nodes\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mremove_nodes\u001b[49m\n\u001b[1;32m 205\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 207\u001b[0m \u001b[38;5;66;03m# get the place edge\u001b[39;00m\n\u001b[1;32m 208\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m node \u001b[38;5;129;01min\u001b[39;00m value\u001b[38;5;241m.\u001b[39mkeys():\n", + "File \u001b[0;32m~/code/bigraph-viz/bigraph_viz/diagram.py:162\u001b[0m, in \u001b[0;36mget_graph_dict\u001b[0;34m(schema, state, core, graph_dict, path, top_state, retain_type_keys, retain_process_keys, remove_nodes, show_process_schema_keys)\u001b[0m\n\u001b[1;32m 153\u001b[0m \u001b[38;5;28;01mcontinue\u001b[39;00m\n\u001b[1;32m 155\u001b[0m node_spec \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 156\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mname\u001b[39m\u001b[38;5;124m'\u001b[39m: key,\n\u001b[1;32m 157\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mpath\u001b[39m\u001b[38;5;124m'\u001b[39m: subpath,\n\u001b[1;32m 158\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mvalue\u001b[39m\u001b[38;5;124m'\u001b[39m: \u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m 159\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mtype\u001b[39m\u001b[38;5;124m'\u001b[39m: \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m 160\u001b[0m }\n\u001b[0;32m--> 162\u001b[0m is_edge \u001b[38;5;241m=\u001b[39m \u001b[43mcore\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcheck\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43medge\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mvalue\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 163\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m is_edge: \u001b[38;5;66;03m# this is a process/edge node\u001b[39;00m\n\u001b[1;32m 164\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m key \u001b[38;5;129;01min\u001b[39;00m removed_process_keys \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m retain_process_keys:\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:465\u001b[0m, in \u001b[0;36mTypeSystem.check\u001b[0;34m(self, initial_schema, state)\u001b[0m\n\u001b[1;32m 463\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcheck\u001b[39m(\u001b[38;5;28mself\u001b[39m, initial_schema, state):\n\u001b[1;32m 464\u001b[0m schema \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mretrieve(initial_schema)\n\u001b[0;32m--> 465\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcheck_state\u001b[49m\u001b[43m(\u001b[49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:457\u001b[0m, in \u001b[0;36mTypeSystem.check_state\u001b[0;34m(self, schema, state)\u001b[0m\n\u001b[1;32m 452\u001b[0m check_key \u001b[38;5;241m=\u001b[39m any_type[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m_check\u001b[39m\u001b[38;5;124m'\u001b[39m]\n\u001b[1;32m 454\u001b[0m check_function \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtype_registry\u001b[38;5;241m.\u001b[39mcheck_registry\u001b[38;5;241m.\u001b[39maccess(\n\u001b[1;32m 455\u001b[0m check_key)\n\u001b[0;32m--> 457\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mcheck_function\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 458\u001b[0m \u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 459\u001b[0m \u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 460\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:1923\u001b[0m, in \u001b[0;36mcheck_edge\u001b[0;34m(schema, state, core)\u001b[0m\n\u001b[1;32m 1922\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcheck_edge\u001b[39m(schema, state, core):\n\u001b[0;32m-> 1923\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(state, \u001b[38;5;28mdict\u001b[39m) \u001b[38;5;129;01mand\u001b[39;00m check_ports(state, core, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124minputs\u001b[39m\u001b[38;5;124m'\u001b[39m) \u001b[38;5;129;01mand\u001b[39;00m \u001b[43mcheck_ports\u001b[49m\u001b[43m(\u001b[49m\u001b[43mstate\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcore\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43moutputs\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:1917\u001b[0m, in \u001b[0;36mcheck_ports\u001b[0;34m(state, core, key)\u001b[0m\n\u001b[1;32m 1916\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcheck_ports\u001b[39m(state, core, key):\n\u001b[0;32m-> 1917\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m key \u001b[38;5;129;01min\u001b[39;00m state \u001b[38;5;129;01mand\u001b[39;00m \u001b[43mcore\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcheck\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1918\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mwires\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1919\u001b[0m \u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m[\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:465\u001b[0m, in \u001b[0;36mTypeSystem.check\u001b[0;34m(self, initial_schema, state)\u001b[0m\n\u001b[1;32m 463\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcheck\u001b[39m(\u001b[38;5;28mself\u001b[39m, initial_schema, state):\n\u001b[1;32m 464\u001b[0m schema \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mretrieve(initial_schema)\n\u001b[0;32m--> 465\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcheck_state\u001b[49m\u001b[43m(\u001b[49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:457\u001b[0m, in \u001b[0;36mTypeSystem.check_state\u001b[0;34m(self, schema, state)\u001b[0m\n\u001b[1;32m 452\u001b[0m check_key \u001b[38;5;241m=\u001b[39m any_type[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m_check\u001b[39m\u001b[38;5;124m'\u001b[39m]\n\u001b[1;32m 454\u001b[0m check_function \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtype_registry\u001b[38;5;241m.\u001b[39mcheck_registry\u001b[38;5;241m.\u001b[39maccess(\n\u001b[1;32m 455\u001b[0m check_key)\n\u001b[0;32m--> 457\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mcheck_function\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 458\u001b[0m \u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 459\u001b[0m \u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 460\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:1648\u001b[0m, in \u001b[0;36mcheck_tree\u001b[0;34m(schema, state, core)\u001b[0m\n\u001b[1;32m 1646\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(state, \u001b[38;5;28mdict\u001b[39m):\n\u001b[1;32m 1647\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m key, value \u001b[38;5;129;01min\u001b[39;00m state\u001b[38;5;241m.\u001b[39mitems():\n\u001b[0;32m-> 1648\u001b[0m check \u001b[38;5;241m=\u001b[39m \u001b[43mcore\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcheck\u001b[49m\u001b[43m(\u001b[49m\u001b[43m{\u001b[49m\n\u001b[1;32m 1649\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43m_type\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mtree\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1650\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43m_leaf\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mleaf_type\u001b[49m\u001b[43m}\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1651\u001b[0m \u001b[43m \u001b[49m\u001b[43mvalue\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1653\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m check:\n\u001b[1;32m 1654\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m core\u001b[38;5;241m.\u001b[39mcheck(\n\u001b[1;32m 1655\u001b[0m leaf_type,\n\u001b[1;32m 1656\u001b[0m value)\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:465\u001b[0m, in \u001b[0;36mTypeSystem.check\u001b[0;34m(self, initial_schema, state)\u001b[0m\n\u001b[1;32m 463\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcheck\u001b[39m(\u001b[38;5;28mself\u001b[39m, initial_schema, state):\n\u001b[1;32m 464\u001b[0m schema \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mretrieve(initial_schema)\n\u001b[0;32m--> 465\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcheck_state\u001b[49m\u001b[43m(\u001b[49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:457\u001b[0m, in \u001b[0;36mTypeSystem.check_state\u001b[0;34m(self, schema, state)\u001b[0m\n\u001b[1;32m 452\u001b[0m check_key \u001b[38;5;241m=\u001b[39m any_type[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m_check\u001b[39m\u001b[38;5;124m'\u001b[39m]\n\u001b[1;32m 454\u001b[0m check_function \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtype_registry\u001b[38;5;241m.\u001b[39mcheck_registry\u001b[38;5;241m.\u001b[39maccess(\n\u001b[1;32m 455\u001b[0m check_key)\n\u001b[0;32m--> 457\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mcheck_function\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 458\u001b[0m \u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 459\u001b[0m \u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 460\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:1660\u001b[0m, in \u001b[0;36mcheck_tree\u001b[0;34m(schema, state, core)\u001b[0m\n\u001b[1;32m 1658\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m\n\u001b[1;32m 1659\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m-> 1660\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mcore\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcheck\u001b[49m\u001b[43m(\u001b[49m\u001b[43mleaf_type\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:465\u001b[0m, in \u001b[0;36mTypeSystem.check\u001b[0;34m(self, initial_schema, state)\u001b[0m\n\u001b[1;32m 463\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcheck\u001b[39m(\u001b[38;5;28mself\u001b[39m, initial_schema, state):\n\u001b[1;32m 464\u001b[0m schema \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mretrieve(initial_schema)\n\u001b[0;32m--> 465\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcheck_state\u001b[49m\u001b[43m(\u001b[49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:457\u001b[0m, in \u001b[0;36mTypeSystem.check_state\u001b[0;34m(self, schema, state)\u001b[0m\n\u001b[1;32m 452\u001b[0m check_key \u001b[38;5;241m=\u001b[39m any_type[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m_check\u001b[39m\u001b[38;5;124m'\u001b[39m]\n\u001b[1;32m 454\u001b[0m check_function \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtype_registry\u001b[38;5;241m.\u001b[39mcheck_registry\u001b[38;5;241m.\u001b[39maccess(\n\u001b[1;32m 455\u001b[0m check_key)\n\u001b[0;32m--> 457\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mcheck_function\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 458\u001b[0m \u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 459\u001b[0m \u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 460\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:1586\u001b[0m, in \u001b[0;36mcheck_list\u001b[0;34m(schema, state, core)\u001b[0m\n\u001b[1;32m 1584\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(state, \u001b[38;5;28mlist\u001b[39m):\n\u001b[1;32m 1585\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m element \u001b[38;5;129;01min\u001b[39;00m state:\n\u001b[0;32m-> 1586\u001b[0m check \u001b[38;5;241m=\u001b[39m \u001b[43mcore\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcheck\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1587\u001b[0m \u001b[43m \u001b[49m\u001b[43melement_type\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1588\u001b[0m \u001b[43m \u001b[49m\u001b[43melement\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1590\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m check:\n\u001b[1;32m 1591\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;01mFalse\u001b[39;00m\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:464\u001b[0m, in \u001b[0;36mTypeSystem.check\u001b[0;34m(self, initial_schema, state)\u001b[0m\n\u001b[1;32m 463\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcheck\u001b[39m(\u001b[38;5;28mself\u001b[39m, initial_schema, state):\n\u001b[0;32m--> 464\u001b[0m schema \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mretrieve\u001b[49m\u001b[43m(\u001b[49m\u001b[43minitial_schema\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 465\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcheck_state(schema, state)\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:95\u001b[0m, in \u001b[0;36mTypeSystem.retrieve\u001b[0;34m(self, schema)\u001b[0m\n\u001b[1;32m 90\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mretrieve\u001b[39m(\u001b[38;5;28mself\u001b[39m, schema):\n\u001b[1;32m 91\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m'''\u001b[39;00m\n\u001b[1;32m 92\u001b[0m \u001b[38;5;124;03m like access(schema) but raises an exception if nothing is found\u001b[39;00m\n\u001b[1;32m 93\u001b[0m \u001b[38;5;124;03m '''\u001b[39;00m\n\u001b[0;32m---> 95\u001b[0m found \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43maccess\u001b[49m\u001b[43m(\u001b[49m\u001b[43mschema\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 96\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m found \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 97\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mschema not found for type: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mschema\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m'\u001b[39m)\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:85\u001b[0m, in \u001b[0;36mTypeSystem.access\u001b[0;34m(self, schema)\u001b[0m\n\u001b[1;32m 84\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21maccess\u001b[39m(\u001b[38;5;28mself\u001b[39m, schema):\n\u001b[0;32m---> 85\u001b[0m found \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtype_registry\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43maccess\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 86\u001b[0m \u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 87\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m found\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/registry.py:998\u001b[0m, in \u001b[0;36mTypeRegistry.access\u001b[0;34m(self, schema)\u001b[0m\n\u001b[1;32m 992\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m'''\u001b[39;00m\n\u001b[1;32m 993\u001b[0m \u001b[38;5;124;03mexpand the schema to its full type information from the type registry\u001b[39;00m\n\u001b[1;32m 994\u001b[0m \u001b[38;5;124;03m'''\u001b[39;00m\n\u001b[1;32m 996\u001b[0m found \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[0;32m--> 998\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28;43misinstance\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mdict\u001b[39;49m\u001b[43m)\u001b[49m:\n\u001b[1;32m 999\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m_description\u001b[39m\u001b[38;5;124m'\u001b[39m \u001b[38;5;129;01min\u001b[39;00m schema:\n\u001b[1;32m 1000\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m schema\n", + "\u001b[0;31mRecursionError\u001b[0m: maximum recursion depth exceeded while calling a Python object" ] - }, - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "bigraph\n", - "\n", - "\n", - "\n", - "('cell',)\n", - "\n", - "cell\n", - "\n", - "\n", - "\n", - "('cell', 'membrane')\n", - "\n", - "membrane\n", - "\n", - "\n", - "\n", - "('cell',)->('cell', 'membrane')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm')\n", - "\n", - "cytoplasm\n", - "\n", - "\n", - "\n", - "('cell',)->('cell', 'cytoplasm')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'nucleoid')\n", - "\n", - "nucleoid\n", - "\n", - "\n", - "\n", - "('cell',)->('cell', 'nucleoid')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'membrane', 'transporters')\n", - "\n", - "transporters\n", - "\n", - "\n", - "\n", - "('cell', 'membrane')->('cell', 'membrane', 'transporters')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'membrane', 'lipids')\n", - "\n", - "lipids\n", - "\n", - "\n", - "\n", - "('cell', 'membrane')->('cell', 'membrane', 'lipids')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'membrane', 'transmembrane transport')\n", - "\n", - "transmembrane transport\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'membrane', 'transporters')->('cell', 'membrane', 'transmembrane transport')\n", - "\n", - "\n", - "transporters\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'metabolites')\n", - "\n", - "metabolites\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm')->('cell', 'cytoplasm', 'metabolites')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'ribosomal complexes')\n", - "\n", - "ribosomal complexes\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm')->('cell', 'cytoplasm', 'ribosomal complexes')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'transcript regulation complex')\n", - "\n", - "transcript regulation complex\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm')->('cell', 'cytoplasm', 'transcript regulation complex')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'translation')\n", - "\n", - "translation\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'metabolites')->('cell', 'membrane', 'transmembrane transport')\n", - "\n", - "\n", - "internal\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'ribosomal complexes')->('cell', 'cytoplasm', 'translation')\n", - "\n", - "\n", - "p1\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'transcript regulation complex', 'transcripts')\n", - "\n", - "transcripts\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'transcript regulation complex')->('cell', 'cytoplasm', 'transcript regulation complex', 'transcripts')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'transcript regulation complex', 'transcripts')->('cell', 'cytoplasm', 'translation')\n", - "\n", - "\n", - "p2\n", - "\n", - "\n", - "\n", - "('cell', 'nucleoid', 'chromosome')\n", - "\n", - "chromosome\n", - "\n", - "\n", - "\n", - "('cell', 'nucleoid')->('cell', 'nucleoid', 'chromosome')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'nucleoid', 'chromosome', 'genes')\n", - "\n", - "genes\n", - "\n", - "\n", - "\n", - "('cell', 'nucleoid', 'chromosome')->('cell', 'nucleoid', 'chromosome', 'genes')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'membrane', 'transmembrane transport', 'external')->('cell', 'membrane', 'transmembrane transport')\n", - "\n", - "\n", - "external\n", - "\n", - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 19, - "metadata": {}, - "output_type": "execute_result" } ], "source": [ @@ -3390,10 +3406,10 @@ " '_process': 'transport URI',\n", " '_config': {'parameter': 1}\n", " },\n", - " 'wires': {\n", + " 'outputs': {\n", " 'transporters': 'transporters',\n", " 'internal': ['..', 'cytoplasm', 'metabolites']},\n", - " '_ports': {\n", + " '_outputs': {\n", " 'transporters': 'concentrations',\n", " 'internal': 'concentrations',\n", " 'external': 'concentrations'\n", @@ -3417,8 +3433,9 @@ " }\n", " },\n", " 'translation': {\n", - " 'wires': {\n", - " 'p1': 'ribosomal complexes',\n", + " '_type': 'process',\n", + " 'outputs': {\n", + " 'p1': ['ribosomal complexes'],\n", " 'p2': ['transcript regulation complex', 'transcripts']}}},\n", " 'nucleoid': {\n", " 'chromosome': {\n", @@ -3427,7 +3444,10 @@ " }\n", " }\n", "}\n", - "plot_bigraph(cell_struct_func, remove_process_place_edges=True, out_dir='out', filename='cell')" + "core = TypeSystem()\n", + "core.register('concentrations', 'float')\n", + "cell_struct_func2 = replace_regex_recursive(cell_struct_func)\n", + "plot_bigraph(cell_struct_func2, core=core, remove_process_place_edges=True, out_dir='out', filename='cell')" ] }, { @@ -3442,20 +3462,12 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "16960d1b-6e35-421e-bb7d-3efe5052e4fc", "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Writing out/ecoli\n" - ] - } - ], + "outputs": [], "source": [ "ecoli = { \n", " 'chromosome-structure': { \n", diff --git a/notebooks/basics2.ipynb b/notebooks/basics2.ipynb deleted file mode 100644 index b060bfa..0000000 --- a/notebooks/basics2.ipynb +++ /dev/null @@ -1,2855 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "5338cfab-cf15-4c63-a091-c1cbb51bf8dd", - "metadata": {}, - "source": [ - "# Process Bigraph Schema\n", - "This tutorial covers Process Bigraph Schema, starting with single `store` and increasing in detail as you scroll towards the bottom. It uses the libraries [bigraph-schema](https://github.com/vivarium-collective/bigraph-schema) for the schema validation and type registry and [bigraph-viz](https://github.com/vivarium-collective/bigraph-viz) for visualization.\n", - "\n", - "## Bigraph-schema and Bigraph-viz\n", - "\n", - "[Bigraph-schema](https://github.com/vivarium-collective/bigraph-schema) is a serializable type schema for Process Bigraph simulations. From this library, we will use the `validate_schema` method to check our schemas, and `fill` to fill in missing details to prepare the schema for simulation. We will also use the `type_registry` to access different schemas, and register new ones.\n", - "\n", - "[Bigraph-viz](https://github.com/vivarium-collective/bigraph-viz) is an easy-to-use plotting tool for compositional bigraph schema, built on top of Graphviz. It reads raw Compositional Bigraph Schemas and generates a figure that can be displayed in a notebook or saved to file. Bigraph-viz's main plotting function is `plot_bigraph` for the bigraph structure. `plot_flow` and `plot_multitimestep` make plots of process orchestration." - ] - }, - { - "cell_type": "markdown", - "id": "df69e36f-3da8-4bfb-8bc0-0aeb04a6f7d7", - "metadata": {}, - "source": [ - "### Installation" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "id": "63fb7d1a-cd49-4aac-8d4f-31bb54496a51", - "metadata": { - "tags": [] - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "-e git+https://github.com/vivarium-collective/bigraph-schema.git@0c90a88ffe83c4b88d057e28a4f30fb19ef0263e#egg=bigraph_schema\n", - "bigraph-viz==0.0.31\n", - "-e git+https://github.com/vivarium-collective/process-bigraph.git@6517fc88103bc3cfaad4d5a1fdbd9131015360d4#egg=process_bigraph\n" - ] - } - ], - "source": [ - "# !pip install bigraph-schema\n", - "# !pip install bigraph-viz\n", - "!pip freeze | grep bigraph" - ] - }, - { - "cell_type": "markdown", - "id": "f700afa2-bfee-49bf-a4b1-e23f0540461d", - "metadata": {}, - "source": [ - "### Imports" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "id": "2ab3cb32-e007-45c4-807e-b1b442ac1608", - "metadata": { - "tags": [] - }, - "outputs": [], - "source": [ - "# from bigraph_viz import plot_bigraph, plot_flow, plot_multitimestep, pf\n", - "from bigraph_viz.dict_utils import replace_regex_recursive\n", - "from bigraph_viz.diagram import plot_bigraph\n", - "\n", - "plot_settings = {\n", - " # 'remove_process_place_edges': True\n", - "}\n", - "save_images = False\n", - "if save_images:\n", - " plot_settings.update({'out_dir': 'out','dpi': '250'})" - ] - }, - { - "cell_type": "markdown", - "id": "0e716c23-5fbe-4c08-a868-09611ca40ec4", - "metadata": { - "tags": [] - }, - "source": [ - "## Stores" - ] - }, - { - "cell_type": "markdown", - "id": "9a6e9cc2-e0df-4f73-b4c3-eddb1055b088", - "metadata": {}, - "source": [ - "### Simple stores\n", - "A store can be declared in a JSON dictionary with the store's name mapped to its `value`. " - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "id": "d711b952-089a-4938-817d-d1ccad9de56e", - "metadata": { - "tags": [] - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Writing out/simple_store\n" - ] - }, - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "bigraph\n", - "\n", - "\n", - "\n", - "('store1',)\n", - "\n", - "store1: 1.0\n", - "\n", - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "simple_store_state = {\n", - " 'store1': 1.0,\n", - "}\n", - "plot_bigraph(simple_store_state, **plot_settings, show_values=True, filename='simple_store')" - ] - }, - { - "cell_type": "markdown", - "id": "db1cead7-e691-4291-920e-827d69c00727", - "metadata": {}, - "source": [ - "To include values *and* types in a node label, you can instead have the store name map to a dict with `_value` and `_type` keys." - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "id": "f3e5fa71-7ffc-4a8f-a1a0-dc547c886f84", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Writing out/store\n" - ] - }, - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "bigraph\n", - "\n", - "\n", - "\n", - "('store1',)\n", - "\n", - "store1\n", - "[float]\n", - "\n", - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 7, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "typed_store_spec = {\n", - " 'store1': {\n", - " '_value': 1.0, \n", - " '_type': 'float',\n", - " },\n", - "}\n", - "plot_bigraph(typed_store_spec, **plot_settings, show_values=True, show_types=True, filename='store')" - ] - }, - { - "cell_type": "markdown", - "id": "de1011cb-903b-4c15-baed-a62f4afdd6b9", - "metadata": {}, - "source": [ - "### Hierarchy\n", - "A hierarchy is a place graph of nested stores. Stores can be placed within stores using JSON dictionary nesting." - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "id": "0f3f0824-f89d-4c6e-830e-2c5a321f7b33", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Writing out/hierarchy\n" - ] - }, - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "bigraph\n", - "\n", - "\n", - "\n", - "('store1',)\n", - "\n", - "store1\n", - "\n", - "\n", - "\n", - "('store1', 'store1.1')\n", - "\n", - "store1.1\n", - "\n", - "\n", - "\n", - "('store1',)->('store1', 'store1.1')\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'store1.2')\n", - "\n", - "store1.2\n", - "\n", - "\n", - "\n", - "('store1',)->('store1', 'store1.2')\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'store1.1', 'store1.1.1')\n", - "\n", - "store1.1.1\n", - "\n", - "\n", - "\n", - "('store1', 'store1.1')->('store1', 'store1.1', 'store1.1.1')\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'store1.1', 'store1.1.2')\n", - "\n", - "store1.1.2\n", - "\n", - "\n", - "\n", - "('store1', 'store1.1')->('store1', 'store1.1', 'store1.1.2')\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'store1.1', 'store1.1.3')\n", - "\n", - "store1.1.3\n", - "\n", - "\n", - "\n", - "('store1', 'store1.1')->('store1', 'store1.1', 'store1.1.3')\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'store1.1', 'store1.1.3', 'store1.1.3.1')\n", - "\n", - "store1.1.3.1\n", - "\n", - "\n", - "\n", - "('store1', 'store1.1', 'store1.1.3')->('store1', 'store1.1', 'store1.1.3', 'store1.1.3.1')\n", - "\n", - "\n", - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "hierarchy_spec = {\n", - " 'store1': {\n", - " 'store1.1': {\n", - " 'store1.1.1': 'Any',\n", - " 'store1.1.2': 'Any',\n", - " 'store1.1.3': {\n", - " 'store1.1.3.1': 'Any',\n", - " },\n", - " },\n", - " 'store1.2': 'Any',\n", - " },\n", - "}\n", - "plot_bigraph(hierarchy_spec, **plot_settings, filename='hierarchy')" - ] - }, - { - "cell_type": "markdown", - "id": "c825e07c-8cd5-4df1-8958-aa0f36d61045", - "metadata": {}, - "source": [ - "## Processes" - ] - }, - { - "cell_type": "markdown", - "id": "47ea1a83-aeac-4048-9593-7b30588b0ad8", - "metadata": {}, - "source": [ - "### Single process\n", - "Processes require ports, which are declared with the `_ports` key mapped to a dict that has port names matched to types." - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "id": "7c74237b-0d66-4e8f-a8ca-79174fadad8b", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Writing out/process\n" - ] - }, - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "bigraph\n", - "\n", - "\n", - "\n", - "('process1',)\n", - "\n", - "process1\n", - "\n", - "\n", - "\n", - "\n", - "('process1', 'p', 'o', 'r', 't', '1')->('process1',)\n", - "\n", - "\n", - "port1\n", - "\n", - "\n", - "\n", - "\n", - "('process1', 'p', 'o', 'r', 't', '2')->('process1',)\n", - "\n", - "\n", - "port2\n", - "\n", - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 14, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "process_spec = {\n", - " 'process1': {\n", - " '_type': 'edge',\n", - " '_inputs': {\n", - " 'port1': 'Any',\n", - " 'port2': 'Any',\n", - " },\n", - " },\n", - "}\n", - "plot_bigraph(process_spec, **plot_settings, rankdir='RL', filename='process')" - ] - }, - { - "cell_type": "markdown", - "id": "68a2c480-32fe-43d3-b618-8fc6c647b8ca", - "metadata": {}, - "source": [ - "### Multiple processes" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "id": "8c2457a3-fc47-4850-8b9e-9ee98e81567d", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Writing out/multiple_processes\n" - ] - }, - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "bigraph\n", - "\n", - "\n", - "\n", - "('process1',)\n", - "\n", - "process1\n", - "\n", - "\n", - "\n", - "('process2',)\n", - "\n", - "process2\n", - "\n", - "\n", - "\n", - "('process3',)\n", - "\n", - "process3\n", - "\n", - "\n", - "\n", - "\n", - "('process1', 'p', 'o', 'r', 't', '1')->('process1',)\n", - "\n", - "\n", - "port1\n", - "\n", - "\n", - "\n", - "\n", - "('process1', 'p', 'o', 'r', 't', '2')->('process1',)\n", - "\n", - "\n", - "port2\n", - "\n", - "\n", - "\n", - "\n", - "('process2', 'p', 'o', 'r', 't', '1')->('process2',)\n", - "\n", - "\n", - "port1\n", - "\n", - "\n", - "\n", - "\n", - "('process2', 'p', 'o', 'r', 't', '2')->('process2',)\n", - "\n", - "\n", - "port2\n", - "\n", - "\n", - "\n", - "\n", - "('process3', 'p', 'o', 'r', 't', '1')->('process3',)\n", - "\n", - "\n", - "port1\n", - "\n", - "\n", - "\n", - "\n", - "('process3', 'p', 'o', 'r', 't', '2')->('process3',)\n", - "\n", - "\n", - "port2\n", - "\n", - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 15, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "process_schema = {\n", - " '_type': 'process',\n", - " '_inputs': {\n", - " 'port1': 'Any',\n", - " 'port2': 'Any'\n", - " }\n", - "}\n", - "\n", - "processes_spec = {\n", - " 'process1': process_schema,\n", - " 'process2': process_schema,\n", - " 'process3': process_schema,\n", - "}\n", - "plot_bigraph(processes_spec, **plot_settings, rankdir='BT', filename='multiple_processes')" - ] - }, - { - "cell_type": "markdown", - "id": "15e5f5a6-8dd4-41c3-ba37-33ed9e3e0830", - "metadata": {}, - "source": [ - "## Wires\n", - "To connect a process's ports to stores, add wiring with a `_wires` key that maps port names to relative paths in the store hierarchy. The ports used by the wires need to match the ports in the schema." - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "id": "a6ecad5d-8948-4636-910c-79284a3e8679", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Writing out/wires\n" - ] - }, - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "bigraph\n", - "\n", - "\n", - "\n", - "('node1',)\n", - "\n", - "node1\n", - "\n", - "\n", - "\n", - "('process1',)\n", - "\n", - "process1\n", - "\n", - "\n", - "\n", - "('node1',)->('process1',)\n", - "\n", - "\n", - "port1\n", - "\n", - "\n", - "\n", - "('node2',)\n", - "\n", - "node2\n", - "\n", - "\n", - "\n", - "('node2',)->('process1',)\n", - "\n", - "\n", - "port2\n", - "\n", - "\n", - "\n", - "('node3',)\n", - "\n", - "node3\n", - "\n", - "\n", - "\n", - "('node3',)->('process1',)\n", - "\n", - "\n", - "port3\n", - "\n", - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 19, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "connected_process_spec = {\n", - " 'process1': {\n", - " '_type': 'edge',\n", - " '_inputs': {\n", - " 'port1': 'float',\n", - " 'port2': 'int',\n", - " 'port3': 'int',\n", - " },\n", - " 'inputs': {\n", - " 'port1': ['node1'],\n", - " 'port2': ['node2'],\n", - " 'port3': ['node3'],\n", - " }\n", - " },\n", - " 'node1': 'float', # TODO -- shouldn't these fill?\n", - " 'node2': 'int',\n", - " 'node3': 'int',\n", - "}\n", - "plot_bigraph(connected_process_spec, **plot_settings, filename='wires')" - ] - }, - { - "cell_type": "markdown", - "id": "e037285d-116a-404d-96ec-ba47318a2e8b", - "metadata": {}, - "source": [ - "### Advanced wiring\n", - "**TODO**" - ] - }, - { - "cell_type": "markdown", - "id": "01b17201-2489-45c8-a06b-9fdc29a714a7", - "metadata": {}, - "source": [ - "## Composites" - ] - }, - { - "cell_type": "markdown", - "id": "daf5d428-db23-4985-80ff-6b93d22973aa", - "metadata": {}, - "source": [ - "### Flat composite\n", - "A flat composite connects stores with multiple connected processes, without nesting." - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "id": "781a84e6-bbe2-4708-b441-47efc611b46f", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Writing out/flat_composite\n" - ] - }, - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "bigraph\n", - "\n", - "\n", - "\n", - "('store1.1',)\n", - "\n", - "store1.1\n", - "\n", - "\n", - "\n", - "('process1',)\n", - "\n", - "process1\n", - "\n", - "\n", - "\n", - "('store1.1',)->('process1',)\n", - "\n", - "\n", - "port1\n", - "\n", - "\n", - "\n", - "('process2',)\n", - "\n", - "process2\n", - "\n", - "\n", - "\n", - "('store1.1',)->('process2',)\n", - "\n", - "\n", - "port1\n", - "\n", - "\n", - "\n", - "('store1.2',)\n", - "\n", - "store1.2\n", - "\n", - "\n", - "\n", - "('store1.2',)->('process1',)\n", - "\n", - "\n", - "port2\n", - "\n", - "\n", - "\n", - "('store1.2',)->('process2',)\n", - "\n", - "\n", - "port2\n", - "\n", - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 22, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "flat_composite_spec = {\n", - " 'store1.1': 'float',\n", - " 'store1.2': 'int',\n", - " 'process1': {\n", - " '_type': 'process',\n", - " 'outputs': {\n", - " 'port1': ['store1.1'],\n", - " 'port2': ['store1.2'],\n", - " }\n", - " },\n", - " 'process2': {\n", - " '_type': 'process',\n", - " 'inputs': {\n", - " 'port1': ['store1.1'],\n", - " 'port2': ['store1.2'],\n", - " }\n", - " },\n", - "}\n", - "plot_bigraph(flat_composite_spec, **plot_settings, rankdir='RL', filename='flat_composite')" - ] - }, - { - "cell_type": "markdown", - "id": "398509c7-cf5c-4cce-a179-3a39752b0dde", - "metadata": {}, - "source": [ - "### Nested composite\n", - "A nested composite has store hierarchies with multiple connected processes." - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "id": "701e759d-7f9b-41bb-911c-a8208c892462", - "metadata": {}, - "outputs": [ - { - "ename": "TypeError", - "evalue": "argument of type 'NoneType' is not iterable", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[0;32mIn[24], line 27\u001b[0m\n\u001b[1;32m 1\u001b[0m nested_composite_spec \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 2\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mstore1\u001b[39m\u001b[38;5;124m'\u001b[39m: {\n\u001b[1;32m 3\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mstore1.1\u001b[39m\u001b[38;5;124m'\u001b[39m: \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mfloat\u001b[39m\u001b[38;5;124m'\u001b[39m,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 25\u001b[0m }\n\u001b[1;32m 26\u001b[0m }\n\u001b[0;32m---> 27\u001b[0m \u001b[43mplot_bigraph\u001b[49m\u001b[43m(\u001b[49m\u001b[43mnested_composite_spec\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mplot_settings\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfilename\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mnested_composite\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/code/bigraph-viz/venv/lib/python3.9/site-packages/bigraph_viz/diagram.py:336\u001b[0m, in \u001b[0;36mplot_bigraph\u001b[0;34m(state, schema, core, out_dir, filename, file_format, size, node_label_size, show_values, show_types, port_labels, port_label_size, rankdir, print_source, dpi, label_margin, remove_nodes)\u001b[0m\n\u001b[1;32m 333\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m core\u001b[38;5;241m.\u001b[39mexists(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mprocess\u001b[39m\u001b[38;5;124m'\u001b[39m):\n\u001b[1;32m 334\u001b[0m core\u001b[38;5;241m.\u001b[39mregister(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mprocess\u001b[39m\u001b[38;5;124m'\u001b[39m, process_type)\n\u001b[0;32m--> 336\u001b[0m schema, state \u001b[38;5;241m=\u001b[39m \u001b[43mcore\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcomplete\u001b[49m\u001b[43m(\u001b[49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 338\u001b[0m \u001b[38;5;66;03m# parse out the network\u001b[39;00m\n\u001b[1;32m 339\u001b[0m graph_dict \u001b[38;5;241m=\u001b[39m get_graph_dict(\n\u001b[1;32m 340\u001b[0m schema\u001b[38;5;241m=\u001b[39mschema,\n\u001b[1;32m 341\u001b[0m state\u001b[38;5;241m=\u001b[39mstate,\n\u001b[1;32m 342\u001b[0m core\u001b[38;5;241m=\u001b[39mcore,\n\u001b[1;32m 343\u001b[0m remove_nodes\u001b[38;5;241m=\u001b[39mremove_nodes,\n\u001b[1;32m 344\u001b[0m )\n", - "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:1251\u001b[0m, in \u001b[0;36mTypeSystem.complete\u001b[0;34m(self, initial_schema, initial_state)\u001b[0m\n\u001b[1;32m 1245\u001b[0m state \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhydrate(\n\u001b[1;32m 1246\u001b[0m full_schema,\n\u001b[1;32m 1247\u001b[0m initial_state)\n\u001b[1;32m 1249\u001b[0m \u001b[38;5;66;03m# fill in the parts of the composition schema\u001b[39;00m\n\u001b[1;32m 1250\u001b[0m \u001b[38;5;66;03m# determined by the state\u001b[39;00m\n\u001b[0;32m-> 1251\u001b[0m schema, state \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minfer_schema\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1252\u001b[0m \u001b[43m \u001b[49m\u001b[43mfull_schema\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1253\u001b[0m \u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1255\u001b[0m final_state \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfill(schema, state)\n\u001b[1;32m 1257\u001b[0m \u001b[38;5;66;03m# TODO: add flag to types.access(copy=True)\u001b[39;00m\n", - "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:1177\u001b[0m, in \u001b[0;36mTypeSystem.infer_schema\u001b[0;34m(self, schema, state, top_state, path)\u001b[0m\n\u001b[1;32m 1174\u001b[0m inner_path \u001b[38;5;241m=\u001b[39m path \u001b[38;5;241m+\u001b[39m (key,)\n\u001b[1;32m 1175\u001b[0m \u001b[38;5;66;03m# if get_path(schema, inner_path) is None or get_path(state, inner_path) is None:\u001b[39;00m\n\u001b[0;32m-> 1177\u001b[0m schema, top_state \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minfer_schema\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1178\u001b[0m \u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1179\u001b[0m \u001b[43m \u001b[49m\u001b[43mvalue\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1180\u001b[0m \u001b[43m \u001b[49m\u001b[43mtop_state\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtop_state\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1181\u001b[0m \u001b[43m \u001b[49m\u001b[43mpath\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43minner_path\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1183\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(state, \u001b[38;5;28mstr\u001b[39m):\n\u001b[1;32m 1184\u001b[0m \u001b[38;5;28;01mpass\u001b[39;00m\n", - "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:1177\u001b[0m, in \u001b[0;36mTypeSystem.infer_schema\u001b[0;34m(self, schema, state, top_state, path)\u001b[0m\n\u001b[1;32m 1174\u001b[0m inner_path \u001b[38;5;241m=\u001b[39m path \u001b[38;5;241m+\u001b[39m (key,)\n\u001b[1;32m 1175\u001b[0m \u001b[38;5;66;03m# if get_path(schema, inner_path) is None or get_path(state, inner_path) is None:\u001b[39;00m\n\u001b[0;32m-> 1177\u001b[0m schema, top_state \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minfer_schema\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1178\u001b[0m \u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1179\u001b[0m \u001b[43m \u001b[49m\u001b[43mvalue\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1180\u001b[0m \u001b[43m \u001b[49m\u001b[43mtop_state\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtop_state\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1181\u001b[0m \u001b[43m \u001b[49m\u001b[43mpath\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43minner_path\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1183\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(state, \u001b[38;5;28mstr\u001b[39m):\n\u001b[1;32m 1184\u001b[0m \u001b[38;5;28;01mpass\u001b[39;00m\n", - "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:1135\u001b[0m, in \u001b[0;36mTypeSystem.infer_schema\u001b[0;34m(self, schema, state, top_state, path)\u001b[0m\n\u001b[1;32m 1128\u001b[0m state_type \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 1129\u001b[0m key: value\n\u001b[1;32m 1130\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m key, value \u001b[38;5;129;01min\u001b[39;00m state\u001b[38;5;241m.\u001b[39mitems()\n\u001b[1;32m 1131\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m key\u001b[38;5;241m.\u001b[39mstartswith(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m_\u001b[39m\u001b[38;5;124m'\u001b[39m)}\n\u001b[1;32m 1132\u001b[0m state_schema \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39maccess(\n\u001b[1;32m 1133\u001b[0m state_type)\n\u001b[0;32m-> 1135\u001b[0m hydrated_state \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdeserialize\u001b[49m\u001b[43m(\u001b[49m\u001b[43mstate_schema\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1136\u001b[0m top_state \u001b[38;5;241m=\u001b[39m set_path(\n\u001b[1;32m 1137\u001b[0m top_state,\n\u001b[1;32m 1138\u001b[0m path,\n\u001b[1;32m 1139\u001b[0m hydrated_state)\n\u001b[1;32m 1141\u001b[0m update \u001b[38;5;241m=\u001b[39m state_type\n", - "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:614\u001b[0m, in \u001b[0;36mTypeSystem.deserialize\u001b[0;34m(self, schema, encoded)\u001b[0m\n\u001b[1;32m 612\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m key, branch \u001b[38;5;129;01min\u001b[39;00m encoded\u001b[38;5;241m.\u001b[39mitems():\n\u001b[1;32m 613\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m key \u001b[38;5;129;01min\u001b[39;00m schema:\n\u001b[0;32m--> 614\u001b[0m result[key] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdeserialize\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 615\u001b[0m \u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[43m[\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 616\u001b[0m \u001b[43m \u001b[49m\u001b[43mbranch\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 617\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m result\n\u001b[1;32m 619\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n", - "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:590\u001b[0m, in \u001b[0;36mTypeSystem.deserialize\u001b[0;34m(self, schema, encoded)\u001b[0m\n\u001b[1;32m 587\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mdeserialize\u001b[39m(\u001b[38;5;28mself\u001b[39m, schema, encoded):\n\u001b[1;32m 588\u001b[0m found \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39maccess(schema)\n\u001b[0;32m--> 590\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43m_deserialize\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01min\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mfound\u001b[49m:\n\u001b[1;32m 591\u001b[0m deserialize \u001b[38;5;241m=\u001b[39m found[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m_deserialize\u001b[39m\u001b[38;5;124m'\u001b[39m]\n\u001b[1;32m 592\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(deserialize, \u001b[38;5;28mstr\u001b[39m):\n", - "\u001b[0;31mTypeError\u001b[0m: argument of type 'NoneType' is not iterable" - ] - } - ], - "source": [ - "nested_composite_spec = {\n", - " 'store1': {\n", - " 'store1.1': 'float',\n", - " 'store1.2': 'int',\n", - " 'process1': {\n", - " '_type': 'process',\n", - " 'inputs': {\n", - " 'port1': ['store1.1'],\n", - " 'port2': ['store1.2'],\n", - " }\n", - " },\n", - " 'process2': {\n", - " '_type': 'proces',\n", - " 'outputs': {\n", - " 'port1': ['store1.1'],\n", - " 'port2': ['store1.2'],\n", - " }\n", - " },\n", - " },\n", - " 'process3': {\n", - " '_type': 'process',\n", - " 'inputs': {\n", - " 'port1': ['store1'],\n", - " }\n", - " }\n", - "}\n", - "plot_bigraph(nested_composite_spec, **plot_settings, filename='nested_composite')" - ] - }, - { - "cell_type": "markdown", - "id": "0c8c1704-2331-44eb-bd05-72e36ccb6858", - "metadata": {}, - "source": [ - "### Composite process\n", - "Composite processes are processes with internal stores and internal processes, which can run as their own simulation. The composite process has schema, allowing it to connect to a super-simulation. This allows for improved distributed computation, with composite processes able to run on their own computer and syncronize to the super-simulation via message passing." - ] - }, - { - "cell_type": "code", - "execution_count": 11, - "id": "638c5dc7-4cfd-46e4-b66a-8c42ca98ff1d", - "metadata": {}, - "outputs": [ - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "bigraph\n", - "\n", - "\n", - "\n", - "('composite_process', 'store1.1')\n", - "\n", - "store1.1\n", - "\n", - "\n", - "\n", - "('composite_process', 'process1')\n", - "\n", - "process1\n", - "\n", - "\n", - "\n", - "('composite_process', 'store1.1')->('composite_process', 'process1')\n", - "\n", - "\n", - "port1\n", - "\n", - "\n", - "\n", - "('composite_process', 'process2')\n", - "\n", - "process2\n", - "\n", - "\n", - "\n", - "('composite_process', 'store1.1')->('composite_process', 'process2')\n", - "\n", - "\n", - "port1\n", - "\n", - "\n", - "\n", - "('composite_process', 'store1.2')\n", - "\n", - "store1.2\n", - "\n", - "\n", - "\n", - "('composite_process', 'store1.2')->('composite_process', 'process1')\n", - "\n", - "\n", - "port2\n", - "\n", - "\n", - "\n", - "('composite_process', 'store1.2')->('composite_process', 'process2')\n", - "\n", - "\n", - "port2\n", - "\n", - "\n", - "\n", - "('composite_process',)\n", - "\n", - "\n", - "composite_process\n", - "\n", - "\n", - "\n", - "('composite_process',)->('composite_process', 'store1.1')\n", - "\n", - "\n", - "\n", - "\n", - "('composite_process',)->('composite_process', 'store1.1')\n", - "\n", - "\n", - "tunnel port1\n", - "\n", - "\n", - "\n", - "('composite_process',)->('composite_process', 'store1.2')\n", - "\n", - "\n", - "\n", - "\n", - "('composite_process',)->('composite_process', 'store1.2')\n", - "\n", - "\n", - "tunnel port2\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('composite_process', 'port1')->('composite_process',)\n", - "\n", - "\n", - "port1\n", - "\n", - "\n", - "\n", - "\n", - "('composite_process', 'port2')->('composite_process',)\n", - "\n", - "\n", - "port2\n", - "\n", - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 11, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "composite_process_spec = {\n", - " 'composite_process': {\n", - " 'store1.1': 'Any',\n", - " 'store1.2': 'Any',\n", - " 'process1': {\n", - " '_type': 'python_process:temporal',\n", - " 'wires': {\n", - " 'port1': 'store1.1',\n", - " 'port2': 'store1.2',\n", - " }\n", - " },\n", - " 'process2': {\n", - " '_type': 'python_process:temporal',\n", - " 'wires': {\n", - " 'port1': 'store1.1',\n", - " 'port2': 'store1.2',\n", - " }\n", - " },\n", - " '_ports': {\n", - " 'port1': 'Any', \n", - " 'port2': 'Any', \n", - " },\n", - " '_tunnels': {\n", - " 'port1': 'store1.1',\n", - " 'port2': 'store1.2',\n", - " }\n", - " }\n", - "}\n", - "plot_bigraph(composite_process_spec, **plot_settings, filename='composite_process')" - ] - }, - { - "cell_type": "markdown", - "id": "847cef26-65a1-4da6-9dd3-eb5839277970", - "metadata": {}, - "source": [ - "## Orchestration" - ] - }, - { - "cell_type": "code", - "execution_count": 12, - "id": "e76c97a8-3037-464a-929e-ba4414c73c34", - "metadata": {}, - "outputs": [], - "source": [ - "plot_settings2={}\n", - "if save_images:\n", - " plot_settings2.update({\n", - " 'out_dir': 'out',\n", - " 'dpi': '250'\n", - " })" - ] - }, - { - "cell_type": "markdown", - "id": "48975890-06a4-462a-9b1d-6bddd51779fe", - "metadata": {}, - "source": [ - "### Multi-timestepping\n", - "\n", - "Temporal processes can be run by multi-timestepping, with each process updating the state according to its `sync_state` state, which it can update adaptively." - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "id": "f0eff7b0-f0e2-4d56-8b16-ef0fc1ce5aba", - "metadata": {}, - "outputs": [ - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "flow\n", - "\n", - "\n", - "\n", - "('temporal<br/>process2',)\n", - "\n", - "temporal\n", - "process2\n", - "\n", - "\n", - "\n", - "('temporal<br/>process2',) 1.0\n", - "\n", - "1.0\n", - "\n", - "\n", - "\n", - "('temporal<br/>process2',)->('temporal<br/>process2',) 1.0\n", - "\n", - "\n", - "\n", - "\n", - "('temporal<br/>process2',) 2.0\n", - "\n", - "2.0\n", - "\n", - "\n", - "\n", - "('temporal<br/>process2',) 1.0->('temporal<br/>process2',) 2.0\n", - "\n", - "\n", - "\n", - "\n", - "('state',)\n", - "\n", - "state\n", - "\n", - "\n", - "\n", - "('temporal<br/>process2',) 1.0->('state',)\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('temporal<br/>process2',) end\n", - "\n", - "\n", - "\n", - "\n", - "('temporal<br/>process2',) 2.0->('temporal<br/>process2',) end\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('temporal<br/>process2',) 2.0->('state',)\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('temporal<br/>process1',)\n", - "\n", - "temporal\n", - "process1\n", - "\n", - "\n", - "\n", - "('temporal<br/>process1',) 0.5\n", - "\n", - "0.5\n", - "\n", - "\n", - "\n", - "('temporal<br/>process1',)->('temporal<br/>process1',) 0.5\n", - "\n", - "\n", - "\n", - "\n", - "('temporal<br/>process1',) 1.0\n", - "\n", - "1.0\n", - "\n", - "\n", - "\n", - "('temporal<br/>process1',) 0.5->('temporal<br/>process1',) 1.0\n", - "\n", - "\n", - "\n", - "\n", - "('temporal<br/>process1',) 0.5->('state',)\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('temporal<br/>process1',) 1.5\n", - "\n", - "1.5\n", - "\n", - "\n", - "\n", - "('temporal<br/>process1',) 1.0->('temporal<br/>process1',) 1.5\n", - "\n", - "\n", - "\n", - "\n", - "('temporal<br/>process1',) 1.0->('state',)\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('temporal<br/>process1',) 2.0\n", - "\n", - "2.0\n", - "\n", - "\n", - "\n", - "('temporal<br/>process1',) 1.5->('temporal<br/>process1',) 2.0\n", - "\n", - "\n", - "\n", - "\n", - "('temporal<br/>process1',) 1.5->('state',)\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('temporal<br/>process1',) end\n", - "\n", - "\n", - "\n", - "\n", - "('temporal<br/>process1',) 2.0->('temporal<br/>process1',) end\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('temporal<br/>process1',) 2.0->('state',)\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 13, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "multitimestep_spec = {\n", - " 'temporal process2': {\n", - " '_ports': {'port1': 'Any'},\n", - " 'wires': {'port1': 'state'},\n", - " '_sync_step': 1.0,\n", - " },\n", - " 'temporal process1': {\n", - " '_ports': {'port1': 'Any'},\n", - " 'wires': {'port1': 'state'},\n", - " '_sync_step': 0.5,\n", - " },\n", - "}\n", - "multitimestep_spec = replace_regex_recursive(multitimestep_spec)\n", - "plot_multitimestep(multitimestep_spec, total_time=2.0, **plot_settings2, filename='multitimestep')" - ] - }, - { - "cell_type": "markdown", - "id": "a00cf677-ebac-4309-8ac9-a5b2855724af", - "metadata": {}, - "source": [ - "### Flows\n", - "\n", - "A directed acyclic graph (DAG) – a type of workflow that declares the dependencies between processes. A flow run is not temporal, and the order is entirely based on dependencies. It can triggered between time steps, running the steps in the order as determined by their dependencies." - ] - }, - { - "cell_type": "code", - "execution_count": 14, - "id": "db45c99b-b97b-47bc-a73e-c669882f3969", - "metadata": {}, - "outputs": [ - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "flow\n", - "\n", - "\n", - "\n", - "('step1',)\n", - "\n", - "step1\n", - "\n", - "\n", - "\n", - "('step2',)\n", - "\n", - "step2\n", - "\n", - "\n", - "\n", - "('step1',)->('step2',)\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('step4',)\n", - "\n", - "step4\n", - "\n", - "\n", - "\n", - "('step2',)->('step4',)\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('step3',)\n", - "\n", - "step3\n", - "\n", - "\n", - "\n", - "('step3',)->('step4',)\n", - "\n", - "\n", - "\n", - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 14, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "flow = {\n", - " 'step1': {\n", - " '_type': 'step_process',\n", - " '_ports': {},\n", - " '_depends_on': [], \n", - " },\n", - " 'step2': {\n", - " '_type': 'step_process',\n", - " '_ports': {},\n", - " '_depends_on': 'step1', \n", - " },\n", - " 'step3': {\n", - " '_type': 'step_process',\n", - " '_ports': {},\n", - " '_depends_on': [], \n", - " },\n", - " 'step4': {\n", - " '_type': 'step_process',\n", - " '_ports': {},\n", - " '_depends_on': ['step2', 'step3'], \n", - " },\n", - "}\n", - "\n", - "plot_flow(flow, **plot_settings2, filename='flow')" - ] - }, - { - "cell_type": "markdown", - "id": "5882581a-c5ef-40b5-acbd-efddad269807", - "metadata": {}, - "source": [ - "## Examples" - ] - }, - { - "cell_type": "markdown", - "id": "ff81178f-36e4-4200-982a-ed8155b87934", - "metadata": { - "tags": [] - }, - "source": [ - "### Multiscale map of a cell\n", - "\n", - "Bigraphs can represent the hierarchical nesting of cellular structures. Below is a multiscale map of a cell from [Qin et al. A multi-scale map of cell structure fusing protein images and interactions. Nature. 2021.](https://pubmed.ncbi.nlm.nih.gov/34819669/)" - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "id": "47bdf8e5-0bdd-4cac-b57e-2449c75fa178", - "metadata": { - "tags": [] - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Writing out/cell_hierarchy\n" - ] - }, - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "bigraph\n", - "\n", - "\n", - "\n", - "('cell',)\n", - "\n", - "cell\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm')\n", - "\n", - "cytoplasm\n", - "\n", - "\n", - "\n", - "('cell',)->('cell', 'cytoplasm')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus')\n", - "\n", - "nucleus\n", - "\n", - "\n", - "\n", - "('cell',)->('cell', 'nucleus')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'secretory<br/>organelles')\n", - "\n", - "secretory\n", - "organelles\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm')->('cell', 'cytoplasm', 'secretory<br/>organelles')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles')\n", - "\n", - "cytoplasmic\n", - "organelles\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'transcriptional<br/>regulation<br/>complex<br/>family')\n", - "\n", - "transcriptional\n", - "regulation\n", - "complex\n", - "family\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm')->('cell', 'cytoplasm', 'transcriptional<br/>regulation<br/>complex<br/>family')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'secretory<br/>organelles', 'transmembrane<br/>transport<br/>systems')\n", - "\n", - "transmembrane\n", - "transport\n", - "systems\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'secretory<br/>organelles')->('cell', 'cytoplasm', 'secretory<br/>organelles', 'transmembrane<br/>transport<br/>systems')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'secretory<br/>organelles', 'transmembrane<br/>transport<br/>systems', 'ion<br/>transmembrane<br/>transport<br/>systems')\n", - "\n", - "ion\n", - "transmembrane\n", - "transport\n", - "systems\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'secretory<br/>organelles', 'transmembrane<br/>transport<br/>systems')->('cell', 'cytoplasm', 'secretory<br/>organelles', 'transmembrane<br/>transport<br/>systems', 'ion<br/>transmembrane<br/>transport<br/>systems')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles')\n", - "\n", - "subgroup\n", - "of\n", - "cytoplasmic\n", - "organelles\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'metabolic<br/>organelles')\n", - "\n", - "metabolic\n", - "organelles\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'metabolic<br/>organelles')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family')\n", - "\n", - "ribonucleoprotein\n", - "complex\n", - "family\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'metabolic<br/>organelles', 'subgroup<br/>of<br/>metabolic<br/>organelles')\n", - "\n", - "subgroup\n", - "of\n", - "metabolic\n", - "organelles\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'metabolic<br/>organelles')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'metabolic<br/>organelles', 'subgroup<br/>of<br/>metabolic<br/>organelles')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'metabolic<br/>organelles', 'mitochondrion')\n", - "\n", - "mitochondrion\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'metabolic<br/>organelles')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'metabolic<br/>organelles', 'mitochondrion')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'RNA<br/>processing<br/>complex<br/>1')\n", - "\n", - "RNA\n", - "processing\n", - "complex\n", - "1\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'RNA<br/>processing<br/>complex<br/>1')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community')\n", - "\n", - "ribosome\n", - "biogenesis\n", - "community\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'RNA<br/>processing<br/>complex<br/>1', 'RNA<br/>splicing<br/>complex<br/>1')\n", - "\n", - "RNA\n", - "splicing\n", - "complex\n", - "1\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'RNA<br/>processing<br/>complex<br/>1')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'RNA<br/>processing<br/>complex<br/>1', 'RNA<br/>splicing<br/>complex<br/>1')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome')\n", - "\n", - "ribosome\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'nucleic<br/>acid<br/>binding<br/>complex')\n", - "\n", - "nucleic\n", - "acid\n", - "binding\n", - "complex\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'nucleic<br/>acid<br/>binding<br/>complex')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit')\n", - "\n", - "ribosomal\n", - "subunit\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'mitochondirial<br/>large<br/>ribosomal<br/>subunit')\n", - "\n", - "mitochondirial\n", - "large\n", - "ribosomal\n", - "subunit\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'mitochondirial<br/>large<br/>ribosomal<br/>subunit')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'mito-cyto<br/>ribosomal<br/>cluster')\n", - "\n", - "mito-cyto\n", - "ribosomal\n", - "cluster\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'mito-cyto<br/>ribosomal<br/>cluster')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'cotranslational<br/>protein<br/>targeting<br/>to<br/>membrane<br/>system')\n", - "\n", - "cotranslational\n", - "protein\n", - "targeting\n", - "to\n", - "membrane\n", - "system\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'cotranslational<br/>protein<br/>targeting<br/>to<br/>membrane<br/>system')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'ribosomal<br/>complex<br/>5')\n", - "\n", - "ribosomal\n", - "complex\n", - "5\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'ribosomal<br/>complex<br/>5')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'ribosomal<br/>complex<br/>2')\n", - "\n", - "ribosomal\n", - "complex\n", - "2\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit')->('cell', 'cytoplasm', 'cytoplasmic<br/>organelles', 'subgroup<br/>of<br/>cytoplasmic<br/>organelles', 'ribonucleoprotein<br/>complex<br/>family', 'ribosome<br/>biogenesis<br/>community', 'ribosome', 'ribosomal<br/>subunit', 'ribosomal<br/>complex<br/>2')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'transcriptional<br/>regulation<br/>complex<br/>family', 'transcriptional<br/>regulation<br/>complexes')\n", - "\n", - "transcriptional\n", - "regulation\n", - "complexes\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'transcriptional<br/>regulation<br/>complex<br/>family')->('cell', 'cytoplasm', 'transcriptional<br/>regulation<br/>complex<br/>family', 'transcriptional<br/>regulation<br/>complexes')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'DNA<br/>metabolic<br/>assembly')\n", - "\n", - "DNA\n", - "metabolic\n", - "assembly\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus')->('cell', 'nucleus', 'DNA<br/>metabolic<br/>assembly')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nuclear<br/>lumen')\n", - "\n", - "nuclear\n", - "lumen\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus')->('cell', 'nucleus', 'nuclear<br/>lumen')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nuclear<br/>body')\n", - "\n", - "nuclear\n", - "body\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus')->('cell', 'nucleus', 'nuclear<br/>body')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nucleo-plasm<br/>1')\n", - "\n", - "nucleo-plasm\n", - "1\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus')->('cell', 'nucleus', 'nucleo-plasm<br/>1')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nucleo-plasm<br/>2')\n", - "\n", - "nucleo-plasm\n", - "2\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus')->('cell', 'nucleus', 'nucleo-plasm<br/>2')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nuclear<br/>transcriptional<br/>speckle')\n", - "\n", - "nuclear\n", - "transcriptional\n", - "speckle\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus')->('cell', 'nucleus', 'nuclear<br/>transcriptional<br/>speckle')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus')\n", - "\n", - "nucleolus\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nuclear<br/>lumen')->('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nuclear<br/>lumen', 'nuclear<br/>splicing<br/>speckle')\n", - "\n", - "nuclear\n", - "splicing\n", - "speckle\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nuclear<br/>lumen')->('cell', 'nucleus', 'nuclear<br/>lumen', 'nuclear<br/>splicing<br/>speckle')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'ribonucleprotein<br/>complex<br/>family')\n", - "\n", - "ribonucleprotein\n", - "complex\n", - "family\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus')->('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'ribonucleprotein<br/>complex<br/>family')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'RNA<br/>processing<br/>complex<br/>family')\n", - "\n", - "RNA\n", - "processing\n", - "complex\n", - "family\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus')->('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'RNA<br/>processing<br/>complex<br/>family')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'splicosomal<br/>complex<br/>family')\n", - "\n", - "splicosomal\n", - "complex\n", - "family\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus')->('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'splicosomal<br/>complex<br/>family')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'RNA<br/>processing<br/>complex<br/>family', 'RNA<br/>processing<br/>complex<br/>1')\n", - "\n", - "RNA\n", - "processing\n", - "complex\n", - "1\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'RNA<br/>processing<br/>complex<br/>family')->('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'RNA<br/>processing<br/>complex<br/>family', 'RNA<br/>processing<br/>complex<br/>1')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'RNA<br/>processing<br/>complex<br/>family', 'RNA<br/>splicing<br/>complex<br/>family')\n", - "\n", - "RNA\n", - "splicing\n", - "complex\n", - "family\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'RNA<br/>processing<br/>complex<br/>family')->('cell', 'nucleus', 'nuclear<br/>lumen', 'nucleolus', 'RNA<br/>processing<br/>complex<br/>family', 'RNA<br/>splicing<br/>complex<br/>family')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family')\n", - "\n", - "chromosome\n", - "organization\n", - "complex\n", - "family\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nucleo-plasm<br/>1')->('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family', 'chromatin<br/>organization<br/>complex<br/>family')\n", - "\n", - "chromatin\n", - "organization\n", - "complex\n", - "family\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family')->('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family', 'chromatin<br/>organization<br/>complex<br/>family')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family', 'chromatin<br/>organization<br/>complex<br/>family', 'HAT<br/>complex<br/>family')\n", - "\n", - "HAT\n", - "complex\n", - "family\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family', 'chromatin<br/>organization<br/>complex<br/>family')->('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family', 'chromatin<br/>organization<br/>complex<br/>family', 'HAT<br/>complex<br/>family')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family', 'chromatin<br/>organization<br/>complex<br/>family', 'HAT<br/>complex<br/>family', 'NuA4<br/>HAT<br/>complex')\n", - "\n", - "NuA4\n", - "HAT\n", - "complex\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family', 'chromatin<br/>organization<br/>complex<br/>family', 'HAT<br/>complex<br/>family')->('cell', 'nucleus', 'nucleo-plasm<br/>1', 'chromosome<br/>organization<br/>complex<br/>family', 'chromatin<br/>organization<br/>complex<br/>family', 'HAT<br/>complex<br/>family', 'NuA4<br/>HAT<br/>complex')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nucleo-plasm<br/>2', 'chromatin<br/>regulation<br/>complex')\n", - "\n", - "chromatin\n", - "regulation\n", - "complex\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nucleo-plasm<br/>2')->('cell', 'nucleus', 'nucleo-plasm<br/>2', 'chromatin<br/>regulation<br/>complex')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nuclear<br/>transcriptional<br/>speckle', 'negative<br/>regulation<br/>of<br/>RNA<br/>biosynthesis<br/>process')\n", - "\n", - "negative\n", - "regulation\n", - "of\n", - "RNA\n", - "biosynthesis\n", - "process\n", - "\n", - "\n", - "\n", - "('cell', 'nucleus', 'nuclear<br/>transcriptional<br/>speckle')->('cell', 'nucleus', 'nuclear<br/>transcriptional<br/>speckle', 'negative<br/>regulation<br/>of<br/>RNA<br/>biosynthesis<br/>process')\n", - "\n", - "\n", - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 25, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "music_map = {\n", - " 'cell': {\n", - " 'cytoplasm': {\n", - " 'secretory organelles': {\n", - " 'transmembrane transport systems': {\n", - " 'ion transmembrane transport systems': {}}},\n", - " 'cytoplasmic organelles': {\n", - " 'subgroup of cytoplasmic organelles': {\n", - " 'metabolic organelles': {\n", - " 'subgroup of metabolic organelles': {},\n", - " 'mitochondrion': {}},\n", - " 'ribonucleoprotein complex family': {\n", - " 'RNA processing complex 1': {'RNA splicing complex 1': {}},\n", - " 'ribosome biogenesis community': {\n", - " 'ribosome': {\n", - " 'ribosomal subunit': {\n", - " 'mitochondirial large ribosomal subunit': {\n", - " # 'large ribosomal subunit subcomplex 1': {}\n", - " },\n", - " 'mito-cyto ribosomal cluster': {},\n", - " 'cotranslational protein targeting to membrane system': {},\n", - " 'ribosomal complex 5': {},\n", - " 'ribosomal complex 2': {}}},\n", - " 'nucleic acid binding complex': {}}}}},\n", - " 'transcriptional regulation complex family': {\n", - " 'transcriptional regulation complexes': {}}},\n", - " 'nucleus': {\n", - " 'DNA metabolic assembly': {},\n", - " 'nuclear lumen': {\n", - " 'nucleolus': {\n", - " 'ribonucleprotein complex family': {},\n", - " 'RNA processing complex family': {\n", - " 'RNA processing complex 1': {},\n", - " 'RNA splicing complex family': {}},\n", - " 'splicosomal complex family': {}},\n", - " 'nuclear splicing speckle': {}},\n", - " 'nuclear body': {},\n", - " 'nucleo-plasm 1': {\n", - " 'chromosome organization complex family': {\n", - " 'chromatin organization complex family': {\n", - " 'HAT complex family': {\n", - " 'NuA4 HAT complex': {}}}}},\n", - " 'nucleo-plasm 2': {\n", - " 'chromatin regulation complex': {}},\n", - " 'nuclear transcriptional speckle': {\n", - " 'negative regulation of RNA biosynthesis process': {}}}}}\n", - "music_map1 = replace_regex_recursive(music_map)\n", - "plot_bigraph(music_map1, **plot_settings, filename='cell_hierarchy')" - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "id": "ab431982-d156-4b7a-9918-384a5ea5132a", - "metadata": { - "tags": [] - }, - "outputs": [ - { - "data": { - "text/plain": [ - "{'cell': {'cytoplasm': {'secretory organelles': {'transmembrane transport systems': {'ion transmembrane transport systems': {}}},\n", - " 'cytoplasmic organelles': {'subgroup of cytoplasmic organelles': {'metabolic organelles': {'subgroup of metabolic organelles': {},\n", - " 'mitochondrion': {}},\n", - " 'ribonucleoprotein complex family': {'RNA processing complex 1': {'RNA splicing complex 1': {}},\n", - " 'ribosome biogenesis community': {'ribosome': {'ribosomal subunit': {'mitochondirial large ribosomal subunit': {},\n", - " 'mito-cyto ribosomal cluster': {},\n", - " 'cotranslational protein targeting to membrane system': {},\n", - " 'ribosomal complex 5': {},\n", - " 'ribosomal complex 2': {}}},\n", - " 'nucleic acid binding complex': {}}}}},\n", - " 'transcriptional regulation complex family': {'transcriptional regulation complexes': {}}},\n", - " 'nucleus': {'DNA metabolic assembly': {},\n", - " 'nuclear lumen': {'nucleolus': {'ribonucleprotein complex family': {},\n", - " 'RNA processing complex family': {'RNA processing complex 1': {},\n", - " 'RNA splicing complex family': {}},\n", - " 'splicosomal complex family': {}},\n", - " 'nuclear splicing speckle': {}},\n", - " 'nuclear body': {},\n", - " 'nucleo-plasm 1': {'chromosome organization complex family': {'chromatin organization complex family': {'HAT complex family': {'NuA4 HAT complex': {}}}}},\n", - " 'nucleo-plasm 2': {'chromatin regulation complex': {}},\n", - " 'nuclear transcriptional speckle': {'negative regulation of RNA biosynthesis process': {}}}}}" - ] - }, - "execution_count": 26, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "music_map" - ] - }, - { - "cell_type": "code", - "execution_count": 27, - "id": "5a76608a-fff0-4005-9f32-c02afef39d9e", - "metadata": { - "tags": [] - }, - "outputs": [ - { - "ename": "TypeError", - "evalue": "plot_bigraph() got an unexpected keyword argument 'node_border_colors'", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[0;32mIn[27], line 128\u001b[0m\n\u001b[1;32m 118\u001b[0m plot_settingsx[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mnode_border_colors\u001b[39m\u001b[38;5;124m'\u001b[39m] \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 119\u001b[0m (\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mcell\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mtranslation\u001b[39m\u001b[38;5;124m'\u001b[39m): \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mblue\u001b[39m\u001b[38;5;124m'\u001b[39m,\n\u001b[1;32m 120\u001b[0m (\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mcell\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mtranscription\u001b[39m\u001b[38;5;124m'\u001b[39m): \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mblue\u001b[39m\u001b[38;5;124m'\u001b[39m,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 125\u001b[0m (\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mcell\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mRNA
processing\u001b[39m\u001b[38;5;124m'\u001b[39m): \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mblue\u001b[39m\u001b[38;5;124m'\u001b[39m,\n\u001b[1;32m 126\u001b[0m }\n\u001b[1;32m 127\u001b[0m \u001b[38;5;66;03m# plot_settingsx.update({'out_dir': 'out','dpi': '250'})\u001b[39;00m\n\u001b[0;32m--> 128\u001b[0m \u001b[43mplot_bigraph\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmusic_map2\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mplot_settingsx\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfilename\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mcell_hierarchy_functions\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\n", - "\u001b[0;31mTypeError\u001b[0m: plot_bigraph() got an unexpected keyword argument 'node_border_colors'" - ] - } - ], - "source": [ - "import copy\n", - "\n", - "transcription_process = {\n", - " '_ports': {\n", - " 'RNA processing': 'Any',\n", - " 'regulation': 'Any',\n", - " 'nucleic acids': 'Any',\n", - " 'negative regulation': 'Any'\n", - " },\n", - " 'wires': {\n", - " 'RNA processing': [\n", - " 'nucleus', 'nuclear lumen', 'nucleolus', 'RNA processing complex family'],\n", - " 'regulation': [\n", - " 'cytoplasm', 'transcriptional regulation complex family', 'transcriptional regulation complexes'],\n", - " 'nucleic acids': [\n", - " 'cytoplasm', 'cytoplasmic organelles', 'subgroup of cytoplasmic organelles', \n", - " 'ribonucleoprotein complex family', 'ribosome biogenesis community', 'nucleic acid binding complex'],\n", - " 'negative regulation': [\n", - " 'nucleus', 'nuclear transcriptional speckle', 'negative regulation of RNA biosynthesis process'],\n", - " }\n", - "}\n", - "\n", - "translation_process = {\n", - " '_ports': {\n", - " 'ribosomes': 'Any',\n", - " 'membrane': 'Any'\n", - " },\n", - " 'wires': {\n", - " 'ribosomes': [\n", - " 'cytoplasm', 'cytoplasmic organelles', 'subgroup of cytoplasmic organelles', 'ribonucleoprotein complex family', 'ribosome biogenesis community', 'ribosome'],\n", - " # 'membrane': ['],\n", - " }\n", - "}\n", - "\n", - "metabolism_process = {\n", - " '_ports': {\n", - " 'organelles': 'Any',\n", - " 'mitochondrion': 'Any',\n", - " 'ion transport': 'Any',\n", - " },\n", - " 'wires': {\n", - " 'organelles': [\n", - " 'cytoplasm', 'cytoplasmic organelles', 'subgroup of cytoplasmic organelles', 'metabolic organelles', ],\n", - " 'mitochondrion': [\n", - " 'cytoplasm', 'cytoplasmic organelles', 'subgroup of cytoplasmic organelles', 'metabolic organelles', 'mitochondrion'],\n", - " 'ion transport': [\n", - " 'cytoplasm', 'secretory organelles', 'transmembrane transport systems', 'ion transmembrane transport systems'],\n", - " }\n", - "}\n", - "\n", - "cell_cycle_process = {\n", - " '_ports': {\n", - " 'DNA': 'Any',\n", - " 'chromosome': 'Any',\n", - " 'chromatin': 'Any',\n", - " },\n", - " 'wires': { \n", - " 'DNA': ['nucleus', 'DNA metabolic assembly'],\n", - " 'chromosome': ['nucleus', 'nucleo-plasm 1', 'chromosome organization complex family',],\n", - " 'chromatin': ['nucleus', 'nucleo-plasm 1', 'chromosome organization complex family', 'chromatin organization complex family'],\n", - " }\n", - "}\n", - "\n", - "signalling_process = {\n", - " '_ports': {\n", - " 'transport': 'Any',\n", - " 'trancript regulation': 'Any',\n", - " },\n", - " 'wires': { \n", - " 'transport': [\n", - " 'cytoplasm', 'secretory organelles', 'transmembrane transport systems'],\n", - " 'trancript regulation': [\n", - " 'cytoplasm', 'transcriptional regulation complex family', 'transcriptional regulation complexes'],\n", - " }\n", - "}\n", - "\n", - "protein_transport_process = {\n", - " '_ports': {\n", - " 'transmembrane transport': 'Any',\n", - " 'secretory': 'Any',\n", - " 'cotranslation': 'Any',\n", - " },\n", - " 'wires': { \n", - " 'transmembrane transport': [\n", - " 'cytoplasm', 'secretory organelles', 'transmembrane transport systems'],\n", - " 'secretory': [\n", - " 'cytoplasm', 'secretory organelles'],\n", - " 'cotranslation': [\n", - " 'cytoplasm', 'cytoplasmic organelles', 'subgroup of cytoplasmic organelles', 'ribonucleoprotein complex family', \n", - " 'ribosome biogenesis community', 'ribosome', 'ribosomal subunit', 'cotranslational protein targeting to membrane system']\n", - " }\n", - "}\n", - "\n", - "rna_processing_process = {\n", - " '_ports': {\n", - " 'processing complex': 'Any',\n", - " },\n", - " 'wires': { \n", - " 'processing complex': [\n", - " 'nucleus', 'nuclear lumen', 'nucleolus', 'RNA processing complex family'],\n", - " }\n", - "}\n", - "\n", - "# compose schema\n", - "music_map['cell']['transcription'] = transcription_process\n", - "music_map['cell']['translation'] = translation_process\n", - "music_map['cell']['metabolism'] = metabolism_process\n", - "music_map['cell']['cell cycle'] = cell_cycle_process\n", - "music_map['cell']['signalling'] = signalling_process\n", - "music_map['cell']['protein transport'] = protein_transport_process\n", - "music_map['cell']['RNA processing'] = rna_processing_process\n", - "\n", - "music_map2 = replace_regex_recursive(music_map)\n", - "\n", - "# plot\n", - "plot_settingsx = copy.deepcopy(plot_settings)\n", - "plot_settingsx['label_margin'] = '0.02'\n", - "plot_settingsx['node_border_colors'] = {\n", - " ('cell', 'translation'): 'blue',\n", - " ('cell', 'transcription'): 'blue',\n", - " ('cell', 'metabolism'): 'blue',\n", - " ('cell', 'cell
cycle'): 'blue',\n", - " ('cell', 'signalling'): 'blue',\n", - " ('cell', 'protein
transport'): 'blue',\n", - " ('cell', 'RNA
processing'): 'blue',\n", - "}\n", - "# plot_settingsx.update({'out_dir': 'out','dpi': '250'})\n", - "plot_bigraph(music_map2, **plot_settingsx, filename='cell_hierarchy_functions')" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "id": "fe3008ad-498e-449f-8521-6ea29fd903f1", - "metadata": { - "tags": [] - }, - "outputs": [ - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "bigraph\n", - "\n", - "\n", - "\n", - "('hypothesized<br/>mechanism',)\n", - "\n", - "hypothesized\n", - "mechanism\n", - "\n", - "\n", - "\n", - "\n", - "('hypothesized<br/>mechanism', '1')->('hypothesized<br/>mechanism',)\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('hypothesized<br/>mechanism', '2')->('hypothesized<br/>mechanism',)\n", - "\n", - "\n", - "\n", - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 18, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "new_process = {\n", - " 'hypothesized mechanism': {\n", - " '_ports': {\n", - " '1': 'Any',\n", - " '2': 'Any',\n", - " }\n", - " }\n", - "}\n", - "\n", - "new_process = replace_regex_recursive(new_process)\n", - "\n", - "# plot\n", - "plot_settingsx = copy.deepcopy(plot_settings)\n", - "plot_settingsx['label_margin'] = '0.03'\n", - "plot_settingsx['node_border_colors'] = {\n", - " ('hypothesized
mechanism',): 'blue',\n", - "}\n", - "plot_settingsx['port_labels'] = False\n", - "plot_bigraph(new_process, **plot_settingsx, filename='hypothesized_mechanism')" - ] - }, - { - "cell_type": "markdown", - "id": "ae52f73c-e384-4880-b18f-47b4c25ce203", - "metadata": {}, - "source": [ - "### Cell structure and function\n", - "Processes represent their functions, we show a more minimal cell structure with added processes." - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "id": "b39417ce-d9a1-4985-abce-ce22df816897", - "metadata": { - "tags": [] - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Writing out/cell\n" - ] - }, - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "bigraph\n", - "\n", - "\n", - "\n", - "('cell',)\n", - "\n", - "cell\n", - "\n", - "\n", - "\n", - "('cell', 'membrane')\n", - "\n", - "membrane\n", - "\n", - "\n", - "\n", - "('cell',)->('cell', 'membrane')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm')\n", - "\n", - "cytoplasm\n", - "\n", - "\n", - "\n", - "('cell',)->('cell', 'cytoplasm')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'nucleoid')\n", - "\n", - "nucleoid\n", - "\n", - "\n", - "\n", - "('cell',)->('cell', 'nucleoid')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'membrane', 'transporters')\n", - "\n", - "transporters\n", - "\n", - "\n", - "\n", - "('cell', 'membrane')->('cell', 'membrane', 'transporters')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'membrane', 'lipids')\n", - "\n", - "lipids\n", - "\n", - "\n", - "\n", - "('cell', 'membrane')->('cell', 'membrane', 'lipids')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'membrane', 'transmembrane transport')\n", - "\n", - "transmembrane transport\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'membrane', 'transporters')->('cell', 'membrane', 'transmembrane transport')\n", - "\n", - "\n", - "transporters\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'metabolites')\n", - "\n", - "metabolites\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm')->('cell', 'cytoplasm', 'metabolites')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'ribosomal complexes')\n", - "\n", - "ribosomal complexes\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm')->('cell', 'cytoplasm', 'ribosomal complexes')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'transcript regulation complex')\n", - "\n", - "transcript regulation complex\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm')->('cell', 'cytoplasm', 'transcript regulation complex')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'translation')\n", - "\n", - "translation\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'metabolites')->('cell', 'membrane', 'transmembrane transport')\n", - "\n", - "\n", - "internal\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'ribosomal complexes')->('cell', 'cytoplasm', 'translation')\n", - "\n", - "\n", - "p1\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'transcript regulation complex', 'transcripts')\n", - "\n", - "transcripts\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'transcript regulation complex')->('cell', 'cytoplasm', 'transcript regulation complex', 'transcripts')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'cytoplasm', 'transcript regulation complex', 'transcripts')->('cell', 'cytoplasm', 'translation')\n", - "\n", - "\n", - "p2\n", - "\n", - "\n", - "\n", - "('cell', 'nucleoid', 'chromosome')\n", - "\n", - "chromosome\n", - "\n", - "\n", - "\n", - "('cell', 'nucleoid')->('cell', 'nucleoid', 'chromosome')\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'nucleoid', 'chromosome', 'genes')\n", - "\n", - "genes\n", - "\n", - "\n", - "\n", - "('cell', 'nucleoid', 'chromosome')->('cell', 'nucleoid', 'chromosome', 'genes')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('cell', 'membrane', 'transmembrane transport', 'external')->('cell', 'membrane', 'transmembrane transport')\n", - "\n", - "\n", - "external\n", - "\n", - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 19, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "cell_struct_func = {\n", - " 'cell': {\n", - " 'membrane': {\n", - " 'transporters': 'concentrations',\n", - " 'lipids': 'concentrations',\n", - " 'transmembrane transport': {\n", - " '_value': {\n", - " '_process': 'transport URI',\n", - " '_config': {'parameter': 1}\n", - " },\n", - " 'wires': {\n", - " 'transporters': 'transporters',\n", - " 'internal': ['..', 'cytoplasm', 'metabolites']},\n", - " '_ports': {\n", - " 'transporters': 'concentrations',\n", - " 'internal': 'concentrations',\n", - " 'external': 'concentrations'\n", - " }\n", - " }\n", - " },\n", - " 'cytoplasm': {\n", - " 'metabolites': {\n", - " '_value': 1.1,\n", - " '_type': 'concentrations'\n", - " },\n", - " 'ribosomal complexes': {\n", - " '_value': 2.2,\n", - " '_type': 'concentrations'\n", - " },\n", - " 'transcript regulation complex': {\n", - " '_value': 0.01,\n", - " 'transcripts': {\n", - " '_value': 0.1,\n", - " '_type': 'concentrations'\n", - " }\n", - " },\n", - " 'translation': {\n", - " 'wires': {\n", - " 'p1': 'ribosomal complexes',\n", - " 'p2': ['transcript regulation complex', 'transcripts']}}},\n", - " 'nucleoid': {\n", - " 'chromosome': {\n", - " 'genes': 'sequences'\n", - " }\n", - " }\n", - " }\n", - "}\n", - "plot_bigraph(cell_struct_func, remove_process_place_edges=True, out_dir='out', filename='cell')" - ] - }, - { - "cell_type": "markdown", - "id": "188eb4a6-c526-4b38-a22d-97f7fb8b7244", - "metadata": {}, - "source": [ - "### Whole-cell *E. coli* model\n", - "\n", - "We here plot the processes and wiring of a whole-cell model of *E. coli* from [Macklin et al. Simultaneous cross-evaluation of heterogeneous E. coli datasets via mechanistic simulation. Science. 2020.](https://pubmed.ncbi.nlm.nih.gov/32703847/)" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "id": "16960d1b-6e35-421e-bb7d-3efe5052e4fc", - "metadata": { - "tags": [] - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Writing out/ecoli\n" - ] - } - ], - "source": [ - "ecoli = { \n", - " 'chromosome-structure': { \n", - " 'wires': {\n", - " 'fragmentBases': ('bulk',),\n", - " 'molecules': ('bulk',),\n", - " 'active_tfs': ('bulk',),\n", - " 'subunits': ('bulk',),\n", - " 'amino_acids': ('bulk',),\n", - " 'active_replisomes': ('unique', 'active_replisome'),\n", - " 'oriCs': ('unique', 'oriC'),\n", - " 'chromosome_domains': ('unique', 'chromosome_domain'),\n", - " 'active_RNAPs': ('unique', 'active_RNAP'),\n", - " 'RNAs': ('unique', 'RNA'),\n", - " 'active_ribosome': ('unique', 'active_ribosome'),\n", - " 'full_chromosomes': ('unique', 'full_chromosome'),\n", - " 'promoters': ('unique', 'promoter'),\n", - " 'DnaA_boxes': ('unique', 'DnaA_box')\n", - " }\n", - " },\n", - " 'metabolism': { \n", - " 'wires': {\n", - " 'metabolites': ('bulk',),\n", - " 'catalysts': ('bulk',),\n", - " 'kinetics_enzymes': ('bulk',),\n", - " 'kinetics_substrates': ('bulk',),\n", - " 'amino_acids': ('bulk',),\n", - " 'environment': ('environment',),\n", - " 'amino_acids_total': ('bulk',)\n", - " }\n", - " },\n", - " 'tf-binding': { \n", - " 'wires': {\n", - " 'promoters': ('unique', 'promoter'),\n", - " 'active_tfs': ('bulk',),\n", - " 'active_tfs_total': ('bulk',),\n", - " 'inactive_tfs_total': ('bulk',),\n", - " }\n", - " },\n", - " 'transcript-initiation': { \n", - " 'wires': {\n", - " 'environment': ('environment',),\n", - " 'full_chromosomes': ('unique', 'full_chromosome'),\n", - " 'RNAs': ('unique', 'RNA'),\n", - " 'active_RNAPs': ('unique', 'active_RNAP'),\n", - " 'promoters': ('unique', 'promoter'),\n", - " 'molecules': ('bulk',),\n", - " }\n", - " },\n", - " 'transcript-elongation': { \n", - " 'wires': {\n", - " 'environment': ('environment',),\n", - " 'RNAs': ('unique', 'RNA'),\n", - " 'active_RNAPs': ('unique', 'active_RNAP'),\n", - " 'molecules': ('bulk',),\n", - " 'bulk_RNAs': ('bulk',),\n", - " 'ntps': ('bulk',),\n", - " }\n", - " },\n", - " 'rna-degradation': { \n", - " 'wires': {\n", - " 'charged_trna': ('bulk',),\n", - " 'bulk_RNAs': ('bulk',),\n", - " 'nmps': ('bulk',),\n", - " 'fragmentMetabolites': ('bulk',),\n", - " 'fragmentBases': ('bulk',),\n", - " 'endoRnases': ('bulk',),\n", - " 'exoRnases': ('bulk',),\n", - " 'subunits': ('bulk',),\n", - " 'molecules': ('bulk',),\n", - " 'RNAs': ('unique', 'RNA'),\n", - " 'active_ribosome': ('unique', 'active_ribosome'),\n", - " }\n", - " },\n", - " 'polypeptide-initiation': { \n", - " 'wires': {\n", - " 'environment': ('environment',),\n", - " 'active_ribosome': ('unique', 'active_ribosome'),\n", - " 'RNA': ('unique', 'RNA'),\n", - " 'subunits': ('bulk',)\n", - " }\n", - " },\n", - " 'polypeptide-elongation': { \n", - " 'wires': {\n", - " 'environment': ('environment',),\n", - " 'active_ribosome': ('unique', 'active_ribosome'),\n", - " 'molecules': ('bulk',),\n", - " 'monomers': ('bulk',),\n", - " 'amino_acids': ('bulk',),\n", - " 'ppgpp_reaction_metabolites': ('bulk',),\n", - " 'uncharged_trna': ('bulk',),\n", - " 'charged_trna': ('bulk',),\n", - " 'charging_molecules': ('bulk',),\n", - " 'synthetases': ('bulk',),\n", - " 'subunits': ('bulk',),\n", - " 'molecules_total': ('bulk',),\n", - " 'amino_acids_total': ('bulk',),\n", - " 'charged_trna_total': ('bulk',),\n", - " 'uncharged_trna_total': ('bulk',)\n", - " }\n", - " },\n", - " 'complexation': {\n", - " 'wires': {\n", - " 'molecules': ('bulk',), \n", - " }\n", - " },\n", - " 'two-component-system': { \n", - " 'wires': {\n", - " 'molecules': ('bulk',)\n", - " }\n", - " },\n", - " 'equilibrium': {\n", - " 'wires': {\n", - " 'molecules': ('bulk',)\n", - " }\n", - " },\n", - " 'protein-degradation': { \n", - " 'wires': {\n", - " 'metabolites': ('bulk',),\n", - " 'proteins': ('bulk',)\n", - " }\n", - " },\n", - " 'chromosome-replication': { \n", - " 'wires': {\n", - " 'replisome_trimers': ('bulk',),\n", - " 'replisome_monomers': ('bulk',),\n", - " 'dntps': ('bulk',),\n", - " 'ppi': ('bulk',),\n", - " 'active_replisomes': ('unique', 'active_replisome'),\n", - " 'oriCs': ('unique', 'oriC'),\n", - " 'chromosome_domains': ('unique', 'chromosome_domain'),\n", - " 'full_chromosomes': ('unique', 'full_chromosome'),\n", - " 'environment': ('environment',)\n", - " }\n", - " },\n", - " 'unique': {\n", - " 'chromosome_domain': {},\n", - " 'full_chromosome': {},\n", - " 'oriC': {},\n", - " 'active_replisome': {},\n", - " 'RNA': {},\n", - " 'active_ribosome': {},\n", - " 'DnaA_box': {},\n", - " 'promoter': {},\n", - " },\n", - " 'bulk': {},\n", - " 'environment': {},\n", - "}\n", - "node_groups = [[ #line up the top nodes for visual effect\n", - " ('unique',), ('bulk',), ('environment',), \n", - " ],\n", - "]\n", - "# plot settings\n", - "plot_settings_ecoli = {\n", - " 'remove_process_place_edges': True,\n", - " 'rankdir': 'RL',\n", - " 'dpi': '100',\n", - " 'out_dir': 'out',\n", - "}\n", - "fig = plot_bigraph(ecoli, **plot_settings_ecoli, node_groups=node_groups, filename='ecoli')" - ] - }, - { - "cell_type": "markdown", - "id": "54e1102d-521c-49cc-8ed2-be26c2b84c3d", - "metadata": { - "tags": [] - }, - "source": [ - "[See E. coli wiring diagram](https://github.com/vivarium-collective/bigraph-viz/blob/main/doc/_static/ecoli.png?raw=true)" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.9.6" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/notebooks/format.ipynb b/notebooks/format.ipynb index 1a723a4..d5f09e1 100644 --- a/notebooks/format.ipynb +++ b/notebooks/format.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 15, + "execution_count": 1, "id": "bb80269d-cc1e-42c9-9667-57ade3f98a21", "metadata": { "tags": [] @@ -16,7 +16,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 2, "id": "f90fe969-5506-4c10-8828-499b9a361017", "metadata": { "tags": [] @@ -26,7 +26,7 @@ "name": "stdout", "output_type": "stream", "text": [ - "bigraph-viz==0.0.29\n" + "-e git+https://github.com/vivarium-collective/bigraph-viz.git@846f9a2bfd4f601146f9143a7f5bf2c80e559393#egg=bigraph_viz\n" ] } ], @@ -37,7 +37,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 3, "id": "51ccd25e-7bad-48ac-ac75-a08f8eb40e60", "metadata": { "tags": [] @@ -47,45 +47,9 @@ "name": "stdout", "output_type": "stream", "text": [ - "Help on function plot_bigraph in module bigraph_viz.plot:\n", + "Help on function plot_bigraph in module bigraph_viz.diagram:\n", "\n", - "plot_bigraph(bigraph_schema, size='16,10', node_label_size='12pt', show_values=False, show_types=False, collapse_processes=False, port_labels=True, port_label_size='10pt', rankdir='TB', node_border_colors=None, node_fill_colors=None, node_groups=False, remove_nodes=None, invisible_edges=False, mark_top=False, remove_process_place_edges=False, print_source=False, dpi='70', file_format='png', out_dir=None, filename=None)\n", - " Plot a bigraph from bigraph schema.\n", - " \n", - " Args:\n", - " bigraph_schema (dict): The bigraph schema dict that will be plotted.\n", - " size (str, optional): The size of the output figure (example: '16,10'). Default is '16,10'.\n", - " node_label_size (str, optional): The font size for the node labels. Default is None.\n", - " show_values (bool, optional): Display on value info in node label. Default is False.\n", - " show_types (bool, optional): Display on type info in node label. Default is False.\n", - " collapse_processes (bool, optional): Collapse rectangular process nodes to a hyperedge vertex. Default is False.\n", - " port_labels (bool, optional): Turn on port labels. Default is True.\n", - " port_label_size (str, optional): The font size of the port labels (example: '10pt'). Default is None.\n", - " rankdir (str, optional): Sets direction of graph layout. 'TB'=top-to-bottom, 'LR'=left-to-right.\n", - " Default is 'TB'.\n", - " node_border_colors (dict, optional): Colors of node borders, with node path tuples mapped to the node color as\n", - " the value: {('path', 'to', 'node',): 'color'}. Colors at https://graphviz.org/doc/info/colors.html\n", - " node_fill_colors (dict, optional): Colors of node fills, with node path tuples mapped to the node color as\n", - " the value: {('path', 'to', 'node',): 'color'}. Colors at https://graphviz.org/doc/info/colors.html\n", - " node_groups (list, optional): A list of lists of nodes.\n", - " Each sub-list is a grouping of nodes that will be aligned at the same rank.\n", - " For example: [[('path to', 'group1 node1',), ('path to', 'group1 node2',)], [another group]]\n", - " Default is None.\n", - " remove_nodes (list, optional): A list of nodes to be removed.\n", - " invisible_edges (list, optional): A list of edge tuples. The edge tuples have the (source, target) node\n", - " according to the nodes' paths. For example: [(('top',), ('top', 'inner1')), (another edge)]\n", - " Default is None.\n", - " mark_top (bool). Turn on to mark the top nodes with a double outline.\n", - " remove_process_place_edges (bool, optional): Turn off process place edges from plotting. Default is False.\n", - " print_source (bool, optional): Print the graphviz DOT source code as string. Default is False.\n", - " file_format (str, optional): File format of the output image. Default is 'png'.\n", - " out_dir (bool, optional): The output directory for the bigraph image. Default is None.\n", - " filename (bool, optional): The file name for the bigraph image. Default is None.\n", - " \n", - " Notes:\n", - " You can adjust node labels using HTML syntax for fonts, colors, sizes, subscript, superscript. For example:\n", - " H2O will print H2O with 2 as a subscript with smaller font.\n", - " You can also make newlines by adding with
\n", + "plot_bigraph(state, schema=None, core=None, out_dir=None, filename=None, file_format='png', size='16,10', node_label_size='12pt', show_values=False, show_types=False, port_labels=True, port_label_size='10pt', rankdir='TB', print_source=False, dpi='70', label_margin='0.05', node_border_colors=None, node_fill_colors=None, node_groups=False, remove_nodes=None, invisible_edges=False, remove_process_place_edges=False, show_process_schema_keys=['interval'])\n", "\n" ] } @@ -106,138 +70,30 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 6, "id": "5f0f7e7e-4216-40ac-a39f-3c6f7599b526", "metadata": { "tags": [] }, "outputs": [ { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "bigraph\n", - "\n", - "\n", - "\n", - "('store1',)\n", - "\n", - "store1\n", - "\n", - "\n", - "\n", - "('store1', 'store1.1')\n", - "\n", - "store1.1\n", - "\n", - "\n", - "\n", - "('store1',)->('store1', 'store1.1')\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'store1.2')\n", - "\n", - "store1.2\n", - "\n", - "\n", - "\n", - "('store1',)->('store1', 'store1.2')\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'store1.3')\n", - "\n", - "store1.3\n", - "\n", - "\n", - "\n", - "('store1',)->('store1', 'store1.3')\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'process1')\n", - "\n", - "process1\n", - "\n", - "\n", - "\n", - "('store1',)->('store1', 'process1')\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'process2')\n", - "\n", - "process2\n", - "\n", - "\n", - "\n", - "('store1',)->('store1', 'process2')\n", - "\n", - "\n", - "\n", - "\n", - "('process3',)\n", - "\n", - "process3\n", - "\n", - "\n", - "\n", - "('store1',)->('process3',)\n", - "\n", - "\n", - "port1\n", - "\n", - "\n", - "\n", - "('store1', 'store1.1')->('store1', 'process1')\n", - "\n", - "\n", - "port1\n", - "\n", - "\n", - "\n", - "('store1', 'store1.1')->('store1', 'process2')\n", - "\n", - "\n", - "port1\n", - "\n", - "\n", - "\n", - "('store1', 'store1.2')->('store1', 'process1')\n", - "\n", - "\n", - "port2\n", - "\n", - "\n", - "\n", - "('store1', 'store1.2')->('store1', 'process2')\n", - "\n", - "\n", - "port2\n", - "\n", - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 18, - "metadata": {}, - "output_type": "execute_result" + "ename": "Exception", + "evalue": "schema not found for type: 2", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mException\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[6], line 42\u001b[0m\n\u001b[1;32m 1\u001b[0m nested_composite_spec \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 2\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mstore1\u001b[39m\u001b[38;5;124m'\u001b[39m: {\n\u001b[1;32m 3\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mstore1.1\u001b[39m\u001b[38;5;124m'\u001b[39m: {\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 40\u001b[0m }\n\u001b[1;32m 41\u001b[0m }\n\u001b[0;32m---> 42\u001b[0m \u001b[43mplot_bigraph\u001b[49m\u001b[43m(\u001b[49m\u001b[43mnested_composite_spec\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/code/bigraph-viz/bigraph_viz/diagram.py:430\u001b[0m, in \u001b[0;36mplot_bigraph\u001b[0;34m(state, schema, core, out_dir, filename, file_format, size, node_label_size, show_values, show_types, port_labels, port_label_size, rankdir, print_source, dpi, label_margin, node_border_colors, node_fill_colors, node_groups, remove_nodes, invisible_edges, remove_process_place_edges, show_process_schema_keys)\u001b[0m\n\u001b[1;32m 427\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m core\u001b[38;5;241m.\u001b[39mexists(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mprocess\u001b[39m\u001b[38;5;124m'\u001b[39m):\n\u001b[1;32m 428\u001b[0m core\u001b[38;5;241m.\u001b[39mregister(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mprocess\u001b[39m\u001b[38;5;124m'\u001b[39m, process_type)\n\u001b[0;32m--> 430\u001b[0m schema, state \u001b[38;5;241m=\u001b[39m \u001b[43mcore\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcomplete\u001b[49m\u001b[43m(\u001b[49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 432\u001b[0m \u001b[38;5;66;03m# parse out the network\u001b[39;00m\n\u001b[1;32m 433\u001b[0m graph_dict \u001b[38;5;241m=\u001b[39m get_graph_dict(\n\u001b[1;32m 434\u001b[0m schema\u001b[38;5;241m=\u001b[39mschema,\n\u001b[1;32m 435\u001b[0m state\u001b[38;5;241m=\u001b[39mstate,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 438\u001b[0m show_process_schema_keys\u001b[38;5;241m=\u001b[39mshow_process_schema_keys,\n\u001b[1;32m 439\u001b[0m )\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:1334\u001b[0m, in \u001b[0;36mTypeSystem.complete\u001b[0;34m(self, initial_schema, initial_state)\u001b[0m\n\u001b[1;32m 1328\u001b[0m state \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhydrate(\n\u001b[1;32m 1329\u001b[0m full_schema,\n\u001b[1;32m 1330\u001b[0m initial_state)\n\u001b[1;32m 1332\u001b[0m \u001b[38;5;66;03m# fill in the parts of the composition schema\u001b[39;00m\n\u001b[1;32m 1333\u001b[0m \u001b[38;5;66;03m# determined by the state\u001b[39;00m\n\u001b[0;32m-> 1334\u001b[0m schema, state \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minfer_schema\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1335\u001b[0m \u001b[43m \u001b[49m\u001b[43mfull_schema\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1336\u001b[0m \u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1338\u001b[0m final_state \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfill(schema, state)\n\u001b[1;32m 1340\u001b[0m \u001b[38;5;66;03m# TODO: add flag to types.access(copy=True)\u001b[39;00m\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:1260\u001b[0m, in \u001b[0;36mTypeSystem.infer_schema\u001b[0;34m(self, schema, state, top_state, path)\u001b[0m\n\u001b[1;32m 1257\u001b[0m inner_path \u001b[38;5;241m=\u001b[39m path \u001b[38;5;241m+\u001b[39m (key,)\n\u001b[1;32m 1258\u001b[0m \u001b[38;5;66;03m# if get_path(schema, inner_path) is None or get_path(state, inner_path) is None:\u001b[39;00m\n\u001b[0;32m-> 1260\u001b[0m schema, top_state \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minfer_schema\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1261\u001b[0m \u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1262\u001b[0m \u001b[43m \u001b[49m\u001b[43mvalue\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1263\u001b[0m \u001b[43m \u001b[49m\u001b[43mtop_state\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtop_state\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1264\u001b[0m \u001b[43m \u001b[49m\u001b[43mpath\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43minner_path\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1266\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(state, \u001b[38;5;28mstr\u001b[39m):\n\u001b[1;32m 1267\u001b[0m \u001b[38;5;28;01mpass\u001b[39;00m\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:1260\u001b[0m, in \u001b[0;36mTypeSystem.infer_schema\u001b[0;34m(self, schema, state, top_state, path)\u001b[0m\n\u001b[1;32m 1257\u001b[0m inner_path \u001b[38;5;241m=\u001b[39m path \u001b[38;5;241m+\u001b[39m (key,)\n\u001b[1;32m 1258\u001b[0m \u001b[38;5;66;03m# if get_path(schema, inner_path) is None or get_path(state, inner_path) is None:\u001b[39;00m\n\u001b[0;32m-> 1260\u001b[0m schema, top_state \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43minfer_schema\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 1261\u001b[0m \u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1262\u001b[0m \u001b[43m \u001b[49m\u001b[43mvalue\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1263\u001b[0m \u001b[43m \u001b[49m\u001b[43mtop_state\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtop_state\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 1264\u001b[0m \u001b[43m \u001b[49m\u001b[43mpath\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43minner_path\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1266\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(state, \u001b[38;5;28mstr\u001b[39m):\n\u001b[1;32m 1267\u001b[0m \u001b[38;5;28;01mpass\u001b[39;00m\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:1218\u001b[0m, in \u001b[0;36mTypeSystem.infer_schema\u001b[0;34m(self, schema, state, top_state, path)\u001b[0m\n\u001b[1;32m 1211\u001b[0m state_type \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 1212\u001b[0m key: value\n\u001b[1;32m 1213\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m key, value \u001b[38;5;129;01min\u001b[39;00m state\u001b[38;5;241m.\u001b[39mitems()\n\u001b[1;32m 1214\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m key\u001b[38;5;241m.\u001b[39mstartswith(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m_\u001b[39m\u001b[38;5;124m'\u001b[39m)}\n\u001b[1;32m 1215\u001b[0m state_schema \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39maccess(\n\u001b[1;32m 1216\u001b[0m state_type)\n\u001b[0;32m-> 1218\u001b[0m hydrated_state \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdeserialize\u001b[49m\u001b[43m(\u001b[49m\u001b[43mstate_schema\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstate\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1219\u001b[0m top_state \u001b[38;5;241m=\u001b[39m set_path(\n\u001b[1;32m 1220\u001b[0m top_state,\n\u001b[1;32m 1221\u001b[0m path,\n\u001b[1;32m 1222\u001b[0m hydrated_state)\n\u001b[1;32m 1224\u001b[0m update \u001b[38;5;241m=\u001b[39m state_type\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:684\u001b[0m, in \u001b[0;36mTypeSystem.deserialize\u001b[0;34m(self, schema, encoded)\u001b[0m\n\u001b[1;32m 682\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m key, branch \u001b[38;5;129;01min\u001b[39;00m encoded\u001b[38;5;241m.\u001b[39mitems():\n\u001b[1;32m 683\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m key \u001b[38;5;129;01min\u001b[39;00m schema:\n\u001b[0;32m--> 684\u001b[0m result[key] \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdeserialize\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 685\u001b[0m \u001b[43m \u001b[49m\u001b[43mschema\u001b[49m\u001b[43m[\u001b[49m\u001b[43mkey\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 686\u001b[0m \u001b[43m \u001b[49m\u001b[43mbranch\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 687\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m result\n\u001b[1;32m 689\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:658\u001b[0m, in \u001b[0;36mTypeSystem.deserialize\u001b[0;34m(self, schema, encoded)\u001b[0m\n\u001b[1;32m 657\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mdeserialize\u001b[39m(\u001b[38;5;28mself\u001b[39m, schema, encoded):\n\u001b[0;32m--> 658\u001b[0m found \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mretrieve\u001b[49m\u001b[43m(\u001b[49m\u001b[43mschema\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 660\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m_deserialize\u001b[39m\u001b[38;5;124m'\u001b[39m \u001b[38;5;129;01min\u001b[39;00m found:\n\u001b[1;32m 661\u001b[0m deserialize \u001b[38;5;241m=\u001b[39m found[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m_deserialize\u001b[39m\u001b[38;5;124m'\u001b[39m]\n", + "File \u001b[0;32m~/code/bigraph-schema/bigraph_schema/type_system.py:97\u001b[0m, in \u001b[0;36mTypeSystem.retrieve\u001b[0;34m(self, schema)\u001b[0m\n\u001b[1;32m 95\u001b[0m found \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39maccess(schema)\n\u001b[1;32m 96\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m found \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m---> 97\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mschema not found for type: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mschema\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 98\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m found\n", + "\u001b[0;31mException\u001b[0m: schema not found for type: 2" + ] } ], "source": [ @@ -256,28 +112,28 @@ " '_type': 'float',\n", " },\n", " 'process1': {\n", - " '_ports': {\n", - " 'port1': {'_type': 'type'}, \n", - " 'port2': {'_type': 'type'},\n", + " '_outputs': {\n", + " 'port1': 'float', \n", + " 'port2': 'int',\n", " },\n", - " 'wires': {\n", + " 'outputs': {\n", " 'port1': 'store1.1',\n", " 'port2': 'store1.2',\n", " }\n", " },\n", " 'process2': {\n", - " '_ports': {\n", - " 'port1': {'_type': 'type'}, \n", - " 'port2': {'_type': 'type'},\n", + " '_outputs': {\n", + " 'port1': 'float', \n", + " 'port2': 'int',\n", " },\n", - " 'wires': {\n", + " 'outputs': {\n", " 'port1': 'store1.1',\n", " 'port2': 'store1.2',\n", " }\n", " },\n", " },\n", " 'process3': {\n", - " 'wires': {\n", + " 'outputs': {\n", " 'port1': 'store1',\n", " }\n", " }\n", @@ -295,132 +151,12 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "3ac86e22-9914-4508-9890-4105f17c944e", "metadata": { "tags": [] }, - "outputs": [ - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "bigraph\n", - "\n", - "\n", - "\n", - "('store1',)\n", - "\n", - "store1\n", - "\n", - "\n", - "\n", - "('store1', 'store1.1')\n", - "\n", - "store1.1\n", - "\n", - "\n", - "\n", - "('store1',)->('store1', 'store1.1')\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'store1.2')\n", - "\n", - "store1.2\n", - "\n", - "\n", - "\n", - "('store1',)->('store1', 'store1.2')\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'store1.3')\n", - "\n", - "store1.3\n", - "\n", - "\n", - "\n", - "('store1',)->('store1', 'store1.3')\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'process1')\n", - "\n", - "process1\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'process2')\n", - "\n", - "process2\n", - "\n", - "\n", - "\n", - "\n", - "('process3',)\n", - "\n", - "process3\n", - "\n", - "\n", - "\n", - "('store1',)->('process3',)\n", - "\n", - "\n", - "port1\n", - "\n", - "\n", - "\n", - "('store1', 'store1.1')->('store1', 'process1')\n", - "\n", - "\n", - "port1\n", - "\n", - "\n", - "\n", - "('store1', 'store1.1')->('store1', 'process2')\n", - "\n", - "\n", - "port1\n", - "\n", - "\n", - "\n", - "('store1', 'store1.2')->('store1', 'process1')\n", - "\n", - "\n", - "port2\n", - "\n", - "\n", - "\n", - "('store1', 'store1.2')->('store1', 'process2')\n", - "\n", - "\n", - "port2\n", - "\n", - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 19, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "plot_settings['remove_process_place_edges'] = True\n", "plot_bigraph(nested_composite_spec, **plot_settings)" @@ -436,119 +172,10 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "9e6b1ea1-8084-41ff-aa87-c654a4d3de08", "metadata": {}, - "outputs": [ - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "bigraph\n", - "\n", - "\n", - "\n", - "('store1',)\n", - "\n", - "store1\n", - "\n", - "\n", - "\n", - "('store1', 'store1.1')\n", - "\n", - "store1.1\n", - "\n", - "\n", - "\n", - "('store1',)->('store1', 'store1.1')\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'store1.2')\n", - "\n", - "store1.2\n", - "\n", - "\n", - "\n", - "('store1',)->('store1', 'store1.2')\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'process1')\n", - "\n", - "process1\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'process2')\n", - "\n", - "process2\n", - "\n", - "\n", - "\n", - "\n", - "('process3',)\n", - "\n", - "process3\n", - "\n", - "\n", - "\n", - "('store1',)->('process3',)\n", - "\n", - "\n", - "port1\n", - "\n", - "\n", - "\n", - "('store1', 'store1.1')->('store1', 'process1')\n", - "\n", - "\n", - "port1\n", - "\n", - "\n", - "\n", - "('store1', 'store1.1')->('store1', 'process2')\n", - "\n", - "\n", - "port1\n", - "\n", - "\n", - "\n", - "('store1', 'store1.2')->('store1', 'process1')\n", - "\n", - "\n", - "port2\n", - "\n", - "\n", - "\n", - "('store1', 'store1.2')->('store1', 'process2')\n", - "\n", - "\n", - "port2\n", - "\n", - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 20, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "remove_nodes = [\n", " ('store1', 'store1.3'),\n", @@ -567,116 +194,12 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "2c109939-715b-4757-9914-388bdb93a213", "metadata": { "tags": [] }, - "outputs": [ - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "bigraph\n", - "\n", - "\n", - "\n", - "('store1',)\n", - "\n", - "store1\n", - "\n", - "\n", - "\n", - "('store1', 'store1.1')\n", - "\n", - "store1.1\n", - "\n", - "\n", - "\n", - "('store1',)->('store1', 'store1.1')\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'store1.2')\n", - "\n", - "store1.2\n", - "\n", - "\n", - "\n", - "('store1',)->('store1', 'store1.2')\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'process1')\n", - "\n", - "process1\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'process2')\n", - "\n", - "process2\n", - "\n", - "\n", - "\n", - "\n", - "('process3',)\n", - "\n", - "process3\n", - "\n", - "\n", - "\n", - "('store1',)->('process3',)\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'store1.1')->('store1', 'process1')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'store1.1')->('store1', 'process2')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'store1.2')->('store1', 'process1')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'store1.2')->('store1', 'process2')\n", - "\n", - "\n", - "\n", - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 21, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "plot_settings['port_labels'] = False\n", "plot_bigraph(nested_composite_spec, **plot_settings)" @@ -692,116 +215,12 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "4042e0b5-8677-42ef-ab66-83f08861d867", "metadata": { "tags": [] }, - "outputs": [ - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "bigraph\n", - "\n", - "\n", - "\n", - "('store1',)\n", - "\n", - "store1\n", - "\n", - "\n", - "\n", - "('store1', 'store1.1')\n", - "\n", - "store1.1\n", - "\n", - "\n", - "\n", - "('store1',)->('store1', 'store1.1')\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'store1.2')\n", - "\n", - "store1.2\n", - "\n", - "\n", - "\n", - "('store1',)->('store1', 'store1.2')\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'process1')\n", - "\n", - "process1\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'process2')\n", - "\n", - "process2\n", - "\n", - "\n", - "\n", - "\n", - "('process3',)\n", - "\n", - "process3\n", - "\n", - "\n", - "\n", - "('store1',)->('process3',)\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'store1.1')->('store1', 'process1')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'store1.1')->('store1', 'process2')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'store1.2')->('store1', 'process1')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'store1.2')->('store1', 'process2')\n", - "\n", - "\n", - "\n", - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 22, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "plot_settings['node_border_colors'] = {\n", " ('store1', 'store1.1'): 'blue',\n", @@ -822,118 +241,12 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "id": "447cce01-c619-4012-8a4e-1f8edf9515e9", "metadata": { "tags": [] }, - "outputs": [ - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "bigraph\n", - "\n", - "\n", - "\n", - "('store1',)\n", - "\n", - "store1\n", - "\n", - "\n", - "\n", - "('store1', 'store1.1')\n", - "\n", - "store1.1\n", - "\n", - "\n", - "\n", - "('store1',)->('store1', 'store1.1')\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'store1.2')\n", - "\n", - "store1.2\n", - "\n", - "\n", - "\n", - "('store1',)->('store1', 'store1.2')\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'process1')\n", - "\n", - "process1\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'process2')\n", - "\n", - "process2\n", - "\n", - "\n", - "\n", - "\n", - "('process3',)\n", - "\n", - "process3\n", - "\n", - "\n", - "\n", - "('store1',)->('process3',)\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'store1.1')->('store1', 'process1')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'store1.1')->('store1', 'process2')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'store1.2')->('store1', 'process1')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'store1.2')->('store1', 'process2')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 23, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "plot_settings['node_groups'] = [\n", " [('store1', 'process1'), ('store1', 'process2'), ('process3',)]\n", @@ -951,118 +264,12 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "id": "d0c5d918-4fa9-495c-8424-4254e495efc9", "metadata": { "tags": [] }, - "outputs": [ - { - "data": { - "image/svg+xml": [ - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "bigraph\n", - "\n", - "\n", - "\n", - "('store1',)\n", - "\n", - "store1\n", - "\n", - "\n", - "\n", - "('store1', 'store1.1')\n", - "\n", - "store1.1\n", - "\n", - "\n", - "\n", - "('store1',)->('store1', 'store1.1')\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'store1.2')\n", - "\n", - "store1.2\n", - "\n", - "\n", - "\n", - "('store1',)->('store1', 'store1.2')\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'process1')\n", - "\n", - "process1\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'process2')\n", - "\n", - "process2\n", - "\n", - "\n", - "\n", - "\n", - "('process3',)\n", - "\n", - "process3\n", - "\n", - "\n", - "\n", - "('store1',)->('process3',)\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'store1.1')->('store1', 'process1')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'store1.1')->('store1', 'process2')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'store1.2')->('store1', 'process1')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "('store1', 'store1.2')->('store1', 'process2')\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 25, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "plot_settings['rankdir'] = 'LR'\n", "plot_bigraph(nested_composite_spec, **plot_settings)"