hERG channelΒΆ
Write about the hERG channel https://en.wikipedia.org/wiki/HERG
import utils
import matplotlib.pyplot as plt
utils.list_ode_models()
['tentusscher_noble_noble_panfilov_2006_c.ode']
model_name = "tentusscher_noble_noble_panfilov_2006_c"
model = utils.load_model(model_name, rebuild=True)
Loaded ODE model 'tentusscher_noble_noble_panfilov_2006_c' with:
Num full states: 17
Num parameters: 46
t, u = model.solve(t_start=0, t_end=1000.0, dt=0.1)
V_index = model.state_index("V")
print(V_index)
15
V = u[:, V_index]
fig, ax = plt.subplots()
ax.plot(t, V)
[<matplotlib.lines.Line2D at 0x7f1c340db290>]
monitor = model.monitor(u, t)
u.shape
(10001, 17)
monitor.shape
(10001, 86)
# List all monitor names
# model.monitor_names()
i_Kr_index = model.monitor_index("i_Kr")
i_Kr = monitor[:, i_Kr_index]
fig, ax = plt.subplots()
ax.plot(t, i_Kr)
[<matplotlib.lines.Line2D at 0x7f1c32700c10>]
parameters = model.default_parameters()
parameters["g_Kr"] *= 0.2
t2, u2 = model.solve(t_start=0, t_end=1000.0, dt=0.1, parameters=parameters)
Update paramameter g_Kr from 0.096 to 0.019200000000000002
V_kr_block = u2[:, V_index]
fig, ax = plt.subplots()
ax.plot(t, V, label="Original")
ax.plot(t2, V_kr_block, label="Kr block")
ax.legend(loc="best")
<matplotlib.legend.Legend at 0x7f1c326c6450>
import ipywidgets as widgets
%matplotlib widget
fig, ax = plt.subplots(2, 1, sharex=True)
ax[0].plot(t, V, label="Original")
line_V, = ax[0].plot(t, V, label="Kr block")
ax[0].legend(loc="best")
ax[0].set_title("Voltage")
ax[1].plot(t, i_Kr, label="Original")
line_iKr, = ax[1].plot(t, i_Kr, label="Kr block")
ax[1].legend(loc="best")
ax[1].set_title("i Kr")
@widgets.interact(block=(-1, 1, 0.1))
def Kr_block(block):
parameters = model.default_parameters().copy()
parameters["g_Kr"] *= (1 + block)
t2, u2 = model.solve(t_start=0, t_end=1000.0, dt=0.1, parameters=parameters)
monitor = model.monitor(u2, t2)
i_Kr_block = monitor[:, i_Kr_index]
V_kr_block = u2[:, V_index]
line_V.set_ydata(V_kr_block)
line_iKr.set_ydata(i_Kr_block)
fig.canvas.draw_idle()