diff --git a/docs/notebooks/Editing_Kinetics.ipynb b/docs/notebooks/Editing_Kinetics.ipynb index 145f6bc..ce76e46 100644 --- a/docs/notebooks/Editing_Kinetics.ipynb +++ b/docs/notebooks/Editing_Kinetics.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "ac7fdcca", + "id": "86d5d8a5", "metadata": {}, "source": [ "## Editing reaction kinetics\n", @@ -12,7 +12,7 @@ { "cell_type": "code", "execution_count": 1, - "id": "51e4b06a", + "id": "ec398d0f", "metadata": {}, "outputs": [], "source": [ @@ -21,7 +21,7 @@ }, { "cell_type": "markdown", - "id": "624e263a", + "id": "719e97a5", "metadata": {}, "source": [ "now lets create a new model: " @@ -30,7 +30,7 @@ { "cell_type": "code", "execution_count": 2, - "id": "03e06c2e", + "id": "bff10872", "metadata": {}, "outputs": [], "source": [ @@ -39,7 +39,7 @@ }, { "cell_type": "markdown", - "id": "8ccddfb5", + "id": "bd513ab6", "metadata": {}, "source": [ "we know we can create a reaction, by using the `add_reaction` command. It requires at the very least two arguments: \n", @@ -53,7 +53,7 @@ { "cell_type": "code", "execution_count": 3, - "id": "6fb13e49", + "id": "0d2daeaa", "metadata": {}, "outputs": [], "source": [ @@ -62,7 +62,7 @@ }, { "cell_type": "markdown", - "id": "a759d106", + "id": "eaea42a1", "metadata": {}, "source": [ "creates the reaction `R1`, species `A` and `B` and a local parameter `(R1).k1`. With `get_reactions` we can have a look at what was created: " @@ -71,7 +71,7 @@ { "cell_type": "code", "execution_count": 4, - "id": "f4105b56", + "id": "9a201872", "metadata": {}, "outputs": [ { @@ -134,7 +134,7 @@ }, { "cell_type": "markdown", - "id": "153c334b", + "id": "f64abc5a", "metadata": {}, "source": [ "here I want to point out, the `mapping` column. It shows that the parameter `k1` is a local one, as it is mapped to a value. And that the substrate of the function is mapped to `A`. We can specify the mapping directly in the `add_reaction` call, or we can specify it using `set_reaction`. So for example, if we wanted to modify the reaction, to map the reactions `k1` parameter to a global quantity `global_k`, we could to that as follows: " @@ -143,7 +143,7 @@ { "cell_type": "code", "execution_count": 5, - "id": "96f852a4", + "id": "b9e54bdd", "metadata": {}, "outputs": [], "source": [ @@ -154,7 +154,7 @@ { "cell_type": "code", "execution_count": 6, - "id": "63ecea1e", + "id": "d2265200", "metadata": {}, "outputs": [ { @@ -217,7 +217,7 @@ }, { "cell_type": "markdown", - "id": "bb2b7277", + "id": "5321d797", "metadata": {}, "source": [ "next let us assume, i wanted to use a kinetic from the function database, that includes inhibition for the reaction. Using `get_functions` we can filter the functiondatabase, for suitable functions for our reaction, and then filter for ones that contain inhibition: " @@ -226,7 +226,7 @@ { "cell_type": "code", "execution_count": 7, - "id": "7b433631", + "id": "b0ef53ab", "metadata": {}, "outputs": [ { @@ -327,7 +327,7 @@ }, { "cell_type": "markdown", - "id": "6aceb40d", + "id": "b550042e", "metadata": {}, "source": [ "let us use `Allosteric inhibition (MWC)` here, lets have a look at the formula and the mapping table: " @@ -336,7 +336,7 @@ { "cell_type": "code", "execution_count": 8, - "id": "39678fd6", + "id": "2faf9910", "metadata": {}, "outputs": [ { @@ -364,7 +364,7 @@ }, { "cell_type": "markdown", - "id": "2e21b9e9", + "id": "b2aadc12", "metadata": {}, "source": [ "since this function requires a modifier, we also change the reaction scheme to include a modifier. This is done by adding a semicolon at the end of the reaction scheme, and listing the modifiers space separated there. Then we an assign that function directly. " @@ -373,7 +373,7 @@ { "cell_type": "code", "execution_count": 9, - "id": "3573e0d7", + "id": "a44ab0c2", "metadata": {}, "outputs": [ { @@ -441,7 +441,7 @@ }, { "cell_type": "markdown", - "id": "5e67bcbb", + "id": "6666b360", "metadata": {}, "source": [ "*Note:* that here, the mapping is not necessary, as the function has only one modifier, had we multiple modifiers defined, then we'd want to specify the mapping dictionary and map the `Inhibitor` to the respective modifier in our reaction scheme: " @@ -450,7 +450,7 @@ { "cell_type": "code", "execution_count": 10, - "id": "97c24b0b", + "id": "e588d15a", "metadata": {}, "outputs": [ { @@ -518,16 +518,16 @@ }, { "cell_type": "markdown", - "id": "a36fb78b", + "id": "111ed9d0", "metadata": {}, "source": [ - "*Note:* Assigning a function that uses modifiers, *requires* that modifiers are present in the reaction scheme. So assigning the function above would fail with error, if no modifier is declared: " + "*Note:* Assigning a function that uses modifiers, *requires* that modifiers are present in the reaction scheme, or that *all modifiers* are specified in the mapping parameter. So assigning the function above would fail with error, if no modifier is declared: " ] }, { "cell_type": "code", "execution_count": 11, - "id": "2b86b131", + "id": "e4fd7589", "metadata": {}, "outputs": [ { @@ -536,10 +536,161 @@ "text": [ "ERROR:root:the mapping for reaction \"error\" with function \"Allosteric inhibition (MWC)\" is not valid and cannot be applied.\n" ] + }, + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
schemefunctionmapping
name
R1A -> B; DAllosteric inhibition (MWC){'substrate': 'A', 'Inhibitor': 'D', 'V': 0.1,...
errorA -> BMass action (irreversible){'k1': 0.1, 'substrate': 'A'}
\n", + "
" + ], + "text/plain": [ + " scheme function \\\n", + "name \n", + "R1 A -> B; D Allosteric inhibition (MWC) \n", + "error A -> B Mass action (irreversible) \n", + "\n", + " mapping \n", + "name \n", + "R1 {'substrate': 'A', 'Inhibitor': 'D', 'V': 0.1,... \n", + "error {'k1': 0.1, 'substrate': 'A'} " + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ - "add_reaction('error', scheme='A -> B', function='Allosteric inhibition (MWC)');" + "add_reaction('error', scheme='A -> B', function='Allosteric inhibition (MWC)');\n", + "get_reactions()[['scheme', 'function', 'mapping']]" + ] + }, + { + "cell_type": "markdown", + "id": "fca16b2a", + "metadata": {}, + "source": [ + "However, it will succeeed, if the modifier is specified. in the mapping parameter: " + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "359b2f58", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
schemefunctionmapping
name
R1A -> B; DAllosteric inhibition (MWC){'substrate': 'A', 'Inhibitor': 'D', 'V': 0.1,...
now_it_worksA -> B; DAllosteric inhibition (MWC){'substrate': 'A', 'Inhibitor': 'D', 'V': 0.1,...
\n", + "
" + ], + "text/plain": [ + " scheme function \\\n", + "name \n", + "R1 A -> B; D Allosteric inhibition (MWC) \n", + "now_it_works A -> B; D Allosteric inhibition (MWC) \n", + "\n", + " mapping \n", + "name \n", + "R1 {'substrate': 'A', 'Inhibitor': 'D', 'V': 0.1,... \n", + "now_it_works {'substrate': 'A', 'Inhibitor': 'D', 'V': 0.1,... " + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "set_reaction('error', new_name='now_it_works', function='Allosteric inhibition (MWC)', mapping={'Inhibitor': 'D'})\n", + "get_reactions()[['scheme', 'function', 'mapping']]" ] } ],