import sympy as sp
= sp.symbols("P_1 P_2 P_T k_on k_off k_D", positive=True) P1, P2, PT, k_on, k_off, kD
Protein binding kinetics
The aim of these posts is to explore protein and ligand binding kinetics and how they can be calculated.
We will use python to derive and visualization of steady-state concentration laws.
Monomer - Dimer kinetics
Lets start with the simple example of dimer formation from two identical protomers:
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.
Where square brackets are used to indicate the concentration of the species, ie
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:
When reading the equation above, for the equality to hold true, we find that the dimer
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.
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.
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:
Since extinction coefficients are additive (
Third, we need to have some value for the forward
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 (
We can now use sympy to do some mathematics and figure out what the steady-state concentrations are.
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:
= sp.solve(
sol
[-2 * k_on * P1 * P1 + 2 * k_off * P2,
+ 2 * P2 - PT,
P1 / k_on) - kD,
(k_off
],
[P1, P2, k_on, k_off],dict=True,
) sol
[{P_1: sqrt(k_D)*sqrt(8*P_T + k_D)/4 - k_D/4,
P_2: P_T/2 - sqrt(k_D)*sqrt(8*P_T + k_D)/8 + k_D/8,
k_off: k_D*k_on}]
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:
0][P2] sol[
We can see that indeed the solution only depends on the dissociation constant
Next, lets use solara to quickly make an interactive component so that we can easily calculate the monomer and dimer concentrations, given a total protomer concentration
First, we take the symbolic solutions from sympy
and lambdify them so that we can input numbers and calculate the output:
= [P1, P2]
solve_for = [PT, kD]
inputs
= {s: sp.lambdify(inputs, sol[0][s]) for s in solve_for} lambdas
Next, we make a solara
component, where a user can input the values for
import solara
@solara.component
def Page():
= solara.use_reactive(10.)
PT = solara.use_reactive(1.)
kD
= {k: ld(PT.value, kD.value) for k, ld in lambdas.items()}
ans
'PT', value=PT)
solara.InputFloat('kD', value=kD)
solara.InputFloat(
for k, v in ans.items():
f'{k.name}: {v}')
solara.Text(
Page()
Note that the values are all unitless, so if we enter a dissociation constant of 1
This little widget now tells us that if the monomer concentration if 10 times over the value of
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
import numpy as np
import pandas as pd
# create a new function which calculates total molarity (monomer + dimer)
= sp.lambdify(inputs, sol[0][P1] + sol[0][P2])
ld_total
# create a vector of PT values ranging from 0.1 times kD to 1000 times kD
= np.logspace(-1, 3, endpoint=True, num=100)
PT_values = {k: ld(PT_values, 1) / ld_total(PT_values, 1) for k, ld in lambdas.items()}
ans
# put the results in a dataframe, together with input PT values
= pd.DataFrame(dict(PT=PT_values) | {k.name: v for k, v in ans.items()})
df
df.head()
PT | P_1 | P_2 | |
---|---|---|---|
0 | 0.100000 | 0.921311 | 0.078689 |
1 | 0.109750 | 0.915248 | 0.084752 |
2 | 0.120450 | 0.908825 | 0.091175 |
3 | 0.132194 | 0.902035 | 0.097965 |
4 | 0.145083 | 0.894871 | 0.105129 |
The resulting values are fractions of monomer and dimer respectively, rather than their concentrations. We can plot the results with altair
, adapting the gallery example for a multi-line tooltip graph.
import altair as alt
= df.melt("PT", var_name="species", value_name="y")
source
# Create a selection that chooses the nearest point & selects based on x-value
= alt.selection_point(nearest=True, on="pointerover",
nearest =["PT"], empty=False)
fields
# The basic line
= alt.Chart(source).mark_line(interpolate="basis").encode(
line =alt.X("PT:Q", scale=alt.Scale(type="log"), title='Ratio PT/kD'),
x=alt.Y("y:Q", title='Fraction of total'),
y="species:N",
color
)
# Draw points on the line, and highlight based on selection
= line.mark_point().encode(
points =alt.condition(nearest, alt.value(1), alt.value(0))
opacity
)
# Draw a rule at the location of the selection
= alt.Chart(source).transform_pivot(
rules "species",
="y",
value=["PT"]
groupby="black").encode(
).mark_rule(color="PT:Q",
x=alt.condition(nearest, alt.value(0.3), alt.value(0)),
opacity=[alt.Tooltip(c, type="quantitative", format=".2f") for c in df.columns],
tooltip
).add_params(nearest)
# Put the five layers into a chart and bind the data
alt.layer(
line, points, rules
).properties(=600, height=300
width )
From the graph, we can see that if we are at
So what about the ‘10x above
Meanwhile, we can think about why its so hard to reach full dimerization even if concentrations used are far higher than the dissociation constant. If we think about the reaction from an maximum entropy point of view, out intuition might tell us that the entropic equivalent of making all promomers into a dimer is the equivalent of putting all ‘air molecules’ into one corner of the room: it has a vanishingly low probability of happing because its so far away from the maximium entropy state of the system.
Second, a closer look at the differential equation describing the change of