Skip to content

Commit

Permalink
Adding nmllite to generate figures 4C and 7B from paper
Browse files Browse the repository at this point in the history
  • Loading branch information
pgleeson committed May 28, 2024
1 parent 8ac0100 commit 6d66daf
Show file tree
Hide file tree
Showing 6 changed files with 293 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ arm64
/LEMS_RMD.xml
/report.txt
/NeuroML2/Test_AWCon.ode
/NeuroML2/Fig4C_AWCon.json
/NeuroML2/Sim_Fig4C_AWCon.json
/NeuroML2/Fig7B_RMD.json
/NeuroML2/Sim_Fig7B_RMD.json
64 changes: 64 additions & 0 deletions NeuroML2/Fig4C_AWCon.net.nml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<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.1.xsd" id="Fig4C_AWCon">
<notes>Generated by NeuroMLlite v0.5.9
Generated network: Fig4C_AWCon
Generation seed: 1234</notes>
<include href="AWCon.cell.nml"/>
<pulseGenerator id="iclamp_stim_min4" delay="200ms" duration="500ms" amplitude="-4pA"/>
<pulseGenerator id="iclamp_stim_0" delay="200ms" duration="500ms" amplitude="0pA"/>
<pulseGenerator id="iclamp_stim_4" delay="200ms" duration="500ms" amplitude="4pA"/>
<pulseGenerator id="iclamp_stim_8" delay="200ms" duration="500ms" amplitude="8pA"/>
<pulseGenerator id="iclamp_stim_12" delay="200ms" duration="500ms" amplitude="12pA"/>
<pulseGenerator id="iclamp_stim_16" delay="200ms" duration="500ms" amplitude="16pA"/>
<pulseGenerator id="iclamp_stim_20" delay="200ms" duration="500ms" amplitude="20pA"/>
<network id="Fig4C_AWCon" type="networkWithTemperature" temperature="34.0degC">
<notes>A network model: Fig4C_AWCon</notes>
<property tag="recommended_dt_ms" value="0.025"/>
<property tag="recommended_duration_ms" value="800.0"/>
<population id="pop_AWCon" component="AWCon" size="7" type="populationList">
<property tag="color" value="0.8 0 0"/>
<property tag="region" value="Worm"/>
<instance id="0">
<location x="966.453535692138757" y="44.073259917535268" z="7.491470058587191"/>
</instance>
<instance id="1">
<location x="910.975962449124154" y="93.926899736376399" z="582.227573058949133"/>
</instance>
<instance id="2">
<location x="671.563481487985086" y="8.393822683708397" z="766.480932791796249"/>
</instance>
<instance id="3">
<location x="236.809775363117751" y="3.081402172660996" z="788.772717236283484"/>
</instance>
<instance id="4">
<location x="346.088965597123092" y="62.328147503916853" z="615.815695103615212"/>
</instance>
<instance id="5">
<location x="148.55463870828757" y="18.309064740993165" z="114.412969688687639"/>
</instance>
<instance id="6">
<location x="14.618780486909122" y="48.675154060475833" z="964.901560916215658"/>
</instance>
</population>
<inputList id="input_iclamp_stim_min4" population="pop_AWCon" component="iclamp_stim_min4">
<input id="0" target="../pop_AWCon/0/AWCon" destination="synapses"/>
</inputList>
<inputList id="input_iclamp_stim_0" population="pop_AWCon" component="iclamp_stim_0">
<input id="0" target="../pop_AWCon/1/AWCon" destination="synapses"/>
</inputList>
<inputList id="input_iclamp_stim_4" population="pop_AWCon" component="iclamp_stim_4">
<input id="0" target="../pop_AWCon/2/AWCon" destination="synapses"/>
</inputList>
<inputList id="input_iclamp_stim_8" population="pop_AWCon" component="iclamp_stim_8">
<input id="0" target="../pop_AWCon/3/AWCon" destination="synapses"/>
</inputList>
<inputList id="input_iclamp_stim_12" population="pop_AWCon" component="iclamp_stim_12">
<input id="0" target="../pop_AWCon/4/AWCon" destination="synapses"/>
</inputList>
<inputList id="input_iclamp_stim_16" population="pop_AWCon" component="iclamp_stim_16">
<input id="0" target="../pop_AWCon/5/AWCon" destination="synapses"/>
</inputList>
<inputList id="input_iclamp_stim_20" population="pop_AWCon" component="iclamp_stim_20">
<input id="0" target="../pop_AWCon/6/AWCon" destination="synapses"/>
</inputList>
</network>
</neuroml>
50 changes: 50 additions & 0 deletions NeuroML2/Fig7B_RMD.net.nml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<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.1.xsd" id="Fig7B_RMD">
<notes>Generated by NeuroMLlite v0.5.9
Generated network: Fig7B_RMD
Generation seed: 1234</notes>
<include href="RMD.cell.nml"/>
<pulseGenerator id="iclamp_stim_min2" delay="110ms" duration="50ms" amplitude="-2pA"/>
<pulseGenerator id="iclamp_stim_2" delay="110ms" duration="50ms" amplitude="2pA"/>
<pulseGenerator id="iclamp_stim_6" delay="110ms" duration="50ms" amplitude="6pA"/>
<pulseGenerator id="iclamp_stim_10" delay="110ms" duration="50ms" amplitude="10pA"/>
<pulseGenerator id="iclamp_hyp" delay="210ms" duration="20ms" amplitude="-15pA"/>
<network id="Fig7B_RMD" type="networkWithTemperature" temperature="34.0degC">
<notes>A network model: Fig7B_RMD</notes>
<property tag="recommended_dt_ms" value="0.025"/>
<property tag="recommended_duration_ms" value="250.0"/>
<population id="pop_RMD" component="RMD" size="4" type="populationList">
<property tag="color" value="0.8 0 0"/>
<property tag="region" value="Worm"/>
<instance id="0">
<location x="966.453535692138757" y="44.073259917535268" z="7.491470058587191"/>
</instance>
<instance id="1">
<location x="910.975962449124154" y="93.926899736376399" z="582.227573058949133"/>
</instance>
<instance id="2">
<location x="671.563481487985086" y="8.393822683708397" z="766.480932791796249"/>
</instance>
<instance id="3">
<location x="236.809775363117751" y="3.081402172660996" z="788.772717236283484"/>
</instance>
</population>
<inputList id="input_iclamp_stim_min2" population="pop_RMD" component="iclamp_stim_min2">
<input id="0" target="../pop_RMD/0/RMD" destination="synapses"/>
</inputList>
<inputList id="input_iclamp_stim_2" population="pop_RMD" component="iclamp_stim_2">
<input id="0" target="../pop_RMD/1/RMD" destination="synapses"/>
</inputList>
<inputList id="input_iclamp_stim_6" population="pop_RMD" component="iclamp_stim_6">
<input id="0" target="../pop_RMD/2/RMD" destination="synapses"/>
</inputList>
<inputList id="input_iclamp_stim_10" population="pop_RMD" component="iclamp_stim_10">
<input id="0" target="../pop_RMD/3/RMD" destination="synapses"/>
</inputList>
<inputList id="input_iclamp_hyp" population="pop_RMD" component="iclamp_hyp">
<input id="0" target="../pop_RMD/0/RMD" destination="synapses"/>
<input id="1" target="../pop_RMD/1/RMD" destination="synapses"/>
<input id="2" target="../pop_RMD/2/RMD" destination="synapses"/>
<input id="3" target="../pop_RMD/3/RMD" destination="synapses"/>
</inputList>
</network>
</neuroml>
93 changes: 93 additions & 0 deletions NeuroML2/GenerateExamples.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
from neuromllite import *
from neuromllite.NetworkGenerator import *
from neuromllite.utils import create_new_model
import sys


def generate(cell, config, parameters=None):
reference = "%s_%s" % (config, cell)

cell_id = "%s" % cell
cell_nmll = Cell(id=cell_id, neuroml2_source_file="%s.cell.nml" % (cell))

amps = [-4, 0, 4, 8, 12, 16, 20]
stim_delay = 100
stim_dur = 500
post_stim = 100
extra_init = 100

if cell == "RMD":
amps = [-2, 2, 6, 10]
stim_delay = 10
stim_dur = 50
post_stim = 90
extra_init = 100

sim, net = create_new_model(
reference,
duration=extra_init + stim_delay + stim_dur + post_stim,
dt=0.025, # ms
temperature=34, # degC
default_region="Worm",
parameters=parameters,
cell_for_default_population=cell_nmll,
)

net.populations[0].size = len(amps)

for i in amps:
ins = InputSource(
id="iclamp_stim_%s" % str(i).replace("-", "min"),
neuroml2_input="PulseGenerator",
parameters={
"amplitude": "%spA" % i,
"delay": "%sms" % (extra_init + stim_delay),
"duration": "%sms" % (stim_dur),
},
)
net.input_sources.append(ins)
net.inputs.append(
Input(
id="input_%s" % ins.id,
input_source=ins.id,
population=net.populations[0].id,
cell_ids=[amps.index(i)],
)
)
if config == "Fig7B":
hyp_amp = -15
hyp_delay = 50
hyp_dur = 20
ins = InputSource(
id="iclamp_hyp",
neuroml2_input="PulseGenerator",
parameters={
"amplitude": "%spA" % hyp_amp,
"delay": "%sms" % (extra_init + stim_delay + stim_dur + hyp_delay),
"duration": "%sms" % (hyp_dur),
},
)
net.input_sources.append(ins)
net.inputs.append(
Input(
id="input_%s" % ins.id,
input_source=ins.id,
population=net.populations[0].id,
percentage=100,
)
)

net.to_json_file()

return sim, net


if __name__ == "__main__":

sim, net = generate("AWCon", config="Fig4C")

check_to_generate_or_run(sys.argv, sim)

sim, net = generate("RMD", config="Fig7B")

check_to_generate_or_run(sys.argv, sim)
44 changes: 44 additions & 0 deletions NeuroML2/LEMS_Sim_Fig4C_AWCon.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<Lems>

<!--
This LEMS file has been automatically generated using PyNeuroML v1.2.15 (libNeuroML v0.6.0)
-->

<!-- Specify which component to run -->
<Target component="Sim_Fig4C_AWCon" reportFile="report.Sim_Fig4C_AWCon.txt"/>

<!-- Include core NeuroML2 ComponentType definitions -->
<Include file="Cells.xml"/>
<Include file="Networks.xml"/>
<Include file="Simulation.xml"/>

<Include file="PyNN.xml"/>
<Include file="Fig4C_AWCon.net.nml"/>
<Include file="AWCon.cell.nml"/>

<Simulation id="Sim_Fig4C_AWCon" length="800.0ms" step="0.025ms" target="Fig4C_AWCon" seed="12345"> <!-- Note seed: ensures same random numbers used every run -->
<Display id="pop_AWCon_v" title="Plots of pop_AWCon_v" timeScale="1ms" xmin="-80.0" xmax="880.0000000000001" ymin="-80" ymax="40">
<Line id="pop_AWCon_0_AWCon_v" quantity="pop_AWCon/0/AWCon/v" scale="1mV" color="#d54f33" timeScale="1ms"/>
<Line id="pop_AWCon_1_AWCon_v" quantity="pop_AWCon/1/AWCon/v" scale="1mV" color="#0534e4" timeScale="1ms"/>
<Line id="pop_AWCon_2_AWCon_v" quantity="pop_AWCon/2/AWCon/v" scale="1mV" color="#98e752" timeScale="1ms"/>
<Line id="pop_AWCon_3_AWCon_v" quantity="pop_AWCon/3/AWCon/v" scale="1mV" color="#bca074" timeScale="1ms"/>
<Line id="pop_AWCon_4_AWCon_v" quantity="pop_AWCon/4/AWCon/v" scale="1mV" color="#632794" timeScale="1ms"/>
<Line id="pop_AWCon_5_AWCon_v" quantity="pop_AWCon/5/AWCon/v" scale="1mV" color="#8a5d88" timeScale="1ms"/>
<Line id="pop_AWCon_6_AWCon_v" quantity="pop_AWCon/6/AWCon/v" scale="1mV" color="#df5954" timeScale="1ms"/>
</Display>

<OutputFile id="Sim_Fig4C_AWCon_pop_AWCon_v_dat" fileName="Sim_Fig4C_AWCon.pop_AWCon.v.dat">
<OutputColumn id="pop_AWCon_0_AWCon_v" quantity="pop_AWCon/0/AWCon/v"/>
<OutputColumn id="pop_AWCon_1_AWCon_v" quantity="pop_AWCon/1/AWCon/v"/>
<OutputColumn id="pop_AWCon_2_AWCon_v" quantity="pop_AWCon/2/AWCon/v"/>
<OutputColumn id="pop_AWCon_3_AWCon_v" quantity="pop_AWCon/3/AWCon/v"/>
<OutputColumn id="pop_AWCon_4_AWCon_v" quantity="pop_AWCon/4/AWCon/v"/>
<OutputColumn id="pop_AWCon_5_AWCon_v" quantity="pop_AWCon/5/AWCon/v"/>
<OutputColumn id="pop_AWCon_6_AWCon_v" quantity="pop_AWCon/6/AWCon/v"/>
</OutputFile>

</Simulation>

</Lems>
38 changes: 38 additions & 0 deletions NeuroML2/LEMS_Sim_Fig7B_RMD.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<Lems>

<!--
This LEMS file has been automatically generated using PyNeuroML v1.2.15 (libNeuroML v0.6.0)
-->

<!-- Specify which component to run -->
<Target component="Sim_Fig7B_RMD" reportFile="report.Sim_Fig7B_RMD.txt"/>

<!-- Include core NeuroML2 ComponentType definitions -->
<Include file="Cells.xml"/>
<Include file="Networks.xml"/>
<Include file="Simulation.xml"/>

<Include file="PyNN.xml"/>
<Include file="Fig7B_RMD.net.nml"/>
<Include file="RMD.cell.nml"/>

<Simulation id="Sim_Fig7B_RMD" length="250.0ms" step="0.025ms" target="Fig7B_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="-25.0" xmax="275.0" ymin="-80" ymax="40">
<Line id="pop_RMD_0_RMD_v" quantity="pop_RMD/0/RMD/v" scale="1mV" color="#d54f33" timeScale="1ms"/>
<Line id="pop_RMD_1_RMD_v" quantity="pop_RMD/1/RMD/v" scale="1mV" color="#0534e4" timeScale="1ms"/>
<Line id="pop_RMD_2_RMD_v" quantity="pop_RMD/2/RMD/v" scale="1mV" color="#98e752" timeScale="1ms"/>
<Line id="pop_RMD_3_RMD_v" quantity="pop_RMD/3/RMD/v" scale="1mV" color="#bca074" timeScale="1ms"/>
</Display>

<OutputFile id="Sim_Fig7B_RMD_pop_RMD_v_dat" fileName="Sim_Fig7B_RMD.pop_RMD.v.dat">
<OutputColumn id="pop_RMD_0_RMD_v" quantity="pop_RMD/0/RMD/v"/>
<OutputColumn id="pop_RMD_1_RMD_v" quantity="pop_RMD/1/RMD/v"/>
<OutputColumn id="pop_RMD_2_RMD_v" quantity="pop_RMD/2/RMD/v"/>
<OutputColumn id="pop_RMD_3_RMD_v" quantity="pop_RMD/3/RMD/v"/>
</OutputFile>

</Simulation>

</Lems>

0 comments on commit 6d66daf

Please sign in to comment.