Skip to content

Commit

Permalink
fix: remove cameo style solutions
Browse files Browse the repository at this point in the history
  • Loading branch information
hredestig committed Aug 6, 2017
1 parent ae07ebb commit 037aed4
Showing 1 changed file with 53 additions and 56 deletions.
109 changes: 53 additions & 56 deletions escher-01.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import escher\n",
Expand Down Expand Up @@ -111,7 +113,7 @@
"source": [
"model = cobra.io.read_sbml_model('data/e_coli_core.xml.gz')\n",
"solution = model.optimize()\n",
"print('Growth rate: %.2f' % solution.f)"
"print('Growth rate: %.2f' % solution.objective_value)"
]
},
{
Expand Down Expand Up @@ -149,46 +151,9 @@
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Faster map generation in cameo\n",
"\n",
"Cameo provides shortcuts for generating Escher visualizations. Try it out for the same data."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
"heading_collapsed": true
},
"outputs": [],
"source": [
"cam_model = cameo.load_model('e_coli_core')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"cam_solution = cameo.fba(cam_model)\n",
"cam_solution.objective_value"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"cam_solution.display_on_map(map_name='e_coli_core.Core metabolism')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Escher for experimental data (20min)\n",
"\n",
Expand All @@ -204,7 +169,10 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true,
"hidden": true
},
"outputs": [],
"source": [
"import pandas as pd\n",
Expand All @@ -214,7 +182,9 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"hidden": true
},
"source": [
"Escher expects a dictionary, so let's make a dictionary out of this data and pass it into a Builder as `metabolite_data`."
]
Expand All @@ -223,7 +193,8 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
"collapsed": true,
"hidden": true
},
"outputs": [],
"source": [
Expand All @@ -233,7 +204,10 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true,
"hidden": true
},
"outputs": [],
"source": [
"b = escher.Builder(map_name='e_coli_core.Core metabolism',\n",
Expand All @@ -250,7 +224,9 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"hidden": true
},
"source": [
"## Gene data & dataset comparison with Escher\n",
"\n",
Expand All @@ -262,7 +238,10 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true,
"hidden": true
},
"outputs": [],
"source": [
"b = escher.Builder(map_name='e_coli_core.Core metabolism',\n",
Expand All @@ -273,7 +252,9 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"hidden": true
},
"source": [
"You can provide genes by ID (the locus tags show on the map) or by name (you can see these when you hover over a gene).\n",
"\n",
Expand All @@ -283,7 +264,10 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true,
"hidden": true
},
"outputs": [],
"source": [
"rnaseq = pd.read_table('data/S6_RNA-seq_aerobic_to_anaerobic.csv', sep=',', header=0, index_col=0)\n",
Expand All @@ -293,7 +277,8 @@
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
"collapsed": true,
"hidden": true
},
"source": [
"Notice that we have two datasets here. For multiple datasets, Escher expects an array of data dictionaries. E.g.:\n",
Expand All @@ -307,7 +292,8 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
"collapsed": true,
"hidden": true
},
"outputs": [],
"source": [
Expand All @@ -316,15 +302,20 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"hidden": true
},
"source": [
"Let's plot it on the map! Genes are visualized on reactions, so the `reaction_scale` and `reaction_styles` options still work here. We also have new options for `reaction_compare_style` which can be 'fold', 'log2_fold', or 'diff' and define how the two datasets are compared on the map."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true,
"hidden": true
},
"outputs": [],
"source": [
"b = escher.Builder(map_name='e_coli_core.Core metabolism',\n",
Expand All @@ -343,7 +334,9 @@
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"hidden": true
},
"source": [
"Right away, we can see that genes activated in anaerobic conditions (e.g. fermentation pathways) are red, and genes activated in aerobic conditions (e.g. TCA cycle) are green."
]
Expand All @@ -367,7 +360,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# pass the model to a new builder\n",
Expand All @@ -385,7 +380,9 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"b = escher.Builder(map_json='data/CHANGE_ME.json')\n",
Expand All @@ -409,7 +406,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.1"
"version": "3.6.0"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 037aed4

Please sign in to comment.