diff --git a/.gitignore b/.gitignore
index cd5fb9c..e3b8b43 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
# Distribution / packaging
+__pycache__/
.Python
env/
build/
@@ -19,5 +20,4 @@ wheels/
*.out
out/
.python-version
-__pycache__/
.ipynb_checkpoints/
diff --git a/notebooks/BMCA.ipynb b/notebooks/BMCA.ipynb
new file mode 100644
index 0000000..e756624
--- /dev/null
+++ b/notebooks/BMCA.ipynb
@@ -0,0 +1,477 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "id": "5c510aab",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from bigraph_viz import plot_bigraph"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "id": "17969769",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "image/svg+xml": [
+ "\n",
+ "\n",
+ "\n",
+ "\n",
+ "\n"
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "execution_count": 14,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "bounds_type = {\n",
+ " 'upper': 'float',\n",
+ " 'lower': 'float',\n",
+ "}\n",
+ "\n",
+ "objective_type = 'function[array[(decisions),float],float]~string'\n",
+ "\n",
+ "gene_type = 'string'\n",
+ "reaction_type = 'string'\n",
+ "metabolite_type = 'string'\n",
+ "\n",
+ "perturbation_type = {\n",
+ " 'entity': 'reaction~gene',\n",
+ " 'direction': 'boolean',\n",
+ "}\n",
+ "\n",
+ "medium_type = 'map[reaction,bounds]'\n",
+ "\n",
+ "condition_type = '(medium|list[perturbation])'\n",
+ "\n",
+ "spec = {\n",
+ " 'BMCA_workflow': {\n",
+ "\n",
+ " # top-level ports\n",
+ " '_ports': {\n",
+ " 'input_expression': 'map[array[(genes),float]]',\n",
+ " 'input_model': 'sbml',\n",
+ " 'input_flux_data': 'maybe[array[(reactions),maybe[float]]]',\n",
+ " 'output_flux_control_coeff': 'array[(external_metabolites|reactions),float]',\n",
+ " 'output_metabolite_control_coeffs': 'array[(external_metabolites|reactions),float]',\n",
+ " },\n",
+ "\n",
+ " # internal states\n",
+ " 'fluxes': {},\n",
+ " 'internal_metabolites': {},\n",
+ " 'external_metabolites': {},\n",
+ " 'enzymes': {},\n",
+ "\n",
+ " # internal processes\n",
+ " 'BMCA_inference': {\n",
+ " '_ports': {\n",
+ " 'input_fluxes': 'map[array[(reactions),float]]',\n",
+ " 'input_enzymes': 'map[array[(enzymes), float]]',\n",
+ " },\n",
+ " 'wires': {\n",
+ " 'input_fluxes': ['fluxes'],\n",
+ " },\n",
+ " },\n",
+ " 'get_flux_from_expression': {\n",
+ " '_ports': {\n",
+ " 'input_method': 'enum[(e-flux,imat)]', # E-flux, iMAT\n",
+ " 'input_expression': 'map[array[(genes),float]]',\n",
+ " 'input_model': 'sbml',\n",
+ " 'output_fluxes': 'map[array[(reactions),float]]',\n",
+ " # 'output_fba_config': ''\n",
+ " },\n",
+ " 'wires': {\n",
+ " 'output_fluxes': ['fluxes'],\n",
+ " },\n",
+ " 'config': {\n",
+ " 'condition_normalization': 'A',\n",
+ " 'scaling': 'media',\n",
+ " },\n",
+ " 'flux_variability_analysis': {\n",
+ " '_ports': {\n",
+ " 'input_model': 'sbml',\n",
+ " 'input_conditions': '', # media conditions\n",
+ " 'output_flux_bounds': 'map[bounds]' # from reaction to bounds, launches 2 FBAs for each\n",
+ " },\n",
+ " 'FBA': { # these will actually be launched following the output of FVA\n",
+ " '_ports': {\n",
+ " 'input_bounds': 'array[(reactions),bounds]',\n",
+ " 'input_objective': 'objective',\n",
+ " 'input_model': 'sbml',\n",
+ " 'output_metabolite_dual_values': 'array[(total_metabolites),float]', # total_metabolites = internal_metabolites + external_metabolites\n",
+ " 'output_reaction_dual_values': 'array[(reactions),float]',\n",
+ " 'output_fluxes': 'array[(reactions),float]',\n",
+ " },\n",
+ " },\n",
+ " },\n",
+ " },\n",
+ " }\n",
+ "}\n",
+ "\n",
+ "plot_bigraph(spec, \n",
+ " # remove_process_place_edges=True\n",
+ " )"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "id": "1af3b2fe",
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Help on function plot_bigraph in module bigraph_viz.plot:\n",
+ "\n",
+ "plot_bigraph(bigraph_schema, size='16,10', node_label_size='12pt', show_values=False, show_types=False, show_process_schema=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', label_margin='0.05', 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",
+ " show_process_schema (bool, optional): Display process schema info as internal nodes. 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",
+ " label_margin (str, optional): The margin size around a label. Default is '0.05'.\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",
+ "\n"
+ ]
+ }
+ ],
+ "source": [
+ "help(plot_bigraph)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "ad27ee01-e86d-4615-8ebe-b71d06ca9c6c",
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "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
+}