Skip to content

Commit

Permalink
Different form of <gate> to ensure valid neuroml
Browse files Browse the repository at this point in the history
  • Loading branch information
pgleeson committed Apr 25, 2024
1 parent 8e001f9 commit 3b0a781
Show file tree
Hide file tree
Showing 15 changed files with 82 additions and 44 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ report.*.txt
/NeuroML2/LEMS_Test_RMD_cca.xml
/NeuroML2/LEMS_Test_RMD_shak.xml
/NeuroML2/LEMS_Test_*.xml
/RMD_2.ode
8 changes: 4 additions & 4 deletions NeuroML2/AWCon_cca.channel.nml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
<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">
<gate id="m" instances="2" type="gateHHtauInf">
<timeCourse type="cca_m_tau"/>
<steadyState type="cca_m_inf"/>
</gateHHtauInf>
<gateHHtauInf id="h" instances="1">
</gate>
<gate id="h" instances="1" type="gateHHtauInf">
<timeCourse type="cca_h_tau"/>
<steadyState type="cca_h_inf"/>
</gateHHtauInf>
</gate>
</ionChannelHH>
<ComponentType name="cca_m_inf" extends="baseVoltageDepVariable">
<Constant name="VOLT_SCALE" dimension="voltage" value="1 mV"/>
Expand Down
4 changes: 2 additions & 2 deletions NeuroML2/AWCon_kir.channel.nml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<notes>An ion channel from cell AWCon from Nicoletti et al. 2019</notes>
<ionChannelHH id="AWCon_kir" species="k" conductance="10pS">
<notes>AWCon_kir channel from Nicoletti et al. 2019</notes>
<gateHHtauInf id="m" instances="1">
<gate id="m" instances="1" type="gateHHtauInf">
<timeCourse type="kir_m_tau"/>
<steadyState type="kir_m_inf"/>
</gateHHtauInf>
</gate>
</ionChannelHH>
<ComponentType name="kir_m_inf" extends="baseVoltageDepVariable">
<Constant name="VOLT_SCALE" dimension="voltage" value="1 mV"/>
Expand Down
8 changes: 4 additions & 4 deletions NeuroML2/AWCon_shak.channel.nml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
<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">
<gate id="m" instances="1" type="gateHHtauInf">
<timeCourse type="shak_m_tau"/>
<steadyState type="shak_m_inf"/>
</gateHHtauInf>
<gateHHtauInf id="h" instances="1">
</gate>
<gate id="h" instances="1" type="gateHHtauInf">
<timeCourse type="shak_h_tau"/>
<steadyState type="shak_h_inf"/>
</gateHHtauInf>
</gate>
</ionChannelHH>
<ComponentType name="shak_m_inf" extends="baseVoltageDepVariable">
<Constant name="VOLT_SCALE" dimension="voltage" value="1 mV"/>
Expand Down
8 changes: 4 additions & 4 deletions NeuroML2/AWCon_shal.channel.nml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<notes>An ion channel from cell AWCon from Nicoletti et al. 2019</notes>
<ionChannelHH id="AWCon_shal" species="k" conductance="10pS">
<notes>AWCon_shal channel from Nicoletti et al. 2019</notes>
<gateHHtauInf id="m" instances="3">
<gate id="m" instances="3" type="gateHHtauInf">
<timeCourse type="shal_m_tau"/>
<steadyState type="shal_m_inf"/>
</gateHHtauInf>
<gateFractional id="h" instances="1">
</gate>
<gate id="h" instances="1" type="gateFractional">
<subGate id="hf" fractionalConductance="0.7">
<steadyState type="shal_h_hf_inf"/>
<timeCourse type="shal_h_hf_tau"/>
Expand All @@ -15,7 +15,7 @@
<steadyState type="shal_h_hs_inf"/>
<timeCourse type="shal_h_hs_tau"/>
</subGate>
</gateFractional>
</gate>
</ionChannelHH>
<ComponentType name="shal_m_inf" extends="baseVoltageDepVariable">
<Constant name="VOLT_SCALE" dimension="voltage" value="1 mV"/>
Expand Down
8 changes: 4 additions & 4 deletions NeuroML2/AWCon_unc2.channel.nml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
<notes>An ion channel from cell AWCon from Nicoletti et al. 2019</notes>
<ionChannelHH id="AWCon_unc2" species="ca" conductance="10pS">
<notes>AWCon_unc2 channel from Nicoletti et al. 2019</notes>
<gateHHtauInf id="m" instances="1">
<gate id="m" instances="1" type="gateHHtauInf">
<timeCourse type="unc2_m_tau"/>
<steadyState type="unc2_m_inf"/>
</gateHHtauInf>
<gateHHtauInf id="h" instances="1">
</gate>
<gate id="h" instances="1" type="gateHHtauInf">
<timeCourse type="unc2_h_tau"/>
<steadyState type="unc2_h_inf"/>
</gateHHtauInf>
</gate>
</ionChannelHH>
<ComponentType name="unc2_m_inf" extends="baseVoltageDepVariable">
<Constant name="VOLT_SCALE" dimension="voltage" value="1 mV"/>
Expand Down
32 changes: 30 additions & 2 deletions NeuroML2/GenerateNeuroML.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def _add_tc_ss(chan_id_in_cell, gate_id, inf_expr_param, tau_expr_param, chan_do
inf_expr = xpp["derived_variables"][inf_expr_param]
tau_expr = xpp["derived_variables"][tau_expr_param]

print("For channel %s, gate %s, inf = [%s], tau = [%s]"%(chan_id_in_cell, gate_id, inf_expr, tau_expr))

potential_parameters = []
for p in xpp["parameters"]:
if chan_id_in_cell in p:
Expand Down Expand Up @@ -101,12 +103,12 @@ def create_channel_file(chan_id_in_cell, cell_id, xpp, species, gates={}, extra_
if type(gates[gate_id]) == list:
ss, tc = _add_tc_ss(chan_id_in_cell, gate_id, gates[gate_id][1], gates[gate_id][2], chan_doc, xpp, extra_params)

gc = component_factory("GateHHTauInf", id=gate_id, instances=gates[gate_id][0], steady_state=ss, time_course=tc, validate=True)
gc = component_factory("GateHHUndetermined", type="gateHHtauInf", id=gate_id, instances=gates[gate_id][0], steady_state=ss, time_course=tc, validate=True)
channel.add(gc)

elif type(gates[gate_id]) == dict:

gc = component_factory("GateFractional", id=gate_id, instances=1, validate=False)
gc = component_factory("GateHHUndetermined", type="gateFractional", id=gate_id, instances=1, validate=False)

for sub_gate in gates[gate_id]:
# gates={'m':[3,'minf_shal','tm_shal'],'h':{'hf': [0.7,'hinf_shal','thf_shal'],'hs': [0.3,'hinf_shal','ths_shal']} }
Expand Down Expand Up @@ -343,6 +345,31 @@ def create_cells(channels_to_include):
),
)

# EGL-19 CHANNELS
if 'egl19' in channels_to_include:
chan_id = 'egl19'
ion = 'ca'
g_param = 'gegl19'
gates={'m':[1,'minf_egl19','tm_egl19'],'h':[1,'hinf_egl19','th_egl19']}
extra_params = []

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
),
)

# CCA-1 channels
if 'cca' in channels_to_include:
chan_id = 'cca'
Expand Down Expand Up @@ -400,5 +427,6 @@ def create_cells(channels_to_include):
channels_to_include = ['leak','kir','shak','cca']
channels_to_include = ['leak','shal','kir','shak','cca']
channels_to_include = ['leak','shal','egl36','kir','shak','cca']
channels_to_include = ['leak','shal','egl36','kir','shak','cca','unc2','egl19']
channels_to_include = ['leak','shal','egl36','kir','shak','cca','unc2']
create_cells(channels_to_include)
8 changes: 4 additions & 4 deletions NeuroML2/RMD_cca.channel.nml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
<notes>An ion channel from cell RMD from Nicoletti et al. 2019</notes>
<ionChannelHH id="RMD_cca" species="ca" conductance="10pS">
<notes>RMD_cca channel from Nicoletti et al. 2019</notes>
<gateHHtauInf id="m" instances="2">
<gate id="m" instances="2" type="gateHHtauInf">
<timeCourse type="cca_m_tau"/>
<steadyState type="cca_m_inf"/>
</gateHHtauInf>
<gateHHtauInf id="h" instances="1">
</gate>
<gate id="h" instances="1" type="gateHHtauInf">
<timeCourse type="cca_h_tau"/>
<steadyState type="cca_h_inf"/>
</gateHHtauInf>
</gate>
</ionChannelHH>
<ComponentType name="cca_m_inf" extends="baseVoltageDepVariable">
<Constant name="VOLT_SCALE" dimension="voltage" value="1 mV"/>
Expand Down
4 changes: 2 additions & 2 deletions NeuroML2/RMD_egl36.channel.nml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<notes>An ion channel from cell RMD from Nicoletti et al. 2019</notes>
<ionChannelHH id="RMD_egl36" species="k" conductance="10pS">
<notes>RMD_egl36 channel from Nicoletti et al. 2019</notes>
<gateFractional id="m" instances="1">
<gate id="m" instances="1" type="gateFractional">
<subGate id="m1" fractionalConductance="0.31">
<steadyState type="egl36_m_m1_inf"/>
<timeCourse type="egl36_m_m1_tau"/>
Expand All @@ -15,7 +15,7 @@
<steadyState type="egl36_m_m3_inf"/>
<timeCourse type="egl36_m_m3_tau"/>
</subGate>
</gateFractional>
</gate>
</ionChannelHH>
<ComponentType name="egl36_m_m1_inf" extends="baseVoltageDepVariable">
<Constant name="VOLT_SCALE" dimension="voltage" value="1 mV"/>
Expand Down
4 changes: 2 additions & 2 deletions NeuroML2/RMD_kir.channel.nml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<notes>An ion channel from cell RMD from Nicoletti et al. 2019</notes>
<ionChannelHH id="RMD_kir" species="k" conductance="10pS">
<notes>RMD_kir channel from Nicoletti et al. 2019</notes>
<gateHHtauInf id="m" instances="1">
<gate id="m" instances="1" type="gateHHtauInf">
<timeCourse type="kir_m_tau"/>
<steadyState type="kir_m_inf"/>
</gateHHtauInf>
</gate>
</ionChannelHH>
<ComponentType name="kir_m_inf" extends="baseVoltageDepVariable">
<Constant name="VOLT_SCALE" dimension="voltage" value="1 mV"/>
Expand Down
8 changes: 4 additions & 4 deletions NeuroML2/RMD_shak.channel.nml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
<notes>An ion channel from cell RMD from Nicoletti et al. 2019</notes>
<ionChannelHH id="RMD_shak" species="k" conductance="10pS">
<notes>RMD_shak channel from Nicoletti et al. 2019</notes>
<gateHHtauInf id="m" instances="1">
<gate id="m" instances="1" type="gateHHtauInf">
<timeCourse type="shak_m_tau"/>
<steadyState type="shak_m_inf"/>
</gateHHtauInf>
<gateHHtauInf id="h" instances="1">
</gate>
<gate id="h" instances="1" type="gateHHtauInf">
<timeCourse type="shak_h_tau"/>
<steadyState type="shak_h_inf"/>
</gateHHtauInf>
</gate>
</ionChannelHH>
<ComponentType name="shak_m_inf" extends="baseVoltageDepVariable">
<Constant name="VOLT_SCALE" dimension="voltage" value="1 mV"/>
Expand Down
8 changes: 4 additions & 4 deletions NeuroML2/RMD_shal.channel.nml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<notes>An ion channel from cell RMD from Nicoletti et al. 2019</notes>
<ionChannelHH id="RMD_shal" species="k" conductance="10pS">
<notes>RMD_shal channel from Nicoletti et al. 2019</notes>
<gateHHtauInf id="m" instances="3">
<gate id="m" instances="3" type="gateHHtauInf">
<timeCourse type="shal_m_tau"/>
<steadyState type="shal_m_inf"/>
</gateHHtauInf>
<gateFractional id="h" instances="1">
</gate>
<gate id="h" instances="1" type="gateFractional">
<subGate id="hf" fractionalConductance="0.7">
<steadyState type="shal_h_hf_inf"/>
<timeCourse type="shal_h_hf_tau"/>
Expand All @@ -15,7 +15,7 @@
<steadyState type="shal_h_hs_inf"/>
<timeCourse type="shal_h_hs_tau"/>
</subGate>
</gateFractional>
</gate>
</ionChannelHH>
<ComponentType name="shal_m_inf" extends="baseVoltageDepVariable">
<Constant name="VOLT_SCALE" dimension="voltage" value="1 mV"/>
Expand Down
8 changes: 4 additions & 4 deletions NeuroML2/RMD_unc2.channel.nml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
<notes>An ion channel from cell RMD from Nicoletti et al. 2019</notes>
<ionChannelHH id="RMD_unc2" species="ca" conductance="10pS">
<notes>RMD_unc2 channel from Nicoletti et al. 2019</notes>
<gateHHtauInf id="m" instances="1">
<gate id="m" instances="1" type="gateHHtauInf">
<timeCourse type="unc2_m_tau"/>
<steadyState type="unc2_m_inf"/>
</gateHHtauInf>
<gateHHtauInf id="h" instances="1">
</gate>
<gate id="h" instances="1" type="gateHHtauInf">
<timeCourse type="unc2_h_tau"/>
<steadyState type="unc2_h_inf"/>
</gateHHtauInf>
</gate>
</ionChannelHH>
<ComponentType name="unc2_m_inf" extends="baseVoltageDepVariable">
<Constant name="VOLT_SCALE" dimension="voltage" value="1 mV"/>
Expand Down
16 changes: 12 additions & 4 deletions NeuroML2/TestXPP.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@

from pyneuroml.xppaut import parse_script, to_lems, to_xpp, run_xpp_file


from pprint import pprint
parsed_data = parse_script("../RMD.ode")
pprint(parsed_data)

all_g = ['gleak','gshal','gkir','gshak','gegl36','gunc2','gegl19','gcca1','gslo1','gbk','gbk2','gslo2','gca','gsc','gnca']


all_g = ['gshal','gkir','gshak','gegl36','gunc2','gegl19','gcca1','gslo1','gbk','gbk2','gslo2','gca','gsc','gnca']
channels_to_include = ['leak']
channels_to_include = ['leak','shal','egl36','kir','shak','cca','unc2']

all_g.remove('gkir')
all_g.remove('gcca1')
for c in channels_to_include:
print('Including channel: %s'%c)
if c =='cca': c='cca1'
all_g.remove('g%s'%c)

for p in all_g:
parsed_data['parameters'][p] = 0

new_ode_file = 'Test_RMD.ode'
parsed_data['settings']['total'] = 800
new_ode = to_xpp(parsed_data, new_ode_file)


Expand Down
1 change: 1 addition & 0 deletions NeuroML2/clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mv *dat *txt LEMS_Test*.xml /tmp

0 comments on commit 3b0a781

Please sign in to comment.