Skip to content

Commit

Permalink
2 more channels added
Browse files Browse the repository at this point in the history
  • Loading branch information
pgleeson committed Apr 22, 2024
1 parent 9faa191 commit 113b1a1
Show file tree
Hide file tree
Showing 16 changed files with 333 additions and 45 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ report.*.txt
/NeuroML2/Test_RMD.ode
/NeuroML2/report.txt
/RMD.model.xml
/NeuroML2/LEMS_Test_RMD_cca.xml
/NeuroML2/LEMS_Test_RMD_shak.xml
4 changes: 4 additions & 0 deletions NeuroML2/AWCon.cell.nml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<neuroml xmlns="http://www.neuroml.org/schema/neuroml2" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.neuroml.org/schema/neuroml2 https://raw.github.com/NeuroML/NeuroML2/development/Schemas/NeuroML2/NeuroML_v2.3.xsd" id="AWCon">
<notes>A cell from Nicoletti et al. 2019</notes>
<include href="AWCon_leak.channel.nml"/>
<include href="AWCon_shak.channel.nml"/>
<include href="AWCon_kir.channel.nml"/>
<include href="AWCon_cca.channel.nml"/>
<cell id="AWCon">
<notes>AWCon cell from Nicoletti et al. 2019</notes>
<morphology id="morphology">
Expand All @@ -21,7 +23,9 @@
<biophysicalProperties id="biophys">
<membraneProperties>
<channelDensity id="leak_chans" ionChannel="AWCon_leak" condDensity="0.27 S_per_m2" erev="-80.0mV" ion="non_specific"/>
<channelDensity id="shak_chans" ionChannel="AWCon_shak" condDensity="0.1 S_per_m2" erev="-80.0mV" ion="k"/>
<channelDensity id="kir_chans" ionChannel="AWCon_kir" condDensity="0.65 S_per_m2" erev="-80.0mV" ion="k"/>
<channelDensity id="cca_chans" ionChannel="AWCon_cca" condDensity="0.7 S_per_m2" erev="60.0mV" ion="ca"/>
<spikeThresh value="0mV"/>
<specificCapacitance value="0.0031000000000000003 F_per_m2"/>
<initMembPotential value="-70mV"/>
Expand Down
66 changes: 66 additions & 0 deletions NeuroML2/AWCon_cca.channel.nml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<neuroml xmlns="http://www.neuroml.org/schema/neuroml2" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.neuroml.org/schema/neuroml2 https://raw.github.com/NeuroML/NeuroML2/development/Schemas/NeuroML2/NeuroML_v2.3.xsd" id="AWCon_cca">
<notes>An ion channel from cell AWCon from Nicoletti et al. 2019</notes>
<ionChannelHH id="AWCon_cca" species="ca" conductance="10pS">
<notes>AWCon_cca channel from Nicoletti et al. 2019</notes>
<gateHHtauInf id="m" instances="2">
<timeCourse type="cca_m_tau"/>
<steadyState type="cca_m_inf"/>
</gateHHtauInf>
<gateHHtauInf id="h" instances="1">
<timeCourse type="cca_h_tau"/>
<steadyState type="cca_h_inf"/>
</gateHHtauInf>
</ionChannelHH>
<ComponentType name="cca_m_inf" extends="baseVoltageDepVariable">
<Constant name="VOLT_SCALE" dimension="voltage" value="1 mV"/>
<Constant name="va_cca1" dimension="none" value="-42.65"/>
<Constant name="ka_cca1" dimension="none" value="1.7"/>
<Constant name="sscca1" dimension="none" value="15.0"/>
<Constant name="fcca" dimension="none" value="1.4"/>
<Dynamics>
<DerivedVariable name="V" dimension="none" value="(v) / VOLT_SCALE"/>
<DerivedVariable name="x" dimension="none" exposure="x" value="1/(exp((1/(fcca*ka_cca1))*(-V - sscca1 + va_cca1)) + 1)"/>
</Dynamics>
</ComponentType>
<ComponentType name="cca_m_tau" extends="baseVoltageDepTime">
<Constant name="VOLT_SCALE" dimension="voltage" value="1 mV"/>
<Constant name="TIME_SCALE" dimension="time" value="1 ms"/>
<Constant name="stmcca1" dimension="none" value="30.0"/>
<Constant name="constmcca1" dimension="none" value="0.5"/>
<Constant name="p1tmcca1" dimension="none" value="40.0"/>
<Constant name="p2tmcca1" dimension="none" value="-62.5393"/>
<Constant name="p3tmcca1" dimension="none" value="-12.4758"/>
<Constant name="p4tmcca1" dimension="none" value="0.6947"/>
<Constant name="f3ca" dimension="none" value="1.7"/>
<Dynamics>
<DerivedVariable name="V" dimension="none" value="(v) / VOLT_SCALE"/>
<DerivedVariable name="t" dimension="time" exposure="t" value="(constmcca1*(p1tmcca1/(exp((1/(f3ca*p3tmcca1))*(-V + p2tmcca1 - stmcca1)) + 1) + p4tmcca1))/1000"/>
</Dynamics>
</ComponentType>
<ComponentType name="cca_h_inf" extends="baseVoltageDepVariable">
<Constant name="VOLT_SCALE" dimension="voltage" value="1 mV"/>
<Constant name="sshcca1" dimension="none" value="15.0"/>
<Constant name="f2cca1" dimension="none" value="1.15"/>
<Constant name="vi_cca1" dimension="none" value="-58.0"/>
<Constant name="ki_cca1" dimension="none" value="7.0"/>
<Dynamics>
<DerivedVariable name="V" dimension="none" value="(v) / VOLT_SCALE"/>
<DerivedVariable name="x" dimension="none" exposure="x" value="1/(exp((1/(f2cca1*ki_cca1))*(V + sshcca1 - vi_cca1)) + 1)"/>
</Dynamics>
</ComponentType>
<ComponentType name="cca_h_tau" extends="baseVoltageDepTime">
<Constant name="VOLT_SCALE" dimension="voltage" value="1 mV"/>
<Constant name="TIME_SCALE" dimension="time" value="1 ms"/>
<Constant name="sthcca1" dimension="none" value="15.0"/>
<Constant name="consthcca1" dimension="none" value="0.08"/>
<Constant name="p1thcca1" dimension="none" value="280.0"/>
<Constant name="p2thcca1" dimension="none" value="-60.7312"/>
<Constant name="p3thcca1" dimension="none" value="8.5224"/>
<Constant name="p4thcca1" dimension="none" value="19.7456"/>
<Constant name="f4ca" dimension="none" value="1.1"/>
<Dynamics>
<DerivedVariable name="V" dimension="none" value="(v) / VOLT_SCALE"/>
<DerivedVariable name="t" dimension="time" exposure="t" value="(consthcca1*(p1thcca1/(exp((1/(f4ca*p3thcca1))*(V - p2thcca1 + sthcca1)) + 1) + p4thcca1))/1000"/>
</Dynamics>
</ComponentType>
</neuroml>
10 changes: 1 addition & 9 deletions NeuroML2/AWCon_kir.channel.nml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@
<Constant name="VOLT_SCALE" dimension="voltage" value="1 mV"/>
<Constant name="va_kir" dimension="none" value="-52.0"/>
<Constant name="ka_kir" dimension="none" value="13.0"/>
<Constant name="p1tmkir" dimension="none" value="17.0752"/>
<Constant name="p2tmkir" dimension="none" value="-17.8258"/>
<Constant name="p3tmkir" dimension="none" value="20.3154"/>
<Constant name="p4tmkir" dimension="none" value="-43.4414"/>
<Constant name="p5tmkir" dimension="none" value="11.1691"/>
<Constant name="p6tmkir" dimension="none" value="3.8329"/>
<Dynamics>
<DerivedVariable name="V" dimension="none" value="(v) / VOLT_SCALE"/>
<DerivedVariable name="x" dimension="none" exposure="x" value="1/(exp((V - va_kir + 30)/ka_kir) + 1)"/>
Expand All @@ -25,8 +19,6 @@
<ComponentType name="kir_m_tau" extends="baseVoltageDepTime">
<Constant name="VOLT_SCALE" dimension="voltage" value="1 mV"/>
<Constant name="TIME_SCALE" dimension="time" value="1 ms"/>
<Constant name="va_kir" dimension="none" value="-52.0"/>
<Constant name="ka_kir" dimension="none" value="13.0"/>
<Constant name="p1tmkir" dimension="none" value="17.0752"/>
<Constant name="p2tmkir" dimension="none" value="-17.8258"/>
<Constant name="p3tmkir" dimension="none" value="20.3154"/>
Expand All @@ -35,7 +27,7 @@
<Constant name="p6tmkir" dimension="none" value="3.8329"/>
<Dynamics>
<DerivedVariable name="V" dimension="none" value="(v) / VOLT_SCALE"/>
<DerivedVariable name="t" dimension="time" exposure="t" value="p1tmkir/(exp((-V + p2tmkir)/p3tmkir) + exp((V - p4tmkir)/p5tmkir)) + p6tmkir"/>
<DerivedVariable name="t" dimension="time" exposure="t" value="(p1tmkir/(exp((-V + p2tmkir)/p3tmkir) + exp((V - p4tmkir)/p5tmkir)) + p6tmkir)/1000"/>
</Dynamics>
</ComponentType>
</neuroml>
57 changes: 57 additions & 0 deletions NeuroML2/AWCon_shak.channel.nml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<neuroml xmlns="http://www.neuroml.org/schema/neuroml2" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.neuroml.org/schema/neuroml2 https://raw.github.com/NeuroML/NeuroML2/development/Schemas/NeuroML2/NeuroML_v2.3.xsd" id="AWCon_shak">
<notes>An ion channel from cell AWCon from Nicoletti et al. 2019</notes>
<ionChannelHH id="AWCon_shak" species="k" conductance="10pS">
<notes>AWCon_shak channel from Nicoletti et al. 2019</notes>
<gateHHtauInf id="m" instances="1">
<timeCourse type="shak_m_tau"/>
<steadyState type="shak_m_inf"/>
</gateHHtauInf>
<gateHHtauInf id="h" instances="1">
<timeCourse type="shak_h_tau"/>
<steadyState type="shak_h_inf"/>
</gateHHtauInf>
</ionChannelHH>
<ComponentType name="shak_m_inf" extends="baseVoltageDepVariable">
<Constant name="VOLT_SCALE" dimension="voltage" value="1 mV"/>
<Constant name="vashak" dimension="none" value="20.4"/>
<Constant name="kashak" dimension="none" value="7.7"/>
<Constant name="shiftV05" dimension="none" value="0.0"/>
<Dynamics>
<DerivedVariable name="V" dimension="none" value="(v) / VOLT_SCALE"/>
<DerivedVariable name="x" dimension="none" exposure="x" value="1/(exp((-V - shiftV05 + vashak)/kashak) + 1)"/>
</Dynamics>
</ComponentType>
<ComponentType name="shak_m_tau" extends="baseVoltageDepTime">
<Constant name="VOLT_SCALE" dimension="voltage" value="1 mV"/>
<Constant name="TIME_SCALE" dimension="time" value="1 ms"/>
<Constant name="ptmshak1" dimension="none" value="26.571450568169027"/>
<Constant name="ptmshak2" dimension="none" value="-33.74161180071613"/>
<Constant name="ptmshak3" dimension="none" value="15.757936311607475"/>
<Constant name="ptmshak4" dimension="none" value="15.364937728953288"/>
<Constant name="ptmshak5" dimension="none" value="1.990037272604829"/>
<Constant name="shiftV05" dimension="none" value="0.0"/>
<Dynamics>
<DerivedVariable name="V" dimension="none" value="(v) / VOLT_SCALE"/>
<DerivedVariable name="t" dimension="time" exposure="t" value="(ptmshak1/(exp((V - (ptmshak2 + shiftV05))/ptmshak3) + exp((-V + ptmshak2 + shiftV05)/ptmshak4)) + ptmshak5)/1000"/>
</Dynamics>
</ComponentType>
<ComponentType name="shak_h_inf" extends="baseVoltageDepVariable">
<Constant name="VOLT_SCALE" dimension="voltage" value="1 mV"/>
<Constant name="kishak" dimension="none" value="5.8"/>
<Constant name="vishak" dimension="none" value="-6.95"/>
<Constant name="shiftV05" dimension="none" value="0.0"/>
<Dynamics>
<DerivedVariable name="V" dimension="none" value="(v) / VOLT_SCALE"/>
<DerivedVariable name="x" dimension="none" exposure="x" value="1/(exp((V + shiftV05 - vishak)/kishak) + 1)"/>
</Dynamics>
</ComponentType>
<ComponentType name="shak_h_tau" extends="baseVoltageDepTime">
<Constant name="VOLT_SCALE" dimension="voltage" value="1 mV"/>
<Constant name="TIME_SCALE" dimension="time" value="1 ms"/>
<Constant name="pthshak" dimension="none" value="1400.0"/>
<Dynamics>
<DerivedVariable name="V" dimension="none" value="(v) / VOLT_SCALE"/>
<DerivedVariable name="t" dimension="time" exposure="t" value="(pthshak)/1000"/>
</Dynamics>
</ComponentType>
</neuroml>
87 changes: 65 additions & 22 deletions NeuroML2/GenerateNeuroML.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
colors = {"AWCon": "0 0 0.8", "RMD": "0 0.8 0", "GenericMuscleCell": "0.8 0 0"}


def create_channel_file(chan_id_in_cell, cell_id, xpp, species, gates={}, parameters={}):
def create_channel_file(chan_id_in_cell, cell_id, xpp, species, gates={},extra_params=[]):
chan_id = "%s_%s" % (cell_id, chan_id_in_cell)
chan_doc = NeuroMLDocument(
id=chan_id,
Expand Down Expand Up @@ -51,27 +51,35 @@ def create_channel_file(chan_id_in_cell, cell_id, xpp, species, gates={}, parame
tcct.add(tscale)


inf_expr = xpp["derived_variables"][gates[g][1]]
tau_expr = xpp["derived_variables"][gates[g][2]]

for p in parameters:
potential_parameters = []
for p in xpp["parameters"]:
if chan_id_in_cell in p:
potential_parameters.append(p)

for p in potential_parameters+extra_params:
const = component_factory(
"Constant", name=p, dimension="none", value=str(xpp["parameters"][p])
)
ssct.add(const)
tcct.add(const)
if p in inf_expr:
ssct.add(const)
if p in tau_expr:
tcct.add(const)


d = component_factory("Dynamics")
ssct.add(d)
dvv = component_factory("DerivedVariable", name="V", dimension="none", value="(v) / VOLT_SCALE")
d.add(dvv)

expr = xpp["derived_variables"][gates[g][1]]

import sympy
from sympy.parsing.sympy_parser import parse_expr
v,V = sympy.symbols('v V')

s_expr = parse_expr(expr, evaluate=False)
s_expr = parse_expr(inf_expr, evaluate=False)
s_expr = s_expr.subs(v,V)

dv = component_factory("DerivedVariable", name="x", exposure="x", dimension="none", value=s_expr)
Expand All @@ -81,11 +89,10 @@ def create_channel_file(chan_id_in_cell, cell_id, xpp, species, gates={}, parame
tcct.add(d)
d.add(dvv)

expr = xpp["derived_variables"][gates[g][2]]
s_expr = parse_expr(expr, evaluate=False)
s_expr = parse_expr(tau_expr, evaluate=False)
s_expr = s_expr.subs(v,V)

dv = component_factory("DerivedVariable", name="t", exposure="t", dimension="time", value=s_expr)
dv = component_factory("DerivedVariable", name="t", exposure="t", dimension="time", value='(%s)/1000'%s_expr)
d.add(dv)


Expand Down Expand Up @@ -177,8 +184,8 @@ def create_cells(channels_to_include):
seg_type="soma",
)

# Leak channel
if 'leak' in channels_to_include:
# Leak channel
cell.add_channel_density(
cell_doc,
cd_id="leak_chans",
Expand All @@ -189,9 +196,33 @@ def create_cells(channels_to_include):
ion_chan_def_file=create_channel_file("leak", cell_id, xpps[cell_id], species='non_specific'),
)

# SHK1 CHANNELS
if 'shak' in channels_to_include:
chan_id = 'shak'
ion = 'k'
g_param = 'gshak'
gates={'m':[1,'minf_shak','tm_shak'],'h':[1,'hinf_shak','th_shak']}
extra_params = ['shiftV05']

cell.add_channel_density(
cell_doc,
cd_id="%s_chans"%chan_id,
cond_density="%s S_per_m2" % xpps[cell_id]["parameters"][g_param],
erev="%smV" % xpps[cell_id]["parameters"]["e%s"%ion],
ion=ion,
ion_channel="%s_%s" % (cell_id,chan_id),
ion_chan_def_file=create_channel_file(
chan_id,
cell_id,
xpps[cell_id],
species=ion,
gates=gates,
extra_params = extra_params
),
)

# IRK/Kir channel
if 'kir' in channels_to_include:
# IRK/Kir channel
cell.add_channel_density(
cell_doc,
cd_id="kir_chans",
Expand All @@ -205,17 +236,28 @@ def create_cells(channels_to_include):
xpps[cell_id],
species='k',
gates={'m':[1,'minf_kir','tm_kir']},
parameters=[
"va_kir",
"ka_kir",
"p1tmkir",
"p2tmkir",
"p3tmkir",
"p4tmkir",
"p5tmkir",
"p6tmkir",
],
),
)

# CCA-1 channels
if 'cca' in channels_to_include:
chan_id = 'cca'
ion = 'ca'

cell.add_channel_density(
cell_doc,
cd_id="%s_chans"%chan_id,
cond_density="%s S_per_m2" % xpps[cell_id]["parameters"]["gcca1"],
erev="%smV" % xpps[cell_id]["parameters"]["e%s"%ion],
ion=ion,
ion_channel="%s_%s" % (cell_id,chan_id),
ion_chan_def_file=create_channel_file(
chan_id,
cell_id,
xpps[cell_id],
species=ion,
gates={'m':[2,'minf_cca1','tm_cca1'],'h':[1,'hinf_cca1','th_cca1']},
extra_params = ['f3ca','f4ca']
),
)

Expand All @@ -235,7 +277,7 @@ def create_cells(channels_to_include):
)

sim, net = generate_nmllite(
cell_id, duration=400, config="IClamp", parameters=None
cell_id, duration=1400, config="IClamp", parameters=None
)

################################################################################
Expand All @@ -251,4 +293,5 @@ def create_cells(channels_to_include):

channels_to_include = ['leak']
channels_to_include = ['leak','kir']
channels_to_include = ['leak','kir','shak','cca']
create_cells(channels_to_include)
2 changes: 1 addition & 1 deletion NeuroML2/IClamp_RMD.net.nml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<network id="IClamp_RMD" type="networkWithTemperature" temperature="34.0degC">
<notes>A network model: IClamp_RMD</notes>
<property tag="recommended_dt_ms" value="0.025"/>
<property tag="recommended_duration_ms" value="400.0"/>
<property tag="recommended_duration_ms" value="1400.0"/>
<population id="pop_RMD" component="RMD" size="1" type="populationList">
<property tag="color" value="0 0.8 0"/>
<property tag="region" value="Worm"/>
Expand Down
4 changes: 2 additions & 2 deletions NeuroML2/LEMS_Sim_IClamp_RMD.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<Include file="IClamp_RMD.net.nml"/>
<Include file="RMD.cell.nml"/>

<Simulation id="Sim_IClamp_RMD" length="400.0ms" step="0.025ms" target="IClamp_RMD" seed="12345"> <!-- Note seed: ensures same random numbers used every run -->
<Display id="pop_RMD_v" title="Plots of pop_RMD_v" timeScale="1ms" xmin="-40.0" xmax="440.00000000000006" ymin="-80" ymax="40">
<Simulation id="Sim_IClamp_RMD" length="1400.0ms" step="0.025ms" target="IClamp_RMD" seed="12345"> <!-- Note seed: ensures same random numbers used every run -->
<Display id="pop_RMD_v" title="Plots of pop_RMD_v" timeScale="1ms" xmin="-140.0" xmax="1540.0000000000002" ymin="-80" ymax="40">
<Line id="pop_RMD_0_RMD_v" quantity="pop_RMD/0/RMD/v" scale="1mV" color="#d54f33" timeScale="1ms"/>
</Display>

Expand Down
4 changes: 4 additions & 0 deletions NeuroML2/RMD.cell.nml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<neuroml xmlns="http://www.neuroml.org/schema/neuroml2" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.neuroml.org/schema/neuroml2 https://raw.github.com/NeuroML/NeuroML2/development/Schemas/NeuroML2/NeuroML_v2.3.xsd" id="RMD">
<notes>A cell from Nicoletti et al. 2019</notes>
<include href="RMD_leak.channel.nml"/>
<include href="RMD_shak.channel.nml"/>
<include href="RMD_kir.channel.nml"/>
<include href="RMD_cca.channel.nml"/>
<cell id="RMD">
<notes>RMD cell from Nicoletti et al. 2019</notes>
<morphology id="morphology">
Expand All @@ -21,7 +23,9 @@
<biophysicalProperties id="biophys">
<membraneProperties>
<channelDensity id="leak_chans" ionChannel="RMD_leak" condDensity="0.4 S_per_m2" erev="-80.0mV" ion="non_specific"/>
<channelDensity id="shak_chans" ionChannel="RMD_shak" condDensity="1.1 S_per_m2" erev="-80.0mV" ion="k"/>
<channelDensity id="kir_chans" ionChannel="RMD_kir" condDensity="0.2 S_per_m2" erev="-80.0mV" ion="k"/>
<channelDensity id="cca_chans" ionChannel="RMD_cca" condDensity="3.1 S_per_m2" erev="60.0mV" ion="ca"/>
<spikeThresh value="0mV"/>
<specificCapacitance value="0.0012 F_per_m2"/>
<initMembPotential value="-70mV"/>
Expand Down
Loading

0 comments on commit 113b1a1

Please sign in to comment.