{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Protein binding kinetics\n", "\n", "The aim of these posts is to explore protein and ligand binding kinetics and how they can be calculated. \n", "\n", "We will use python to derive and visualization of steady-state concentration laws. \n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Monomer - Dimer kinetics\n", "\n", "Lets start with the simple example of dimer formation from two identical protomers:\n", "\n", "$$\n", "\\ce{P1 + P1 <=>[k_{on}][k_{off}] P2}\n", "$$\n", "\n", "From the kinetic scheme above, we can write down the differential equations describing this system. These differential equations tell us how the concentrations of the reaction (in this case dimerization) change in time. \n", "\n", "$$\n", "\\frac{\\partial [P_1]}{\\partial t} = - 2 k_{on} [P_1][P_1] + 2 k_{off} [P_2]\n", "$$\n", "\n", "$$\n", "\\frac{\\partial [P_2]}{\\partial t} = k_{on} [P_1][P_1] - k_{off} [P_2]\n", "$$\n", "\n", "Where square brackets are used to indicate the concentration of the species, ie $[P_1]$ is the concentration of the monomer at a given time point $t$.\n", "\n", "To sanity check our results, we can multiply the second equation with -2, such that both right-hand sides become equal. We then find that:\n", "\n", "$$\n", "\\frac{\\partial [P_1]}{\\partial t} = - 2 \\frac{\\partial [P_2]}{\\partial t}\n", "$$\n", "\n", "When reading the equation above, for the equality to hold true, we find that the dimer $P_2$ must appear at _half_ the rate at which the monomer $P_1$ disappears. Cross-checking this with our chemical intuition this makes sense, since two monomers are required to make one dimer. \n", "\n", "In order to now find which concentrations of monomer and dimer are formed given how much protomer is in the tube, we need three more pieces of information. \n", "\n", "First, we are looking for the concentration of the monomer and dimer at _steady-state_: the system has reached equillibrium and no more changes in the concentration of either the monomer or the dimer occur. This means we can set both differential equations to zero. \n", "\n", "Second, we realize that the total amount of protomer in the tube never goes up or down; its either monomer or as one of the protomers in a dimer. The total amount of protomer is thus:\n", "\n", "$$\n", "[P_T] = [P_1] + 2[P_2]\n", "$$\n", "\n", "Since extinction coefficients are additive ($\\epsilon_{P_2} = 2\\epsilon_{P_1}$) the total protomer concentration can be measured directly by UV-VIS spectroscopy. \n", "\n", "Third, we need to have some value for the forward $k_{on}$ and backward rates $k_{off}$. These rates describe how fast the reaction takes place, but at the moment we are only interested in the steady-state concentrations. We can define a single new quantity which depends on the ratio of the forward and backward rates:\n", "\n", "$$\n", "K_d = \\frac{k_{off}}{k_{on}}\n", "$$\n", "\n", "If we look at our differential equations, the left-hand side describes the change of concentration of the monomer over time. The units are therefore molar per second ($M s^{-1}$). To make the units match on the left and right-hand side, we can deduce that the units of $k_{on}$ must be $M^{-1} s^{-1}$. Similarly, the units of $k_{off}$ are $s^{-1}$. From this unit analysis, we can see that the lifetime or off rate from a complex is independent of concentratation and we can recognize $K_d$ as the dissociation constant with units $M$." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can now use [sympy](https://www.sympy.org/en/index.html) to do some mathematics and figure out what the steady-state concentrations are." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import sympy as sp\n", "\n", "P1, P2, PT, k_on, k_off, kD = sp.symbols(\"P_1 P_2 P_T k_on k_off k_D\", positive=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now, we can solve the system of equations as we defined them above. Because of steady-state conditions, the differential equations are zero. We only use one here because the first is just the second multiplied by a constant factor, and thus does now have any additional information. To input equations into `sympy`, we must set the right hand side to zero and input the resulting left hand side:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[{P_1: sqrt(k_D)*sqrt(8*P_T + k_D)/4 - k_D/4,\n", " P_2: P_T/2 - sqrt(k_D)*sqrt(8*P_T + k_D)/8 + k_D/8,\n", " k_off: k_D*k_on}]" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sol = sp.solve(\n", " [\n", " -2 * k_on * P1 * P1 + 2 * k_off * P2,\n", " P1 + 2 * P2 - PT,\n", " (k_off / k_on) - kD,\n", " ],\n", " [P1, P2, k_on, k_off],\n", " dict=True,\n", ")\n", "sol" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This returns a single solution, because we have told `sympy` that all input symbols are positive. We can have a look at the solution for the concentration of the dimer:" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\frac{P_{T}}{2} - \\frac{\\sqrt{k_{D}} \\sqrt{8 P_{T} + k_{D}}}{8} + \\frac{k_{D}}{8}$" ], "text/plain": [ "P_T/2 - sqrt(k_D)*sqrt(8*P_T + k_D)/8 + k_D/8" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sol[0][P2]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can see that indeed the solution only depends on the dissociation constant $K_D$, and not the individual rates and indeed the 'mass balance' equation still holds ($P_1 + 2P_2 = P_T$), excercise for the reader." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Next, lets use [solara](https://solara.dev/) to quickly make an interactive component so that we can easily calculate the monomer and dimer concentrations, given a total protomer concentration $P_T$ and the dissociation constant. \n", "\n", "First, we take the symbolic solutions from `sympy` and lambdify them so that we can input numbers and calculate the output:" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "solve_for = [P1, P2]\n", "inputs = [PT, kD]\n", "\n", "lambdas = {s: sp.lambdify(inputs, sol[0][s]) for s in solve_for}" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Next, we make a `solara` component, where a user can input the values for $P_T$ and $K_{D}$ and directly obtain $P_1$ and $P_2$ at steady-state:" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "7b7432b1958f4bdb91256f7c93718220", "version_major": 2, "version_minor": 0 }, "text/html": [ "Cannot show widget. You probably want to rerun the code cell above (Click in the code cell, and press Shift+Enter ⇧+↩)." ], "text/plain": [ "Cannot show ipywidgets in text" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import solara\n", "\n", "@solara.component\n", "def Page():\n", " PT = solara.use_reactive(10.)\n", " kD = solara.use_reactive(1.)\n", "\n", " ans = {k: ld(PT.value, kD.value) for k, ld in lambdas.items()}\n", "\n", " solara.InputFloat('PT', value=PT)\n", " solara.InputFloat('kD', value=kD)\n", "\n", " for k, v in ans.items():\n", " solara.Text(f'{k.name}: {v}')\n", "\n", "Page()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Note that the values are all unitless, so if we enter a dissociation constant of 1 $\\mu M$, the concentration $P_T$ should also be given in $\\mu M$, and the outputs are then $\\mu M$ as well. \n", "\n", "This little widget now tells us that if the monomer concentration if 10 times over the value of $k_D$, in the steady-state equillibrium one out of three species is still a monomer!" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Lets try if we can visualize the ratio of dimer to monomer over a larger range of concentrations. To do so we evalulate the monomer/dimer concentrations over a range spanning from 0.1 $k_D$ to 1000 $k_D$. " ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | PT | \n", "P_1 | \n", "P_2 | \n", "
---|---|---|---|
0 | \n", "0.100000 | \n", "0.921311 | \n", "0.078689 | \n", "
1 | \n", "0.109750 | \n", "0.915248 | \n", "0.084752 | \n", "
2 | \n", "0.120450 | \n", "0.908825 | \n", "0.091175 | \n", "
3 | \n", "0.132194 | \n", "0.902035 | \n", "0.097965 | \n", "
4 | \n", "0.145083 | \n", "0.894871 | \n", "0.105129 | \n", "