{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Building a Boolean-Based Model"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This simple example demonstrates how to create a boolean-based model, its components, regulators, conditions and sub-conditions into [Cell Collective](https://cellcollective.org).\n",
"\n",
"We'll attempt to reconstruct the [Cortical Area Development](https://research.cellcollective.org/?dashboard=true#2035:1/cortical-area-development/1) authored by CE Giacomantonio.\n",
"\n",
"![](../data/images/cortical-area-development.png)\n",
"\n",
"Begin by importing the ccapi module into your workspace."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import ccapi"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now, let’s try creating a client object in order to interact with services provided by [Cell Collective](https://cellcollective.org)."
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"client = ccapi.Client()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Authenticate your client using a ***password flow type authentication*** scheme.\n",
"\n",
"**NOTE**: *Before you can authenticate using ccapi, you must first register an application of the appropriate type on [Cell Collective](https://cellcollective.org). If you do not require a user context, it is read only.*"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"client.auth(email = \"test@cellcollective.org\", password = \"test\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Creating a Base Model"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Create a Base Model using ccapi and instantize it with an authenticated client."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n",
" \n",
" \n",
" \n",
" ID\n",
" \n",
" | \n",
" \n",
" 163454\n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Name\n",
" \n",
" | \n",
" \n",
" Cortical Area Development\n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Memory Address\n",
" \n",
" | \n",
" \n",
" 0x010d4ee490\n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Number of Versions\n",
" \n",
" | \n",
" \n",
" 1\n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Versions\n",
" \n",
" | \n",
" \n",
" [<BooleanModel 163454 version 1 at 0x010d4ee650>]\n",
" | \n",
"
\n",
"
"
],
"text/plain": [
""
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"model = ccapi.Model(\"Cortical Area Development\", client = client)\n",
"model.save()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"A `ccapi.Model` consists of various `ccapi.ModelVersion` objects that help you build various versions to a model. By default, a `ccapi.Model` provides you a default model version of a boolean type. "
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" \n",
" \n",
" ID\n",
" \n",
" | \n",
" \n",
" 163454\n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Version\n",
" \n",
" | \n",
" \n",
" 1\n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Name\n",
" \n",
" | \n",
" \n",
" Version 1\n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Memory Address\n",
" \n",
" | \n",
" \n",
" 0x010d4ee650\n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Number of Components\n",
" \n",
" | \n",
" \n",
" 0\n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Components\n",
" \n",
" | \n",
" \n",
" \n",
" | \n",
"
\n",
"
"
],
"text/plain": [
""
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# get the default model version\n",
"boolean = model.versions[0]\n",
"boolean.name = \"Version 1\"\n",
"boolean"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Adding Components to a Boolean-Based Model"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"First, we need to create a list of component objects for this model."
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"# create components\n",
"COUP_TFI = ccapi.InternalComponent(\"COUP-TFI\")\n",
"EMX2 = ccapi.InternalComponent(\"EMX2\")\n",
"FGF8 = ccapi.InternalComponent(\"FGF8\")\n",
"PAX6 = ccapi.InternalComponent(\"PAX6\")\n",
"Sp8 = ccapi.InternalComponent(\"Sp8\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now let us add a list of components to our Boolean Model."
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"# add components to model\n",
"boolean.add_components(COUP_TFI, EMX2, FGF8, PAX6, Sp8)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Saving a Model"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Ensure you save your model in order to commit your work."
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" \n",
" \n",
" ID\n",
" \n",
" | \n",
" \n",
" 163454\n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Name\n",
" \n",
" | \n",
" \n",
" Cortical Area Development\n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Memory Address\n",
" \n",
" | \n",
" \n",
" 0x010d4ee490\n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Number of Versions\n",
" \n",
" | \n",
" \n",
" 1\n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Versions\n",
" \n",
" | \n",
" \n",
" [<BooleanModel 163454 version 1 at 0x010d4ee650 name='Version 1'>]\n",
" | \n",
"
\n",
"
"
],
"text/plain": [
""
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"model.save()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Adding Regulators, Conditions and Sub-Conditions"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's add a list of regulators and conditions to our components. A list of regulators and conditions as well as sub-conditions can all be added at once to a component."
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"# add regulators to components\n",
"COUP_TFI.add_regulators(\n",
" ccapi.NegativeRegulator(Sp8),\n",
" ccapi.NegativeRegulator(FGF8)\n",
")\n",
"EMX2.add_regulators(\n",
" ccapi.PositiveRegulator(COUP_TFI),\n",
" ccapi.NegativeRegulator(FGF8),\n",
" ccapi.NegativeRegulator(PAX6),\n",
" ccapi.NegativeRegulator(Sp8)\n",
")\n",
"Sp8.add_regulators(\n",
" ccapi.PositiveRegulator(FGF8),\n",
" ccapi.NegativeRegulator(EMX2)\n",
")\n",
"FGF8.add_regulators(\n",
" # add conditions to regulators\n",
" ccapi.PositiveRegulator(FGF8, conditions = [\n",
" ccapi.Condition(components = Sp8)\n",
" ])\n",
")\n",
"PAX6.add_regulators(\n",
" ccapi.PositiveRegulator(Sp8),\n",
" ccapi.NegativeRegulator(COUP_TFI)\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" \n",
" \n",
" ID\n",
" \n",
" | \n",
" \n",
" 163454\n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Name\n",
" \n",
" | \n",
" \n",
" Cortical Area Development\n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Memory Address\n",
" \n",
" | \n",
" \n",
" 0x010d4ee490\n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Number of Versions\n",
" \n",
" | \n",
" \n",
" 1\n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Versions\n",
" \n",
" | \n",
" \n",
" [<BooleanModel 163454 version 1 at 0x010d4ee650 name='Version 1'>]\n",
" | \n",
"
\n",
"
"
],
"text/plain": [
""
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"model.save()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We've now got things within our Boolean Model."
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"scrolled": false
},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" \n",
" \n",
" ID | Name | Number of Positive Regulators | Number of Negative Regulators | \n",
"
\n",
" \n",
" \n",
" 3202260 | COUP-TFI | 0 | 2 |
3202258 | EMX2 | 1 | 3 |
3202261 | FGF8 | 1 | 0 |
3202257 | PAX6 | 1 | 1 |
3202259 | Sp8 | 1 | 1 |
\n",
" \n",
"
\n",
" "
],
"text/plain": [
"[,\n",
" ,\n",
" ,\n",
" ,\n",
" ]"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"boolean.components"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" \n",
" \n",
" ID | Name | Number of Conditions | \n",
"
\n",
" \n",
" \n",
" 4136618 | | 1 |
\n",
" \n",
"
\n",
" "
],
"text/plain": [
"[]"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"FGF8.positive_regulators"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Model Summary"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can view detailed summary of your model using the `summary` function provided."
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Internal Components (+, -) External Components\n",
"-------------------------- -------------------\n",
"COUP-TFI (0,2) \n",
"EMX2 (1,3) \n",
"FGF8 (1,0) \n",
"PAX6 (1,1) \n",
"Sp8 (1,1) \n"
]
}
],
"source": [
"boolean.summary()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"...or view detailed information within your jupyter notebook."
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
" \n",
" \n",
" \n",
" ID\n",
" \n",
" | \n",
" \n",
" 163454\n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Version\n",
" \n",
" | \n",
" \n",
" 1\n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Name\n",
" \n",
" | \n",
" \n",
" Version 1\n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Memory Address\n",
" \n",
" | \n",
" \n",
" 0x010d4ee650\n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Number of Components\n",
" \n",
" | \n",
" \n",
" 5\n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" Components\n",
" \n",
" | \n",
" \n",
" COUP-TFI, EMX2, FGF8, PAX6, Sp8\n",
" | \n",
"
\n",
"
"
],
"text/plain": [
""
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"boolean"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Model Rendering"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"You can also attempt to visualize a Boolean Model using the `draw` function provided."
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Exception in thread Thread-4:\n",
"Traceback (most recent call last):\n",
" File \"/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py\", line 926, in _bootstrap_inner\n",
" self.run()\n",
" File \"/Users/achillesrasquinha/.venv/lib/python3.7/site-packages/pygraphviz/agraph.py\", line 44, in run\n",
" chunk = self.pipe.read()\n",
" File \"/Users/achillesrasquinha/.venv/lib/python3.7/site-packages/gevent/_fileobjectposix.py\", line 164, in readall\n",
" data = self.__read(DEFAULT_BUFFER_SIZE)\n",
" File \"/Users/achillesrasquinha/.venv/lib/python3.7/site-packages/gevent/_fileobjectposix.py\", line 158, in __read\n",
" wait_on_watcher(self._read_watcher, None, None, self.hub)\n",
" File \"src/gevent/_hub_primitives.py\", line 326, in gevent._gevent_c_hub_primitives.wait_on_watcher\n",
" File \"src/gevent/_hub_primitives.py\", line 350, in gevent._gevent_c_hub_primitives.wait_on_watcher\n",
" File \"src/gevent/_hub_primitives.py\", line 304, in gevent._gevent_c_hub_primitives._primitive_wait\n",
" File \"src/gevent/_hub_primitives.py\", line 46, in gevent._gevent_c_hub_primitives.WaitOperationsGreenlet.wait\n",
" File \"src/gevent/_hub_primitives.py\", line 46, in gevent._gevent_c_hub_primitives.WaitOperationsGreenlet.wait\n",
" File \"src/gevent/_hub_primitives.py\", line 55, in gevent._gevent_c_hub_primitives.WaitOperationsGreenlet.wait\n",
" File \"src/gevent/_waiter.py\", line 151, in gevent._gevent_c_waiter.Waiter.get\n",
" File \"src/gevent/_greenlet_primitives.py\", line 61, in gevent._gevent_c_greenlet_primitives.SwitchOutGreenletWithLoop.switch\n",
" File \"src/gevent/_greenlet_primitives.py\", line 61, in gevent._gevent_c_greenlet_primitives.SwitchOutGreenletWithLoop.switch\n",
" File \"src/gevent/_greenlet_primitives.py\", line 65, in gevent._gevent_c_greenlet_primitives.SwitchOutGreenletWithLoop.switch\n",
" File \"src/gevent/_gevent_c_greenlet_primitives.pxd\", line 35, in gevent._gevent_c_greenlet_primitives._greenlet_switch\n",
"greenlet.error: cannot switch to a different thread\n",
"Exception in thread Thread-5:\n",
"Traceback (most recent call last):\n",
" File \"/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py\", line 926, in _bootstrap_inner\n",
" self.run()\n",
" File \"/Users/achillesrasquinha/.venv/lib/python3.7/site-packages/pygraphviz/agraph.py\", line 44, in run\n",
" chunk = self.pipe.read()\n",
" File \"/Users/achillesrasquinha/.venv/lib/python3.7/site-packages/gevent/_fileobjectposix.py\", line 164, in readall\n",
" data = self.__read(DEFAULT_BUFFER_SIZE)\n",
" File \"/Users/achillesrasquinha/.venv/lib/python3.7/site-packages/gevent/_fileobjectposix.py\", line 158, in __read\n",
" wait_on_watcher(self._read_watcher, None, None, self.hub)\n",
" File \"src/gevent/_hub_primitives.py\", line 326, in gevent._gevent_c_hub_primitives.wait_on_watcher\n",
" File \"src/gevent/_hub_primitives.py\", line 350, in gevent._gevent_c_hub_primitives.wait_on_watcher\n",
" File \"src/gevent/_hub_primitives.py\", line 304, in gevent._gevent_c_hub_primitives._primitive_wait\n",
" File \"src/gevent/_hub_primitives.py\", line 46, in gevent._gevent_c_hub_primitives.WaitOperationsGreenlet.wait\n",
" File \"src/gevent/_hub_primitives.py\", line 46, in gevent._gevent_c_hub_primitives.WaitOperationsGreenlet.wait\n",
" File \"src/gevent/_hub_primitives.py\", line 55, in gevent._gevent_c_hub_primitives.WaitOperationsGreenlet.wait\n",
" File \"src/gevent/_waiter.py\", line 151, in gevent._gevent_c_waiter.Waiter.get\n",
" File \"src/gevent/_greenlet_primitives.py\", line 61, in gevent._gevent_c_greenlet_primitives.SwitchOutGreenletWithLoop.switch\n",
" File \"src/gevent/_greenlet_primitives.py\", line 61, in gevent._gevent_c_greenlet_primitives.SwitchOutGreenletWithLoop.switch\n",
" File \"src/gevent/_greenlet_primitives.py\", line 65, in gevent._gevent_c_greenlet_primitives.SwitchOutGreenletWithLoop.switch\n",
" File \"src/gevent/_gevent_c_greenlet_primitives.pxd\", line 35, in gevent._gevent_c_greenlet_primitives._greenlet_switch\n",
"greenlet.error: cannot switch to a different thread\n",
"\n",
"\n"
]
},
{
"ename": "TypeError",
"evalue": "not a file handle",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mboolean\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdraw\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m~/dev/dev/hl/ccapi/src/ccapi/model/model/boolean/__init__.py\u001b[0m in \u001b[0;36mdraw\u001b[0;34m(self, type_, **kwargs)\u001b[0m\n\u001b[1;32m 154\u001b[0m \u001b[0mgraph\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0madd_nodes_from\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mc\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mname\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mc\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcomponents\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 155\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 156\u001b[0;31m \u001b[0mlayout\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgraphviz_layout\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mgraph\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 157\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 158\u001b[0m nx.draw_networkx_nodes(graph, layout,\n",
"\u001b[0;32m~/.venv/lib/python3.7/site-packages/networkx/drawing/nx_agraph.py\u001b[0m in \u001b[0;36mgraphviz_layout\u001b[0;34m(G, prog, root, args)\u001b[0m\n\u001b[1;32m 235\u001b[0m \u001b[0mThis\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0ma\u001b[0m \u001b[0mwrapper\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mpygraphviz_layout\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 236\u001b[0m \"\"\"\n\u001b[0;32m--> 237\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mpygraphviz_layout\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mG\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mprog\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mprog\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mroot\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mroot\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0margs\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 238\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 239\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/.venv/lib/python3.7/site-packages/networkx/drawing/nx_agraph.py\u001b[0m in \u001b[0;36mpygraphviz_layout\u001b[0;34m(G, prog, root, args)\u001b[0m\n\u001b[1;32m 283\u001b[0m \u001b[0margs\u001b[0m \u001b[0;34m+=\u001b[0m \u001b[0;34mf\"-Groot={root}\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 284\u001b[0m \u001b[0mA\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mto_agraph\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mG\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 285\u001b[0;31m \u001b[0mA\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlayout\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mprog\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mprog\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0margs\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 286\u001b[0m \u001b[0mnode_pos\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 287\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mn\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mG\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/.venv/lib/python3.7/site-packages/pygraphviz/agraph.py\u001b[0m in \u001b[0;36mlayout\u001b[0;34m(self, prog, args)\u001b[0m\n\u001b[1;32m 1420\u001b[0m \"\"\"\n\u001b[1;32m 1421\u001b[0m \u001b[0mfmt\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m\"dot\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1422\u001b[0;31m \u001b[0mdata\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_run_prog\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mprog\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\" \"\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mjoin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"-T\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfmt\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1423\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfrom_string\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1424\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mhas_layout\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/.venv/lib/python3.7/site-packages/pygraphviz/agraph.py\u001b[0m in \u001b[0;36m_run_prog\u001b[0;34m(self, prog, args)\u001b[0m\n\u001b[1;32m 1377\u001b[0m \u001b[0mt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstart\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1378\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1379\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mwrite\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mchild_stdin\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1380\u001b[0m \u001b[0mchild_stdin\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mclose\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1381\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/.venv/lib/python3.7/site-packages/pygraphviz/agraph.py\u001b[0m in \u001b[0;36mwrite\u001b[0;34m(self, path)\u001b[0m\n\u001b[1;32m 1256\u001b[0m \u001b[0mfh\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_get_fh\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpath\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"w\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1257\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1258\u001b[0;31m \u001b[0mgv\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0magwrite\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mhandle\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfh\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1259\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mOSError\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1260\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"IO error writing file\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m~/.venv/lib/python3.7/site-packages/pygraphviz/graphviz.py\u001b[0m in \u001b[0;36magwrite\u001b[0;34m(g, file)\u001b[0m\n\u001b[1;32m 86\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 87\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0magwrite\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mg\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfile\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 88\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0m_graphviz\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0magwrite\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mg\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfile\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 89\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 90\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0magisundirected\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mg\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mTypeError\u001b[0m: not a file handle"
]
}
],
"source": [
"# boolean.draw()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
}