{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Transcription with a single activator\n", "\n", "Implement a model of Z, which is activated by X (a parameter) and that degrades. The model function takes as input the time, state variables, and parameters. It should have one state variable, Z, that is activated by a transcription factor X.\n", "\n", "The parameters are\n", "- vmax_z: maximum rate of Z's transcription\n", "- K_xz: the activation threshold for X's activation of Z\n", "- n_xz: the Hill coefficient (exponent) for X's activation of Z\n", "- d_z: the degradation rate constant for Z\n", "- X: the amount of X in the system\n", "\n", "The model's activation function is\n", "\n", "$v_{max} \\frac{x^{n_{xz}}}{K_{xz}^{n_{xz}}+x^{n_{xz}}}$\n", "\n", "and $\\frac{dZ}{dt}$ depends on activation and degradation." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "ename": "SyntaxError", "evalue": "invalid syntax (, line 7)", "output_type": "error", "traceback": [ "\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m7\u001b[0m\n\u001b[0;31m dydt[0] = # Write code here\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n" ] } ], "source": [ "import numpy as np\n", "\n", "def single_activator( t, statevars, params ):\n", " # write code here\n", "\n", " dydt = np.zeros( (1,) )\n", " dydt[0] = # Write code here\n", " return dydt" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Before simulating the model, first look at the activation function\n", "\n", "Assuming $v_{max}=1$, plot the activation as a function of x (x from 0 to 2 with step of 0.01) for values of $n_{xz}$ ranging from 1 to 10 with a step of 1. Identify on the plot the location of $K_{xz}=0.5$. Also, identify the location on each line where x=1, because we will be using x=1 for activated x in the model simulation." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import matplotlib.pyplot as plt\n", "\n", "# Write code here" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Simulate the model\n", "\n", "Use $v_{max}=1$, $K_{xz}=0.5$, $n_{xz}=5$, and $d_z=2$. X should be 0 until t=0.5, and 1 thereafter. Simulate from t=0 to t=20 with a time steps of 0.01.\n", "\n", "We are going to take extra precautions when we solve this system. We will first simulate the situation before X is on, then start a new simulation with X on. This way, we can guarantee that we have the solution change behaviors at exactly the right time. (The danger is that the solver is so satisfied with the flat solution before X is on, that it takes such big steps that it doesn't notice when X is turned on.)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import scipy.integrate\n", "\n", "# Write code here" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Plot the simulation\n", "Plot X over time in an upper subplot and Z over time in a lower subplot." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "scrolled": true }, "outputs": [], "source": [ "# Write code here." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Simulate and plot the model for varying Hill coefficients\n", "For $n_{xz}$ from 1 to 10 (with step of 1), simulate the model (with all other info as above). Plot all simulation outputs on the same plot, and use a legend to label the value of $n_{xz}$ for each line." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "# Write code here" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Model a dual activator system with an AND gate\n", "\n", "There are now two factors X and Y. Both are activators and their effects are multiplied. This means the model's activation function is\n", "\n", "$v_{max} \\frac{x^{n_{xz}}}{K_{xz}^{n_{xz}}+x^{n_{xz}}} \\frac{y^{n_{yz}}}{K_{yz}^{n_{yz}}+y^{n_{yz}}}$\n", "\n" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "# Write code here" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Simulate the model\n", "\n", "Use $v_{max}=1$, $K_{xz}=0.5$, $n_{xz}=5$, $K_{yz}=0.5$, $n_{yz}=5$, and $d_z=1$. X should be 0 until t=0.5, and 1 thereafter. Y should be 0 until t=5, and 1 thereafter. \n", "\n", "Simulate from t=0 to t=20 with a time steps of 0.01." ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "# Write code here" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Plot the simulation\n", "\n", "Plot X over time in an upper subplot, Y over time in a middle subplot, and Z over time in a lower subplot." ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "# Write code here" ] } ], "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.8.5" } }, "nbformat": 4, "nbformat_minor": 4 }