Browse Source

copying to personal repo

master
Alan 2 years ago
commit
bf2ffa7315
  1. 31
      .gitignore
  2. 30
      LICENSE
  3. 343
      README.rst
  4. 321
      Windows_setup.md
  5. 1
      _config.yml
  6. 25
      cnmodel/__init__.py
  7. 23
      cnmodel/cells/__init__.py
  8. 967
      cnmodel/cells/bushy.py
  9. 447
      cnmodel/cells/cartwheel.py
  10. 1200
      cnmodel/cells/cell.py
  11. 897
      cnmodel/cells/dstellate.py
  12. 47
      cnmodel/cells/hh.py
  13. 516
      cnmodel/cells/msoprincipal.py
  14. 718
      cnmodel/cells/octopus.py
  15. 482
      cnmodel/cells/pyramidal.py
  16. 467
      cnmodel/cells/sgc.py
  17. 3
      cnmodel/cells/tests/cell_data/SGC_rat_a.pk
  18. 3
      cnmodel/cells/tests/cell_data/SGC_rat_bm.pk
  19. 3
      cnmodel/cells/tests/cell_data/bushy-mouse-typeII.pk
  20. 3
      cnmodel/cells/tests/cell_data/bushy_guineapig-typeII-I.pk
  21. 3
      cnmodel/cells/tests/cell_data/bushy_guineapig-typeII.pk
  22. 3
      cnmodel/cells/tests/cell_data/cartwheel_rat_I.pk
  23. 3
      cnmodel/cells/tests/cell_data/dstellate_guineapig-typeI-II.pk
  24. 3
      cnmodel/cells/tests/cell_data/dstellate_mouse-typeI-II.pk
  25. 3
      cnmodel/cells/tests/cell_data/octopus_guineapig-typeII-o.pk
  26. 3
      cnmodel/cells/tests/cell_data/pyramidal_rat_I.pk
  27. 3
      cnmodel/cells/tests/cell_data/tstellate_guineapig-typeI-c.pk
  28. 3
      cnmodel/cells/tests/cell_data/tstellate_guineapig-typeI-t.pk
  29. 3
      cnmodel/cells/tests/cell_data/tstellate_mouse-typeI-c.pk
  30. 3
      cnmodel/cells/tests/cell_data/tuberculoventral_mouse_I.pk
  31. 227
      cnmodel/cells/tests/test_cells.py
  32. 1089
      cnmodel/cells/tstellate.py
  33. 619
      cnmodel/cells/tuberculoventral.py
  34. 23
      cnmodel/custom_init.hoc
  35. 18
      cnmodel/data/__init__.py
  36. 321
      cnmodel/data/_db.py
  37. 234
      cnmodel/data/connectivity.py
  38. 582
      cnmodel/data/ionchannels.py
  39. 37
      cnmodel/data/populations.py
  40. 503
      cnmodel/data/synapses.py
  41. 72
      cnmodel/data/tests/test_db.py
  42. 9
      cnmodel/decorator/__init__.py
  43. 392
      cnmodel/decorator/decorator.py
  44. 109
      cnmodel/mechanisms/CaPCalyx.mod
  45. 134
      cnmodel/mechanisms/Gly5GC.mod
  46. 149
      cnmodel/mechanisms/Gly5PL.mod
  47. 147
      cnmodel/mechanisms/Gly5State.mod
  48. 131
      cnmodel/mechanisms/Gly6S.mod
  49. 64
      cnmodel/mechanisms/Iclamp2.mod
  50. 142
      cnmodel/mechanisms/NMDA.mod
  51. 212
      cnmodel/mechanisms/NMDA_Kampa.mod
  52. 125
      cnmodel/mechanisms/adex.mod
  53. 224
      cnmodel/mechanisms/ampa_trussell.mod
  54. 129
      cnmodel/mechanisms/atm.mod
  55. 98
      cnmodel/mechanisms/bkpkj.mod
  56. 157
      cnmodel/mechanisms/cabpump.mod
  57. 50
      cnmodel/mechanisms/cadiff.mod
  58. 100
      cnmodel/mechanisms/cadyn.mod
  59. 86
      cnmodel/mechanisms/cap.mod
  60. 71
      cnmodel/mechanisms/capmp.mod
  61. 32
      cnmodel/mechanisms/capump.mod
  62. 88
      cnmodel/mechanisms/cleftXmtr.mod
  63. 65
      cnmodel/mechanisms/gly.mod
  64. 196
      cnmodel/mechanisms/gly2.mod
  65. 101
      cnmodel/mechanisms/hcno.mod
  66. 103
      cnmodel/mechanisms/hcno_bo.mod
  67. 48
      cnmodel/mechanisms/iStim.mod
  68. 56
      cnmodel/mechanisms/ihpkj.mod
  69. 134
      cnmodel/mechanisms/ihpyr.mod
  70. 142
      cnmodel/mechanisms/ihpyr_adj.mod
  71. 155
      cnmodel/mechanisms/ihsgc_apical.mod
  72. 154
      cnmodel/mechanisms/ihsgc_basalmiddle.mod
  73. 79
      cnmodel/mechanisms/ihvcn.mod
  74. 188
      cnmodel/mechanisms/inav11.mod
  75. 136
      cnmodel/mechanisms/jsrnaf.mod
  76. 104
      cnmodel/mechanisms/ka.mod
  77. 72
      cnmodel/mechanisms/kcnq.mod
  78. 92
      cnmodel/mechanisms/kdpyr.mod
  79. 111
      cnmodel/mechanisms/kht.mod
  80. 128
      cnmodel/mechanisms/kif.mod
  81. 108
      cnmodel/mechanisms/kir.mod
  82. 123
      cnmodel/mechanisms/kis.mod
  83. 109
      cnmodel/mechanisms/klt.mod
  84. 94
      cnmodel/mechanisms/kpkj.mod
  85. 67
      cnmodel/mechanisms/kpkj2.mod
  86. 63
      cnmodel/mechanisms/kpkjslow.mod
  87. 111
      cnmodel/mechanisms/kpksk.mod
  88. 32
      cnmodel/mechanisms/leak.mod
  89. 379
      cnmodel/mechanisms/multisite.mod
  90. 100
      cnmodel/mechanisms/na.mod
  91. 103
      cnmodel/mechanisms/nacn.mod
  92. 138
      cnmodel/mechanisms/nacncoop.mod
  93. 130
      cnmodel/mechanisms/nap.mod
  94. 137
      cnmodel/mechanisms/napyr.mod
  95. 17
      cnmodel/mechanisms/pkjlk.mod
  96. 196
      cnmodel/mechanisms/rsg.mod
  97. 40
      cnmodel/mechanisms/tests/test_mechanisms.py
  98. 72
      cnmodel/mechanisms/vecevent.mod
  99. 12
      cnmodel/morphology/__init__.py
  100. 90
      cnmodel/morphology/bushy_stick.hoc
  101. Some files were not shown because too many files have changed in this diff Show More

31
.gitignore vendored

@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
*.pyc
*.npz
*.lock
*.bak
*.dat
cache
i386
cnmodel/mechanisms/*.c
cnmodel/mechanisms/*.o
cnmodel/an_model/model/*.mexmaci64
x86_64
cnmodel/an_model
doc/build
build
dist/
cnmodel.egg*
.cache*
.pytest*
Figure6*
project/__pycache__
project/testing.py
how
*.dll
.idea/
project/run_data/
*__pycache__/
.gitattributes

30
LICENSE

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
BSD 3-Clause License
Copyright (c) 2017 Paul B. Manis, Luke Campagnola, University of North Carolina
at Chapel Hill
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

343
README.rst

@ -0,0 +1,343 @@ @@ -0,0 +1,343 @@
Changes
=======
This version of cnmodel runs under Python3.6 or later, using Neuron 7.6. New features include a method for changing the data tables on the fly without editing the original tables, and a tool for fitting Exp2Syn "simple" PSCs to the multisite PSC data (or, potentially, to experimental data) to get parameters for the synapse description table.
About CNModel
=============
CNModel is a Python-based interface to NEURON models of cochlear nucleus neurons, synapses, network connectivity. To drive the model with sound stimuli, the Zilany et al (2010, 2014) auditory periphery model is used to generate auditory nerve spike trains (either via the "cochlea" Python package or by the original MATLAB model; see below). The overall goal is to provide a platform for modeling networks of cochlear nucleus neurons with different levels of biological realism in the context of an accurate simulation of auditory nerve input.
At the lowest level are NEURON-based implementations of ion channels and synapses. Ion channel models for potassium channels are derived largely from the measurements and models of Rothman and Manis (2003abc), and Kanold and Manis (1999, 2001); other channels are derived or modified from the literature. Cell models are in turn based on the insertion of ion channels in densities based on measurements in guinea pig and mouse. The "point" somatic cell models, which form the base set of models in CNModel, replicate the data reported in the original papers.
The postsynaptic receptor/conductance models are based on kinetic models of glutamate (Raman and Trussell, 1992) and glycinergic receptors, as adjusted to match measurements of synaptic conductances from the mouse cochlear nucleus collected in Xie and Manis, 2013. The glutamate receptor models include desensitization and the effects of internal polyamine receptor block, based on the kinetic scheme of Woodhull (1982).
The presynaptic release model includes a multisite, probabilistic synapse that includes time-dependent changes in release probability based on the Dittman, Kreitzer and Regehr (J Neurosci. 2000 Feb 15;20(4):1374-85) kinetic scheme. Although detailed, this model is computationally expensive and likely not suitable for large scale network simulations. Other simpler models of synapses are also included.
Network connectivity may be defined programmatically, or based on a table of connectivity patterns. A table with estimates derived from the literature is included in the source.
Included in this package is a set of test suites for different components. An overriding set of unit tests is available to confirm performance of the base models against a set of reference runs, several of which are in turn directly traceable to the original manuscripts. The test suites are useful in verifying performance of the model after modifications of the code or changes in the installation (upgrades of Python or Matlab, for example).
A manuscript describing this package has been published:
--------------------------------------------------------
Paul B. Manis, Luke Campagnola,
A biophysical modelling platform of the cochlear nucleus and other auditory circuits:
From channels to networks,
Hearing Research,
Volume 360,
2018,
Pages 76-91,
ISSN 0378-5955,
https://doi.org/10.1016/j.heares.2017.12.017.
Open Access: http://www.sciencedirect.com/science/article/pii/S037859551730360X
If you use this package, we would appreciate it if you cite our work in any publications or abstracts.
Installation requirements
-------------------------
This package depends on the following:
1. Python 3.6 with numpy (1.14.3), scipy (1.1.0), lmfit (0.9.11), matplotlib (3.0.0), faulthandler, and pyqtgraph (0.11.0). The cochlea module requires pandas as well.
An Anaconda install with the appropriate scientific packages works well::
conda install python=3.6 pyqt pyqtgraph matplotlib numpy scipy pandas pytest cython
pip install resampy
pip install lmfit
pip install cochlea
or:
conda create --name py3mpl3 python=3.6 pyqt pyqtgraph matplotlib=3 numpy scipy pandas pytest cython
pip install resampy
pip install lmfit
pip install cochlea
(Note that under MacOSX, python 3.7 is usable, but the Windows versio of Matlab R2018b is restricted
to python 3.6)
2. A Python-linked version of NEURON (www.neuron.yale.edu). The code has been tested with NEURON 7.5 and 7.6.
3. A C compiler (gcc). Needed for compilation of mechanisms for NEURON.
4. The Zilany et al (JASA 2014) auditory periphery model. This can be provided one of two ways:
* The Python-based cochlea model by Rudnicki and Hemmert at https://github.com/mrkrd/cochlea.
This is probably best installed via pip per the instructions on the PyPi site: ``pip install cochlea``.
* The original MATLAB-based Zilany model; requires MATLAB 2011 or later. A C compiler will also
be needed to build this model. The model should be placed in the directory
``cnmodel/cnmodel/an_model/model``, with the following components: ANmodel.m, complex.c, complex.h,
complex.hpp, ffGn.m, fituaudiogram2.m, mexANmodel.m, model_IHC.c, model_Synapse.c,
and the THRESHOLD_ALL_* files. When cnmodel attempts to access this code the first time,
it will perform the necessary compilation.
5. neuronvis (optional) available at https://github.com/campagnola/neuronvis or https://github.com/pbmanis/neuronvis).
This provides 3D visualization for morphology.
After the code is installed, enter the cnmodel directory and compile the NEURON mod files::
$ nrnivmodl cnmodel/mechanisms
This will create a directory ("x86_64" or "special") in the top cnmodel directory with the compiled mechanisms.
Under Windows 10, use::
$ mknrndll cnmodel\mechanisms
to do the same thing.
For more detailed information on setup in a Windows environment, see the file Windows_setup.md. Thanks to Laurel Carney for prompting the generation of this set of instructions, and for identifying issues on Windows.
Windows caveat:
--------------
Manually compile the mex files (using Matlab, go to the an_model/models folder, and use mexANmodel.m to compile the files). Then, add the an_model/model folder to the Matlab path, so that it can find the files when needed.
For more detailed information on setup in a Windows environment, see the file Windows_setup.md. Thanks to Laurel Carney for prompting the generation of this set of instructions, and for identifying issues on Windows.
Note: *This package is not yet compatible with Python 3.x. Neuron is not yet compatible with Python 3.x*
Testing
-------
Make sure you are in the cnmodel directory, and that you have selected the right environment in Anaconda (in
my case, this is usually py3mpl3).
At this point::
After the code is installed, enter the cnmodel directory and compile the NEURON mod files::
$ nrnivmodl cnmodel/mechanisms
This will create a directory ("x86_64" or "special") in the top cnmodel directory with the compiled mechanisms.
Then::
$ python examples/toy_model.py
should generate a plot with several sets of traces showing responses of individual neuron models to depolarizing and hyperpolarizing current steps.
The test suite should be run as::
$ python test.py
This will test each of the models against reference data, the synapse mechanisms, a number of internal routines, and the auditory nerve model. The tests should pass for each component. Failures may indicate incorrect installation or incorrect function within individual components. These should be corrected before proceeding with simulations.
Note
----
Under Windows, it may be best to use the standard windows command terminal rather than the "bash" terminal provided by NEURON, at least to run the Python scripts.
Matlab
------
This version has been tested with the Matlab AN model of Zilany et al., 2014.
Before using, you will need to compile the C code in an_model using Matlab's mex tool. First however, change the following code:
In model_Synapse.c:
Change (line 63 in the source)::
$ int nrep, pxbins, lp, outsize[2], totalstim;
to::
$ int nrep, pxbins, lp, totalstim;
$ size_t outsize[2];
Likewise, in model_IHC.c, change::
$ int nrep, pxbins, lp, outsize[2], totalstim, species;
to::
$ int nrep, pxbins, lp, totalstim, species;
$ size_t outsize[2];
Then, in Matlab, go to the cnmodel/an_model/model directory, and run::
$ mexANmodel
Then, cd to an_model and run::
$ testANmodel
to confirm that the model is installed and working.
(You may need to add the model directory to the Matlab path.)
Figures
-------
The data for the figures in the manuscript (Manis and Campagnola, Hearing Research 2018) can be generated using the bash script "figures.sh" in the examples subdirectory.
From the main cnmodel directory::
$ ./examples figures.sh fignum
where fignum is one of 2a, 2b, 2c, 3, 4, 5, 6a, 6b, or 7.
Note that Figure 7 may take several **hours** to generate.
Example code and tests
----------------------
A number of additional tests are included in the examples directory.
- `test_an_model.py` verifies that the auditory nerve model can be run. If necessary, it will compile (using MEX) the mechanisms for matlab.
- `test_ccstim.py` tests the generation of different stimulus waveforms by the pulse generator module.
- `test_cells.py` runs different cell models in current or voltage clamp.
Usage::
test_cells.py celltype species[-h] [--type TYPE] [--temp TEMP] [-m MORPHOLOGY]
[--nav NAV] [--ttx] [-p PULSETYPE] [--vc | --cc | --rmp]
For example: ``python test_cells.py bushy mouse --cc --temp 34``
- `test_cells.py` can run protocols on selected cell models.
Usage::
test_cells.py [-h] [--type TYPE] [--temp TEMP] [-m MORPHOLOGY]
[--nav NAV] [--ttx] [-p PULSETYPE] [--vc | --cc | --rmp]
celltype species
- `test_circuit.py` tests the generation of circuits with populations of cells. No simulations are run.
- `test_decorator.py` generates an IV curve for the reconstructed cell LC_bushy.hoc (Figure 5B,C)
- `test_mechanisms.py` runs a voltage clamp I/V protocol on a selected mechanism and displays the result.
Usage::
python test_mechanisms.py <mechname>
Available channel mechanisms:
========== ========= ========== ============= ==================
CaPCalyx KIR bkpkj hcno hcnobo
hh hpkj ihpyr ihsgcApical ihsgcBasalMiddle
ihvcn jsrna k_ion ka kcnq
kdpyr kht kif kis klt
kpkj kpkj2 kpkjslow kpksk leak
lkpkj na naRsg na_ion nacn
nacncoop nap napyr nav11
========== ========= ========== ============= ==================
- `test_mso_inputs.py` runs a circuit that creates a point MSO neuron, innervated by bushy cells from independent "ears". This demonstrates how to construct a binaural circuit using CNModel.
- `test_physiology.py` runs a large VCN circuit that converges onto a single bushy cell. This run can take a long time. The output was used to create Figure 7 of the manuscript.
- `test_populations.py` tests synaptic connections between two cell types. Usage::
python test_populations.py <pre_celltype> <post_celltype>
- `test_sgc_input_phaselocking.py` tests phase locking with SGC inputs to a bushy cell.
- `test_sgc_input_PSTH.py` shows SGC inputs and postsynaptic bushy cell PSTHs.
- `test_sgc_input.py` demonstrates SGC input to a VCN bushy cell.
- `test_simple_synapses.py` tests simple Exp2Syn inputs to different cell types. Usage::
python test_synapses.py <pre_celltype> <post_celltype>
Supported cell types: sgc, bushy, tstellate, dstellate, tuberculoventral, pyramidal
- `test_sound_stim.py` generates spike trains from the selected model (cochlea, matlab) and plots rate-intensity functions for the 3 different SR groups.
- `test_sounds.py` generates waveforms for different kinds of sounds included in the sounds class.
- `test_synapses.py` evokes spikes in a presynaptic cell while recording the postsynaptic potential. Usage::
python test_synapses.py <pre_celltype> <post_celltype>
Supported cell types: sgc, bushy, tstellate, dstellate
- `toy_model.py` generates IV plots for each of the principal point cell types included in CNModel. This is the code that generates Figure 3 of the manuscript.
Potential Issues and Solutions
------------------------------
1. Occasionally one of the AN spike train files, which are stored in the directory `cnmodel/an_model/cache`, become locked. This can occur if the calling routines are aborted (^C, ^Z) in the middle of a transaction accessing the cache file, or perhaps during when parallel processing is enabled and a routine fails or is aborted. In this case, a file with the extension ``".lock"`` exists, which prevents the an_model code from accessing the file. The ``".lock"`` file needs to be deleted from the cache directory.
* First, print a list of the locked files::
$ find /path/to/cache -name '*.lock'
* Where /path/to/cache may be something like `cnmodel/an_model/cache`.
There is most likely only one such file in the diretory.
* Next, to delete the files::
$ find /path/to/cache -name '*.lock' -delete
* Under Windows (and other OS's), you should be able do accomplish the same thing
with the File Explorer/Finder, limiting the files by extension.
References
----------
1. Cao XJ, Oertel D. The magnitudes of hyperpolarization-activated and
low-voltage-activated potassium currents co-vary in neurons of the ventral
cochlear nucleus. J Neurophysiol. 2011 Aug;106(2):630-40. doi:
10.1152/jn.00015.2010. Epub 2011 May 11. PubMed PMID: 21562186; PubMed Central
PMCID: PMC3154804.
2. Cao XJ, Oertel D. Auditory nerve fibers excite targets through synapses that
vary in convergence, strength, and short-term plasticity. J Neurophysiol. 2010
Nov;104(5):2308-20. doi: 10.1152/jn.00451.2010. Epub 2010 Aug 25. PubMed PMID:
20739600; PubMed Central PMCID: PMC3350034.
3. Dittman JS, Kreitzer AC, Regehr WG. Interplay between facilitation, depression,
and residual calcium at three presynaptic terminals. J Neurosci. 2000
Feb 15;20(4):1374-85. PubMed PMID: 10662828.
1. Isaacson JS, Walmsley B. Counting quanta: direct measurements of transmitter
release at a central synapse. Neuron. 1995 Oct;15(4):875-84.
4. Kanold PO, Manis PB. A physiologically based model of discharge pattern
regulation by transient K+ currents in cochlear nucleus pyramidal cells. J
Neurophysiol. 2001 Feb;85(2):523-38. PubMed PMID: 11160490.
5. Kanold PO, Manis PB. Transient potassium currents regulate the discharge
patterns of dorsal cochlear nucleus pyramidal cells. J Neurosci. 1999 Mar
15;19(6):2195-208. PubMed PMID: 10066273.
6. Liu Q, Manis PB, Davis RL. Ih and HCN channels in murine spiral ganglion
neurons: tonotopic variation, local heterogeneity, and kinetic model. J Assoc Res
Otolaryngol. 2014 Aug;15(4):585-99. doi: 10.1007/s10162-014-0446-z. Epub 2014 Feb
21. Erratum in: J Assoc Res Otolaryngol. 2014 Aug;15(4):601. PubMed PMID:
24558054; PubMed Central PMCID: PMC4141436.
7. Raman IM, Trussell LO. The kinetics of the response to glutamate and kainate
in neurons of the avian cochlear nucleus. Neuron. 1992 Jul;9(1):173-86. PubMed
PMID: 1352983.
8. Rothman JS, Manis PB. The roles potassium currents play in regulating the
electrical activity of ventral cochlear nucleus neurons. J Neurophysiol. 2003
Jun;89(6):3097-113. PubMed PMID: 12783953.
9. Rothman JS, Manis PB. Kinetic analyses of three distinct potassium
conductances in ventral cochlear nucleus neurons. J Neurophysiol. 2003
Jun;89(6):3083-96. PubMed PMID: 12783952.
10. Rothman JS, Manis PB. Differential expression of three distinct potassium
currents in the ventral cochlear nucleus. J Neurophysiol. 2003 Jun;89(6):3070-82.
PubMed PMID: 12783951.
11. Rothman JS, Young ED, Manis PB. Convergence of auditory nerve fibers onto
bushy cells in the ventral cochlear nucleus: implications of a computational
model. J Neurophysiol. 1993 Dec;70(6):2562-83. PubMed PMID: 8120599.
12. Woodhull AM. Ionic blockage of sodium channels in nerve. J Gen Physiol. 1973
Jun;61(6):687-708. PubMed PMID: 4541078; PubMed Central PMCID: PMC2203489.
13. Xie R, Manis PB. Target-specific IPSC kinetics promote temporal processing in
auditory parallel pathways. J Neurosci. 2013 Jan 23;33(4):1598-614. doi:
10.1523/JNEUROSCI.2541-12.2013. PubMed PMID: 23345233; PubMed Central PMCID:
PMC3737999.
14. Zilany MS, Bruce IC, Carney LH. Updated parameters and expanded simulation
options for a model of the auditory periphery. J Acoust Soc Am. 2014
Jan;135(1):283-6. doi: 10.1121/1.4837815. PubMed PMID: 24437768; PubMed Central
PMCID: PMC3985897.
15. Zilany MS, Carney LH. Power-law dynamics in an auditory-nerve model can
account for neural adaptation to sound-level statistics. J Neurosci. 2010 Aug
4;30(31):10380-90. doi: 10.1523/JNEUROSCI.0647-10.2010. PubMed PMID: 20685981;
PubMed Central PMCID: PMC2935089.
16. Zilany MS, Bruce IC, Nelson PC, Carney LH. A phenomenological model of the
synapse between the inner hair cell and auditory nerve: long-term adaptation with
power-law dynamics. J Acoust Soc Am. 2009 Nov;126(5):2390-412. doi:
10.1121/1.3238250. PubMed PMID: 19894822; PubMed Central PMCID: PMC2787068.

321
Windows_setup.md

@ -0,0 +1,321 @@ @@ -0,0 +1,321 @@
CNMODEL Setup for Windows Systems
=================================
(as of 2 March 2018, tested on Windows 10)
On a bare system, you will need to install the following packages:
1. Anaconda Python 2.7 (this may also include the Microsoft Visual Studio for Python)
2. git
3. msvc2.7forpython (required for cochlea)
4. external python package from PyPi: cochlea
5. NEURON7.5 (this must be installed last)
6. cnmodel, cloned from the main repository with git
7. build the .dll file for the Neuron mechanisms used in cnmodel
Some installs are accomplished via a graphical interface (anaconda, git, msvc, neuron).
Other parts of the install are done from the terminal (Windows "Command Prompt" - look in the Windows Accessories)
Follow the instructions below to do this installation. The order only partially matters - msvcforpython must be installed before cochlea can be built; python should be installed before NEURON; and git is required get the cnmodel repository.
Step 1: Install Anaconda python for Python 2.7 for your system.
Note that NEURON is not yet compatible with Python 3.x
https://repo.continuum.io/archive/
The most recent versions of the Anaconda installer (5.x) are OK to use.
Check the box to set DOS path variables so can run from command prompt.
Install only for yourself.
If you want, create an environment for python 2.7, Using the standard windows terminal ("Command Prompt"), install the additional required packages::
conda create --name models python=2.7 pyqt pyqtgraph matplotlib numpy scipy pandas pytest faulthandler
Note: this may take a while, and will install many other packages that are required dependencies.
Now, activate the environment::
conda activate models
Or else, just install everything to the root environment:
conda install pyqt pyqtgraph matplotlib numpy scipy pytest faulthandler
If you are working with a previous Anaconda installation, you might need to do these steps::
conda update --all
conda update qt
The following must be retrieved from the PyPi repository (I had problems with the one in the anaconda repo)::
pip install lmfit
Step 2: Install git (a widely used source control module)::
https://git-scm.com/downloads
Step 3: Install MS visual studio for python::
https://www.visualstudio.com/vs/python/
Step 4: Install cochlea (Rudnicki and Hemmert's implementation of several models under python)::
pip install cochlea
This should build quickly and have no errors.
Step 5: Install NEURON7.5 for mswindows from::
www.neuron.yale.edu.
Restart the command window so that the paths to the python installation are updated.
Make sure that python and neuron are installed correctly together by testing the ability to import NEURON::
(base) pbmanis: Python $ python
Python 2.7.14 |Anaconda custom (64-bit)| (default, Dec 7 2017, 11:07:58)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from neuron import h
NEURON -- VERSION 7.5 master (6b4c19f) 2017-09-25
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2016
See http://neuron.yale.edu/neuron/credits
>>>
(^Z to exit)
Step 6: Go to where you want to put the model code repository, and clone the repo::
git clone https://github.com/cnmodel/cnmodel.git
Jump into the cnmodel directory.
Step 7: Find the mknrndll gui from where you installed neuron with the Explorer (the program in the nrn folder). Run the program, and select the directory cnmodel\cnmodel\mechanisms, then build.
This will make nrnmech.dll in the mechanisms directory.
Copy the nrnmech.dll into the main cnmodel directory.
Step 8: Run::
python setup.py develop
in the main cnmodel directory to make a library version in the anaconda site-packages directory. This will make cnmodel accessible as an import into python from any location. However, you will (on Windows) need to copy the nrnmech.dll file to the directory that you are starting in. (If you import cnmodel and there is not a list of mechanisms after the Neuron banner, then nrnmech.dll was not found).
Running
=======
The following should be all that is needed once everything is set up.
Go the the cnmodel main directory.
if you set up a Python environment, activate it to make sure you have the right dependencies available.
Now, these scripts should run just fine::
python examples/test_mechanisms.py klt
python examples/toy_model.py
python examples/test_synapses.py sgc bushy
python examples/test_phaselocking.py
You should also be able to run the full battery of tests::
python test.py
All the tests should pass (except perhaps with the exception dstellate->dstellate; this passes under MacOSX so we will need to investigate why it fails under Windows). MacOSX and Windows test results are listed below.
Notes
=====
1. You cannot use the "bash" terminal window that comes with neuron - it doesn't set the paths correctly for access to the anaconda python.
2. Some of the graphical displays are not correctly sized in Windows. You may need to expand the window to see all the plots (specifically, toy_model has this problem).
3. Report occurrences of failures to "import PyQt4" to: https://github.com/cnmodel/cnmodel/issues.
4. The test suite (python test.py) may fail on one test: dstellate -> dstellate synapses (as of 23Feb2018), and if you do not have Matlab, the Matlab test will be skipped.
Things solved with Windows
==========================
1. The test suite works and most tests pass (python test.py).
2. Qt5 and current anaconda install are acceptable (we are no longer trying to force Qt4).
3. The prior dependency on pylibrary has been removed.
Potential problems
==================
This software has been tested primarily on Mac OSX and Linux systems. Some tests have been performed on Windows. If issues are found, please report them via github as an issue (as noted above).
Test results
============
Windows 10 (24 Feb 2018; Qt5 Branch)
------------------------------------
::
C:\Users\pbmanis\Desktop\Python\cnmodel>python test.py > testresults.txt
NEURON -- VERSION 7.5 master (6b4c19f) 2017-09-25
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2016
See http://neuron.yale.edu/neuron/credits
loading membrane mechanisms from C:\Users\pbmanis\Desktop\Python\cnmodel\nrnmech.dll
Additional mechanisms from files
CaPCalyx.mod Gly5GC.mod Gly5PL.mod Gly5State.mod Gly6S.mod Iclamp2.mod NMDA.mod NMDA_Kampa.mod
ampa_trussell.mod bkpkj.mod cabpump.mod cadiff.mod cadyn.mod cap.mod capmp.mod capump.mod cleftXmtr.mod
gly.mod gly2.mod hcno.mod hcno_bo.mod iStim.mod ihpkj.mod ihpyr.mod ihsgc_apical.mod ihsgc_
basalmiddle.mod ihvcn.mod inav11.mod jsrnaf.mod ka.mod kcnq.mod kdpyr.mod kht.mod kif.mod
kir.mod kis.mod klt.mod kpkj.mod kpkj2.mod kpkjslow.mod kpksk.mod leak.mod multisite.mod
na.mod nacn.mod nacncoop.mod nap.mod napyr.mod pkjlk.mod rsg.mod vecevent.mod
Testing with flags: -v --tb=short cnmodel/
============================= test session starts =============================
platform win32 -- Python 2.7.14, pytest-3.3.2, py-1.5.2, pluggy-0.6.0 -- C:\Users\pbmanis\Anaconda2\python.exe
cachedir: .cache
rootdir: C:\Users\pbmanis\Desktop\Python\cnmodel, inifile:
collecting ... collected 36 items
cnmodel/an_model/tests/test_cache.py::test_cache PASSED [ 2%]
cnmodel/an_model/tests/test_cache.py::test_parallel PASSED [ 5%]
cnmodel/cells/tests/test_cells.py::test_bushy PASSED [ 8%]
cnmodel/cells/tests/test_cells.py::test_bushy21 PASSED [ 11%]
cnmodel/cells/tests/test_cells.py::test_bushy_mouse PASSED [ 13%]
cnmodel/cells/tests/test_cells.py::test_tstellate PASSED [ 16%]
cnmodel/cells/tests/test_cells.py::test_tstellate_mouse PASSED [ 19%]
cnmodel/cells/tests/test_cells.py::test_tstellatet PASSED [ 22%]
cnmodel/cells/tests/test_cells.py::test_dstellate PASSED [ 25%]
cnmodel/cells/tests/test_cells.py::test_dstellate_mouse PASSED [ 27%]
cnmodel/cells/tests/test_cells.py::test_octopus PASSED [ 30%]
cnmodel/cells/tests/test_cells.py::test_pyramidal PASSED [ 33%]
cnmodel/cells/tests/test_cells.py::test_tuberculoventral PASSED [ 36%]
cnmodel/cells/tests/test_cells.py::test_cartwheel PASSED [ 38%]
cnmodel/cells/tests/test_cells.py::test_sgc_basal_middle PASSED [ 41%]
cnmodel/cells/tests/test_cells.py::test_sgc_apical PASSED [ 44%]
cnmodel/data/tests/test_db.py::test_db PASSED [ 47%]
cnmodel/mechanisms/tests/test_mechanisms.py::test_max_open_probability PASSED [ 50%]
cnmodel/synapses/tests/test_psd.py::test_sgc_bushy_psd PASSED [ 52%]
cnmodel/synapses/tests/test_psd.py::test_sgc_tstellate_psd PASSED [ 55%]
cnmodel/synapses/tests/test_psd.py::test_sgc_dstellate_psd PASSED [ 58%]
cnmodel/synapses/tests/test_psd.py::test_sgc_octopus_psd PASSED [ 61%]
cnmodel/synapses/tests/test_synapses.py::test_sgc_bushy PASSED [ 63%]
cnmodel/synapses/tests/test_synapses.py::test_sgc_tstellate PASSED [ 66%]
cnmodel/synapses/tests/test_synapses.py::test_sgc_tstellate2 PASSED [ 69%]
cnmodel/synapses/tests/test_synapses.py::test_sgc_dstellate PASSED [ 72%]
cnmodel/synapses/tests/test_synapses.py::test_dstellate_bushy PASSED [ 75%]
cnmodel/synapses/tests/test_synapses.py::test_dstellate_tstellate PASSED [ 77%]
cnmodel/synapses/tests/test_synapses.py::test_dstellate_dstellate FAILED [ 80%]
cnmodel/util/tests/test_expfitting.py::test_fit1 PASSED [ 83%]
cnmodel/util/tests/test_expfitting.py::test_fit2 PASSED [ 86%]
cnmodel/util/tests/test_matlab.py::test_matlab SKIPPED [ 88%]
cnmodel/util/tests/test_sound.py::test_conversions PASSED [ 91%]
cnmodel/util/tests/test_sound.py::test_tonepip PASSED [ 94%]
cnmodel/util/tests/test_sound.py::test_noisepip PASSED [ 97%]
cnmodel/util/tests/test_stim.py::test_make_pulse PASSED [100%]
================================== FAILURES ===================================
__________________________ test_dstellate_dstellate ___________________________
cnmodel\synapses\tests\test_synapses.py:40: in test_dstellate_dstellate
SynapseTester('dstellate', 'dstellate')
cnmodel\synapses\tests\test_synapses.py:72: in __init__
UserTester.__init__(self, "%s_%s" % (pre, post), pre, post)
cnmodel\util\user_tester.py:33: in __init__
self.assert_test_info(*args, **kwds)
cnmodel\synapses\tests\test_synapses.py:108: in assert_test_info
super(SynapseTester, self).assert_test_info(*args, **kwds)
cnmodel\util\user_tester.py:127: in assert_test_info
self.compare_results(result, expect)
cnmodel\util\user_tester.py:60: in compare_results
self.compare_results(info[k], expect[k])
cnmodel\util\user_tester.py:63: in compare_results
self.compare_results(info[i], expect[i])
cnmodel\util\user_tester.py:79: in compare_results
self.compare_results(info[k], expect[k])
cnmodel\util\user_tester.py:71: in compare_results
assert np.all(inans == enans)
E AssertionError
---------------------------- Captured stdout call -----------------------------
<< D-stellate: JSR Stellate Type I-II cell model created >>
<< D-stellate: JSR Stellate Type I-II cell model created >>
Elapsed time for 1 Repetions: 0.355309
=============== 1 failed, 34 passed, 1 skipped in 96.33 seconds ===============
Mac OSX (24 Feb 2018; Qt5 Branch)
---------------------
::
(base) pbmanis: cnmodel [qt5+]$ python test.py
NEURON -- VERSION 7.5 master (6b4c19f) 2017-09-25
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2016
See http://neuron.yale.edu/neuron/credits
loading membrane mechanisms from x86_64/.libs/libnrnmech.so
Additional mechanisms from files
cnmodel/mechanisms//CaPCalyx.mod cnmodel/mechanisms//Gly5GC.mod cnmodel/mechanisms//Gly5PL.mod
cnmodel/mechanisms//Gly5State.mod cnmodel/mechanisms//Gly6S.mod cnmodel/mechanisms//Iclamp2.mod
cnmodel/mechanisms//NMDA.mod cnmodel/mechanisms//NMDA_Kampa.mod
cnmodel/mechanisms//ampa_trussell.mod cnmodel/mechanisms//bkpkj.mod
cnmodel/mechanisms//cabpump.mod cnmodel/mechanisms//cadiff.mod cnmodel/mechanisms//cadyn.mod
cnmodel/mechanisms//cap.mod cnmodel/mechanisms//capmp.mod
cnmodel/mechanisms//capump.mod cnmodel/mechanisms//cleftXmtr.mod
cnmodel/mechanisms//gly.mod cnmodel/mechanisms//gly2.mod cnmodel/mechanisms//hcno.mod
cnmodel/mechanisms//hcno_bo.mod cnmodel/mechanisms//iStim.mod cnmodel/mechanisms//ihpkj.mod
cnmodel/mechanisms//ihpyr.mod cnmodel/mechanisms//ihsgc_apical.mod
cnmodel/mechanisms//ihsgc_basalmiddle.mod cnmodel/mechanisms//ihvcn.mod
cnmodel/mechanisms//inav11.mod cnmodel/mechanisms//jsrnaf.mod
cnmodel/mechanisms//ka.mod cnmodel/mechanisms//kcnq.mod cnmodel/mechanisms//kdpyr.mod
cnmodel/mechanisms//kht.mod cnmodel/mechanisms//kif.mod cnmodel/mechanisms//kir.mod
cnmodel/mechanisms//kis.mod cnmodel/mechanisms//klt.mod cnmodel/mechanisms//kpkj.mod
cnmodel/mechanisms//kpkj2.mod cnmodel/mechanisms//kpkjslow.mod cnmodel/mechanisms//kpksk.mod
cnmodel/mechanisms//leak.mod cnmodel/mechanisms//multisite.mod cnmodel/mechanisms//na.mod
cnmodel/mechanisms//nacn.mod cnmodel/mechanisms//nacncoop.mod cnmodel/mechanisms//nap.mod c
nmodel/mechanisms//napyr.mod cnmodel/mechanisms//pkjlk.mod cnmodel/mechanisms//rsg.mod
cnmodel/mechanisms//vecevent.mod
Testing with flags: -v --tb=short cnmodel/
=============================================== test session starts ===============================================
platform darwin -- Python 2.7.14, pytest-3.0.7, py-1.4.33, pluggy-0.4.0 -- /Users/pbmanis/anaconda/bin/python
cachedir: .cache
rootdir: /Users/pbmanis/Desktop/Python/cnmodel, inifile:
collected 36 items
cnmodel/an_model/tests/test_cache.py::test_cache PASSED
cnmodel/an_model/tests/test_cache.py::test_parallel PASSED
cnmodel/cells/tests/test_cells.py::test_bushy PASSED
cnmodel/cells/tests/test_cells.py::test_bushy21 PASSED
cnmodel/cells/tests/test_cells.py::test_bushy_mouse PASSED
cnmodel/cells/tests/test_cells.py::test_tstellate PASSED
cnmodel/cells/tests/test_cells.py::test_tstellate_mouse PASSED
cnmodel/cells/tests/test_cells.py::test_tstellatet PASSED
cnmodel/cells/tests/test_cells.py::test_dstellate PASSED
cnmodel/cells/tests/test_cells.py::test_dstellate_mouse PASSED
cnmodel/cells/tests/test_cells.py::test_octopus PASSED
cnmodel/cells/tests/test_cells.py::test_pyramidal PASSED
cnmodel/cells/tests/test_cells.py::test_tuberculoventral PASSED
cnmodel/cells/tests/test_cells.py::test_cartwheel PASSED
cnmodel/cells/tests/test_cells.py::test_sgc_basal_middle PASSED
cnmodel/cells/tests/test_cells.py::test_sgc_apical PASSED
cnmodel/data/tests/test_db.py::test_db PASSED
cnmodel/mechanisms/tests/test_mechanisms.py::test_max_open_probability PASSED
cnmodel/synapses/tests/test_psd.py::test_sgc_bushy_psd PASSED
cnmodel/synapses/tests/test_psd.py::test_sgc_tstellate_psd PASSED
cnmodel/synapses/tests/test_psd.py::test_sgc_dstellate_psd PASSED
cnmodel/synapses/tests/test_psd.py::test_sgc_octopus_psd PASSED
cnmodel/synapses/tests/test_synapses.py::test_sgc_bushy PASSED
cnmodel/synapses/tests/test_synapses.py::test_sgc_tstellate PASSED
cnmodel/synapses/tests/test_synapses.py::test_sgc_tstellate2 PASSED
cnmodel/synapses/tests/test_synapses.py::test_sgc_dstellate PASSED
cnmodel/synapses/tests/test_synapses.py::test_dstellate_bushy PASSED
cnmodel/synapses/tests/test_synapses.py::test_dstellate_tstellate PASSED
cnmodel/synapses/tests/test_synapses.py::test_dstellate_dstellate PASSED
cnmodel/util/tests/test_expfitting.py::test_fit1 PASSED
cnmodel/util/tests/test_expfitting.py::test_fit2 PASSED
cnmodel/util/tests/test_matlab.py::test_matlab PASSED
cnmodel/util/tests/test_sound.py::test_conversions PASSED
cnmodel/util/tests/test_sound.py::test_tonepip PASSED
cnmodel/util/tests/test_sound.py::test_noisepip PASSED
cnmodel/util/tests/test_stim.py::test_make_pulse PASSED
=========================================== 36 passed in 94.05 seconds ============================================
(base) pbmanis: cnmodel [qt5+]$

1
_config.yml

@ -0,0 +1 @@ @@ -0,0 +1 @@
theme: jekyll-theme-cayman

25
cnmodel/__init__.py

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
__author__ = "Paul B. Manis and Luke Campagnola"
__version__ = "0.32a"
try:
import faulthandler
faulthandler.enable()
except ImportError:
pass
import logging
logging.basicConfig(level=logging.INFO, format="[%(process)s] %(message)s")
import os
dirname = os.path.abspath(os.path.dirname(__file__))
libpath = os.path.join(dirname, "..")
import neuron
try:
neuron.h.MultiSiteSynapse
except AttributeError:
neuron.load_mechanisms(libpath)
# flag to allow unit tests to store / overwrite test results
AUDIT_TESTS = False

23
cnmodel/cells/__init__.py

@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
"""
Cell definitions for models.
This class includes a number of different cell definitions and default
conductances for point models.
"""
from .bushy import *
from .tstellate import *
from .dstellate import *
from .cartwheel import *
from .pyramidal import *
from .sgc import *
from .octopus import *
from .tuberculoventral import *
from .msoprincipal import *
from .hh import *
from .cell import Cell
def cell_from_section(sec):
return Cell.from_section(sec)

967
cnmodel/cells/bushy.py

@ -0,0 +1,967 @@ @@ -0,0 +1,967 @@
from __future__ import print_function
from neuron import h
from collections import OrderedDict
from .cell import Cell
from .. import synapses
from ..util import nstomho
from ..util import Params
import numpy as np
from .. import data
import pprint
pp = pprint.PrettyPrinter(indent=4, width=60)
__all__ = ["Bushy", "BushyRothman"]
class Bushy(Cell):
type = "bushy"
@classmethod
def create(cls, model="RM03", **kwds):
if model == "RM03":
return BushyRothman(**kwds)
else:
raise ValueError("Bushy model %s is unknown", model)
def make_psd(self, terminal, psd_type, **kwds):
"""
Connect a presynaptic terminal to one post section at the specified location, with the fraction
of the "standard" conductance determined by gbar.
The default condition is designed to pass the unit test (loc=0.5)
Parameters
----------
terminal : Presynaptic terminal (NEURON object)
psd_type : either simple or multisite PSD for bushy cell
kwds: dictionary of options.
Two are currently handled:
postsite : expect a list consisting of [sectionno, location (float)]
AMPAScale : float to scale the ampa currents
"""
if (
"postsite" in kwds
): # use a defined location instead of the default (soma(0.5)
postsite = kwds["postsite"]
loc = postsite[1] # where on the section?
uname = (
"sections[%d]" % postsite[0]
) # make a name to look up the neuron section object
post_sec = self.hr.get_section(uname) # Tell us where to put the synapse.
else:
loc = 0.5
post_sec = self.soma
if psd_type == "simple":
if terminal.cell.type in ["sgc", "dstellate", "tuberculoventral"]:
weight = data.get(
"%s_synapse" % terminal.cell.type,
species=self.species,
post_type=self.type,
field="weight",
)
tau1 = data.get(
"%s_synapse" % terminal.cell.type,
species=self.species,
post_type=self.type,
field="tau1",
)
tau2 = data.get(
"%s_synapse" % terminal.cell.type,
species=self.species,
post_type=self.type,
field="tau2",
)
erev = data.get(
"%s_synapse" % terminal.cell.type,
species=self.species,
post_type=self.type,
field="erev",
)
return self.make_exp2_psd(
post_sec,
terminal,
weight=weight,
loc=loc,
tau1=tau1,
tau2=tau2,
erev=erev,
)
else:
raise TypeError(
"Cannot make simple PSD for %s => %s"
% (terminal.cell.type, self.type)
)
elif psd_type == "multisite":
if terminal.cell.type == "sgc":
# Max conductances for the glu mechanisms are calibrated by
# running `synapses/tests/test_psd.py`. The test should fail
# if these values are incorrect
self.AMPAR_gmax = (
data.get(
"sgc_synapse",
species=self.species,
post_type=self.type,
field="AMPAR_gmax",
)
* 1e3
)
self.NMDAR_gmax = (
data.get(
"sgc_synapse",
species=self.species,
post_type=self.type,
field="NMDAR_gmax",
)
* 1e3
)
self.Pr = data.get(
"sgc_synapse", species=self.species, post_type=self.type, field="Pr"
)
self.NMDAR_vshift = data.get(
"sgc_synapse",
species=self.species,
post_type=self.type,
field="NMDAR_vshift",
)
# adjust gmax to correct for initial Pr
self.AMPAR_gmax = self.AMPAR_gmax / self.Pr
self.NMDAR_gmax = self.NMDAR_gmax / self.Pr
# original values (now in synapses.py):
# self.AMPA_gmax = 3.314707700918133*1e3 # factor of 1e3 scales to pS (.mod mechanisms) from nS.
# self.NMDA_gmax = 0.4531929783503451*1e3
if "AMPAScale" in kwds: # normally, this should not be done!
self.AMPAR_gmax = (
self.AMPAR_gmax * kwds["AMPAScale"]
) # allow scaling of AMPA conductances
if "NMDAScale" in kwds:
self.NMDAR_gmax = self.NMDAR_gmax * kwds["NMDAScale"] # and NMDA...
return self.make_glu_psd(
post_sec,
terminal,
self.AMPAR_gmax,
self.NMDAR_gmax,
loc=loc,
nmda_vshift=self.NMDAR_vshift,
)
elif terminal.cell.type == "dstellate":
return self.make_gly_psd(post_sec, terminal, psdtype="glyslow", loc=loc)
elif terminal.cell.type == "tuberculoventral":
return self.make_gly_psd(post_sec, terminal, psdtype="glyslow", loc=loc)
else:
raise TypeError(
"Cannot make PSD for %s => %s" % (terminal.cell.type, self.type)
)
else:
raise ValueError("Unsupported psd type %s" % psd_type)
def make_terminal(self, post_cell, term_type, **kwds):
if term_type == "simple":
return synapses.SimpleTerminal(self.soma, post_cell, **kwds)
elif term_type == "multisite":
if post_cell.type in ["mso"]:
nzones = data.get(
"bushy_synapse",
species=self.species,
post_type=post_cell.type,
field="n_rsites",
)
delay = data.get(
"bushy_synapse",
species=self.species,
post_type=post_cell.type,
field="delay",
)
else:
raise NotImplementedError(
"No knowledge as to how to connect Bushy cell to cell type %s"
% type(post_cell)
)
pre_sec = self.soma
return synapses.StochasticTerminal(
pre_sec,
post_cell,
nzones=nzones,
spike_source=self.spike_source,
delay=delay,
**kwds,
)
else:
raise ValueError("Unsupported terminal type %s" % term_type)
class BushyRothman(Bushy):
"""
VCN bushy cell models.
Rothman and Manis, 2003abc (Type II, Type II-I)
Xie and Manis, 2013
"""
def __init__(
self,
morphology=None,
decorator=None,
nach=None,
ttx=False,
species="guineapig",
modelType=None,
modelName=None,
debug=False,
temperature=None,
):
"""
Create a bushy cell, using the default parameters for guinea pig from
R&M2003, as a type II cell.
Additional modifications to the cell can be made by calling methods below.
Parameters
----------
morphology : string (default: None)
Name of a .hoc file representing the morphology. This file is used to constructe
an electrotonic (cable) model.
If None (default), then a "point" (really, single cylinder) model is made, exactly according to RM03.
decorator : Python function (default: None)
decorator is a function that "decorates" the morphology with ion channels according
to a set of rules.
If None, a default set of channels is inserted into the first soma section, and the
rest of the structure is "bare".
nach : string (default: None)
nach selects the type of sodium channel that will be used in the model. A channel mechanism
by that name must exist. The default channel is set to 'nacn' (R&M03)
temperature : float (default: 22)
temperature to run the cell at.
ttx : Boolean (default: False)
If ttx is True, then the sodium channel conductance is set to 0 everywhere in the cell.
This flag duplicates the effects of tetrodotoxin in the model. Currently, the flag is not implemented.
species: string (default 'guineapig')
species defines the pattern of ion channel densities that will be inserted, according to
prior measurements in various species. Note that
if a decorator function is specified, this argument is ignored as the decorator will
specify the channel density.
modelName: string (default: None)
modelName specifies the source conductance pattern (RM03, XM13, etc).
modelName is passed to the decorator, or to species_scaling to adjust point (single cylinder) models.
modelType: string (default: None)
modelType specifies the subtype of the cell model that will be used (e.g., "II", "II-I", etc).
modelType is passed to the decorator, or to species_scaling to adjust point (single cylinder) models.
debug: boolean (default: False)
When True, there will be multiple printouts of progress and parameters.
Returns
-------
Nothing
"""
super(BushyRothman, self).__init__()
self.i_test_range = {
"pulse": (-1, 1, 0.05)
} # note that this might get reset with decorator according to channels
# Changing the default values will cause the unit tests to fail!
if modelType == None:
modelType = "II"
if species == "guineapig":
modelName = "RM03"
temp = 22.0
if nach == None:
nach = "na"
if species == "mouse":
temp = 34.0
if modelName is None:
modelName = "XM13"
if nach is None:
nach = "na"
self.debug = debug
self.status = {
"species": species,
"cellClass": self.type,
"modelType": modelType,
"modelName": modelName,
"soma": True,
"axon": False,
"dendrites": False,
"pumps": False,
"hillock": False,
"initialsegment": False,
"myelinatedaxon": False,
"unmyelinatedaxon": False,
"na": nach,
"ttx": ttx,
"name": self.type,
"morphology": morphology,
"decorator": decorator,
"temperature": temperature,
}
self.spike_threshold = -40
self.vrange = [-70.0, -55.0] # set a default vrange for searching for rmp
if self.debug:
print(
"model type, model name, species: ", modelType, modelName, species, nach
)
self.c_m = 0.9e-6 # default in units of F/cm^2
self._valid_temperatures = (temp,)
if self.status["temperature"] == None:
self.status["temperature"] = temp
if morphology is None:
"""
instantiate a basic soma-only ("point") model
"""
if self.debug:
print("<< Bushy model: Creating point cell >>")
soma = h.Section(
name="Bushy_Soma_%x" % id(self)
) # one compartment of about 29000 um2
soma.nseg = 1
self.add_section(soma, "soma")
else:
"""
instantiate a structured model with the morphology as specified by
the morphology file
"""
if self.debug:
print(
"<< Bushy model: Creating cell with morphology from %s >>"
% morphology
)
self.set_morphology(morphology_file=morphology)
# decorate the morphology with ion channels
if decorator is None: # basic model, only on the soma, does not use tables.
self.mechanisms = ["klt", "kht", "ihvcn", "leak", nach]
for mech in self.mechanisms:
self.soma.insert(mech)
self.soma.ena = self.e_na
self.soma.ek = self.e_k
self.soma().ihvcn.eh = self.e_h
self.soma().leak.erev = self.e_leak
self.c_m = 0.9
self.species_scaling(
silent=True, species=species, modelType=modelType
) # set the default type II cell parameters
else: # decorate according to a defined set of rules on all cell compartments, with tables.
self.decorate()
self.save_all_mechs() # save all mechanisms inserted, location and gbar values...
self.get_mechs(self.soma)
if debug:
print(" << Created cell >>")
def get_cellpars(self, dataset, species="guineapig", modelType="II"):
"""
Read data for ion channels and cell parameters from the tables
"""
# cell_type = self.map_celltype(cell_type)
# print('getcellpars: dataset, species, mmodeltype: ', dataset, species, modelType)
# print('model name: ', self.status['modelName'])
cellcap = data.get(
dataset, species=species, model_type=modelType, field="soma_Cap"
)
chtype = data.get(
dataset, species=species, model_type=modelType, field="na_type"
)
pars = Params(cap=cellcap, natype=chtype)
# print('pars cell/chtype: ')
if self.debug:
pars.show()
if self.status["modelName"] == "RM03":
for g in [
"%s_gbar" % pars.natype,
"kht_gbar",
"klt_gbar",
"ih_gbar",
"leak_gbar",
]:
pars.additem(
g, data.get(dataset, species=species, model_type=modelType, field=g)
)
if self.status["modelName"] == "XM13":
for g in [
"%s_gbar" % pars.natype,
"kht_gbar",
"klt_gbar",
"ihvcn_gbar",
"leak_gbar",
]:
pars.additem(
g, data.get(dataset, species=species, model_type=modelType, field=g)
)
if self.status["modelName"] == "mGBC":
for g in [
"%s_gbar" % pars.natype,
"kht_gbar",
"klt_gbar",
"ihvcn_gbar",
"leak_gbar",
]:
pars.additem(
g, data.get(dataset, species=species, model_type=modelType, field=g)
)
return pars
def species_scaling(self, species="guineapig", modelType="II", silent=True):
"""
This is called for POINT CELLS ONLY
Adjust all of the conductances and the cell size according to the species requested.
This scaling should be used ONLY for point models, as no other compartments
are scaled.
This scaling routine also sets the temperature for the model to a default value. Some models
can be run at multiple temperatures, and so a default from one of the temperatures is used.
The calling cell.set_temperature(newtemp) will change the conductances and reinitialize
the cell to the new temperature settings.
Parameters
----------
species : string (default: 'guineapig')
name of the species to use for scaling the conductances in the base point model
Must be one of mouse, cat, guineapig
modelType: string (default: 'II')
definition of model type from RM03 models, type II or type II-I
silent : boolean (default: True)
run silently (True) or verbosely (False)
"""
# print '\nSpecies scaling: %s %s' % (species, type)
knownspecies = ["mouse", "guineapig", "cat"]
soma = self.soma
# cellType = self.map_celltype(modelType)
if species == "mouse":
# use conductance levels determined from Cao et al., J. Neurophys., 2007. as
# model description in Xie and Manis 2013. Note that
# conductances were not scaled for temperature (rates were)
# so here we reset the default Q10's for conductance (g) to 1.0
if modelType not in ["II", "II-I"]:
raise ValueError(
"\nModel type %s is not implemented for mouse bushy cells"
% modelType
)
if self.debug:
print(
" Setting conductances for mouse bushy cell (%s), Xie and Manis, 2013"
% modelType
)
if modelname == "XM13":
dataset = "XM13_channels"
elif modelname == "XM13nacncoop":
dataset = "XM13_channels_nacncoop"
elif modelname.startswith("mGBC"):
dataset = "mGBC_channels"
else:
raise ValueError(
f"ModelName {modelname:s} not recognized for mouse bushy cells"
)
self.vrange = [-68.0, -55.0] # set a default vrange for searching for rmp
self.i_test_range = {"pulse": (-1.0, 1.0, 0.05)}
self._valid_temperatures = (34.0,)
if self.status["temperature"] is None:
self.status["temperature"] = 34.0
pars = self.get_cellpars(dataset, species=species, modelType=modelType)
self.set_soma_size_from_Cm(pars.cap)
self.status["na"] = pars.natype
self.adjust_na_chans(soma, sf=1.0)
soma().kht.gbar = nstomho(pars.kht_gbar, self.somaarea)
soma().klt.gbar = nstomho(pars.klt_gbar, self.somaarea)
soma().ihvcn.gbar = nstomho(pars.ihvcn_gbar, self.somaarea)
soma().leak.gbar = nstomho(pars.leak_gbar, self.somaarea)
self.axonsf = 0.57
elif species == "guineapig":
if self.debug:
print(
" Setting conductances for guinea pig %s bushy cell, Rothman and Manis, 2003"
% modelType
)
self._valid_temperatures = (22.0, 38.0)
if self.status["temperature"] is None:
self.status["temperature"] = 22.0
self.i_test_range = {"pulse": (-0.4, 0.4, 0.02)}
sf = 1.0
if (
self.status["temperature"] == 38.0
): # adjust for 2003 model conductance levels at 38
sf = 2 # Q10 of 2, 22->38C. (p3106, R&M2003c)
# note that kinetics are scaled in the mod file.
dataset = "RM03_channels"
pars = self.get_cellpars(dataset, species=species, modelType=modelType)
self.set_soma_size_from_Cm(pars.cap)
self.status["na"] = pars.natype
self.adjust_na_chans(soma, sf=sf)
soma().kht.gbar = nstomho(pars.kht_gbar, self.somaarea)
soma().klt.gbar = nstomho(pars.klt_gbar, self.somaarea)
soma().ihvcn.gbar = nstomho(pars.ih_gbar, self.somaarea)
soma().leak.gbar = nstomho(pars.leak_gbar, self.somaarea)
self.axonsf = 0.57
else:
errmsg = (
'Species "%s" or model type "%s" is not recognized for Bushy cells.'
% (species, modelType)
)
errmsg += "\n Valid species are: \n"
for s in knownspecies:
errmsg += " %s\n" % s
errmsg += "-" * 40
raise ValueError(errmsg)
self.status["species"] = species
self.status["modelType"] = modelType
self.check_temperature()
# self.cell_initialize(vrange=self.vrange) # no need to do this just yet.
if not silent:
print(" set cell as: ", species)
print(" with Vm rest = %6.3f" % self.vm0)
# def channel_manager(self, modelType='RM03', cell_type='bushy-II'):
# """
# This routine defines channel density maps and distance map patterns
# for each type of compartment in the cell. The maps
# are used by the ChannelDecorator class (specifically, its private
# \_biophys function) to decorate the cell membrane.
# These settings are only used if the decorator is called; otherwise
# for point cells, the species_scaling routine defines the channel
# densities.
#
# Parameters
# ----------
# modelType : string (default: 'RM03')
# A string that defines the type of the model. Currently, 3 types are implemented:
# RM03: Rothman and Manis, 2003 somatic densities for guinea pig
# XM13: Xie and Manis, 2013, somatic densities for mouse
# mGBC: experimental mouse globular bushy cell with dendrites, axon, hillock and initial segment, for
# use with fully reconstructed neurons.
#
# Returns
# -------
# Nothing
#
# Notes
# -----
# This routine defines the following variables for the class:
#
# * conductances (gBar)
# * a channelMap (dictonary of channel densities in defined anatomical compartments)
# * a current injection range for IV's (used for testing)
# * a distance map, which defines how each conductance in a selected compartment
# changes with distance from the soma. The current implementation includes both
# linear and exponential gradients,
# the minimum conductance at the end of the gradient, and the space constant or
# slope for the gradient.
#
# """
#
#
# dataset = '%s_channels' % modelType
# decorationmap = dataset + '_compartments'
# # print('dataset: {0:s} decorationmap: {1:s}'.format(dataset, decorationmap))
# cellpars = self.get_cellpars(dataset, species=self.status['species'], celltype=cell_type)
# refarea = 1e-3*cellpars.cap / self.c_m
#
# table = data.get_table_info(dataset)
# chscale = data.get_table_info(decorationmap)
# pars = {}
# # retrive the conductances from the data set
# for g in table['field']:
# x = data.get(dataset, species=self.status['species'], cell_type=cell_type,
# field=g)
# if not isinstance(x, float):
# continue
# if '_gbar' in g:
# pars[g] = x/refarea
# else:
# pars[g] = x
#
# self.channelMap = OrderedDict()
# for c in chscale['compartment']:
# self.channelMap[c] = {}
# for g in pars.keys():
# if g not in chscale['parameter']:
# # print ('Parameter %s not found in chscale parameters!' % g)
# continue
# scale = data.get(decorationmap, species=self.status['species'], cell_type=cell_type,
# compartment=c, parameter=g)
# if '_gbar' in g:
# self.channelMap[c][g] = pars[g]*scale
# else:
# self.channelMap[c][g] = pars[g]
#
# self.irange = np.linspace(-0.6, 1, 9)
def get_distancemap(self):
return {
"dend": {
"klt": {"gradient": "exp", "gminf": 0.0, "lambda": 50.0},
"kht": {"gradient": "exp", "gminf": 0.0, "lambda": 50.0},
"nav11": {"gradient": "exp", "gminf": 0.0, "lambda": 50.0},
}, # linear with distance, gminf (factor) is multiplied by gbar
"dendrite": {
"klt": {"gradient": "linear", "gminf": 0.0, "lambda": 100.0},
"kht": {"gradient": "linear", "gminf": 0.0, "lambda": 100.0},
"nav11": {"gradient": "linear", "gminf": 0.0, "lambda": 100.0},
}, # linear with distance, gminf (factor) is multiplied by gbar
"apic": {
"klt": {"gradient": "linear", "gminf": 0.0, "lambda": 100.0},
"kht": {"gradient": "linear", "gminf": 0.0, "lambda": 100.0},
"nav11": {"gradient": "exp", "gminf": 0.0, "lambda": 200.0},
}, # gradients are: flat, linear, exponential
}
# self.check_temperature()
# return
#
#
#
# if modelType == 'RM03':
# #
# # Create a model based on the Rothman and Manis 2003 conductance set from guinea pig
# #
# self.c_m = 0.9E-6 # default in units of F/cm^2
# self._valid_temperatures = (22., 38.)
# sf = 1.0
# if self.status['temperature'] == None:
# self.status['temperature'] = 22.
# if self.status['temperature'] == 38:
# sf = 3.03
# dataset = 'RM03_channels'
# pars = self.get_cellpars(dataset, species=self.status['species'], celltype='bushy-II')
# refarea = 1e-3*pars.cap / self.c_m
# self.gBar = Params(nabar=sf*pars.soma_na_gbar/refarea, # 1000.0E-9/refarea,
# khtbar=sf*pars.soma_kht_gbar/refarea,
# kltbar=sf*pars.soma_klt_gbar/refarea,
# ihbar=sf*pars.soma_ih_gbar/refarea,
# leakbar=sf*pars.soma_leak_gbar/refarea,
# )
# print 'RM03 gbar:\n', self.gBar.show()
#
# self.channelMap = {
# 'axon': {'nacn': self.gBar.nabar, 'klt': self.gBar.kltbar, 'kht': self.gBar.khtbar, 'ihvcn': 0.,
# 'leak': self.gBar.leakbar / 2.},
# 'hillock': {'nacn': self.gBar.nabar, 'klt': self.gBar.kltbar, 'kht': self.gBar.khtbar, 'ihvcn': 0.,
# 'leak': self.gBar.leakbar, },
# 'initseg': {'nacn': self.gBar.nabar, 'klt': self.gBar.kltbar, 'kht': self.gBar.khtbar,
# 'ihvcn': self.gBar.ihbar / 2., 'leak': self.gBar.leakbar, },
# 'soma': {'nacn': self.gBar.nabar, 'klt': self.gBar.kltbar, 'kht': self.gBar.khtbar,
# 'ihvcn': self.gBar.ihbar, 'leak': self.gBar.leakbar, },
# 'dend': {'nacn': self.gBar.nabar, 'klt': self.gBar.kltbar * 0.5, 'kht': self.gBar.khtbar * 0.5,
# 'ihvcn': self.gBar.ihbar / 3., 'leak': self.gBar.leakbar * 0.5, },
# 'apic': {'nacn': self.gBar.nabar, 'klt': self.gBar.kltbar * 0.2, 'kht': self.gBar.khtbar * 0.2,
# 'ihvcn': self.gBar.ihbar / 4., 'leak': self.gBar.leakbar * 0.2, },
# }
# # self.irange = np.linspace(-1., 1., 21)
# self.distMap = {'dend': {'klt': {'gradient': 'linear', 'gminf': 0., 'lambda': 100.},
# 'kht': {'gradient': 'linear', 'gminf': 0., 'lambda': 100.},
# 'nacn': {'gradient': 'exp', 'gminf': 0., 'lambda': 100.}}, # linear with distance, gminf (factor) is multiplied by gbar
# 'apic': {'klt': {'gradient': 'linear', 'gminf': 0., 'lambda': 100.},
# 'kht': {'gradient': 'linear', 'gminf': 0., 'lambda': 100.},
# 'nacn': {'gradient': 'exp', 'gminf': 0., 'lambda': 100.}}, # gradients are: flat, linear, exponential
# }
#
# elif modelType == 'XM13':
# #
# # Create a model for a mouse bushy cell from Xie and Manis, 2013
# # based on Cao and Oertel mouse conductance values
# # and Rothman and Manis kinetics.
# self.c_m = 0.9E-6 # default in units of F/cm^2
# self._valid_temperatures = (34., )
# if self.status['temperature'] == None:
# self.status['temperature'] = 34.
# dataset = 'XM13_channels'
# pars = self.get_cellpars(dataset, species=self.status['species'], celltype='bushy-II')
# refarea = 1e-3*pars.cap / self.c_m
# # self.gBar = Params(nabar=pars.soma_nav11_gbar/refarea, # 1000.0E-9/refarea,
# # khtbar=pars.soma_kht_gbar/refarea,
# # kltbar=pars.soma_klt_gbar/refarea,
# # ihbar=pars.soma_ihvcn_gbar/refarea,
# # leakbar=pars.soma_leak_gbar/refarea,
# # )
# # print 'XM13 gbar:\n', self.gBar.show()
# # # create channel map:
# decorationmap = 'XM13_channels_bycompartment'
#
# table = data.get_table_info(dataset)
# pars = {}
# for g in table['field']:
# x = data.get(dataset, species=self.status['species'], cell_type='bushy-II',
# field=g)
# if not isinstance(x, float):
# continue
# pars[g] = (1./refarea)*data.get(dataset, species=self.status['species'], cell_type='bushy-II',
# field=g)
# chscale = data.get_table_info(decorationmap)
# self.channelMap1 = OrderedDict()
# # print chscale['parameter']
# for c in chscale['compartment']:
# self.channelMap1[c] = {}
# for g in pars.keys():
# # print g
# if g[5:] not in chscale['parameter']:
# continue
# scale = data.get(decorationmap, species=self.status['species'], cell_type='bushy-II',
# compartment=c, parameter=g[5:])
# self.channelMap1[c][g] = pars[g]*scale
#
# #
# # self.channelMap = {
# # 'unmyelinatedaxon': {'nav11': self.gBar.nabar*1, 'klt': self.gBar.kltbar * 1.0, 'kht': self.gBar.khtbar, 'ihvcn': 0.,
# # 'leak': self.gBar.leakbar * 0.25},
# # 'hillock': {'nav11': self.gBar.nabar*2, 'klt': self.gBar.kltbar, 'kht': self.gBar.khtbar*2.0, 'ihvcn': 0.,
# # 'leak': self.gBar.leakbar, },
# # 'initialsegment': {'nav11': self.gBar.nabar*3.0, 'klt': self.gBar.kltbar*1, 'kht': self.gBar.khtbar*2,
# # 'ihvcn': self.gBar.ihbar * 0.5, 'leak': self.gBar.leakbar, },
# # 'soma': {'nav11': self.gBar.nabar*1.0, 'klt': self.gBar.kltbar, 'kht': self.gBar.khtbar,
# # 'ihvcn': self.gBar.ihbar, 'leak': self.gBar.leakbar, },
# # 'dend': {'nav11': self.gBar.nabar * 0.25, 'klt': self.gBar.kltbar *0.5, 'kht': self.gBar.khtbar *0.5,
# # 'ihvcn': self.gBar.ihbar *0.5, 'leak': self.gBar.leakbar * 0.5, },
# # 'primarydendrite': {'nav11': self.gBar.nabar * 0.25, 'klt': self.gBar.kltbar *0.5, 'kht': self.gBar.khtbar *0.5,
# # 'ihvcn': self.gBar.ihbar *0.5, 'leak': self.gBar.leakbar * 0.5, },
# # 'apic': {'nav11': self.gBar.nabar * 0.25, 'klt': self.gBar.kltbar * 0.25, 'kht': self.gBar.khtbar * 0.25,
# # 'ihvcn': self.gBar.ihbar *0.25, 'leak': self.gBar.leakbar * 0.25, },
# # }
# import pprint
# # print 'original map:\n'
# # for k in self.channelMap.keys():
# # print('Region: %s' % k)
# # if k in self.channelMap1.keys():
# # print 'overlapping Region: %s' % k
# # for ch in self.channelMap[k].keys():
# # # print ch
# # # print self.channelMap1[k].keys()
# # # print self.channelMap[k].keys()
# # if 'soma_' + ch + '_gbar' in self.channelMap1[k].keys():
# # cx = u'soma_' + ch + u'_gbar'
# # # print ch, cx
# # print( ' {0:>4s} = {1:e} {2:e} {3:<5s}'.format(ch, self.channelMap[k][ch], self.channelMap1[k][cx],
# # str(np.isclose(self.channelMap[k][ch], self.channelMap1[k][cx]))))
#
# # print 'original: ', self.channelMap['soma']
# self.channelMap = self.channelMap1 # use the data table
# # except need to remove soma_ from keys
# for k in self.channelMap.keys():
# for n in self.channelMap[k].keys():
# new_key = n.replace('_gbar', '')
# # new_key = n
# new_key = new_key.replace('soma_', '')
# # strip 'soma_' from key
# #print 'newkey: ', new_key, n
# self.channelMap[k][new_key] = self.channelMap[k].pop(n)
#
# print 'final map: ', self.channelMap['soma']
#
# self.irange = np.linspace(-0.6, 1, 9)
# self.distMap = {'dend': {'klt': {'gradient': 'exp', 'gminf': 0., 'lambda': 50.},
# 'kht': {'gradient': 'exp', 'gminf': 0., 'lambda': 50.},
# 'nav11': {'gradient': 'exp', 'gminf': 0., 'lambda': 50.}}, # linear with distance, gminf (factor) is multiplied by gbar
# 'dendrite': {'klt': {'gradient': 'linear', 'gminf': 0., 'lambda': 100.},
# 'kht': {'gradient': 'linear', 'gminf': 0., 'lambda': 100.},
# 'nav11': {'gradient': 'linear', 'gminf': 0., 'lambda': 100.}}, # linear with distance, gminf (factor) is multiplied by gbar
# 'apic': {'klt': {'gradient': 'linear', 'gminf': 0., 'lambda': 100.},
# 'kht': {'gradient': 'linear', 'gminf': 0., 'lambda': 100.},
# 'nav11': {'gradient': 'exp', 'gminf': 0., 'lambda': 200.}}, # gradients are: flat, linear, exponential
# }
#
# elif modelType == 'mGBC':
# # bushy from Xie and Manis, 2013, based on Cao and Oertel mouse conductances,
# # BUT modified ad hoc for SBEM reconstructions.
# dataset = 'mGBC_channels'
#
# self._valid_temperatures = (34.,)
# if self.status['temperature'] == None:
# self.status['temperature'] = 34.
# pars = self.get_cellpars(dataset, species=self.status['species'], celltype='bushy-II')
# refarea = 1e-3*pars.cap / self.c_m
# print (pars.cap, pars.soma_kht_gbar, refarea) # refarea should be about 30e-6
#
# self.gBar = Params(nabar=pars.soma_na_gbar/refarea, # 1000.0E-9/refarea,
# khtbar=pars.soma_kht_gbar/refarea,
# kltbar=pars.soma_klt_gbar/refarea,
# ihbar=pars.soma_ih_gbar/refarea,
# leakbar=pars.soma_leak_gbar/refarea,
# )
# print 'mGBC gbar:\n', self.gBar.show()
# sodiumch = 'jsrna'
# self.channelMap = {
# 'axon': {sodiumch: self.gBar.nabar*1., 'klt': self.gBar.kltbar * 1.0, 'kht': self.gBar.khtbar, 'ihvcn': 0.,
# 'leak': self.gBar.leakbar * 0.25},
# 'unmyelinatedaxon': {sodiumch: self.gBar.nabar*3.0, 'klt': self.gBar.kltbar * 2.0,
# 'kht': self.gBar.khtbar*3.0, 'ihvcn': 0.,
# 'leak': self.gBar.leakbar * 0.25},
# 'myelinatedaxon': {sodiumch: self.gBar.nabar*0, 'klt': self.gBar.kltbar * 1e-2,
# 'kht': self.gBar.khtbar*1e-2, 'ihvcn': 0.,
# 'leak': self.gBar.leakbar * 0.25*1e-3},
# 'hillock': {sodiumch: self.gBar.nabar*4.0, 'klt': self.gBar.kltbar*1.0, 'kht': self.gBar.khtbar*3.0,
# 'ihvcn': 0., 'leak': self.gBar.leakbar, },
# 'initseg': {sodiumch: self.gBar.nabar*3.0, 'klt': self.gBar.kltbar*2, 'kht': self.gBar.khtbar*2,
# 'ihvcn': self.gBar.ihbar * 0.5, 'leak': self.gBar.leakbar, },
# 'soma': {sodiumch: self.gBar.nabar*0.65, 'klt': self.gBar.kltbar, 'kht': self.gBar.khtbar*1.5,
# 'ihvcn': self.gBar.ihbar, 'leak': self.gBar.leakbar, },
# 'dend': {sodiumch: self.gBar.nabar * 0.2, 'klt': self.gBar.kltbar *1, 'kht': self.gBar.khtbar *1,
# 'ihvcn': self.gBar.ihbar *0.5, 'leak': self.gBar.leakbar * 0.5, },
# 'dendrite': {sodiumch: self.gBar.nabar * 0.2, 'klt': self.gBar.kltbar *1, 'kht': self.gBar.khtbar *1,
# 'ihvcn': self.gBar.ihbar *0.5, 'leak': self.gBar.leakbar * 0.5, },
# 'apic': {sodiumch: self.gBar.nabar * 0.25, 'klt': self.gBar.kltbar * 0.25, 'kht': self.gBar.khtbar * 0.25,
# 'ihvcn': self.gBar.ihbar *0.25, 'leak': self.gBar.leakbar * 0.25, },
# }
# self.irange = np.arange(-1.5, 2.1, 0.25 )
# self.distMap = {'dend': {'klt': {'gradient': 'linear', 'gminf': 0., 'lambda': 100.},
# 'kht': {'gradient': 'linear', 'gminf': 0., 'lambda': 100.},
# sodiumch: {'gradient': 'linear', 'gminf': 0., 'lambda': 100.}}, # linear with distance, gminf (factor) is multiplied by gbar
# 'dendrite': {'klt': {'gradient': 'linear', 'gminf': 0., 'lambda': 20.},
# 'kht': {'gradient': 'linear', 'gminf': 0., 'lambda': 20.},
# sodiumch: {'gradient': 'linear', 'gminf': 0., 'lambda': 20.}}, # linear with distance, gminf (factor) is multiplied by gbar
# 'apic': {'klt': {'gradient': 'linear', 'gminf': 0., 'lambda': 100.},
# 'kht': {'gradient': 'linear', 'gminf': 0., 'lambda': 100.},
# sodiumch: {'gradient': 'exp', 'gminf': 0., 'lambda': 200.}}, # gradients are: flat, linear, exponential
# }
# else:
# raise ValueError('model type %s is not implemented' % modelType)
# self.check_temperature()
def adjust_na_chans(self, soma, sf=1.0, gbar=1000.0):
"""
adjust the sodium channel conductance
Parameters
----------
soma : neuron section object
A soma object whose sodium channel complement will have its
conductances adjusted depending on the channel type
gbar : float (default: 1000.)
The maximal conductance for the sodium channel
Returns
-------
Nothing :
"""
if self.status["ttx"]:
gnabar = 0.0
else:
gnabar = nstomho(gbar, self.somaarea) * sf
nach = self.status["na"]
if nach == "jsrna":
soma().jsrna.gbar = gnabar
soma.ena = self.e_na
if self.debug:
print("jsrna gbar: ", soma().jsrna.gbar)
elif nach == "nav11":
soma().nav11.gbar = gnabar
soma.ena = 50 # self.e_na
# print('gnabar: ', soma().nav11.gbar, ' vs: 0.0192307692308')
soma().nav11.vsna = 4.3
if self.debug:
print("bushy using inva11")
if nach == "nacncoop":
soma().nacncoop.gbar = gnabar
soma().nacncoop.KJ = 2000.0
soma().nacncoop.p = 0.25
somae().nacncoop.vsna = 0.0
soma.ena = self.e_na
if debug:
print("nacncoop gbar: ", soma().nacncoop.gbar)
elif nach in ["na", "nacn"]:
soma().na.gbar = gnabar
soma.ena = self.e_na
# soma().na.vsna = 0.
if self.debug:
print("na gbar: ", soma().na.gbar)
else:
raise ValueError(
"Sodium channel %s is not recognized for Bushy cells", nach
)
def add_axon(self):
"""
Add a default axon from the generic cell class to the bushy cell (see cell class).
"""
Cell.add_axon(self, self.c_m, self.R_a, self.axonsf)
def add_pumps(self):
"""
Insert mechanisms for potassium ion management, sodium ion management, and a
sodium-potassium pump at the soma.
"""
soma = self.soma
soma.insert("k_conc")
ki0_k_ion = 140
soma().ki = ki0_k_ion
soma().ki0_k_conc = ki0_k_ion
soma().beta_k_conc = 0.075
soma.insert("na_conc")
nai0_na_ion = 5
soma().nai = nai0_na_ion
soma().nai0_na_conc = nai0_na_ion
soma().beta_na_conc = 0.075
soma.insert("nakpump")
soma().nakpump.inakmax = 8
soma().nao = 145
soma().ko = 5
soma().nakpump.Nai_inf = 5
soma().nakpump.Ki_inf = 140
soma().nakpump.ATPi = 5
self.status["pumps"] = True
def add_dendrites(self):
"""
Add a simple dendrite to the bushy cell.
"""
if self.debug:
print("Adding dendrite to Bushy model")
section = h.Section
primarydendrite = section(cell=self.soma)
primarydendrite.connect(self.soma)
primarydendrite.nseg = 10
primarydendrite.L = 100.0
primarydendrite.diam = 2.5
primarydendrite.insert("klt")
primarydendrite.insert("ihvcn")
primarydendrite().klt.gbar = self.soma().klt.gbar / 2.0
primarydendrite().ihvcn.gbar = self.soma().ihvcn.gbar / 2.0
primarydendrite.cm = self.c_m
primarydendrite.Ra = self.R_a
nsecd = range(0, 5)
secondarydendrite = []
for ibd in nsecd:
secondarydendrite.append(section(cell=self.soma))
for ibd in nsecd:
secondarydendrite[ibd].connect(primarydendrite)
secondarydendrite[ibd].diam = 1.0
secondarydendrite[ibd].L = 15.0
secondarydendrite[ibd].cm = self.c_m
secondarydendrite[ibd].Ra = self.R_a
self.primarydendrite = primarydendrite
self.secondarydendrite = secondarydendrite
self.status["dendrite"] = True
if self.debug:
print("Bushy: added dendrites")
h.topology()
self.add_section(maindend, "primarydendrite")
self.add_section(secdend, "secondarydendrite")

447
cnmodel/cells/cartwheel.py

@ -0,0 +1,447 @@ @@ -0,0 +1,447 @@
from __future__ import print_function
import numpy as np
from neuron import h
from .cell import Cell
from .. import data
from .. import synapses
from ..util import Params
from ..util import nstomho
__all__ = ["Cartwheel", "CartwheelDefault"]
class Cartwheel(Cell):
type = "cartwheel"
@classmethod
def create(cls, model="CW", **kwds):
if model == "CW":
return CartwheelDefault(**kwds)
else:
raise ValueError("Carthweel model is unknown", model)
def make_psd(self, terminal, psd_type, **kwds):
"""
Connect a presynaptic terminal to one post section at the specified location, with the fraction
of the "standard" conductance determined by gbar.
The default condition is to try to pass the default unit test (loc=0.5)
Parameters
----------
terminal : Presynaptic terminal (NEURON object)
psd_type : either simple or multisite PSD for bushy cell
kwds: dict of options. Two are currently handled:
postsize : expect a list consisting of [sectionno, location (float)]
AMPAScale : float to scale the ampa currents
"""
self.pre_sec = terminal.section
pre_cell = terminal.cell
post_sec = self.soma
if psd_type == "simple":
if terminal.cell.type in [
"sgc",
"dstellate",
"tuberculoventral",
"cartwheel",
]:
weight = data.get(
"%s_synapse" % terminal.cell.type,
species=self.species,
post_type=self.type,
field="weight",
)
tau1 = data.get(
"%s_synapse" % terminal.cell.type,
species=self.species,
post_type=self.type,
field="tau1",
)
tau2 = data.get(
"%s_synapse" % terminal.cell.type,
species=self.species,
post_type=self.type,
field="tau2",
)
erev = data.get(
"%s_synapse" % terminal.cell.type,
species=self.species,
post_type=self.type,
field="erev",
)
return self.make_exp2_psd(
post_sec,
terminal,
weight=weight,
loc=loc,
tau1=tau1,
tau2=tau2,
erev=erev,
)
else:
raise TypeError(
"Cannot make simple PSD for %s => %s"
% (terminal.cell.type, self.type)
)
else:
raise ValueError(
"Unsupported psd type %s for cartwheel cell (inputs not implemented yet)"
% psd_type
)
def make_terminal(self, post_cell, term_type, **kwds):
if term_type == "simple":
return synapses.SimpleTerminal(self.soma, post_cell, **kwds)
elif term_type == "multisite":
if post_cell.type in ["tuberculoventral", "pyramidal"]:
nzones = data.get(
"cartwheel_synapse",
species=self.species,
post_type=post_cell.type,
field="n_rsites",
)
delay = data.get(
"cartwheel_synapse",
species=self.species,
post_type=post_cell.type,
field="delay",
)
else:
raise NotImplementedError(
"No knowledge as to how to connect cartwheel cell to cell type %s"
% type(post_cell)
)
pre_sec = self.soma
return synapses.StochasticTerminal(
pre_sec,
post_cell,
nzones=nzones,
spike_source=self.spike_source,
delay=delay,
**kwds
)
else:
raise ValueError("Unsupported terminal type %s" % term_type)
class CartwheelDefault(Cartwheel, Cell):
"""
DCN cartwheel cell model.
"""
def __init__(
self,
morphology=None,
decorator=None,
ttx=False,
nach=None,
species="mouse",
modelType=None,
debug=False,
):
"""
Create cartwheel cell model, based on a Purkinje cell model from Raman.
There are no variations available for this model.
Parameters
----------
morphology : string (default: None)
Name of a .hoc file representing the morphology. This file is used to constructe
an electrotonic (cable) model.
If None (default), then a "point" (really, single cylinder) model is made, exactly according to RM03.
decorator : Python function (default: None)
decorator is a function that "decorates" the morphology with ion channels according
to a set of rules.
If None, a default set of channels is inserted into the first soma section, and the
rest of the structure is "bare".
nach : string (default: None)
nach selects the type of sodium channel that will be used in the model. A channel mechanism
by that name must exist. The default is naRsg, a resurgent sodium channel model.
ttx : Boolean (default: False)
If ttx is True, then the sodium channel conductance is set to 0 everywhere in the cell.
This flag duplicates the effects of tetrodotoxin in the model. Currently, the flag is not implemented.
species: string (default 'rat')
species defines the pattern of ion channel densities that will be inserted, according to
prior measurements in various species. Note that
if a decorator function is specified, this argument is ignored as the decorator will
specify the channel density.
modelType: string (default: None)
modelType specifies the subtype of the cell model that will be used.
modelType is passed to the decorator, or to species_scaling to adjust point (single cylinder) models.
Only type "I" is recognized for the cartwheel cell model.
debug: boolean (default: False)
When True, there will be multiple printouts of progress and parameters.
Returns
-------
Nothing
"""
super(CartwheelDefault, self).__init__()
if modelType == None:
modelType = "I"
if nach == None:
nach = "naRsg"
self.status = {
"soma": True,
"axon": False,
"dendrites": False,
"pumps": False,
"na": nach,
"species": species,
"modelType": modelType,
"ttx": ttx,
"name": "Cartwheel",
"morphology": morphology,
"decorator": decorator,
"temperature": None,
}
self.i_test_range = {"pulse": (-0.2, 0.2, 0.02)}
# self.spike_threshold = 0
self.vrange = [-75.0, -52.0] # set a default vrange for searching for rmp
if morphology is None:
"""
instantiate a basic soma-only ("point") model
"""
soma = h.Section(
name="Cartwheel_Soma_%x" % id(self)
) # one compartment of about 29000 um2
# cm = 1
soma.nseg = 1
self.add_section(soma, "soma")
else:
"""
instantiate a structured model with the morphology as specified by
the morphology file
"""
self.set_morphology(morphology_file=morphology)
# decorate the morphology with ion channels
if decorator is None: # basic model, only on the soma
# v_potassium = -80 # potassium reversal potential
# v_sodium = 50 # sodium reversal potential
self.mechanisms = [
"naRsg",
"bkpkj",
"hpkj",
"kpkj",
"kpkj2",
"kpkjslow",
"kpksk",
"lkpkj",
"cap",
]
for mech in self.mechanisms:
self.soma.insert(mech)
self.soma.insert("cadiff")
self.species_scaling(
silent=True, species=species, modelType=modelType
) # set the default type II cell parameters
else: # decorate according to a defined set of rules on all cell compartments
self.decorate()
self.save_all_mechs() # save all mechanisms inserted, location and gbar values...
self.get_mechs(self.soma)
if debug:
print(
"<< Cartwheel: Modified version of Raman Purkinje cell model created >>"
)
def get_cellpars(self, dataset, species="guineapig", celltype="II"):
somaDia = data.get(
dataset, species=species, cell_type=celltype, field="soma_Dia"
)
chtype = data.get(
dataset, species=species, cell_type=celltype, field="soma_na_type"
)
pcabar = data.get(
dataset, species=species, cell_type=celltype, field="soma_pcabar"
)
pars = Params(soma_Dia=somaDia, soma_natype=chtype, soma_pcabar=pcabar)
for g in [
"soma_narsg_gbar",
"soma_kpkj_gbar",
"soma_kpkj2_gbar",
"soma_kpkjslow_gbar",
"soma_kpksk_gbar",
"soma_lkpkj_gbar",
"soma_bkpkj_gbar",
"soma_hpkj_gbar",
"soma_hpkj_eh",
"soma_lkpkj_e",
"soma_e_k",
"soma_e_na",
"soma_e_ca",
]:
pars.additem(
g, data.get(dataset, species=species, cell_type=celltype, field=g)
)
return pars
def species_scaling(self, silent=True, species="mouse", modelType="I"):
"""
Adjust all of the conductances and the cell size according to the species requested.
This scaling should be used ONLY for point models, as no other compartments
are scaled.
Parameters
----------
species : string (default: 'rat')
name of the species to use for scaling the conductances in the base point model
Must be one of mouse, cat, guineapig
modelType: string (default: 'I')
definition of model type from RM03 models, type II or type II-I
silent : boolean (default: True)
run silently (True) or verbosely (False)
Note
----
For the cartwheel cell model, there is only a single scaling recognized.
"""
if species is not "mouse":
raise ValueError('Cartwheel species: only "mouse" is recognized')
if modelType is not "I":
raise ValueError('Cartwheel modelType: only "I" is recognized')
self._valid_temperatures = (34.0,)
if self.status["temperature"] is None:
self.set_temperature(34.0)
pars = self.get_cellpars("CW_channels", species=species, celltype="cartwheel")
self.set_soma_size_from_Diam(pars.soma_Dia)
self.soma().bkpkj.gbar = nstomho(pars.soma_bkpkj_gbar, self.somaarea)
self.soma().hpkj.gbar = nstomho(pars.soma_hpkj_gbar, self.somaarea)
self.soma().kpkj.gbar = nstomho(pars.soma_kpkj_gbar, self.somaarea)
self.soma().kpkj2.gbar = nstomho(pars.soma_kpkj2_gbar, self.somaarea)
self.soma().kpkjslow.gbar = nstomho(pars.soma_kpkjslow_gbar, self.somaarea)
self.soma().kpksk.gbar = nstomho(pars.soma_kpksk_gbar, self.somaarea)
self.soma().lkpkj.gbar = nstomho(pars.soma_lkpkj_gbar, self.somaarea)
self.soma().naRsg.gbar = nstomho(pars.soma_narsg_gbar, self.somaarea)
self.soma().cap.pcabar = pars.soma_pcabar
self.soma().ena = pars.soma_e_na # 50
self.soma().ek = pars.soma_e_k # -80
self.soma().lkpkj.e = pars.soma_lkpkj_e # -65
self.soma().hpkj.eh = pars.soma_hpkj_eh # -43
self.soma().eca = pars.soma_e_ca # 50
self.status["na"] = pars.soma_natype
self.status["species"] = species
self.status["modelType"] = modelType
self.check_temperature()
if not silent:
print("set cell as: ", species)
print(" with Vm rest = %f" % self.vm0)
# print 'set up'
def i_currents(self, V):
"""
For the steady-state case, return the total current at voltage V
Used to find the zero current point.
Overrides i_currents in cells.py, because this model uses conductances
that are not specified in the default cell mode.
Parameters
----------
V : float, mV (no default)
Voltage at which the current for each conductance is computed.
Returns
-------
I : float, nA
The sum of the currents at steady-state for all of the conductances.
"""
for part in self.all_sections.keys():
for sec in self.all_sections[part]:
sec.v = V
h.celsius = self.status["temperature"]
h.finitialize()
self.ix = {}
if "naRsg" in self.mechanisms:
self.ix["naRsg"] = self.soma().naRsg.gna * (V - self.soma().ena)
if "cap" in self.mechanisms:
a = self.soma().cap.pcabar * self.soma().cap.minf
self.ix["cap"] = a * self.ghk(V, self.soma().cao, self.soma().cai, 2)
if "kpkj" in self.mechanisms:
self.ix["kpkj"] = self.soma().kpkj.gk * (V - self.soma().ek)
if "kpkj2" in self.mechanisms:
self.ix["kpkj2"] = self.soma().kpkj2.gk * (V - self.soma().ek)
if "kpkjslow" in self.mechanisms:
self.ix["kpkjslow"] = self.soma().kpkjslow.gk * (V - self.soma().ek)
if "kpksk" in self.mechanisms:
self.ix["kpksk"] = self.soma().kpksk.gk * (V - self.soma().ek)
if "bkpkj" in self.mechanisms:
self.ix["bkpkj"] = self.soma().bkpkj.gbkpkj * (V - self.soma().ek)
if "hpkj" in self.mechanisms:
self.ix["hpkj"] = self.soma().hpkj.gh * (V - self.soma().hpkj.eh)
# leak
if "lkpkj" in self.mechanisms:
self.ix["lkpkj"] = self.soma().lkpkj.gbar * (V - self.soma().lkpkj.e)
return np.sum([self.ix[i] for i in self.ix])
def ghk(self, v, ci, co, z):
"""
GHK flux equation, used to calculate current density through calcium channels
rather than standard Nernst equation.
Parameters
----------
v : float, mV
voltage for GHK calculation
ci : float, mM
internal ion concentration
co : float, mM
external ion concentraion
z : float, no units
valence
Returns
-------
flux : A/m^2
"""
F = 9.6485e4 # (coul)
R = 8.3145 # (joule/degC)
T = h.celsius + 273.19 # Kelvin
E = (1e-3) * v # convert mV to V
Ci = ci + (self.soma().cap.monovalPerm) * (
self.soma().cap.monovalConc
) # : Monovalent permeability
if (
np.fabs(1 - np.exp(-z * (F * E) / (R * T))) < 1e-6
): # denominator is small -> Taylor series
ghk = (
(1e-6)
* z
* F
* (Ci - co * np.exp(-z * (F * E) / (R * T)))
* (1 - (z * (F * E) / (R * T)))
)
else:
ghk = (
(1e-6)
* z ** 2.0
* (E * F ** 2.0)
/ (R * T)
* (Ci - co * np.exp(-z * (F * E) / (R * T)))
/ (1 - np.exp(-z * (F * E) / (R * T)))
)
return ghk

1200
cnmodel/cells/cell.py

File diff suppressed because it is too large Load Diff

897
cnmodel/cells/dstellate.py

@ -0,0 +1,897 @@ @@ -0,0 +1,897 @@
from __future__ import print_function
from neuron import h
from ..util import nstomho
from .cell import Cell
from ..util import Params
from .. import synapses
from .. import data
__all__ = ["DStellate", "DStellateRothman", "DStellateEager"]
class DStellate(Cell):
type = "dstellate"
@classmethod
def create(cls, model="RM03", **kwds):
if model == "RM03":
return DStellateRothman(**kwds)
elif model == "Eager":
return DStellateEager(**kwds)
elif model == "dummy":
return DummyDStellate(**kwds)
else:
raise ValueError("DStellate type %s is unknown", type)
def __init__(self):
Cell.__init__(self)
self.spike_source = (
None
) # used by DummyDStellate to connect VecStim to terminal
def make_psd(self, terminal, psd_type, **kwds):
"""
Connect a presynaptic terminal to one post section at the specified location, with the fraction
of the "standard" conductance determined by gbar.
The default condition is designed to pass the unit test (loc=0.5)
Parameters
----------
terminal : Presynaptic terminal (NEURON object)
psd_type : either simple or multisite PSD for bushy cell
kwds: dictionary of options.
Two are currently handled:
postsize : expect a list consisting of [sectionno, location (float)]
AMPAScale : float to scale the ampa currents
"""
if (
"postsite" in kwds
): # use a defined location instead of the default (soma(0.5)
postsite = kwds["postsite"]
loc = postsite[1] # where on the section?
uname = (
"sections[%d]" % postsite[0]
) # make a name to look up the neuron section object
post_sec = self.hr.get_section(uname) # Tell us where to put the synapse.
else:
loc = 0.5
post_sec = self.soma
if psd_type == "simple":
if terminal.cell.type in ["sgc", "dstellate", "tuberculoventral"]:
weight = data.get(
"%s_synapse" % terminal.cell.type,
species=self.species,
post_type=self.type,
field="weight",
)
tau1 = data.get(
"%s_synapse" % terminal.cell.type,
species=self.species,
post_type=self.type,
field="tau1",
)
tau2 = data.get(
"%s_synapse" % terminal.cell.type,
species=self.species,
post_type=self.type,
field="tau2",
)
erev = data.get(
"%s_synapse" % terminal.cell.type,
species=self.species,
post_type=self.type,
field="erev",
)
return self.make_exp2_psd(
post_sec,
terminal,
weight=weight,
loc=loc,
tau1=tau1,
tau2=tau2,
erev=erev,
)
else:
raise TypeError(
"Cannot make simple PSD for %s => %s"
% (terminal.cell.type, self.type)
)
elif psd_type == "multisite":
if terminal.cell.type == "sgc":
# Max conductances for the glu mechanisms are calibrated by
# running `synapses/tests/test_psd.py`. The test should fail
# if these values are incorrect
self.AMPAR_gmax = (
data.get(
"sgc_synapse",
species=self.species,
post_type=self.type,
field="AMPAR_gmax",
)
* 1e3
)
self.NMDAR_gmax = (
data.get(
"sgc_synapse",
species=self.species,
post_type=self.type,
field="NMDAR_gmax",
)
* 1e3
)
self.Pr = data.get(
"sgc_synapse", species=self.species, post_type=self.type, field="Pr"
)
# adjust gmax to correct for initial Pr
self.AMPAR_gmax = self.AMPAR_gmax / self.Pr
self.NMDAR_gmax = self.NMDAR_gmax / self.Pr
# old values:
# AMPA_gmax = 0.22479596944138733*1e3 # factor of 1e3 scales to pS (.mod mechanisms) from nS.
# NMDA_gmax = 0.12281291946623739*1e3
if "AMPAScale" in kwds:
self.AMPAR_gmax = (
self.AMPAR_gmax * kwds["AMPAScale"]
) # allow scaling of AMPA conductances
if "NMDAScale" in kwds:
self.NMDAR_gmax = self.NMDAR_gmax * kwds["NMDAScale"]
return self.make_glu_psd(
post_sec, terminal, self.AMPAR_gmax, self.NMDAR_gmax, loc=loc
)
elif terminal.cell.type == "dstellate":
# Get GLY kinetic constants from database
return self.make_gly_psd(post_sec, terminal, psdtype="glyfast", loc=loc)
elif terminal.cell.type == "tuberculoventral":
# Get GLY kinetic constants from database
return self.make_gly_psd(post_sec, terminal, psdtype="glyfast", loc=loc)
else:
raise TypeError(
"Cannot make PSD for %s => %s" % (terminal.cell.type, self.type)
)
else:
raise ValueError("Unsupported psd type %s" % psd_type)
def make_terminal(self, post_cell, term_type, **kwds):
if term_type == "simple":
return synapses.SimpleTerminal(
self.soma, post_cell, spike_source=self.spike_source, **kwds
)
elif term_type == "multisite":
if post_cell.type in [
"dstellate",
"tuberculoventral",
"pyramidal",
"bushy",
"tstellate",
]:
nzones = data.get(
"dstellate_synapse",
species=self.species,
post_type=post_cell.type,
field="n_rsites",
)
delay = data.get(
"dstellate_synapse",
species=self.species,
post_type=post_cell.type,
field="delay",
)
else:
raise NotImplementedError(
"No knowledge as to how to connect D stellate cell to cell type %s"
% type(post_cell)
)
pre_sec = self.soma
return synapses.StochasticTerminal(
pre_sec,
post_cell,
nzones=nzones,
spike_source=self.spike_source,
delay=delay,
**kwds
)
else:
raise ValueError("Unsupported terminal type %s" % term_type)
class DStellateRothman(DStellate):
"""
VCN D-stellate model:
as a type I-II from Rothman and Manis, 2003
"""
def __init__(
self,
morphology=None,
decorator=None,
nach=None,
ttx=False,
species="guineapig",
modelType=None,
modelName=None,
debug=False,
):
"""
initialize a radial stellate (D-stellate) cell, using the default parameters for guinea pig from
R&M2003, as a type I-II cell.
Modifications to the cell can be made by calling methods below. These include:
* changing the sodium channel
* Changing "species" to mouse or cat (scales conductances)
* Shifting model type
Parameters
----------
morphology : string (default: None)
Name of a .hoc file representing the morphology. This file is used to constructe
an electrotonic (cable) model.
If None (default), then a "point" (really, single cylinder) model is made, exactly according to RM03.
decorator : Python function (default: None)
decorator is a function that "decorates" the morphology with ion channels according
to a set of rules.
If None, a default set of channels is inserted into the first soma section, and the
rest of the structure is "bare".
nach : string (default: None)
nach selects the type of sodium channel that will be used in the model. A channel mechanism
by that name must exist. A value of None will set the channel to a default for the model (nacn).
ttx : Boolean (default: False)
If ttx is True, then the sodium channel conductance is set to 0 everywhere in the cell.
This flag duplicates the effects of tetrodotoxin in the model. Currently, the flag is not implemented.
species: string (default 'guineapig')
species defines the pattern of ion channel densities that will be inserted, according to
prior measurements in various species. Note that
if a decorator function is specified, this argument is ignored as the decorator will
specify the channel density.
modelType: string (default: None)
modelType specifies the subtype of the cell model that will be used (e.g., "II", "II-I", etc).
modelType is passed to the decorator, or to species_scaling to adjust point (single cylinder) models.
debug: boolean (default: False)
When True, there will be multiple printouts of progress and parameters.
Returns
-------
Nothing
"""
super(DStellateRothman, self).__init__()
if modelType == None:
modelType = "I-II"
if species == "guineapig":
modelName = "RM03"
temp = 22.0
if nach == None:
nach = "nacn"
if species == "mouse":
temp = 34.0
if modelName is None:
modelName = "XM13"
if nach is None:
nach = "na"
self.debug = debug
# if modelType == None: # allow us to pass None to get the default
# modelType = 'I-II'
# if nach == None:
# nach = 'na'
self.status = {
"soma": True,
"axon": False,
"dendrites": False,
"pumps": False,
"na": nach,
"species": species,
"modelType": modelType,
"modelName": modelName,
"ttx": ttx,
"name": "DStellate",
"morphology": morphology,
"decorator": decorator,
"temperature": None,
}
self.i_test_range = {
"pulse": [(-0.3, 0.3, 0.03), (-0.05, 0.0, 0.005)]
} # set range for ic command test
self.vrange = [-75.0, -55.0]
self.spike_threshold = (
-40.0
) # matches threshold in released CNModel (set in base cell class)
if morphology is None:
"""
instantiate a basic soma-only ("point") model
"""
soma = h.Section(
name="DStellate_Soma_%x" % id(self)
) # one compartment of about 29000 um2
soma.nseg = 1
self.add_section(soma, "soma")
else:
"""
instantiate a structured model with the morphology as specified by
the morphology file
"""
self.set_morphology(morphology_file=morphology)
# decorate the morphology with ion channels
if decorator is None: # basic model, only on the soma
self.mechanisms = ["klt", "kht", "ihvcn", "leak", nach]
for mech in self.mechanisms:
self.soma.insert(mech)
self.soma.ena = self.e_na
self.soma.ek = self.e_k
self.soma().leak.erev = self.e_leak
self.c_m = 0.9
self.set_soma_size_from_Cm(12.0)
self.species_scaling(
silent=True, species=species, modelType=modelType
) # set the default type II cell parameters
else: # decorate according to a defined set of rules on all cell compartments
self.decorate()
self.save_all_mechs() # save all mechanisms inserted, location and gbar values...
self.get_mechs(self.soma)
if self.debug:
print("<< D-stellate: JSR Stellate Type I-II cell model created >>")
def get_cellpars(self, dataset, species="guineapig", modelType="I-II"):
cellcap = data.get(
dataset, species=species, model_type=modelType, field="soma_Cap"
)
chtype = data.get(
dataset, species=species, model_type=modelType, field="na_type"
)
pars = Params(cap=cellcap, natype=chtype)
# pars.show()
if self.status["modelName"] == "RM03":
for g in [
"%s_gbar" % pars.natype,
"kht_gbar",
"klt_gbar",
"ka_gbar",
"ih_gbar",
"leak_gbar",
"leak_erev",
"ih_eh",
"e_k",
"e_na",
]:
pars.additem(
g, data.get(dataset, species=species, model_type=modelType, field=g)
)
if self.status["modelName"] == "XM13":
for g in [
"%s_gbar" % pars.natype,
"kht_gbar",
"klt_gbar",
"ka_gbar",
"ihvcn_gbar",
"leak_gbar",
"leak_erev",
"ih_eh",
"e_k",
"e_na",
]:
pars.additem(
g, data.get(dataset, species=species, model_type=modelType, field=g)
)
if self.status["modelName"] == "mGBC":
for g in [
"%s_gbar" % pars.natype,
"kht_gbar",
"klt_gbar",
"ka_gbar",
"ihvcn_gbar",
"leak_gbar",
"leak_erev",
]:
pars.additem(
g, data.get(dataset, species=species, model_type=modelType, field=g)
)
return pars
def species_scaling(self, species="guineapig", modelType="I-II", silent=True):
"""
Adjust all of the conductances and the cell size according to the species requested.
Parameters
----------
species : string (default: 'guineapig')
A string specifying the species used for scaling. Recognized values are
'mouse', 'guineapig', and 'cat' (cat is just a larger version of the guineapig)
modelType : string (default: 'I-II')
A string specifying the version of the model to use.
Current choices are 'I-II' (others need to be implemented)
silent : boolean (default: True)
Flag for printing debugging information.
"""
soma = self.soma
celltype = modelType
if species == "mouse":
# use conductance levels from Cao et al., J. Neurophys., 2007.
dataset = "XM13_channels"
self._valid_temperatures = (34.0,)
if self.status["temperature"] is None:
self.set_temperature(34.0)
self.c_m = 0.9
pars = self.get_cellpars(dataset, species=species, modelType=modelType)
self.set_soma_size_from_Cm(pars.cap)
self.status["na"] = pars.natype
# pars.show()
self.adjust_na_chans(soma, gbar=pars.na_gbar, sf=1.0)
soma().kht.gbar = nstomho(pars.kht_gbar, self.somaarea)
soma().klt.gbar = nstomho(pars.klt_gbar, self.somaarea)
# soma().ka.gbar = nstomho(pars.ka_gbar, self.somaarea)
soma().ihvcn.gbar = nstomho(pars.ihvcn_gbar, self.somaarea)
soma().ihvcn.eh = pars.ih_eh # Rodrigues and Oertel, 2006
soma().leak.gbar = nstomho(pars.leak_gbar, self.somaarea)
soma().leak.erev = pars.leak_erev
self.e_k = pars.e_k
self.e_na = pars.e_na
soma.ena = self.e_na
soma.ek = self.e_k
# soma().leak.erev = pars.leak_erev
self.axonsf = 0.5
elif species == "guineapig": # values from R&M 2003, Type II-I
dataset = "RM03_channels"
self.c_m = 0.9
self._valid_temperatures = (22.0, 38.0)
if self.status["temperature"] is None:
self.set_temperature(22.0)
sf = 1.0
if (
self.status["temperature"] == 38.0
): # adjust for 2003 model conductance levels at 38
sf = 3.03 # Q10 of 2, 22->38C. (p3106, R&M2003c)
self.i_test_range = {"pulse": (-0.3, 0.3, 0.03)}
self.vrange = [-75.0, -55.0]
pars = self.get_cellpars(dataset, species=species, modelType=modelType)
self.set_soma_size_from_Cm(pars.cap)
self.status["na"] = pars.natype
# pars.show()
self.adjust_na_chans(soma, gbar=pars.nacn_gbar, sf=sf)
soma().kht.gbar = nstomho(pars.kht_gbar, self.somaarea)
soma().klt.gbar = nstomho(pars.klt_gbar, self.somaarea)
# soma().ka.gbar = nstomho(pars.ka_gbar, self.somaarea)
soma().ihvcn.gbar = nstomho(pars.ih_gbar, self.somaarea)
soma().leak.gbar = nstomho(pars.leak_gbar, self.somaarea)
soma().leak.erev = pars.leak_erev
self.axonsf = 0.5
else:
raise ValueError(
"Species %s or species-modelType %s is not recognized for D-Stellate cells"
% (species, modelType)
)
self.status["species"] = species
self.status["modelType"] = modelType
self.check_temperature()
# self.cell_initialize(showinfo=False)
if not silent:
print("set cell as: ", species)
print(" with Vm rest = %6.3f" % self.vm0)
def adjust_na_chans(self, soma, sf=1.0, gbar=1000.0):
"""
adjust the sodium channel conductance
Parameters
----------
soma : soma object (no default)
soma object whose sodium channel complement will have it's
conductances adjusted depending on the channel type
gbar : float (default: 1000.)
The conductance to be set for the sodium channel
debug : boolean (default: False)
Flag for printing the conductance value and Na channel model
Returns
-------
Nothing
"""
if self.status["ttx"]:
gnabar = 0.0
else:
gnabar = nstomho(gbar, self.somaarea) * sf
nach = self.status["na"]
if nach == "jsrna":
soma().jsrna.gbar = gnabar
soma.ena = self.e_na
if self.debug:
print("jsrna gbar: ", soma().jsrna.gbar)
elif nach == "nav11":
soma().nav11.gbar = gnabar * 0.5
soma.ena = self.e_na
soma().nav11.vsna = 4.3
if self.debug:
print("bushy using inva11")
print("nav11 gbar: ", soma().nav11.gbar)
elif nach == "na":
soma().na.gbar = gnabar
soma.ena = self.e_na
if self.debug:
print("na gbar: ", soma().na.gbar)
elif nach == "nacn":
soma().nacn.gbar = gnabar
soma.ena = self.e_na
if self.debug:
print("nacn gbar: ", soma().nacn.gbar)
else:
raise ValueError(
"Dstellate setting Na channels: channel %s not known" % nach
)
def add_axon(self):
"""
Add a default axon from the generic cell class to the bushy cell (see cell class).
"""
Cell.add_axon(self, self.soma, self.somaarea, self.c_m, self.R_a, self.axonsf)
def add_dendrites(self):
"""
Add simple unbranched dendrites to basic Rothman Type I-II model.
The dendrites have some kht and ih current
"""
cs = False # not implemented outside here - internal Cesium.
nDend = range(4) # these will be simple, unbranced, N=4 dendrites
dendrites = []
for i in nDend:
dendrites.append(h.Section(cell=self.soma))
for i in nDend:
dendrites[i].connect(self.soma)
dendrites[i].L = 300 # length of the dendrite (not tapered)
dendrites[i].diam = 1.25 # dendrite diameter
dendrites[i].nseg = 21 # # segments in dendrites
dendrites[i].Ra = 150 # ohm.cm
dendrites[i].insert("kht")
if cs is False:
dendrites[i]().kht.gbar = 0.005 # a little Ht
else:
dendrites[i]().kht.gbar = 0.0
dendrites[i].insert("leak") # leak
dendrites[i]().leak.gbar = 0.0001
dendrites[i].insert("ihvcn") # some H current
dendrites[i]().ihvcn.gbar = 0.0 # 0.001
dendrites[i]().ihvcn.eh = -43.0
self.maindend = dendrites
self.status["dendrites"] = True
self.add_section(self.maindend, "maindend")
class DummyDStellate(DStellate):
""" DStellate class with no cell body; this cell only replays a predetermined
spike train. Useful for testing, or replacing spike trains to determine
the importance of spike structures within a network.
"""
def __init__(self, cf=None, species="mouse"):
"""
Parameters
----------
cf : float (default: None)
Required: the characteristic frequency for the DStellate
Really just for reference.
"""
DStellate.__init__(self)
self.vecstim = h.VecStim()
# this causes the terminal to receive events from the VecStim:
self.spike_source = self.vecstim
# just an empty section for holding the terminal
self.add_section(h.Section(), "soma")
self.status = {
"soma": True,
"axon": False,
"dendrites": False,
"pumps": False,
"na": None,
"species": species,
"modelType": "Dummy",
"modelName": "DummyDStellate",
"ttx": None,
"name": "DummyDStellate",
"morphology": None,
"decorator": None,
"temperature": None,
}
print("<< DStellate: Dummy DStellate Cell created >>")
def set_spiketrain(self, times):
""" Set the times of spikes (in seconds) to be replayed by the cell.
"""
self._spiketrain = times
self._stvec = h.Vector(times)
self.vecstim.play(self._stvec)
class DStellateEager(DStellate):
"""
This is a model of the VCN D-Stellate cells as proposed by
Eager, M.A., Grayden, D.B., Burkitt, A.N., and Meffin, H.,
"A neural circuit model of the ventral cochlear nucleus",
Internet:
http://citeseerx.ist.pus.edu/viewdoc/download?doi=10.1.79.9620.pdf&rep
=rep&type=pdf
also cited as:
Proceedings of the 10th Australian International Conference on
Speech Science and Technology, pp. 539-544, 2004.
It is based on the Rothman and Manis (2003c) model,
with small modifications.
Their model includes dendrites and an axon, which are added in this version
"""
def __init__(
self, nach="na", ttx=False, species="guineapig", modelType="I-II", debug=False
):
"""
Initialize the VCN D-stellate model of Eager et al. Some model parameters may be modified.
Parameters
----------
nach : string (default: 'na')
Set the sodium channel model. Choices are 'na', 'nav11', 'jsrna'
ttx : boolean (default: False)
ttx sets the sodium channel conductance to 0
species : string (default: 'guineapig')
species to use for conductance scaling
modelType : string (default: 'I-II')
RM03 model type to use for conductances.
debug : boolean (default: False)
Flag to use to enable print statements for debugging purposes.
"""
super(DStellateEager, self).__init__()
self.status = {
"soma": True,
"axon": False,
"dendrites": False,
"pumps": False,
"na": nach,
"species": species,
"modelType": modelType,
"ttx": ttx,
"name": "DStellateEager",
}
self.i_test_range = (-0.25, 0.25, 0.025) # set range for ic command test
soma = h.Section(name="DStellateEager_Soma_%x" % id(self)) # one compartment
soma.nseg = 1
if nach in ["nacn", "na"]:
soma.insert("na")
elif nach == "nav11":
soma.insert("nav11")
elif nach == "jsrna":
soma.insert("jsrna")
else:
raise ValueError("Sodium channel %s in type 1 cell not known" % nach)
self.debug = debug
soma.insert("kht")
soma.insert("klt")
soma.insert("ihvcn")
soma.insert("leak")
soma.ek = self.e_k
soma().leak.erev = self.e_leak
self.mechanisms = ["kht", "klt", "ihvcn", "leak", nach]
self.add_section(soma, "soma")
self.species_scaling(
silent=False, species=species, modelType=modelType
) # set the default type II cell parameters
self.add_axon() # must follow species scaling so that area parameters are available
self.add_dendrites() # similar for dendrites
self.save_all_mechs() # save all mechanisms inserted, location and gbar values...
self.get_mechs(soma)
if self.debug:
print("<< D-stellateEager: Eager DStellate Type I-II cell model created >>")
def species_scaling(self, species="guineapig", modelType="I-II", silent=True):
"""
Adjust all of the conductances and the cell size according to the species requested.
Parameters
----------
species : string (default: 'guineapig')
A string specifying the species used for scaling. Recognized values are
'mouse', 'guineapig', and 'cat' (cat is just a larger version of the guineapig)
modelType : string (default: 'I-II')
A string specifying the version of the model to use.
Current choices are 'I-II' (others need to be implemented)
silent : boolean (default: True)
Flag for printing debugging information.
"""
soma = self.soma
if species == "mouse" and modelType == "I-II":
# use conductance levels from Cao et al., J. Neurophys., 2007.
self.set_soma_size_from_Cm(25.0)
self.adjust_na_chans(soma, gbar=800.0)
soma().kht.gbar = nstomho(150.0, self.somaarea)
soma().klt.gbar = nstomho(20.0, self.somaarea)
soma().ihvcn.gbar = nstomho(2.0, self.somaarea)
soma().ihvcn.eh = -43 # Rodrigues and Oertel, 2006
soma().leak.gbar = nstomho(2.0, self.somaarea)
self.axonsf = 0.5
elif (
species == "guineapig" and modelType == "I-II"
): # values from R&M 2003, Type II-I
self.set_soma_size_from_Diam(25.0)
self.adjust_na_chans(soma, gbar=1000.0 * 0.75)
soma().kht.gbar = 0.02 # nstomho(150.0, self.somaarea)
soma().klt.gbar = 0.005 # nstomho(20.0, self.somaarea)
soma().ihvcn.gbar = 0.0002 # nstomho(2.0, self.somaarea)
soma().leak.gbar = 0.0005 # nstomho(2.0, self.somaarea)
self.axonsf = 1.0
elif (
species == "cat" and modelType == "I=II"
): # a cat is a big guinea pig Type I
self.set_soma_size_from_Cm(35.0)
self.adjust_na_chans(soma)
soma().kht.gbar = nstomho(150.0, self.somaarea)
soma().klt.gbar = nstomho(20.0, self.somaarea)
soma().ihvcn.gbar = nstomho(2.0, self.somaarea)
soma().leak.gbar = nstomho(2.0, self.somaarea)
self.axonsf = 1.0
else:
raise ValueError(
"Species %s or species-type %s is not recognized for D-StellateEager cells"
% (species, type)
)
self.status["species"] = species
self.status["type"] = modelType
self.cell_initialize(showinfo=True)
if not silent:
print(" set cell as: ", species)
print(" with Vm rest = %6.3f" % self.vm0)
def adjust_na_chans(self, soma, gbar=1000.0):
"""
adjust the sodium channel conductance
Parameters
----------
soma : soma object (no default)
soma object whose sodium channel complement will have it's
conductances adjusted depending on the channel type
gbar : float (default: 1000.)
The conductance to be set for the sodium channel
Returns
-------
Nothing
"""
if self.status["ttx"]:
gnabar = 0.0
else:
gnabar = nstomho(gbar, self.somaarea)
nach = self.status["na"]
if nach == "jsrna":
soma().jsrna.gbar = gnabar
soma.ena = self.e_na
if self.debug:
print("using jsrna with gbar: ", soma().jsrna.gbar)
elif nach == "nav11":
soma().nav11.gbar = gnabar * 0.5
soma.ena = self.e_na
soma().nav11.vsna = 4.3
if self.debug:
print("using inva11 with gbar:", soma().na.gbar)
print("nav11 gbar: ", soma().nav11.gbar)
elif nach == "na":
soma().na.gbar = gnabar
soma.ena = self.e_na
if self.debug:
print("using na with gbar: ", soma().na.gbar)
elif nach == "nach":
soma().nach.gbar = gnabar
soma.ena = self.e_na
if self.debug:
print(("uwing nacn with gbar: ", soma().nacn.gbar))
else:
raise ValueError(
"DstellateEager setting Na channels: channel %s not known" % nach
)
# print soma().na.gbar
def add_axon(self):
"""
Adds an axon to the Eager. et al model
Cell.add_axon(self, nodes=1, c_m=self.c_m, R_a=self.R_a, axonsf=self.axonsf, dia=3.0, len=70, seg=2)
The Eager et al model just uses one cable, 70 microns long and 3 microns in dameter.
Parameters
----------
None
Returns
-------
Nothing
"""
naxons = 1
axon = []
for i in range(naxons):
axon.append(h.Section(cell=self.soma))
for i in range(naxons):
axon[i].connect(self.soma)
axon[i].L = 70
axon[i].diam = 3.0
axon[i].Ra = 500
axon[i].cm = 0.9
axon[i].nseg = 2
axon[i].insert("kht")
axon[i].insert("klt")
axon[i].insert("ihvcn")
axon[i].insert("leak")
axon[i].insert("na")
axon[i].ek = self.e_k
axon[i].ena = self.e_na
axon[i]().leak.erev = self.e_leak
axon[i]().na.gbar = 0.5
axon[i]().klt.gbar = 0.005
axon[i]().kht.gbar = 0.02
axon[i]().ihvcn.gbar = 0.0002
axon[i]().leak.gbar = 0.0005
self.status["axon"] = True
self.add_section(axon, "axon")
def add_dendrites(self):
"""
Adds dendrites to the Eager model. The Eager model uses simple passive dendrites.
Parameters
----------
None
Returns
-------
Nothing
"""
nDend = range(2) # these will be simple, unbranced, N=4 dendrites
dendrites = []
for i in nDend:
dendrites.append(h.Section(cell=self.soma))
for i in nDend:
dendrites[i].connect(self.soma)
dendrites[i].L = 1100 # length of the dendrite (not tapered)
dendrites[i].diam = 3.5 # dendrite diameter
dendrites[i].nseg = 5 # # segments in dendrites
dendrites[i].Ra = 1500 # ohm.cm
dendrites[i].insert("leak") # leak
dendrites[i]().leak.gbar = 0.00025
dendrites[i]().leak.erev = self.e_leak
self.maindend = dendrites
self.status["dendrites"] = True
self.add_section(self.maindend, "maindend")

47
cnmodel/cells/hh.py

@ -0,0 +1,47 @@ @@ -0,0 +1,47 @@
from __future__ import print_function
from neuron import h
import neuron as nrn
from ..util import nstomho
from .cell import Cell
__all__ = ["HH"]
class HH(Cell):
"""
Standard Hodgkin-Huxley mechanisms from NEURON
"""
def __init__(self, debug=False, message=None):
super(HH, self).__init__()
soma = h.Section(
name="HH_Soma_%x" % id(self)
) # one compartment of about 29000 um2
v_potassium = -80 # potassium reversal potential
v_sodium = 50 # sodium reversal potential
c_m = 1.0
scalefactor = 1.0 # This determines the relative size of the cell
rinsf = 1.0 # input resistance adjustment (also current...)
totcap = 20.0 # scalefactor * 1.0 # cap in pF for cell
effcap = totcap # sometimes we change capacitance - that's effcap
somaarea = totcap * 1e-6 / c_m # pf -> uF, cm = 1uf/cm^2 nominal
lstd = 1e4 * ((somaarea / 3.14159) ** 0.5) # convert from cm to um
soma.nseg = 1
soma.diam = lstd
soma.L = lstd
seg = soma
seg.insert("hh")
seg.insert("pas")
if debug:
if message is None:
print("<< Standard HH model created >>")
else:
print(message)
self.add_section(soma, "soma")
self.vm0 = -67.536

516
cnmodel/cells/msoprincipal.py

@ -0,0 +1,516 @@ @@ -0,0 +1,516 @@
from __future__ import print_function
from neuron import h
from .cell import Cell
# from .. import synapses
from ..util import nstomho
from ..util import Params
import numpy as np
from .. import data
__all__ = ["MSO"]
class MSO(Cell):
type = "mso"
@classmethod
def create(cls, model="MSO-principal", **kwds):
if model == "MSO-principal":
return MSOPrincipal(**kwds)
else:
raise ValueError("MSO cell model %s is unknown", model)
def make_psd(self, terminal, psd_type, **kwds):
"""
Connect a presynaptic terminal to one post section at the specified location, with the fraction
of the "standard" conductance determined by gbar.
The default condition is designed to pass the unit test (loc=0.5)
Parameters
----------
terminal : Presynaptic terminal (NEURON object)
psd_type : either simple or multisite PSD for MSO cell
kwds: dictionary of options.
Two are currently handled:
postsite : expect a list consisting of [sectionno, location (float)]
AMPAScale : float to scale the ampa currents
"""
if (
"postsite" in kwds
): # use a defined location instead of the default (soma(0.5)
postsite = kwds["postsite"]
loc = postsite[1] # where on the section?
uname = (
"sections[%d]" % postsite[0]
) # make a name to look up the neuron section object
post_sec = self.hr.get_section(uname) # Tell us where to put the synapse.
else:
loc = 0.5
post_sec = self.soma
if psd_type == "simple":
return self.make_exp2_psd(post_sec, terminal, loc=loc)
elif psd_type == "multisite":
if terminal.cell.type == "bushy":
# Max conductances for the glu mechanisms are calibrated by
# running `synapses/tests/test_psd.py`. The test should fail
# if these values are incorrect
self.AMPAR_gmax = (
data.get(
"bushy_synapse",
species=self.species,
post_type=self.type,
field="AMPAR_gmax",
)
* 1e3
)
self.NMDAR_gmax = (
data.get(
"bushy_synapse",
species=self.species,
post_type=self.type,
field="NMDAR_gmax",
)
* 1e3
)
self.Pr = data.get(
"bushy_synapse",
species=self.species,
post_type=self.type,
field="Pr",
)
# adjust gmax to correct for initial Pr
self.AMPAR_gmax = self.AMPAR_gmax / self.Pr
self.NMDAR_gmax = self.NMDAR_gmax / self.Pr
if "AMPAScale" in kwds: # normally, this should not be done!
self.AMPAR_gmax = (
self.AMPAR_gmax * kwds["AMPAScale"]
) # allow scaling of AMPA conductances
if "NMDAScale" in kwds:
self.NMDAR_gmax = self.NMDAR_gmax * kwds["NMDAScale"] # and NMDA...
return self.make_glu_psd(
post_sec, terminal, self.AMPAR_gmax, self.NMDAR_gmax, loc=loc
)
else:
raise TypeError(
"Cannot make PSD for %s => %s" % (terminal.cell.type, self.type)
)
else:
raise ValueError("Unsupported psd type %s" % psd_type)
class MSOPrincipal(MSO):
"""
VCN MSO cell models.
Using Rothman and Manis, 2003abc (Type II)
MSO principal cell type
"""
def __init__(
self,
morphology=None,
decorator=None,
nach=None,
ttx=False,
species="guineapig",
modelType=None,
debug=False,
temperature=None,
):
"""
Create a MSO principal cell, using the default parameters for guinea pig from
R&M2003, as a type II cell.
Additional modifications to the cell can be made by calling methods below.
Parameters
----------
morphology : string (default: None)
Name of a .hoc file representing the morphology. This file is used to constructe
an electrotonic (cable) model.
If None (default), then a "point" (really, single cylinder) model is made, exactly according to RM03.
decorator : Python function (default: None)
decorator is a function that "decorates" the morphology with ion channels according
to a set of rules.
If None, a default set of channels is inserted into the first soma section, and the
rest of the structure is "bare".
nach : string (default: None)
nach selects the type of sodium channel that will be used in the model. A channel mechanism
by that name must exist. The default channel is set to 'nacn' (R&M03)
temperature : float (default: 22)
temperature to run the cell at.
ttx : Boolean (default: False)
If ttx is True, then the sodium channel conductance is set to 0 everywhere in the cell.
This flag duplicates the effects of tetrodotoxin in the model. Currently, the flag is not implemented.
temperature : float (default: None, sets to model default of 22)
temperature (deg C) to run the cell at. Must be a valid temperature for the model.
species: string (default 'guineapig')
species defines the pattern of ion channel densities that will be inserted, according to
prior measurements in various species. Note that
if a decorator function is specified, this argument is ignored as the decorator will
specify the channel density.
modelType: string (default: None)
modelType specifies the subtype of the cell model that will be used (e.g., "II", "II-I", etc).
modelType is passed to the decorator, or to species_scaling to adjust point (single cylinder) models.
debug: boolean (default: False)
When True, there will be multiple printouts of progress and parameters.
Returns
-------
Nothing
"""
super(MSO, self).__init__()
self.i_test_range = {
"pulse": (-1, 1, 0.05)
} # note that this gets reset with decorator according to channels
# Changing the default values will cause the unit tests to fail!
if modelType == None:
modelType = "principal"
if nach == None and species == "guineapig":
nach = "na"
if nach == None and species == "mouse":
nach = "na"
self.i_test_range = {"pulse": (-1, 1.2, 0.05)}
self.status = {
"soma": True,
"axon": False,
"dendrites": False,
"pumps": False,
"hillock": False,
"initialsegment": False,
"myelinatedaxon": False,
"unmyelinatedaxon": False,
"na": nach,
"species": species,
"modelType": modelType,
"ttx": ttx,
"name": "MSO",
"morphology": morphology,
"decorator": decorator,
"temperature": temperature,
}
self.spike_threshold = -40
self.vrange = [-70.0, -55.0] # set a default vrange for searching for rmp
print("model type, species: ", modelType, species, nach)
if morphology is None:
"""
instantiate a basic soma-only ("point") model
"""
print("<< MSO model: Creating point principal cell >>")
soma = h.Section(
name="MSO_Soma_%x" % id(self)
) # one compartment of about 29000 um2
soma.nseg = 1
self.add_section(soma, "soma")
else:
"""
instantiate a structured model with the morphology as specified by
the morphology file
"""
print(
"<< MSO principal cell model: Creating cell with morphology from %s >>"
% morphology
)
self.set_morphology(morphology_file=morphology)
# decorate the morphology with ion channels
if decorator is None: # basic model, only on the soma
self.mechanisms = ["klt", "kht", "ihvcn", "leak", nach]
for mech in self.mechanisms:
self.soma.insert(mech)
self.soma.ena = self.e_na
self.soma.ek = self.e_k
self.soma().ihvcn.eh = self.e_h
self.soma().leak.erev = self.e_leak
self.c_m = 0.9
self.species_scaling(
silent=True, species=species, modelType=modelType
) # set the default type II cell parameters
else: # decorate according to a defined set of rules on all cell compartments
self.decorate()
self.save_all_mechs() # save all mechanisms inserted, location and gbar values...
self.get_mechs(self.soma)
if debug:
print(" << Created cell >>")
def get_cellpars(self, dataset, species="guineapig", celltype="principal"):
cellcap = data.get(
dataset, species=species, cell_type=celltype, field="soma_Cap"
)
chtype = data.get(
dataset, species=species, cell_type=celltype, field="soma_na_type"
)
pars = Params(cap=cellcap, natype=chtype)
for g in ["soma_kht_gbar", "soma_klt_gbar", "soma_ih_gbar", "soma_leak_gbar"]:
pars.additem(
g, data.get(dataset, species=species, cell_type=celltype, field=g)
)
return pars
def species_scaling(self, species="guineapig", modelType="principal", silent=True):
"""
Adjust all of the conductances and the cell size according to the species requested.
This scaling should be used ONLY for point models, as no other compartments
are scaled.
This scaling routine also sets the temperature for the model to a default value. Some models
can be run at multiple temperatures, and so a default from one of the temperatures is used.
The calling cell.set_temperature(newtemp) will change the conductances and reinitialize
the cell to the new temperature settings.
Parameters
----------
species : string (default: 'guineapig')
name of the species to use for scaling the conductances in the base point model
Must be one of mouse, cat, guineapig
modelType: string (default: 'principal')
definition of model type from RM03 models, principal cell for mso
silent : boolean (default: True)
run silently (True) or verbosely (False)
"""
# print '\nSpecies scaling: %s %s' % (species, type)
knownspecies = ["guineapig"]
soma = self.soma
if modelType == "principal":
celltype = (
"MSO-principal"
) # There are other possiblities in the literature - this is just the main one
else:
raise ValueError("model type not recognized")
if species == "guineapig":
print(
" Setting conductances for guinea pig %s MSO cell, based on Rothman and Manis, 2003 bushy cell"
% modelType
)
self._valid_temperatures = (22.0, 38.0)
if self.status["temperature"] is None:
self.status["temperature"] = 22.0
self.i_test_range = {"pulse": (-0.4, 0.4, 0.02)}
sf = 1.0
if (
self.status["temperature"] == 38.0
): # adjust for 2003 model conductance levels at 38
sf = 2 # Q10 of 2, 22->38C. (p3106, R&M2003c)
# note that kinetics are scaled in the mod file.
dataset = "MSO_principal_channels"
pars = self.get_cellpars(dataset, species=species, celltype=celltype)
self.set_soma_size_from_Cm(pars.cap)
self.status["na"] = pars.natype
self.adjust_na_chans(soma, sf=sf)
soma().kht.gbar = nstomho(pars.soma_kht_gbar, self.somaarea)
soma().klt.gbar = nstomho(pars.soma_klt_gbar, self.somaarea)
soma().ihvcn.gbar = nstomho(pars.soma_ih_gbar, self.somaarea)
soma().leak.gbar = nstomho(pars.soma_leak_gbar, self.somaarea)
self.axonsf = 0.57
else:
errmsg = (
'Species "%s" or model type "%s" is not recognized for MSO cells.'
% (species, modelType)
)
errmsg += "\n Valid species are: \n"
for s in knownspecies:
errmsg += " %s\n" % s
errmsg += "-" * 40
raise ValueError(errmsg)
self.status["species"] = species
self.status["modelType"] = modelType
self.check_temperature()
# self.cell_initialize(vrange=self.vrange) # no need to do this just yet.
if not silent:
print(" set cell as: ", species)
print(" with Vm rest = %6.3f" % self.vm0)
def channel_manager(self, modelType="MSO-principal"):
"""
This routine defines channel density maps and distance map patterns
for each type of compartment in the cell. The maps
are used by the ChannelDecorator class (specifically, its private
\_biophys function) to decorate the cell membrane.
These settings are only used if the decorator is called; otherwise
for point cells, the species_scaling routine defines the channel
densities.
Parameters
----------
modelType : string (default: 'RM03')
A string that defines the type of the model. Currently, only 1 type is implemented:
RM03: Rothman and Manis, 2003 somatic densities based on guinea pig bushy cell
Returns
-------
Nothing
Notes
-----
This routine defines the following variables for the class:
* conductances (gBar)
* a channelMap (dictonary of channel densities in defined anatomical compartments)
* a current injection range for IV's (used for testing)
* a distance map, which defines how each conductance in a selected compartment
changes with distance from the soma. The current implementation includes both
linear and exponential gradients,
the minimum conductance at the end of the gradient, and the space constant or
slope for the gradient.
"""
self.c_m = 1e-6 # default in units of F/cm^2
if modelType == "MSO-principal":
#
# Create a model based on the Rothman and Manis 2003 conductance set from guinea pig
#
self.c_m = 0.9e-6 # default in units of F/cm^2
totcap = 12.0e-12 # in units of F, from Rothman and Manis, 2003.
refarea = totcap / self.c_m # area is in cm^2
# MSO Rothman-Manis, guinea pig type II
# model gave cell conductance in nS, but we want S/cm^2 for NEURON
# so conversion is 1e-9*nS = uS, and refarea is already in cm2
self._valid_temperatures = (22.0, 38.0)
sf = 1.0
if self.status["temperature"] == None:
self.status["temperature"] = 22.0
if self.status["temperature"] == 38:
sf = 3.03
self.gBar = Params(
nabar=sf * 1000.0e-9 / refarea,
khtbar=sf * 150.0e-9 / refarea,
kltbar=sf * 200.0e-9 / refarea,
ihbar=sf * 20.0e-9 / refarea,
leakbar=sf * 2.0e-9 / refarea,
)
print("MSO principal channels gbar:\n", self.gBar.show())
self.channelMap = {
"axon": {
"nacn": self.gBar.nabar,
"klt": self.gBar.kltbar,
"kht": self.gBar.khtbar,
"ihvcn": 0.0,
"leak": self.gBar.leakbar / 2.0,
},
"hillock": {
"nacn": self.gBar.nabar,
"klt": self.gBar.kltbar,
"kht": self.gBar.khtbar,
"ihvcn": 0.0,
"leak": self.gBar.leakbar,
},
"initseg": {
"nacn": self.gBar.nabar,
"klt": self.gBar.kltbar,
"kht": self.gBar.khtbar,
"ihvcn": self.gBar.ihbar / 2.0,
"leak": self.gBar.leakbar,
},
"soma": {
"nacn": self.gBar.nabar,
"klt": self.gBar.kltbar,
"kht": self.gBar.khtbar,
"ihvcn": self.gBar.ihbar,
"leak": self.gBar.leakbar,
},
"dend": {
"nacn": self.gBar.nabar,
"klt": self.gBar.kltbar * 0.5,
"kht": self.gBar.khtbar * 0.5,
"ihvcn": self.gBar.ihbar / 3.0,
"leak": self.gBar.leakbar * 0.5,
},
"apic": {
"nacn": self.gBar.nabar,
"klt": self.gBar.kltbar * 0.2,
"kht": self.gBar.khtbar * 0.2,
"ihvcn": self.gBar.ihbar / 4.0,
"leak": self.gBar.leakbar * 0.2,
},
}
# self.irange = np.linspace(-1., 1., 21)
self.distMap = {
"dend": {
"klt": {"gradient": "linear", "gminf": 0.0, "lambda": 100.0},
"kht": {"gradient": "linear", "gminf": 0.0, "lambda": 100.0},
"nacn": {"gradient": "exp", "gminf": 0.0, "lambda": 100.0},
}, # linear with distance, gminf (factor) is multiplied by gbar
"apic": {
"klt": {"gradient": "linear", "gminf": 0.0, "lambda": 100.0},
"kht": {"gradient": "linear", "gminf": 0.0, "lambda": 100.0},
"nacn": {"gradient": "exp", "gminf": 0.0, "lambda": 100.0},
}, # gradients are: flat, linear, exponential
}
else:
raise ValueError("model type %s is not implemented" % modelType)
self.check_temperature()
def adjust_na_chans(self, soma, sf=1.0, gbar=1000.0, debug=False):
"""
adjust the sodium channel conductance
Parameters
----------
soma : neuron section object
A soma object whose sodium channel complement will have its
conductances adjusted depending on the channel type
gbar : float (default: 1000.)
The maximal conductance for the sodium channel
debug : boolean (false):
Verbose printing
Returns
-------
Nothing :
"""
if self.status["ttx"]:
gnabar = 0.0
else:
gnabar = nstomho(gbar, self.somaarea) * sf
nach = self.status["na"]
if nach == "jsrna":
soma().jsrna.gbar = gnabar
soma.ena = self.e_na
if debug:
print("jsrna gbar: ", soma().jsrna.gbar)
elif nach == "nav11":
soma().nav11.gbar = gnabar
soma.ena = 50 # self.e_na
# print('gnabar: ', soma().nav11.gbar, ' vs: 0.0192307692308')
soma().nav11.vsna = 4.3
if debug:
print("MSO using inva11")
elif nach in ["na", "nacn"]:
soma().na.gbar = gnabar
soma.ena = self.e_na
if debug:
print("na gbar: ", soma().na.gbar)
else:
raise ValueError("Sodium channel %s is not recognized for MSO cells", nach)

718
cnmodel/cells/octopus.py

@ -0,0 +1,718 @@ @@ -0,0 +1,718 @@
from __future__ import print_function
from neuron import h
from ..util import nstomho
from ..util import Params
import numpy as np
from .cell import Cell
from .. import data
"""
Original hoc code from RMmodel.hoc
// including the "Octopus" cell:
proc set_Type2o() {
gbar_na = nstomho(1000)
gbar_kht = nstomho(150)
gbar_klt = nstomho(600)
gbar_ka = nstomho(0)
gbar_ih = nstomho(0)
gbar_hcno = nstomho(40)
gbar_leak = nstomho(2)
model = 6
modelname = "Type IIo (Octopus)"
vm0 = -66.67
}
"""
__all__ = ["Octopus", "OctopusRothman", "OctopusSpencer"]
class Octopus(Cell):
type = "octopus"
@classmethod
def create(cls, modelType="RM03", **kwds):
if modelType in ["RM03", "II-o"]:
return OctopusRothman(**kwds)
elif modelType == "Spencer":
return OctopusSpencer(**kwds)
else:
raise ValueError("Octopus cell type %s is unknown" % modelType)
def make_psd(self, terminal, psd_type, **kwds):
"""
Connect a presynaptic terminal to one post section at the specified location, with the fraction
of the "standard" conductance determined by gbar.
The default condition is to try to pass the default unit test (loc=0.5)
Parameters
----------
terminal : Presynaptic terminal (NEURON object)
psd_type : either simple or multisite PSD for bushy cell
kwds: dict of options. Two are currently handled:
postsize : expect a list consisting of [sectionno, location (float)]
AMPAScale : float to scale the ampa currents
"""
if (
"postsite" in kwds
): # use a defined location instead of the default (soma(0.5)
postsite = kwds["postsite"]
loc = postsite[1] # where on the section?
uname = (
"sections[%d]" % postsite[0]
) # make a name to look up the neuron section object
post_sec = self.hr.get_section(uname) # Tell us where to put the synapse.
else:
loc = 0.5
post_sec = self.soma
if psd_type == "simple":
if terminal.cell.type in ["sgc"]:
weight = data.get(
"%s_synapse" % terminal.cell.type,
species=self.species,
post_type=self.type,
field="weight",
)
tau1 = data.get(
"%s_synapse" % terminal.cell.type,
species=self.species,
post_type=self.type,
field="tau1",
)
tau2 = data.get(
"%s_synapse" % terminal.cell.type,
species=self.species,
post_type=self.type,
field="tau2",
)
erev = data.get(
"%s_synapse" % terminal.cell.type,
species=self.species,
post_type=self.type,
field="erev",
)
return self.make_exp2_psd(
post_sec,
terminal,
weight=weight,
loc=loc,
tau1=tau1,
tau2=tau2,
erev=erev,
)
else:
raise TypeError(
"Cannot make simple PSD for %s => %s"
% (terminal.cell.type, self.type)
)
elif psd_type == "multisite":
if terminal.cell.type == "sgc":
# Max conductances for the glu mechanisms are calibrated by
# running `synapses/tests/test_psd.py`. The test should fail
# if these values are incorrect
self.AMPAR_gmax = (
data.get(
"sgc_synapse",
species=self.species,
post_type=self.type,
field="AMPAR_gmax",
)
* 1e3
)
self.NMDAR_gmax = (
data.get(
"sgc_synapse",
species=self.species,
post_type=self.type,
field="NMDAR_gmax",
)
* 1e3
)
self.Pr = data.get(
"sgc_synapse", species=self.species, post_type=self.type, field="Pr"
)
# adjust gmax to correct for initial Pr
self.AMPAR_gmax = self.AMPAR_gmax / self.Pr
self.NMDAR_gmax = self.NMDAR_gmax / self.Pr
# AMPA_gmax = 3.314707700918133*1e3 # factor of 1e3 scales to pS (.mod mechanisms) from nS.
# NMDA_gmax = 0.4531929783503451*1e3
if "AMPAScale" in kwds:
self.AMPAR_gmax = (
self.AMPAR_gmax * kwds["AMPAScale"]
) # allow scaling of AMPA conductances
if "NMDAScale" in kwds:
self.NMDAR_gmax = self.NMDAR_gmax * kwds["NMDAScale"]
return self.make_glu_psd(
post_sec, terminal, self.AMPAR_gmax, self.NMDAR_gmax, loc=loc
)
elif terminal.cell.type == "dstellate":
return self.make_gly_psd(post_sec, terminal, psdtype="glyslow", loc=loc)
else:
raise TypeError(
"Cannot make PSD for %s => %s" % (terminal.cell.type, self.type)
)
else:
raise ValueError("Unsupported psd type %s" % psd_type)
class OctopusRothman(Octopus, Cell):
"""
VCN octopus cell model (point cell).
Rothman and Manis, 2003abc (Type II, with high gklt and hcno - octopus cell h current).
"""
def __init__(
self,
morphology=None,
decorator=None,
nach=None,
ttx=False,
species="guineapig",
modelType=None,
debug=False,
):
"""
initialize the octopus cell, using the default parameters for guinea pig from
R&M2003, as a type II cell with modified conductances.
Modifications to the cell can be made by calling methods below.
Parameters
----------
morphology : string (default: None)
a file name to read the cell morphology from. If a valid file is found, a cell is constructed
as a cable model from the hoc file.
If None (default), the only a point model is made, exactly according to RM03.
decorator : Python function (default: None)
decorator is a function that "decorates" the morphology with ion channels according
to a set of rules.
If None, a default set of channels aer inserted into the first soma section, and the
rest of the structure is "bare".
nach : string (default: None)
nach selects the type of sodium channel that will be used in the model. A channel mechanism
by that name must exist. None implies the default channel (jsrna for this model).
ttx : Boolean (default: False)
If ttx is True, then the sodium channel conductance is set to 0 everywhere in the cell.
Currently, this is not implemented.
species: string (default 'guineapig')
species defines the channel density that will be inserted for different models. Note that
if a decorator function is specified, this argument is ignored.
modelType: string (default: None)
modelType specifies the type of the model that will be used (e.g., "II", "II-I", etc).
modelType is passed to the decorator, or to species_scaling to adjust point models.
debug: boolean (default: False)
debug is a boolean flag. When set, there will be multiple printouts of progress and parameters.
Returns
-------
Nothing
"""
super(OctopusRothman, self).__init__()
if modelType == None:
modelType = "II-o"
if nach == None and species == "guineapig":
nach = "jsrna"
if nach == None and species == "mouse":
nach = "nacn"
self.status = {
"soma": True,
"axon": False,
"dendrites": False,
"pumps": False,
"na": nach,
"species": species,
"modelType": modelType,
"ttx": ttx,
"name": "Octopus",
"morphology": morphology,
"decorator": decorator,
"temperature": None,
}
self.i_test_range = {"pulse": (-4.0, 4.0, 0.2)}
self.spike_threshold = -50
self.vrange = [-70.0, -57.0] # set a default vrange for searching for rmp
if morphology is None:
"""
instantiate a basic soma-only ("point") model
"""
soma = h.Section(
name="Octopus_Soma_%x" % id(self)
) # one compartment of about 29000 um2
soma.nseg = 1
self.add_section(soma, "soma")
else:
"""
instantiate a structured model with the morphology as specified by
the morphology file
"""
self.set_morphology(morphology_file=morphology)
# decorate the morphology with ion channels
if decorator is None: # basic model, only on the soma
self.e_leak = -73.0 # from McGinley et al., 2016
self.e_h = -38.0 # from McGinley et al.
self.R_a = 195 # McGinley et al.
if self.status["species"] == "mouse":
self.mechanisms = ["klt", "kht", "hcnobo", "leak", nach]
else:
self.mechanisms = ["klt", "kht", "ihvcn", "leak", nach]
for mech in self.mechanisms:
self.soma.insert(mech)
self.soma.ek = self.e_k
self.soma.ena = self.e_na
if self.status["species"] == "mouse":
self.soma().hcnobo.eh = self.e_h
else:
self.soma().ihvcn.eh = self.e_h
self.soma().leak.erev = self.e_leak
self.soma.Ra = self.R_a
self.species_scaling(
silent=True, species=species, modelType=modelType
) # set the default type II cell parameters
else: # decorate according to a defined set of rules on all cell compartments
self.decorate()
self.save_all_mechs() # save all mechanisms inserted, location and gbar values...
self.get_mechs(self.soma)
if debug:
print("<< octopus: octopus cell model created >>")
# print 'Cell created: ', self.status
def species_scaling(self, species="guineapig", modelType="II-o", silent=True):
"""
Adjust all of the conductances and the cell size according to the species requested.
Used ONLY for point models.
Parameters
----------
species : string (default: 'guineapig')
name of the species to use for scaling the conductances in the base point model
Must be guineapig
modelType: string (default: 'II-o')
definition of model type from RM03 models, currently limited to type II-o
silent : boolean (default: True)
run silently (True) or verbosely (False)
"""
soma = self.soma
if species == "guineapig" and modelType == "II-o":
self.c_m = 0.9
self.set_soma_size_from_Cm(25.0)
self._valid_temperatures = (22.0, 38.0)
if self.status["temperature"] is None:
self.set_temperature(22.0)
sf = 1.0
if (
self.status["temperature"] == 38.0
): # adjust for 2003 model conductance levels at 38
sf = 3.03 # Q10 of 2, 22->38C. (p3106, R&M2003c)
# note that kinetics are scaled in the mod file.
# self.print_soma_info()
self.adjust_na_chans(soma, sf=sf)
soma().kht.gbar = sf * nstomho(150.0, self.somaarea) # 6.1 mmho/cm2
soma().klt.gbar = sf * nstomho(
1000.0, self.somaarea
) # 40.7 mmho/cm2 3195?
soma().ihvcn.gbar = sf * nstomho(
30.0, self.somaarea
) # 7.6 mmho/cm2, cf. Bal and Oertel, Spencer et al. 25 u dia cell 40ns?
soma().leak.gbar = sf * nstomho(2.0, self.somaarea)
self.axonsf = 1.0
elif species == "mouse" and modelType == "II-o":
self.set_soma_size_from_Cm(25.0)
self._valid_temperatures = (34.0,)
if self.status["temperature"] is None:
self.set_temperature(34.0)
# self.print_soma_info()
self.adjust_na_chans(soma, gbar=3000.0)
soma().kht.gbar = nstomho(150.0, self.somaarea) # 6.1 mmho/cm2
soma().klt.gbar = nstomho(3196.0, self.somaarea) # 40.7 mmho/cm2
soma().hcnobo.gbar = nstomho(
40.0, self.somaarea
) # 7.6 mmho/cm2, cf. Bal and Oertel, Spencer et al. 25 u dia cell
soma().leak.gbar = nstomho(2.0, self.somaarea)
self.axonsf = 1.0
else:
raise ValueError(
'Species "%s" or species-type "%s" is not recognized for octopus cells'
% (species, type)
)
self.status["species"] = species
self.status["modelType"] = modelType
# self.cell_initialize(showinfo=True)
self.check_temperature()
if not silent:
print("set cell as: ", species)
print(" with Vm rest = %6.3f" % self.vm0)
def adjust_na_chans(self, soma, sf=1.0, gbar=1000.0, debug=False):
"""
adjust the sodium channel conductance
Parameters
----------
soma : neuron section object
a soma object whose sodium channel complement will have it's
conductances adjusted depending on the channel type
gbar : float (default: 1000.)
the maximal conductance for the sodium channel
debug : boolean (false):
verbose printing
Returns
-------
Nothing
"""
if self.status["ttx"]:
gnabar = 0.0
else:
gnabar = sf * nstomho(gbar, self.somaarea) # mmho/cm2 - 4244.1 moh - 4.2441
nach = self.status["na"]
if nach == "jsrna":
soma().jsrna.gbar = gnabar
soma.ena = self.e_na
if debug:
print("octopus using jsrna, gbar: ", soma().jsrna.gbar)
elif nach == "nav11":
soma().nav11.gbar = gnabar
soma.ena = self.e_na
soma().nav11.vsna = 4.3
if debug:
print("octopus using inva11, gbar:", soma().nav11.gbar)
elif nach in ["na", "nacn"]:
soma().nacn.gbar = gnabar
soma.ena = self.e_na
if debug:
print("octopus cell using na/nacn, gbar: ", soma().na.gbar)
else:
raise ValueError(
"Sodium channel %s is not recognized for octopus cells", nach
)
class OctopusSpencer(Octopus, Cell):
"""
VCN octopus cell model (with dendrites).
Based on Spencer et al Front. Comput. Neurosci., 22 October 2012
https://doi.org/10.3389/fncom.2012.00083
"""
def __init__(
self,
morphology=None,
decorator=None,
nach="jsrna",
ttx=False,
species="guineapig",
modelType=None,
debug=False,
):
"""
initialize the octopus cell, using the parameters Spencer et al. 2012
Modifications to the cell can be made by calling methods below.
Parameters
----------
morphology : string (default: None)
a file name to read the cell morphology from. If a valid file is found, a cell is constructed
as a cable model from the hoc file.
If None (default), the only a point model is made, exactly according to RM03.
decorator : Python function (default: None)
decorator is a function that "decorates" the morphology with ion channels according
to a set of rules.
If None, a default set of channels aer inserted into the first soma section, and the
rest of the structure is "bare".
nach : string (default: 'na')
nach selects the type of sodium channel that will be used in the model. A channel mechanism
by that name must exist.
ttx : Boolean (default: False)
If ttx is True, then the sodium channel conductance is set to 0 everywhere in the cell.
Currently, this is not implemented.
species: string (default 'guineapig')
species defines the channel density that will be inserted for different models. Note that
if a decorator function is specified, this argument is ignored.
modelType: string (default: None)
modelType specifies the type of the model that will be used (e.g., "II", "II-I", etc).
modelType is passed to the decorator, or to species_scaling to adjust point models.
debug: boolean (default: False)
debug is a boolean flag. When set, there will be multiple printouts of progress and parameters.
Returns
-------
Nothing
"""
super(OctopusSpencer, self).__init__()
if modelType == None:
modelType = "Spencer"
self.status = {
"soma": True,
"axon": False,
"dendrites": False,
"pumps": False,
"na": nach,
"species": species,
"modelType": modelType,
"ttx": ttx,
"name": "Octopus",
"morphology": morphology,
"decorator": decorator,
"temperature": None,
}
self.i_test_range = (-4.0, 6.0, 0.25)
self.spike_threshold = -50
self.vrange = [-75.0, -63.0] # set a default vrange for searching for rmp
if morphology is None:
"""
instantiate a basic soma-only ("point") model
"""
soma = h.Section(
name="Octopus_Soma_%x" % id(self)
) # one compartment of about 29000 um2
soma.nseg = 1
self.add_section(soma, "soma")
self.set_soma_size_from_Section(self.soma)
else:
"""
instantiate a structured model with the morphology as specified by
the morphology file
"""
self.set_morphology(morphology_file=morphology)
# decorate the morphology with ion channels
if decorator is None: # basic model, only on the soma
self.e_leak = -62.0 # from Spencer et al., 2012
self.e_h = -38.0 ## from Spencer et al., 2012
self.R_a = 100.0 # from Spencer et al., 2012
self.mechanisms = ["klt", "kht", "hcnobo", "leak", nach]
for mech in self.mechanisms:
self.soma.insert(mech)
self.soma.ek = -70.0 # self.e_k
self.soma.ena = 55.0 # self.e_na
self.soma().hcnobo.eh = self.e_h
self.soma().leak.erev = self.e_leak
self.soma.Ra = self.R_a
self.species_scaling(
silent=True, species=species, modelType=modelType
) # set the default type II cell parameters
else: # decorate according to a defined set of rules on all cell compartments
self.decorate()
self.decorated.channelValidate(self, verify=True)
# print 'Mechanisms inserted: ', self.mechanisms
self.get_mechs(self.soma)
# self.cell_initialize(vrange=self.vrange)
if debug:
print("<< octopus: octopus cell model created >>")
# print 'Cell created: ', self.status
def channel_manager(self, modelType="Spencer"):
"""
This routine defines channel density maps and distance map patterns
for each type of compartment in the cell. The maps
are used by the ChannelDecorator class (specifically, it's private
\_biophys function) to decorate the cell membrane.
Parameters
----------
modelType : string (default: 'Spencer')
A string that defines the type of the model. Currently, 1 type is implemented:
Spencer : Spencer et al Front. Comput. Neurosci. 2012
Returns
-------
Nothing
Notes
-----
This routine defines the following variables for the class:
# conductances (gBar)
# a channelMap (dictonary of channel densities in defined anatomical compartments)
# a current injection range for IV's (when testing)
# a distance map, which defines how selected conductances in selected compartments
will change with distance. This includes both linear and exponential gradients,
the minimum conductance at the end of the gradient, and the space constant or
slope for the gradient.
"""
#
# Create a model based on the Spencer model
# Channel decoration and stick model from Figure 2
# densities from Tables 2 and 3
if modelType == "Spencer":
# print self.c_m
self.c_m = 0.9
# self.set_soma_size_from_Section(self.soma)
totcap = self.totcap
refarea = self.somaarea # totcap / self.c_m # see above for units
# self.print_soma_info()
self._valid_temperatures = (
34.0,
) # 34 for consistency with other mouse models, but
# Spencer data used "33". This affects very slightly
# the HCN channel conductance.
if self.status["temperature"] is None:
self.set_temperature(34.0)
self.gBar = Params(
nabar=0.0, # 0.0407, # S/cm2
nabar_ais=0.42441,
kltbar_ais=0.0,
khtbar_ais=0.0,
ihbar_ais=0.0,
kltbar_soma=0.0407,
khtbar_soma=0.0061,
ihbar_soma=0.0076,
kltbar_dend=0.0027,
khtbar_dend=0.0,
ihbar_dend=0.0006,
khtbar_hillock=0.0,
kltbar_hillock=0.0,
ihbar_hillock=0.0,
leakbar=0.0020,
)
self.channelMap = {
"soma": {
"jsrna": self.gBar.nabar,
"klt": self.gBar.kltbar_soma,
"kht": self.gBar.khtbar_soma,
"hcnobo": self.gBar.ihbar_soma,
"leak": self.gBar.leakbar,
},
"hillock": {
"jsrna": 0.0,
"klt": self.gBar.kltbar_hillock,
"kht": self.gBar.khtbar_hillock,
"hcnobo": self.gBar.ihbar_hillock,
"leak": self.gBar.leakbar,
},
# axon initial segment:
"unmyelinatedaxon": {
"jsrna": self.gBar.nabar_ais,
"klt": self.gBar.kltbar_ais,
"kht": self.gBar.khtbar_ais,
"hcnobo": self.gBar.ihbar_ais,
"leak": self.gBar.leakbar,
},
"primarydendrite": {
"jsrna": 0.0,
"klt": self.gBar.kltbar_dend,
"kht": self.gBar.khtbar_dend,
"hcnobo": self.gBar.ihbar_dend,
"leak": self.gBar.leakbar,
},
}
self.distMap = {
"primarydendrite": {
"klt": {"gradient": "flat", "gminf": 0.0, "lambda": 100.0},
"kht": {"gradient": "flat", "gminf": 0.0, "lambda": 100.0},
"hcnobo": {"gradient": "flat", "gminf": 0.0, "lambda": 100.0},
} # all flat with distance
}
# reversal potential map
self.channelErevMap = {
"soma": {
"jsrna": 55.0,
"klt": -70,
"kht": -70,
"hcnobo": -38,
"leak": -62.0,
},
"hillock": {
"jsrna": 55.0,
"klt": -70,
"kht": -70,
"hcnobo": -38,
"leak": -62.0,
},
"unmyelinatedaxon": {
"jsrna": 55.0,
"klt": -70,
"kht": -70,
"hcnobo": -38,
"leak": -62.0,
},
"primarydendrite": {
"jsrna": 55.0,
"klt": -70,
"kht": -70,
"hcnobo": -38,
"leak": -62.0,
},
}
else:
raise ValueError("model type %s is not implemented" % modelType)
self.check_temperature()
def species_scaling(self, species="mouse", modelType="Spencer", silent=True):
"""
Adjust all of the conductances and the cell size according to the species requested.
Used ONLY for point models.
Parameters
----------
species : string (default: 'guineapig')
name of the species to use for scaling the conductances in the base point model
Must be guineapig
modelType: string (default: 'II-o')
definition of model type from RM03 models, currently limited to type II-o
silent : boolean (default: True)
run silently (True) or verbosely (False)
"""
soma = self.soma
if species == "mouse" and modelType == "Spencer":
print("Octopus: Mouse, Spencer point model - not a valid model")
self.set_soma_size_from_Cm(25.0)
self._valid_temperatures = (34.0,)
if self.status["temperature"] is None:
self.set_temperature(34.0)
self.print_soma_info()
# self.adjust_na_chans(soma)
# soma().kht.gbar = 0.0061 # nstomho(150.0, self.somaarea) # 6.1 mmho/cm2
# soma().klt.gbar = 0.0407 # nstomho(3196.0, self.somaarea) # 40.7 mmho/cm2
# soma().hcnobo.gbar = 0.0076 #nstomho(40.0, self.somaarea) # 7.6 mmho/cm2, cf. Bal and Oertel, Spencer et al. 25 u dia cell
# soma().leak.gbar = 0.0005 # nstomho(2.0, self.somaarea)
self.axonsf = 1.0
else:
raise ValueError(
'Species "%s" or species-type "%s" is not recognized for octopus cells'
% (species, type)
)
self.status["species"] = species
self.status["modelType"] = modelType
self.cell_initialize(showinfo=True)
if not silent:
print("set cell as: ", species)
print(" with Vm rest = %6.3f" % self.vm0)

482
cnmodel/cells/pyramidal.py

@ -0,0 +1,482 @@ @@ -0,0 +1,482 @@
from __future__ import print_function
import numpy as np
from neuron import h
from .cell import Cell
from .. import data
from ..util import Params
from ..util import nstomho
__all__ = ["Pyramidal", "PyramidalKanold"]
class Pyramidal(Cell):
type = "pyramidal"
@classmethod
def create(cls, model="POK", **kwds):
if model == "POK":
return PyramidalKanold(**kwds)
else:
raise ValueError("Pyramidal model %s is unknown", model)
def make_psd(self, terminal, psd_type, **kwds):
"""
Connect a presynaptic terminal to one post section at the specified location, with the fraction
of the "standard" conductance determined by gbar.
The default condition is to try to pass the default unit test (loc=0.5)
Parameters
----------
terminal : Presynaptic terminal (NEURON object)
psd_type : either simple or multisite PSD for bushy cell
kwds: dict of options. Two are currently handled:
postsize : expect a list consisting of [sectionno, location (float)]
AMPAScale : float to scale the ampa currents
"""
if (
"postsite" in kwds
): # use a defined location instead of the default (soma(0.5)
postsite = kwds["postsite"]
loc = postsite[1] # where on the section?
uname = (
"sections[%d]" % postsite[0]
) # make a name to look up the neuron section object
post_sec = self.hr.get_section(uname) # Tell us where to put the synapse.
else:
loc = 0.5
post_sec = self.soma
if psd_type == "simple":
if terminal.cell.type in [
"sgc",
"dstellate",
"tuberculoventral",
"cartwheel",
]:
weight = data.get(
"%s_synapse" % terminal.cell.type,
species=self.species,
post_type=self.type,
field="weight",
)
tau1 = data.get(
"%s_synapse" % terminal.cell.type,
species=self.species,
post_type=self.type,
field="tau1",
)
tau2 = data.get(
"%s_synapse" % terminal.cell.type,
species=self.species,
post_type=self.type,
field="tau2",
)
erev = data.get(
"%s_synapse" % terminal.cell.type,
species=self.species,
post_type=self.type,
field="erev",
)
return self.make_exp2_psd(
post_sec,
terminal,
weight=weight,
loc=loc,
tau1=tau1,
tau2=tau2,
erev=erev,
)
else:
raise TypeError(
"Cannot make simple PSD for %s => %s"
% (terminal.cell.type, self.type)
)
elif psd_type == "multisite":
if terminal.cell.type == "sgc":
# Max conductances for the glu mechanisms are calibrated by
# running `synapses/tests/test_psd.py`. The test should fail
# if these values are incorrect
self.AMPAR_gmax = (
data.get(
"sgc_synapse",
species=self.species,
post_type=self.type,
field="AMPAR_gmax",
)
* 1e3
)
self.NMDAR_gmax = (
data.get(
"sgc_synapse",
species=self.species,
post_type=self.type,
field="NMDAR_gmax",
)
* 1e3
)
self.Pr = data.get(
"sgc_synapse", species=self.species, post_type=self.type, field="Pr"
)
# adjust gmax to correct for initial Pr
self.AMPAR_gmax = self.AMPAR_gmax / self.Pr
self.NMDAR_gmax = self.NMDAR_gmax / self.Pr
if "AMPAScale" in kwds:
self.AMPA_gmax = (
self.AMPA_gmax * kwds["AMPAScale"]
) # allow scaling of AMPA conductances
if "NMDAScale" in kwds:
self.NMDA_gmax = self.NMDA_gmax * kwds["NMDAScale"]
return self.make_glu_psd(
post_sec, terminal, self.AMPAR_gmax, self.NMDAR_gmax, loc=loc
)
elif terminal.cell.type == "dstellate": # WBI input -Voigt, Nelken, Young
return self.make_gly_psd(post_sec, terminal, psdtype="glyfast", loc=loc)
elif (
terminal.cell.type == "tuberculoventral"
): # TV cells talk to each other-Kuo et al.
return self.make_gly_psd(post_sec, terminal, psdtype="glyfast", loc=loc)
else:
raise TypeError(
"Cannot make PSD for %s => %s" % (terminal.cell.type, self.type)
)
else:
raise ValueError("Unsupported psd type %s" % psd_type)
class PyramidalKanold(Pyramidal, Cell):
"""
DCN pyramidal cell
Kanold and Manis, 1999, 2001, 2005
"""
def __init__(
self,
morphology=None,
decorator=None,
nach=None,
ttx=False,
species="rat",
modelType=None,
debug=False,
):
"""
initialize a pyramidal cell, based on the Kanold-Manis (2001) pyramidal cell model.
Modifications to the cell can be made by calling methods below. These include
converting to a model with modified size and conductances (experimental).
Parameters
----------
morphology : string (default: None)
a file name to read the cell morphology from. If a valid file is found, a cell is constructed
as a cable model from the hoc file.
If None (default), the only a point model is made, exactly according to RM03.
decorator : Python function (default: None)
decorator is a function that "decorates" the morphology with ion channels according
to a set of rules.
If None, a default set of channels is inserted into the first soma section, and the
rest of the structure is "bare".
nach : string (default: None)
nach selects the type of sodium channel that will be used in the model. A channel mechanim
by that name must exist. None implies the default channel, 'napyr'.
ttx : Boolean (default: False)
If ttx is True, then the sodium channel conductance is set to 0 everywhere in the cell.
Currently, this is not implemented.
species: string (default 'guineapig')
species defines the channel density that will be inserted for different models. Note that
if a decorator function is specified, this argument is ignored (overridden by decorator).
modelType: string (default: None)
modelType specifies the type of the model that will be used (e.g., "II", "II-I", etc).
modelType is passed to the decorator, or to species_scaling to adjust point models.
debug: boolean (default: False)
debug is a boolean flag. When set, there will be multiple printouts of progress and parameters.
Returns
-------
Nothing
"""
super(PyramidalKanold, self).__init__()
if modelType == None:
modelType = "POK"
if nach == None:
nach = "napyr"
self.status = {
"soma": True,
"axon": False,
"dendrites": False,
"pumps": False,
"na": nach,
"species": species,
"modelType": modelType,
"ttx": ttx,
"name": "Pyramidal",
"morphology": morphology,
"decorator": decorator,
"temperature": None,
}
self.i_test_range = {"pulse": (-0.3, 0.401, 0.02)}
self.vrange = [-75.0, -60.0]
if morphology is None:
"""
instantiate a basic soma-only ("point") model
"""
soma = h.Section(
name="Pyramidal_Soma_%x" % id(self)
) # one compartment of about 29000 um2
soma.nseg = 1
self.add_section(soma, "soma")
else:
"""
instantiate a structured model with the morphology as specified by
the morphology file
"""
self.set_morphology(morphology_file=morphology)
# decorate the morphology with ion channels
if decorator is None: # basic model, only on the soma
self.mechanisms = [
"napyr",
"kdpyr",
"kif",
"kis",
"ihpyr",
"leak",
"kcnq",
"nap",
]
for mech in self.mechanisms:
try:
self.soma.insert(mech)
except ValueError:
print("WARNING: Mechanism %s not found" % mech)
self.soma().kif.kif_ivh = -89.6
self.species_scaling(
silent=True, species=species, modelType=modelType
) # set the default type I-c cell parameters
else: # decorate according to a defined set of rules on all cell compartments
self.decorate()
self.save_all_mechs() # save all mechanisms inserted, location and gbar values...
self.get_mechs(self.soma)
if debug:
print("<< PYR: POK Pyramidal Cell created >>")
def get_cellpars(self, dataset, species="guineapig", celltype="II"):
cellcap = data.get(
dataset, species=species, cell_type=celltype, field="soma_Cap"
)
chtype = data.get(
dataset, species=species, cell_type=celltype, field="soma_natype"
)
pars = Params(cap=cellcap, natype=chtype)
for g in [
"soma_napyr_gbar",
"soma_kdpyr_gbar",
"soma_kif_gbar",
"soma_kis_gbar",
"soma_kcnq_gbar",
"soma_nap_gbar",
"soma_ihpyr_gbar",
"soma_leak_gbar",
"soma_e_h",
"soma_leak_erev",
"soma_e_k",
"soma_e_na",
]:
pars.additem(
g, data.get(dataset, species=species, cell_type=celltype, field=g)
)
return pars
def species_scaling(self, species="rat", modelType="I", silent=True):
"""
Adjust all of the conductances and the cell size according to the species requested.
Used ONLY for point models.
Parameters
----------
species : string (default: 'rat')
name of the species to use for scaling the conductances in the base point model
Must be 'rat'
modelType: string (default: 'I')
definition of model type from Kanold and Manis, 2001
choices are 'I' or 'POK' (canonical model) or
'II', a modified model with more physiological surface area and KCNQ channels
silent : boolean (default: True)
run silently (True) or verbosely (False)
"""
if modelType in ["I", "POK"]:
celltype = "pyramidal"
elif modelType in ["II"]:
celltype = "pyramidal-II"
else:
celltype = modelType
dataset = "POK_channels"
soma = self.soma
if species in ["rat", "mouse"] and modelType in [
"I",
"POK",
"II",
]: # canonical K&M2001 model cell
self._valid_temperatures = (34.0,)
if self.status["temperature"] is None:
self.set_temperature(34.0)
pars = self.get_cellpars(dataset, species=species, celltype=celltype)
self.set_soma_size_from_Cm(pars.cap)
self.status["na"] = pars.natype
soma().napyr.gbar = nstomho(pars.soma_napyr_gbar, self.somaarea)
soma().nap.gbar = nstomho(
pars.soma_nap_gbar, self.somaarea
) # does not exist in canonical model
soma().kdpyr.gbar = nstomho(pars.soma_kdpyr_gbar, self.somaarea)
soma().kcnq.gbar = nstomho(
pars.soma_kcnq_gbar, self.somaarea
) # does not exist in canonical model.
soma().kif.gbar = nstomho(pars.soma_kif_gbar, self.somaarea)
soma().kis.gbar = nstomho(pars.soma_kis_gbar, self.somaarea)
soma().ihpyr.gbar = nstomho(pars.soma_ihpyr_gbar, self.somaarea)
# soma().ihpyr_adj.q10 = 3.0 # no temp scaling to sta
soma().leak.gbar = nstomho(pars.soma_leak_gbar, self.somaarea)
soma().leak.erev = pars.soma_leak_erev
soma().ena = pars.soma_e_na
soma().ek = pars.soma_e_k
soma().ihpyr.eh = pars.soma_e_h
# elif species in 'rat' and modelType == 'II':
# """
# Modified canonical K&M2001 model cell
# In this model version, the specific membrane capacitance is modified
# so that the overall membrane time constant is consistent with experimental
# measures in slices. However, this is not a physiological value. Attempts
# to use the normal 1 uF/cm2 value were unsuccessful in establishing the expected
# ~12 msec time constant.
# This model also adds a KCNQ channel, as described by Li et al., 2012.
# """
# self.c_m = 6.0
# self.set_soma_size_from_Diam(30.0)
# # self.set_soma_size_from_Cm(80.0)
# # print 'diameter: %7.1f' % self.soma.diam
# self._valid_temperatures = (34.,)
# if self.status['temperature'] is None:
# self.set_temperature(34.)
# self.refarea = self.somaarea
# soma().napyr.gbar = nstomho(550, self.refarea)
# soma().nap.gbar = nstomho(60.0, self.refarea)
# soma().kcnq.gbar = nstomho(2, self.refarea) # pyramidal cells have kcnq: Li et al, 2011 (Thanos)
# soma().kdpyr.gbar = nstomho(180, self.refarea) # Normally 80.
# soma().kif.gbar = nstomho(150, self.refarea) # normally 150
# soma().kis.gbar = nstomho(40, self.refarea) # 40
# soma().ihpyr.gbar = nstomho(2.8, self.refarea)
# soma().leak.gbar = nstomho(0.5, self.refarea)
# soma().leak.erev = -62. # override default values in cell.py
# soma().ena = 50.0
# soma().ek = -81.5
# soma().ihpyr.eh = -43
# if not self.status['dendrites']:
# self.add_dendrites()
else:
raise ValueError(
"Species %s or species-modelType %s is not implemented for Pyramidal cells"
% (species, modelType)
)
self.status["species"] = species
self.status["modelType"] = modelType
# self.cell_initialize(showinfo=True)
self.check_temperature()
if not silent:
print("set cell as: ", species, modelType)
print(" with Vm rest = %f" % self.vm0)
print(self.status)
for m in self.mechanisms:
print("%s.gbar = %f" % (m, eval("soma().%s.gbar" % m)))
def i_currents(self, V):
"""
For the steady-state case, return the total current at voltage V
Used to find the zero current point
vrange brackets the interval
Overrides i_currents in cells.py because we have a different set of currents
to compute.
"""
for part in self.all_sections.keys():
for sec in self.all_sections[part]:
sec.v = V
h.celsius = self.status["temperature"]
h.finitialize()
self.ix = {}
if "napyr" in self.mechanisms:
self.ix["napyr"] = self.soma().napyr.gna * (V - self.soma().ena)
if "nap" in self.mechanisms:
self.ix["nap"] = self.soma().nap.gnap * (V - self.soma().ena)
if "kdpyr" in self.mechanisms:
self.ix["kdpyr"] = self.soma().kdpyr.gk * (V - self.soma().ek)
if "kif" in self.mechanisms:
self.ix["kif"] = self.soma().kif.gkif * (V - self.soma().ek)
if "kis" in self.mechanisms:
self.ix["kis"] = self.soma().kis.gkis * (V - self.soma().ek)
if "kcnq" in self.mechanisms:
self.ix["kcnq"] = self.soma().kcnq.gk * (V - self.soma().ek)
if "ihpyr" in self.mechanisms:
self.ix["ihpyr"] = self.soma().ihpyr.gh * (V - self.soma().ihpyr.eh)
if "ihpyr_adj" in self.mechanisms:
self.ix["ihpyr_adj"] = self.soma().ihpyr_adj.gh * (
V - self.soma().ihpyr_adj.eh
)
# leak
if "leak" in self.mechanisms:
self.ix["leak"] = self.soma().leak.gbar * (V - self.soma().leak.erev)
return np.sum([self.ix[i] for i in self.ix])
def add_dendrites(self):
"""
Add simple unbranched dendrite.
The dendrites have some kd, kif and ih current
"""
nDend = range(2) # these will be simple, unbranced, N=4 dendrites
dendrites = []
for i in nDend:
dendrites.append(h.Section(cell=self.soma))
for i in nDend:
dendrites[i].connect(self.soma)
dendrites[i].L = 250 # length of the dendrite (not tapered)
dendrites[i].diam = 1
dendrites[i].cm = self.c_m
# h('dendrites[i].diam(0:1) = 2:1') # dendrite diameter, with tapering
dendrites[i].nseg = 21 # # segments in dendrites
dendrites[i].Ra = 150 # ohm.cm
dendrites[i].insert("napyr")
dendrites[i]().napyr.gbar = 0.00
dendrites[i].insert("kdpyr")
dendrites[i]().kdpyr.gbar = 0.002 # a little Ht
dendrites[i].insert("kif")
dendrites[i]().kif.gbar = 0.0001 # a little Ht
dendrites[i].insert("leak") # leak
dendrites[i]().leak.gbar = 0.00001
dendrites[i].insert("ihpyr_adj") # some H current
# mechanism missing so the ihvcn mechanism need to be inserted
dendrites[i].insert('ihvcn')
dendrites[i]().ihvcn.gbar = 0.0 # 0.00002
dendrites[i]().ihvcn.eh = -43.0
self.maindend = dendrites
self.status["dendrites"] = True
self.add_section(self.maindend, "maindend")

467
cnmodel/cells/sgc.py

@ -0,0 +1,467 @@ @@ -0,0 +1,467 @@
from __future__ import print_function
from neuron import h
from ..util import nstomho
from ..util import Params
import numpy as np
from .cell import Cell
from .. import synapses
from .. import an_model
from .. import data
__all__ = ["SGC", "SGC_TypeI", "DummySGC"]
class SGC(Cell):
type = "sgc"
@classmethod
def create(cls, model="I", species="mouse", **kwds):
if model == "dummy":
return DummySGC(**kwds)
elif model == "I":
return SGC_TypeI(species=species, **kwds)
else:
raise ValueError("SGC model %s is unknown", model)
def __init__(self, cf=None, sr=None):
Cell.__init__(self)
self._cf = cf
self._sr = sr
self.spike_source = None # used by DummySGC to connect VecStim to terminal
@property
def cf(self):
""" Center frequency
"""
return self._cf
@property
def sr(self):
""" Spontaneous rate group. 1=low, 2=mid, 3=high
"""
return self._sr
def make_terminal(self, post_cell, term_type, **kwds):
"""Create a StochasticTerminal and configure it according to the
postsynaptic cell type.
"""
pre_sec = self.soma
# Return a simple terminal unless a stochastic terminal was requested.
if term_type == "simple":
return synapses.SimpleTerminal(
pre_sec, post_cell, spike_source=self.spike_source, **kwds
)
elif term_type == "multisite":
n_rsites = data.get(
"sgc_synapse",
species="mouse",
post_type=post_cell.type,
field="n_rsites",
)
opts = {"nzones": n_rsites, "delay": 0, "dep_flag": 1}
opts.update(kwds)
# when created, depflag is set True (1) so that we compute the DKR D*F to get release
# this can be modified prior to the run by setting the terminal(s) so that dep_flag is 0
# (no DKR: constant release probability)
term = synapses.StochasticTerminal(
pre_sec, post_cell, spike_source=self.spike_source, **opts
)
kinetics = data.get(
"sgc_ampa_kinetics",
species="mouse",
post_type=post_cell.type,
field=["tau_g", "amp_g"],
)
term.set_params(**kinetics)
dynamics = data.get(
"sgc_release_dynamics",
species="mouse",
post_type=post_cell.type,
field=["F", "k0", "kmax", "kd", "kf", "taud", "tauf", "dD", "dF"],
)
term.set_params(**dynamics)
return term
else:
raise ValueError("Unsupported terminal type %s" % term_type)
class DummySGC(SGC):
""" SGC class with no cell body; this cell only replays a predetermined
spike train.
"""
def __init__(self, cf=None, sr=None, simulator=None):
"""
Parameters
----------
cf : float (default: None)
Required: the characteristic frequency for the SGC
sr : int (default None)
required : Selects the spontaneous rate group from the
Zilany et al (2010) model. 1 = LSR, 2 = MSR, 3 = HSR
simulator : 'cochlea' | 'matlab' | None (default None)
Sets the simulator interface that will be used. All models
currently use the Zilany et al. model, but the simulator can
be run though a Python-interface directly to the Matlab code
as publicy available, (simulator='matlab'), or can be run through
Rudnicki & Hemmert's Python interface to the simulator's C code
(simulator='cochlea').
"""
self._simulator = simulator
SGC.__init__(self, cf, sr)
self.vecstim = h.VecStim()
# this causes the terminal to receive events from the VecStim:
self.spike_source = self.vecstim
# just an empty section for holding the terminal
self.add_section(h.Section(), "soma")
self.status = {
"soma": True,
"axon": False,
"dendrites": False,
"pumps": False,
"na": None,
"species": None,
"modelType": "dummy",
"ttx": False,
"name": "DummysGC",
"morphology": None,
"decorator": None,
"temperature": None,
}
def set_spiketrain(self, times):
""" Set the times of spikes (in seconds) to be replayed by the cell.
"""
self._spiketrain = times
self._stvec = h.Vector(times)
self.vecstim.play(self._stvec)
def set_sound_stim(self, stim, seed, simulator=None):
""" Set the sound stimulus used to generate this cell's spike train.
"""
self._sound_stim = stim
spikes = self.generate_spiketrain(stim, seed, simulator)
self.set_spiketrain(spikes)
def generate_spiketrain(self, stim, seed, simulator=None):
if simulator is None:
simulator = self._simulator
spikes = an_model.get_spiketrain(
cf=self.cf, sr=self.sr, seed=seed, stim=stim, simulator=simulator
)
return spikes * 1000
class SGC_TypeI(SGC):
"""
Spiral ganglion cell model
"""
def __init__(
self,
morphology=None,
decorator=None,
nach=None,
ttx=False,
species="guineapig",
modelType="bm",
cf=None,
sr=None,
debug=False,
):
"""
Initialize a spiral ganglion Type I cell, based on a bushy cell model.
Modifications to the cell can be made by calling the methods below. These include
converting to a model with modified size and conductances (experimental), and
and changing the sodium channel conductances.
Parameters
----------
morphology : string (default: None)
a file name to read the cell morphology from. If a valid file is found, a cell is constructed
as a cable model from the hoc file.
If None (default), the only a point model is made, exactly according to RM03.
decorator : Python function (default: None)
decorator is a function that "decorates" the morphology with ion channels according
to a set of rules.
If None, a default set of channels aer inserted into the first soma section, and the
rest of the structure is "bare".
nach : string (default: 'na')
nach selects the type of sodium channel that will be used in the model. A channel mechanim
by that name must exist. The default is jsrna (Rothman et al., 1993)
ttx : Boolean (default: False)
If ttx is True, then the sodium channel conductance is set to 0 everywhere in the cell.
Currently, this is not implemented.
species: string (default 'guineapig')
species defines the channel density that will be inserted for different models. Note that
if a decorator function is specified, this argument is ignored.
modelType: string (default: None)
modelType specifies the type of the model that will be used. SGC model know about "a" (apical)
and "bm" (basal-middle) models, based on Liu et al., JARO, 2014.
modelType is passed to the decorator, or to species_scaling to adjust point models.
cf : float (default: None)
The CF for the auditory nerve fiber that this SGC represents.
sr : string (default: None)
The spontaneous rate group to which this fiber belongs. "LS", "MS", and "HS" are known values.
debug: boolean (default: False)
debug is a boolean flag. When set, there will be multiple printouts of progress and parameters.
Returns
-------
Nothing
"""
super(SGC_TypeI, self).__init__(cf=cf, sr=sr)
if modelType == None:
modelType = "bm" # modelTypes are: a (apical), bm (basal middle)
if nach == None:
nach = "jsrna"
self.status = {
"soma": True,
"axon": False,
"dendrites": False,
"pumps": False,
"na": nach,
"species": species,
"modelType": modelType,
"ttx": ttx,
"name": "SGC",
"morphology": morphology,
"decorator": decorator,
"temperature": None,
}
self.i_test_range = {
"pulse": [(-0.3, 0.3, 0.02), (-0.03, 0.0, 0.005)]
} # include finer range as well
self.vrange = [-75.0, -55.0]
if morphology is None:
"""
instantiate a basic soma-only ("point") model
"""
soma = h.Section(
name="SGC_Soma_%x" % id(self)
) # one compartment of about 29000 um2
soma.nseg = 1
self.add_section(soma, "soma")
else:
"""
instantiate a structured model with the morphology as specified by
the morphology file
"""
self.set_morphology(morphology_file=morphology)
# decorate the morphology with ion channels
if decorator is None: # basic model, only on the soma
self.mechanisms = [nach, "klt", "kht", "leak"]
if modelType == "a":
self.mechanisms.append("ihsgcApical")
elif modelType == "bm":
self.mechanisms.append("ihsgcBasalMiddle")
else:
raise ValueError("Type %s not known for SGC model" % modelType)
for mech in self.mechanisms:
self.soma.insert(mech)
self.soma.ek = self.e_k
self.soma().leak.erev = self.e_leak
self.species_scaling(
silent=True, species=species, modelType=modelType
) # set the default type II cell parameters
else: # decorate according to a defined set of rules on all cell compartments
self.decorate()
self.save_all_mechs() # save all mechanisms inserted, location and gbar values...
self.get_mechs(self.soma)
if debug:
print("<< SGC: Spiral Ganglion Cell created >>")
def get_cellpars(self, dataset, species="guineapig", celltype="sgc-a"):
cellcap = data.get(
dataset, species=species, cell_type=celltype, field="soma_Cap"
)
chtype = data.get(
dataset, species=species, cell_type=celltype, field="soma_na_type"
)
pars = Params(soma_Cap=cellcap, natype=chtype)
for g in [
"soma_na_gbar",
"soma_kht_gbar",
"soma_klt_gbar",
"soma_ihap_gbar",
"soma_ihbm_gbar",
"soma_ihap_eh",
"soma_ihbm_eh",
"soma_leak_gbar",
"soma_leak_erev",
"soma_e_k",
"soma_e_na",
]:
pars.additem(
g, data.get(dataset, species=species, cell_type=celltype, field=g)
)
return pars
def species_scaling(self, silent=True, species="guineapig", modelType="a"):
"""
Adjust all of the conductances and the cell size according to the species requested.
Used ONLY for point models.
Parameters
----------
species : string (default: 'guineapig')
name of the species to use for scaling the conductances in the base point model
Must be one of mouse or guineapig
modelType: string (default: 'a')
definition of HCN model type from Liu et al. JARO 2014:
'a' for apical model
'bm' for basal-middle model
silent : boolean (default: True)
run silently (True) or verbosely (False)
Returns
-------
Nothing
Notes
-----
The 'guineapig' model uses the mouse HCN channel model, verbatim. This may not
be appropriate, given that the other conductances are scaled up.
"""
soma = self.soma
if modelType == "a":
celltype = "sgc-a"
elif modelType == "bm":
celltype = "sgc-bm"
else:
raise ValueError("SGC: unrecognized model type %s " % modelType)
if species == "mouse":
self._valid_temperatures = (34.0,)
if self.status["temperature"] is None:
self.set_temperature(34.0)
par = self.get_cellpars(
"sgc_mouse_channels", species=species, celltype=celltype
)
elif species == "guineapig":
# guinea pig data from Rothman and Manis, 2003, modelType II
self._valid_temperatures = (22.0,)
if self.status["temperature"] is None:
self.set_temperature(22.0)
par = self.get_cellpars(
"sgc_guineapig_channels", species=species, celltype=celltype
)
self.set_soma_size_from_Cm(par.soma_Cap)
self.adjust_na_chans(soma, gbar=par.soma_na_gbar)
soma().kht.gbar = nstomho(par.soma_kht_gbar, self.somaarea)
soma().klt.gbar = nstomho(par.soma_klt_gbar, self.somaarea)
if celltype == "sgc-a":
soma().ihsgcApical.gbar = nstomho(par.soma_ihap_gbar, self.somaarea)
soma().ihsgcApical.eh = par.soma_ihap_eh
elif celltype == "sgc-bm":
soma().ihsgcBasalMiddle.gbar = nstomho(par.soma_ihbm_gbar, self.somaarea)
soma().ihsgcBasalMiddle.eh = par.soma_ihbm_eh
else:
raise ValueError(
"Ihsgc modelType %s not recognized for species %s" % (celltype, species)
)
soma().leak.gbar = nstomho(par.soma_leak_gbar, self.somaarea)
soma().leak.erev = par.soma_leak_erev
self.status["species"] = species
self.status["modelType"] = modelType
self.check_temperature()
if not silent:
print("set cell as: ", species)
print(" with Vm rest = %f" % self.vm0)
def adjust_na_chans(self, soma, gbar=1000.0, debug=False):
"""
adjust the sodium channel conductance
:param soma: a soma object whose sodium channel complement will have it's
conductances adjusted depending on the channel type
:return nothing:
"""
if self.status["ttx"]:
gnabar = 0.0
else:
gnabar = nstomho(gbar, self.somaarea)
nach = self.status["na"]
if nach == "jsrna":
soma().jsrna.gbar = gnabar
soma.ena = self.e_na
if debug:
print("jsrna gbar: ", soma().jsrna.gbar)
elif nach == "nav11":
soma().nav11.gbar = gnabar * 0.5
soma.ena = self.e_na
soma().nav11.vsna = 4.3
if debug:
print("sgc using inva11")
print("nav11 gbar: ", soma().nav11.gbar)
elif nach in ["na", "nacn"]:
soma().na.gbar = gnabar
soma.ena = self.e_na
if debug:
print("na gbar: ", soma().na.gbar)
else:
raise ValueError("Sodium channel %s is not recognized for SGC cells", nach)
def i_currents(self, V):
"""
For the steady-state case, return the total current at voltage V
Used to find the zero current point
vrange brackets the interval
Implemented here are the basic RM03 mechanisms
This function should be replaced for specific cell types.
"""
for part in self.all_sections.keys():
for sec in self.all_sections[part]:
sec.v = V
h.t = 0.0
h.celsius = self.status["temperature"]
h.finitialize()
self.ix = {}
if "na" in self.mechanisms:
# print dir(self.soma().na)
self.ix["na"] = self.soma().na.gna * (V - self.soma().ena)
if "jsrna" in self.mechanisms:
# print dir(self.soma().na)
self.ix["jsrna"] = self.soma().jsrna.gna * (V - self.soma().ena)
if "klt" in self.mechanisms:
self.ix["klt"] = self.soma().klt.gklt * (V - self.soma().ek)
if "kht" in self.mechanisms:
self.ix["kht"] = self.soma().kht.gkht * (V - self.soma().ek)
if "ihsgcApical" in self.mechanisms:
self.ix["ihsgcApical"] = self.soma().ihsgcApical.gh * (
V - self.soma().ihsgcApical.eh
)
if "ihsgcBasalMiddle" in self.mechanisms:
self.ix["ihsgcBasalMiddle"] = self.soma().ihsgcBasalMiddle.gh * (
V - self.soma().ihsgcBasalMiddle.eh
)
if "leak" in self.mechanisms:
self.ix["leak"] = self.soma().leak.gbar * (V - self.soma().leak.erev)
# print self.status['name'], self.status['type'], V, self.ix
return np.sum([self.ix[i] for i in self.ix])

3
cnmodel/cells/tests/cell_data/SGC_rat_a.pk

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2e60518d0332cd475f67e13e8f85e23b1b60dda4f252620b495bdfbc5dab43fe
size 7826

3
cnmodel/cells/tests/cell_data/SGC_rat_bm.pk

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f0814086d71479adab9326978620e1af0ed153fdfc2c6f4fa0d2213c0b80131b
size 7729

3
cnmodel/cells/tests/cell_data/bushy-mouse-typeII.pk

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5dbd4717983175a81d362bd01015cb28baa145d78c6c460dd7ec6456f9f46e72
size 8103

3
cnmodel/cells/tests/cell_data/bushy_guineapig-typeII-I.pk

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:34fbddf52a61283bd29622fe87e1fc8afc6f46160cdce3f0cdd581f89bfeba35
size 7963

3
cnmodel/cells/tests/cell_data/bushy_guineapig-typeII.pk

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:de245b95e0b1f66680ed1f79bc31739bce36aed9edd044d02b6effbd645e948e
size 8160

3
cnmodel/cells/tests/cell_data/cartwheel_rat_I.pk

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0f7c79982ffa921ba17690de6b31ff27be75936acde0fa72b5d52e0e4abc54da
size 5506

3
cnmodel/cells/tests/cell_data/dstellate_guineapig-typeI-II.pk

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:de64e933070f7c216d8f632cb56ee32b346bba282c24f453f818c686439b772a
size 8710

3
cnmodel/cells/tests/cell_data/dstellate_mouse-typeI-II.pk

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0e713ac67a7211e4d78c846bd8bdda4b738c49d5c50fb61c1974f12d45341937
size 9506

3
cnmodel/cells/tests/cell_data/octopus_guineapig-typeII-o.pk

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e86a6fb8651d0ed0a33e30273d49b8358436bf169899ee9d2bcda454f450225e
size 7747

3
cnmodel/cells/tests/cell_data/pyramidal_rat_I.pk

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8ebe0523b9260f3b9a87fc6e535f38cb8f0b5840aea056fe8764943883782db7
size 16581

3
cnmodel/cells/tests/cell_data/tstellate_guineapig-typeI-c.pk

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a2536a5ca43d2f46fa6e6bf786d520ac12815b742896a3272a227660a91fc2c1
size 7863

3
cnmodel/cells/tests/cell_data/tstellate_guineapig-typeI-t.pk

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fa5ddc40011269d7e4d00d70ac3053bd4d2d88293db5f8d6f9ae8225c3ed1bdc
size 8182

3
cnmodel/cells/tests/cell_data/tstellate_mouse-typeI-c.pk

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2990652711db28fa846886f1399faecb4d4680fd8014cbc006636c215248263d
size 14815

3
cnmodel/cells/tests/cell_data/tuberculoventral_mouse_I.pk

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9f50fb610552b181dfd0130245ee41bcbe745d4fc856abfe7f5ad180e84773a5
size 13267

227
cnmodel/cells/tests/test_cells.py

@ -0,0 +1,227 @@ @@ -0,0 +1,227 @@
import os, pickle, pprint
import numpy as np
import neuron
import cnmodel
import cnmodel.cells as cells
from cnmodel.util import UserTester, reset
from cnmodel.protocols import IVCurve
"""
Cell-type tests
"""
def test_bushy():
reset(raiseError=False)
cell = cells.Bushy.create(species="guineapig", modelType="II")
CellTester("bushy_guineapig-typeII", cell)
def test_bushy21():
reset(raiseError=False)
cell = cells.Bushy.create(species="guineapig", modelType="II-I")
CellTester("bushy_guineapig-typeII-I", cell)
def test_bushy_mouse():
reset(raiseError=False)
cell = cells.Bushy.create(species="mouse", modelType="II")
CellTester("bushy-mouse-typeII", cell)
def test_tstellate():
reset(raiseError=False)
cell = cells.TStellate.create(species="guineapig", modelType="I-c")
CellTester("tstellate_guineapig-typeI-c", cell)
def test_tstellate_mouse():
reset(raiseError=False)
cell = cells.TStellate.create(species="mouse", modelType="I-c")
CellTester("tstellate_mouse-typeI-c", cell)
def test_tstellatet():
reset(raiseError=False)
cell = cells.TStellate.create(species="guineapig", modelType="I-t")
CellTester("tstellate_guineapig-typeI-t", cell)
# not implemented yet
# def test_tstellatet_mouse():
# reset(raiseError=False)
# cell = cells.TStellate.create(species='mouse', modelType='I-t')
# CellTester('tstellate_mouse-typeI-t', cell)
def test_dstellate():
reset(raiseError=False)
cell = cells.DStellate.create(species="guineapig", modelType="I-II")
CellTester("dstellate_guineapig-typeI-II", cell)
def test_dstellate_mouse():
reset(raiseError=False)
cell = cells.DStellate.create(species="mouse", modelType="I-II")
CellTester("dstellate_mouse-typeI-II", cell)
def test_octopus():
reset(raiseError=False)
cell = cells.Octopus.create(species="guineapig", modelType="II-o")
CellTester("octopus_guineapig-typeII-o", cell)
def test_pyramidal():
reset(raiseError=False)
cell = cells.Pyramidal.create(species="rat", modelType="I")
CellTester("pyramidal_rat_I", cell)
def test_tuberculoventral():
reset(raiseError=False)
cell = cells.Tuberculoventral.create(species="mouse", modelType="TVmouse")
CellTester("tuberculoventral_mouse_I", cell)
def test_cartwheel():
reset(raiseError=False)
cell = cells.Cartwheel.create(species="mouse", modelType="I")
CellTester("cartwheel_rat_I", cell)
def test_sgc_basal_middle():
reset(raiseError=False)
cell = cells.SGC.create(species="mouse", modelType="bm")
CellTester("SGC_rat_bm", cell)
def test_sgc_apical():
reset(raiseError=False)
cell = cells.SGC.create(species="mouse", modelType="a")
CellTester("SGC_rat_a", cell)
#
# Supporting functions
#
class CellTester(UserTester):
data_dir = "cell_data"
def run_test(self, cell):
# run I/V test on cell
V0 = cell.find_i0(showinfo=True)
rmrintau = cell.compute_rmrintau(auto_initialize=False, vrange=None)
iv = IVCurve()
self.iv = iv
iv.run(cell.i_test_range, cell)
if self.audit:
iv.show(cell)
info = dict(
temp=iv.temp,
icmd=iv.current_cmd,
spikes=iv.spike_times(),
rmp=iv.rest_vm(),
rm_taum=iv.input_resistance_tau(),
vpeak=iv.peak_vm(),
vss=iv.steady_vm(),
rmrintau=rmrintau,
)
return info
def assert_test_info(self, *args, **kwds):
try:
super(CellTester, self).assert_test_info(*args, **kwds)
finally:
if hasattr(self, "iv") and hasattr(self.iv, "win"):
self.iv.win.hide()
# def result_file(key):
# """
# Return a file name to be used for storing / retrieving test results
# given *key*.
# """
# path = os.path.dirname(__file__)
# return os.path.join(path, 'cell_data', key + '.pk')
# def load_cell_info(key):
# """
# Load prior test results for *key*.
# If there are no prior results, return None.
# """
# fn = result_file(key)
# if os.path.isfile(fn):
# return pickle.load(open(fn, 'rb'))
# return None
# def save_cell_info(info, key):
# """
# Store test results for *key*.
# """
# fn = result_file(key)
# dirname = os.path.dirname(fn)
# if not os.path.isdir(dirname):
# os.mkdir(dirname)
# pickle.dump(info, open(fn, 'wb'))
# The following is superseeded by the built in unit tests.
# def CellTester(key):
# """
# Test *cell* and raise exception if the results do not match prior
# data.
# """
# audit = cnmodel.AUDIT_TESTS
## run I/V test on cell
# iv = IVCurve()
# iv.run(cell.i_test_range, cell)
# iv.show(cell)
# try:
# info = dict(
# icmd=iv.current_cmd,
# spikes=iv.spike_times(),
# rmp=iv.rest_vm(),
# rm=iv.input_resistance(),
# vpeak=iv.peak_vm(),
# vss=iv.steady_vm(),
# )
# expect = load_cell_info(key)
# if expect is not None:
## Check test structures are the same
# assert len(info) == len(expect)
# for k in info:
# assert k in expect
## Check data matches
# for k in info:
# if isinstance(info[k], list):
# assert len(info[k]) == len(expect[k])
# for i in range(len(info[k])):
# assert np.allclose(info[k][i], expect[k][i])
# else:
# assert np.allclose(info[k], expect[k])
# else:
# if not audit:
# raise Exception("No prior test results for cell type '%s'. "
# "Run test.py --audit store new test data." % key)
# print "\n=== New test results for %s: ===\n" % key
# pprint.pprint(info)
# print "Store new test results? [y/n]",
# yn = raw_input()
# if yn.lower().startswith('y'):
# save_cell_info(info, key)
# else:
# raise Exception("Rejected test results for '%s'" % key)
# finally:
# iv.win.hide()

1089
cnmodel/cells/tstellate.py

File diff suppressed because it is too large Load Diff

619
cnmodel/cells/tuberculoventral.py

@ -0,0 +1,619 @@ @@ -0,0 +1,619 @@
from __future__ import print_function
from neuron import h
import numpy as np
# import neuron as nrn
from .cell import Cell
from .. import synapses
from ..util import nstomho
from ..util import Params
from .. import data
__all__ = ["Tuberculoventral"]
class Tuberculoventral(Cell):
type = "tuberculoventral"
@classmethod
def create(cls, model="TVmouse", **kwds):
if model in ["TVmouse", "I"]:
return Tuberculoventral(**kwds)
elif model == "dummy":
return DummyTuberculoventral(**kwds)
else:
raise ValueError("Tuberculoventral type %s is unknown", model)
def __init__(self):
Cell.__init__(self)
self.spike_source = (
None
) # used by DummyTuberculoventral to connect VecStim to terminal
def make_psd(self, terminal, psd_type, **kwds):
"""
Connect a presynaptic terminal to one post section at the specified location, with the fraction
of the "standard" conductance determined by gbar.
The default condition is to try to pass the default unit test (loc=0.5)
Parameters
----------
terminal : Presynaptic terminal (NEURON object)
psd_type : either simple or multisite PSD for bushy cell
kwds: dict of options. Two are currently handled:
postsize : expect a list consisting of [sectionno, location (float)]
AMPAScale : float to scale the ampa currents
"""
if (
"postsite" in kwds
): # use a defined location instead of the default (soma(0.5)
postsite = kwds["postsite"]
loc = postsite[1] # where on the section?
uname = (
"sections[%d]" % postsite[0]
) # make a name to look up the neuron section object
post_sec = self.hr.get_section(uname) # Tell us where to put the synapse.
else:
loc = 0.5
post_sec = self.soma
if psd_type == "simple":
if terminal.cell.type in ["sgc", "dstellate", "tuberculoventral"]:
weight = data.get(
"%s_synapse" % terminal.cell.type,
species=self.species,
post_type=self.type,
field="weight",
)
tau1 = data.get(
"%s_synapse" % terminal.cell.type,
species=self.species,
post_type=self.type,
field="tau1",
)
tau2 = data.get(
"%s_synapse" % terminal.cell.type,
species=self.species,
post_type=self.type,
field="tau2",
)
erev = data.get(
"%s_synapse" % terminal.cell.type,
species=self.species,
post_type=self.type,
field="erev",
)
return self.make_exp2_psd(
post_sec,
terminal,
weight=weight,
loc=loc,
tau1=tau1,
tau2=tau2,
erev=erev,
)
else:
raise TypeError(
"Cannot make simple PSD for %s => %s"
% (terminal.cell.type, self.type)
)
elif psd_type == "multisite":
if terminal.cell.type == "sgc":
# Max conductances for the glu mechanisms are calibrated by
# running `synapses/tests/test_psd.py`. The test should fail
# if these values are incorrect
self.AMPAR_gmax = (
data.get(
"sgc_synapse",
species=self.species,
post_type=self.type,
field="AMPAR_gmax",
)
* 1e3
)
self.NMDAR_gmax = (
data.get(
"sgc_synapse",
species=self.species,
post_type=self.type,
field="NMDAR_gmax",
)
* 1e3
)
self.Pr = data.get(
"sgc_synapse", species=self.species, post_type=self.type, field="Pr"
)
# adjust gmax to correct for initial Pr
self.AMPAR_gmax = self.AMPAR_gmax / self.Pr
self.NMDAR_gmax = self.NMDAR_gmax / self.Pr
if "AMPAScale" in kwds:
self.AMPA_gmax = (
self.AMPA_gmax * kwds["AMPAScale"]
) # allow scaling of AMPA conductances
if "NMDAScale" in kwds:
self.NMDA_gmax = self.NMDA_gmax * kwds["NMDAScale"]
return self.make_glu_psd(
post_sec, terminal, self.AMPAR_gmax, self.NMDAR_gmax, loc=loc
)
elif terminal.cell.type == "dstellate": # WBI input -Voigt, Nelken, Young
return self.make_gly_psd(post_sec, terminal, psdtype="glyfast", loc=loc)
elif (
terminal.cell.type == "tuberculoventral"
): # TV cells talk to each other-Kuo et al.
return self.make_gly_psd(post_sec, terminal, psdtype="glyfast", loc=loc)
else:
raise TypeError(
"Cannot make PSD for %s => %s" % (terminal.cell.type, self.type)
)
else:
raise ValueError("Unsupported psd type %s" % psd_type)
def make_terminal(self, post_cell, term_type, **kwds):
pre_sec = self.soma
if term_type == "simple":
return synapses.SimpleTerminal(
pre_sec, post_cell, spike_source=self.spike_source, **kwds
)
elif term_type == "multisite":
if post_cell.type in [
"dstellate",
"tuberculoventral",
"pyramidal",
"bushy",
"tstellate",
]:
nzones = data.get(
"tuberculoventral_synapse",
species=self.species,
post_type=post_cell.type,
field="n_rsites",
)
delay = data.get(
"tuberculoventral_synapse",
species=self.species,
post_type=post_cell.type,
field="delay",
)
else:
raise NotImplementedError(
"No knowledge as to how to connect tuberculoventral cell to cell type %s"
% type(post_cell)
)
pre_sec = self.soma
return synapses.StochasticTerminal(
pre_sec,
post_cell,
nzones=nzones,
spike_source=self.spike_source,
delay=delay,
**kwds
)
else:
raise ValueError("Unsupported terminal type %s" % term_type)
class Tuberculoventral(Tuberculoventral):
"""
Tuberculoventral Neuron (DCN) base model
Adapted from T-stellate model, using target parameters from Kuo et al. J. Neurophys. 2012
"""
def __init__(
self,
morphology=None,
decorator=None,
nach=None,
ttx=False,
species="mouse",
modelType=None,
debug=False,
):
"""
Initialize a DCN Tuberculoventral cell, using the default parameters for guinea pig from
R&M2003, as a type I cell.
Modifications to the cell can be made by calling methods below. These include:
Converting to a type IA model (add transient K current) (species: guineapig-TypeIA).
Changing "species" to mouse or cat (scales conductances)
Parameters
----------
morphology : string (default: None)
a file name to read the cell morphology from. If a valid file is found, a cell is constructed
as a cable model from the hoc file.
If None (default), the only a point model is made, exactly according to RM03.
decorator : Python function (default: None)
decorator is a function that "decorates" the morphology with ion channels according
to a set of rules.
If None, a default set of channels aer inserted into the first soma section, and the
rest of the structure is "bare".
nach : string (default: 'na')
nach selects the type of sodium channel that will be used in the model. A channel mechanims
by that name must exist.
ttx : Boolean (default: False)
If ttx is True, then the sodium channel conductance is set to 0 everywhere in the cell.
Currently, this is not implemented.
species: string (default 'guineapig')
species defines the channel density that will be inserted for different models. Note that
if a decorator function is specified, this argument is ignored.
modelType: string (default: None)
modelType specifies the type of the model that will be used (e.g., "II", "II-I", etc).
modelType is passed to the decorator, or to species_scaling to adjust point models.
debug: boolean (default: False)
debug is a boolean flag. When set, there will be multiple printouts of progress and parameters.
Returns
-------
Nothing
"""
super(Tuberculoventral, self).__init__()
if modelType == None:
modelType = "TVmouse"
if nach == None:
nach = "nacncoop"
self.debug = debug
self.status = {
"soma": True,
"axon": False,
"dendrites": False,
"pumps": False,
"na": nach,
"species": species,
"modelType": modelType,
"ttx": ttx,
"name": "Tuberculoventral",
"morphology": morphology,
"decorator": decorator,
"temperature": None,
}
self.i_test_range = {"pulse": [(-0.35, 1.0, 0.05), (-0.04, 0.01, 0.01)]}
self.vrange = [-80.0, -60.0] # set a default vrange for searching for rmp
if morphology is None:
"""
instantiate a basic soma-only ("point") model
"""
if self.debug:
print("<< Tuberculoventral model: Creating point cell >>")
soma = h.Section(
name="Tuberculoventral_Soma_%x" % id(self)
) # one compartment of about 29000 um2
soma.nseg = 1
self.add_section(soma, "soma")
else:
"""
instantiate a structured model with the morphology as specified by
the morphology file
"""
if self.debug:
print("<< Tuberculoventral model: Creating structured cell >>")
self.set_morphology(morphology_file=morphology)
# decorate the morphology with ion channels
if decorator is None: # basic model, only on the soma
self.mechanisms = ["kht", "ka", "ihvcn", "leak", nach]
for mech in self.mechanisms:
self.soma.insert(mech)
self.species_scaling(
silent=True, species=species, modelType=modelType
) # adjust the default parameters
else: # decorate according to a defined set of rules on all cell compartments
self.decorate()
self.save_all_mechs() # save all mechanisms inserted, location and gbar values...
self.get_mechs(self.soma)
if self.debug:
print("<< Tuberculoventral cell model created >>")
def get_cellpars(self, dataset, species="mouse", celltype="TVmouse"):
cellcap = data.get(
dataset, species=species, cell_type=celltype, field="soma_Cap"
)
chtype = data.get(
dataset, species=species, cell_type=celltype, field="soma_na_type"
)
pars = Params(soma_cap=cellcap, soma_na_type=chtype)
for g in [
"soma_nacncoop_gbar",
"soma_kht_gbar",
"soma_ka_gbar",
"soma_ihvcn_gbar",
"soma_ihvcn_eh",
"soma_leak_gbar",
"soma_leak_erev",
"soma_e_k",
"soma_e_na",
]:
pars.additem(
g, data.get(dataset, species=species, cell_type=celltype, field=g)
)
return pars
def species_scaling(self, species="guineapig", modelType="TVmouse", silent=True):
"""
Adjust all of the conductances and the cell size according to the species requested.
Used ONLY for point models.
Parameters
----------
species : string (default: 'guineapig')
name of the species to use for scaling the conductances in the base point model
Must be one of mouse, cat, guineapig
modelType: string (default: 'I-c')
definition of model type from RM03 models, type I-c or type I-t
silent : boolean (default: True)
run silently (True) or verbosely (False)
"""
soma = self.soma
if self.debug:
print("modelType: ", modelType)
if modelType in ["TVmouse", "I"]:
celltype = "TVmouse" # modelType
modelType = "TVmouse"
else:
raise ValueError(
"Tuberuloventral: Model type %s not recognized" % modelType
)
if species == "mouse" and modelType in ["TVmouse", "I"]:
"""#From Kuo 150 Mohm, 10 msec tau
Firing at 600 pA about 400 Hz
These values from brute_force runs, getting 380 Hz at 600 pA at 35C
Input resistance and vm is ok, time constnat is short
*** Rin: 168 tau: 7.8 v: -68.4
Attempts to get longer time constant - cannot keep rate up.
"""
# Adapted from TStellate model type I-c'
self.vrange = [-80.0, -58.0]
self._valid_temperatures = (34.0,)
if self.status["temperature"] is None:
self.set_temperature(34.0)
pars = self.get_cellpars("TV_channels", species="mouse", celltype=modelType)
self.set_soma_size_from_Cm(pars.soma_cap)
self.status["na"] = pars.soma_na_type
self.adjust_na_chans(soma, gbar=pars.soma_nacncoop_gbar, debug=self.debug)
soma().kht.gbar = nstomho(pars.soma_kht_gbar, self.somaarea)
soma().ka.gbar = nstomho(pars.soma_ka_gbar, self.somaarea)
soma().ihvcn.gbar = nstomho(pars.soma_ihvcn_gbar, self.somaarea)
soma().ihvcn.eh = pars.soma_ihvcn_eh
soma().leak.gbar = nstomho(pars.soma_leak_gbar, self.somaarea)
soma().leak.erev = pars.soma_leak_erev
self.e_leak = pars.soma_leak_erev
self.soma.ek = self.e_k = pars.soma_e_k
self.soma.ena = self.e_na = pars.soma_e_na
self.axonsf = 0.5
else:
raise ValueError(
"Species %s or species-type %s is not recognized for Tuberculoventralcells"
% (species, type)
)
self.status["species"] = species
self.status["modelType"] = modelType
self.check_temperature()
def channel_manager(self, modelType="TVmouse"):
"""
This routine defines channel density maps and distance map patterns
for each type of compartment in the cell. The maps
are used by the ChannelDecorator class (specifically, it's private
_biophys function) to decorate the cell membrane.
Parameters
----------
modelType : string (default: 'RM03')
A string that defines the type of the model. Currently, 3 types are implemented:
RM03: Rothman and Manis, 2003 somatic densities for guinea pig
XM13: Xie and Manis, 2013, somatic densities for mouse
XM13PasDend: XM13, but with only passive dendrites, no channels.
Returns
-------
Nothing
Notes
-----
This routine defines the following variables for the class:
- conductances (gBar)
- a channelMap (dictonary of channel densities in defined anatomical compartments)
- a current injection range for IV's (when testing)
- a distance map, which defines how selected conductances in selected compartments
will change with distance. This includes both linear and exponential gradients,
the minimum conductance at the end of the gradient, and the space constant or
slope for the gradient.
"""
if modelType == "TVmouse":
print("decorate as tvmouse")
# totcap = 95.0E-12 # Tuberculoventral cell (type I), based on stellate, adjusted for Kuo et al. TV firing
self.set_soma_size_from_Section(self.soma)
totcap = self.totcap
refarea = self.somaarea # totcap / self.c_m # see above for units
self.gBar = Params(
nabar=1520.0e-9 / refarea,
khtbar=160.0e-9 / refarea,
kltbar=0.0e-9 / refarea,
kabar=65.0 / refarea,
ihbar=1.25e-9 / refarea,
leakbar=5.5e-9 / refarea,
)
self.channelMap = {
"axon": {
"nacn": 0.0,
"klt": 0.0,
"kht": self.gBar.khtbar,
"ihvcn": 0.0,
"leak": self.gBar.leakbar / 4.0,
},
"hillock": {
"nacn": self.gBar.nabar,
"klt": 0.0,
"kht": self.gBar.khtbar,
"ihvcn": 0.0,
"leak": self.gBar.leakbar,
},
"initseg": {
"nacn": self.gBar.nabar,
"klt": 0.0,
"kht": self.gBar.khtbar,
"ihvcn": self.gBar.ihbar / 2.0,
"leak": self.gBar.leakbar,
},
"soma": {
"nacn": self.gBar.nabar,
"klt": self.gBar.kltbar,
"kht": self.gBar.khtbar,
"ihvcn": self.gBar.ihbar,
"leak": self.gBar.leakbar,
},
"dend": {
"nacn": self.gBar.nabar / 2.0,
"klt": 0.0,
"kht": self.gBar.khtbar * 0.5,
"ihvcn": self.gBar.ihbar / 3.0,
"leak": self.gBar.leakbar * 0.5,
},
"apic": {
"nacn": 0.0,
"klt": 0.0,
"kht": self.gBar.khtbar * 0.2,
"ihvcn": self.gBar.ihbar / 4.0,
"leak": self.gBar.leakbar * 0.2,
},
}
self.irange = np.linspace(-0.3, 0.6, 10)
self.distMap = {
"dend": {
"klt": {"gradient": "linear", "gminf": 0.0, "lambda": 100.0},
"kht": {"gradient": "linear", "gminf": 0.0, "lambda": 100.0},
}, # linear with distance, gminf (factor) is multiplied by gbar
"apic": {
"klt": {"gradient": "linear", "gminf": 0.0, "lambda": 100.0},
"kht": {"gradient": "linear", "gminf": 0.0, "lambda": 100.0},
}, # gradients are: flat, linear, exponential
}
else:
raise ValueError("model type %s is not implemented" % modelType)
def adjust_na_chans(self, soma, gbar=1000.0, debug=False):
"""
Adjust the sodium channel conductance, depending on the type of conductance
Parameters
----------
soma : NEURON section object (required)
This identifies the soma object whose sodium channel complement will have it's
conductances adjusted depending on the sodium channel type
gbar : float (default: 1000.)
The "maximal" conductance to be set in the model.
debug : boolean (default: False)
A flag the prints out messages to confirm the operations applied.
Returns
-------
Nothing
"""
if self.status["ttx"]:
gnabar = 0.0
else:
gnabar = nstomho(gbar, self.somaarea)
nach = self.status["na"]
if nach == "nacncoop":
soma().nacncoop.gbar = gnabar
soma().nacncoop.KJ = 2000.0
soma().nacncoop.p = 0.25
soma.ena = self.e_na
if debug:
print("nacncoop gbar: ", soma().nacncoop.gbar)
elif nach == "jsrna":
soma().jsrna.gbar = gnabar
soma.ena = self.e_na
if debug:
print("jsrna gbar: ", soma().jsrna.gbar)
elif nach == "nav11":
soma().nav11.gbar = gnabar * 0.5
soma.ena = self.e_na
soma().nav11.vsna = 4.3
if debug:
print("Tuberculoventral using inva11")
print("nav11 gbar: ", soma().nav11.gbar)
elif nach == "na":
soma().na.gbar = gnabar
soma.ena = self.e_na
if debug:
print("na gbar: ", soma().na.gbar)
elif nach == "nacn":
soma().nacn.gbar = gnabar
soma.ena = self.e_na
if debug:
print("nacn gbar: ", soma().nacn.gbar)
else:
raise ValueError(
"Tuberculoventral setting Na channels: channel %s not known" % nach
)
class DummyTuberculoventral(Tuberculoventral):
""" Tuberculoventral cell class with no cell body; this cell only replays a predetermined
spike train. Useful for testing, or replacing spike trains to determine
the importance of spike structures within a network.
"""
def __init__(self, cf=None, species="mouse"):
"""
Parameters
----------
cf : float (default: None)
Required: the characteristic frequency for the TV cell
Really just for reference.
"""
Tuberculoventral.__init__(self)
self.vecstim = h.VecStim()
# this causes the terminal to receive events from the VecStim:
self.spike_source = self.vecstim
# just an empty section for holding the terminal
self.add_section(h.Section(), "soma")
self.status = {
"soma": True,
"axon": False,
"dendrites": False,
"pumps": False,
"na": None,
"species": species,
"modelType": "Dummy",
"modelName": "DummyTuberculoventral",
"ttx": None,
"name": "DummyTuberculoventral",
"morphology": None,
"decorator": None,
"temperature": None,
}
print("<< Tuberculoventral: Dummy Tuberculoventral Cell created >>")
def set_spiketrain(self, times):
""" Set the times of spikes (in seconds) to be replayed by the cell.
"""
self._spiketrain = times
self._stvec = h.Vector(times)
self.vecstim.play(self._stvec)

23
cnmodel/custom_init.hoc

@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
INITDUR = 100 // # ms to reach steady state
DTSTEP = 0.1
proc init() { local temp
//print "Using Custom Init"
finitialize(v_init)
t = -2*INITDUR // jump to a time "before" 0
temp = cvode.active()
if (temp != 0) { // if cvode is on, turn it off
cvode.active(0)
dt = DTSTEP
}
while (t < -INITDUR) {
fadvance()
}
if (temp != 0) { cvode.active(1) } // turn cvode back on if necessary
t = 0
if (cvode.active()) {
cvode.re_init()
} else {
fcurrent()
}
frecord_init()
}

18
cnmodel/data/__init__.py

@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
"""
The cnmodel.data package contains information about ion channel densities,
connectivity, synaptic properties, and population distributions. These values
are used by the Cell, Synapse, Population, and related classes to determine
all model construction parameters.
Values are stored in python strings that contain human-readable tables with
provenance documentation.
"""
from ._db import get, get_source, add_table_data, report_changes, setval
from . import connectivity
from . import synapses
from . import populations
from . import ionchannels

321
cnmodel/data/_db.py

@ -0,0 +1,321 @@ @@ -0,0 +1,321 @@
# -*- encoding: utf-8 -*-
from __future__ import print_function
from collections import OrderedDict
import re
# Unified collection point for all empirically-determined biophysical
# values. Each value is a tuple (val, source).
DATA = OrderedDict()
def get(*args, **kwds):
""" Get a single value from the database using the supplied arguments
to query.
Optionally, one keyword argument may be a list of values, in which case
a dict will be returned containing {listval: dbval} pairs for each value in
the list.
"""
return _lookup(0, *args, **kwds)
def get_source(*args, **kwds):
""" Get the source of a single value from the database using the supplied
arguments to query.
Optionally, one keyword argument may be a list of values, in which case
a dict will be returned containing {listval: dbval} pairs for each value in
the list.
"""
return _lookup(1, *args, **kwds)
def print_table(table):
for k in DATA.keys():
if table == k[0]:
print("data key: ", k)
print(DATA[k][0])
def get_table_info(table):
"""
Return a dictionary of row and column names in the table
"""
tinfo = {}
for k in DATA.keys():
if table == k[0]:
for p in k:
if not isinstance(p, tuple):
continue
if p[0] not in tinfo.keys():
tinfo[p[0]] = []
if p[1] not in tinfo[p[0]]:
tinfo[p[0]].append(p[1])
return tinfo
def _lookup(ind, *args, **kwds):
key = mk_key(*args, **kwds)
if isinstance(key, dict):
data = {}
for k, key in key.items():
data[k] = DATA[key][ind]
return data
else:
return DATA[key][ind]
def setval(val, *args, **kwds):
key = mk_key(*args, **kwds)
oldval = None
# change_flag = False
if key in DATA:
# change_flag = True # any attempt to change key will set this
oldval = DATA[key] # save the previous stored value
# raise RuntimeError("Data key '%s' has already been set." % str(key))
DATA[key] = val
return oldval
def mk_key(*args, **kwds):
# Make a unique key (or list of keys) used to access values from the
# database. The generated key is independent of the order that arguments
# are specified.
#
# Optionally, one keyword argument may have a list of values, in which case
# the function will return a dict containing {listval: key} pairs for each
# value in the list.
listkey = None
for k, v in kwds.items():
if isinstance(v, (list, tuple)):
if listkey is not None:
raise TypeError("May only specify a list of values for one key.")
listkey = k
if listkey is None:
return _mk_key(*args, **kwds)
else:
keys = {}
for v in kwds[listkey]:
kwds[listkey] = v
keys[v] = _mk_key(*args, **kwds)
return keys
def _mk_key(*args, **kwds):
key = list(args) + list(kwds.items())
key.sort(key=lambda a: a[0] if isinstance(a, tuple) else a)
return tuple(key)
def add_table_data(name, row_key, col_key, data, **kwds):
"""
Read data like::
Description
------------------------------------
col1 col2 col3
row1 1.2 [1] 0.9e-6 [1] 27 [2]
row2 1.7 [1] [3]
row3 0.93 [2] 0.3e-6 3 [2]
------------------------------------
[1] citation 1
[2] citation 2
[3] missing because.
"""
if isinstance(data, str) and "\xc2" in data:
raise TypeError(
"Data table <%s> appears to contain unicode characters but"
"was not defined as unicode." % name
)
lines = data.split("\n")
# First, split into description, table, and sources using ----- lines
desc = []
table = []
while lines:
line = lines.pop(0)
# print ">", line
if re.match(r"\s*-+\s*$", line):
# print "match!"
break
desc.append(line)
while lines:
line = lines.pop(0)
# print ">", line
if re.match(r"\s*-+\s*$", line):
# print "match!"
break
table.append(line)
# print desc
# print table
# parse remaining lines as sources
sources = parse_sources(lines)
# print sources
#
# parse table
# table might be empty, so take care of that first.
if table == []:
return [] # no changes
while len(table[0].strip()) == 0:
table.pop(0)
spaces = [c == " " for c in table[0]]
cols = [0] + [i for i in range(1, len(spaces)) if spaces[i - 1] and not spaces[i]]
cols = cols + [max(map(len, table)) + 1]
# print spaces
# print cols
# Make sure columns are obeyed strictly
for i, line in enumerate(table):
for j, c in enumerate(cols[1:]):
if len(line) < c:
continue
if line[c - 1] != " ":
print("Table line with error: \n ", line)
raise Exception(
"Table <%s> line: %d, column: %s does not obey column boundaries."
% (name, i, j)
)
# Break table into cells
cells = []
for line in table:
if line.strip() != "":
cells.append(
[line[cols[i] : cols[i + 1]].strip() for i in range(len(cols) - 1)]
)
# print cells
# Extract row/column names
col_names = cells.pop(0)[1:]
row_names = [cells[i].pop(0) for i in range(len(cells))]
if len(set(row_names)) != len(row_names):
for n in set(row_names):
row_names.remove(n)
raise NameError("Duplicate row names: %s" % row_names)
# Parse cell values
for i in range(len(cells)):
for j in range(len(cells[0])):
cell = cells[i][j].strip()
m = re.match(r"([^\[]*)(\[([^\]]+)\])?", cell) # match like "0.7 [3]"
if m is None:
raise ValueError(
"Table cell (%d, %d) has bad format: '%s'" % (i, j, cell)
)
# parse value
# If the value contains '±' then a tuple is returned containing the values
# on either side.
val, _, source = m.groups()
# val = unicode(val) # python 2
val = str(val) # python 3
if val.strip() == "":
val = None
else:
parts = val.split(u"±")
vals = []
for p in parts:
try:
p = int(p)
except ValueError:
try:
p = float(p)
except ValueError:
try:
p = str(
p.strip()
) # allow strings to identify mechanisms also
except ValueError:
raise ValueError(
"Table cell (%d, %d) value has bad format: '%s'"
% (i, j, val)
)
vals.append(p)
if len(vals) == 1:
val = vals[0]
else:
val = tuple(vals)
# parse source
if source is not None:
try:
source = sources[source]
except KeyError:
raise ValueError(
"Table cell (%d, %d) has unknown source key: '%s'"
% (i, j, source)
)
cells[i][j] = (val, source)
changes = [] # a list of parameters that are changed if we are rewriting a table
for i, row in enumerate(row_names):
for j, col in enumerate(col_names):
kwds[row_key] = row
kwds[col_key] = col
oldval = setval(cells[i][j], name, **kwds)
if oldval is not None and oldval != cells[i][j]:
key = mk_key(name, **kwds)
changes.append(
{"key": key, "new": cells[i][j], "old": oldval, "name": name}
)
# changes.append({'name': name, 'row': row, 'col': col, 'new': cells[i][j], 'old': oldval})
return changes
def report_changes(changes):
"""
For changes to data tables, give user a readout
"""
if len(changes) > 0:
anychg = False
for ch in changes:
# print(' >>> Changing %s, %s from default (%s) to %s' % (ch['row'], ch['col'], str(ch['new'][0]), str(ch['old'][0])))
if str(ch["old"][0]) != str(ch["new"][0]):
if anychg is False:
print(
"\nWarning: Data Table '%s' (in memory) has been modified!"
% changes[0]["name"]
)
anychg = True
print(
" >>> Changing %s, from default (%s) to %s"
% (ch["key"], str(ch["old"][0]), str(ch["new"][0]))
)
def parse_sources(lines):
sources = {}
key = None
val = []
for l in lines:
l = l.lstrip()
m = re.match(r"\s*\[([^\]]+)\]\s+(.*)$", l)
if m is not None:
key = m.groups()[0]
sources[key] = m.groups()[1].strip()
else:
if key is None:
if l == "":
continue
raise ValueError(
"Incorrect sources format--got text without "
'citation index: "%s".' % l
)
sources[key] += "\n" + l
return sources
# parse_sources('''\n\n[1] source 1\n it's cool.\n[2] source 2 is not\n'''.split('\n'))

234
cnmodel/data/connectivity.py

@ -0,0 +1,234 @@ @@ -0,0 +1,234 @@
# -*- encoding: utf-8 -*-
from ._db import add_table_data
#: Mouse synaptic convregence table
mouse_convergence = u"""
Convergence defines the average number of presynaptic cells of a particular
type (rows) that synapse onto a single postsynaptic cell of a particular
type (columns).
This connectivity matrix is currently incomplete.
Note: Bushy and pyramidal cells are known to have no (or very few)
collaterals within the CN, and so they are not listed as presynaptic cells in
this table. Octopus cells have collaterals (including in granule cell domains),
and should be added to this table when more data are available (Golding et al.,
J. Neurosci. 15: 3138, 1995)
----------------------------------------------------------------------------------------------
bushy tstellate dstellate octopus pyramidal tuberculoventral
sgc 3.3±0.6 [2] 6.5±1.0 [2] 35±0 [3] 60±0 [2] 48±0 [5] 24±0 [5]
dstellate 7 [1] 20 [1] 3 [1] 0 [4] 15 [5] 15 [5]
tstellate 0 [6] 0 [6] 0 [6] 0 [6] 0 [6] 0 [6]
tuberculoventral 6 6 0 0 [4] 21 [5] 0 [7]
pyramidal 0 0 0 0 0 0
----------------------------------------------------------------------------------------------
[1] Guesses based on Campagnola & Manis 2014
[2] Cao, X. & Oertel, D. (2010). Auditory nerve fibers excite targets through
synapses that vary in convergence, strength, and short-term plasticity.
Journal of Neurophysiology, 104(5), 230820.
Xie and Manis (unpublished): max EPSC = 3.4 ± 1.5 nA with ~0.3 nA steps
(Cao and Oertel, 2010) = ~11 AN inputs. However neither we nor Cao and Oertel
see that many clear steps in the responses, so use lower bound.
[3] Lower bound based on estimates from unpublished data Xie and Manis (2017)
Assumptions: No discernable step sizes when increasing shock intensity
at ANFs in radiate multipolars (dstellate)
Measured: 0.034 ± 15 nA sEPSC @ -70 mV
Measured: Maximal current from AN stim = 1.2 ± 0.7 nA @ -70 mV
Assuming that each AN provides 1 input, then N = ~35
[4] Octopus cells are devoid of inhibitory input (Golding et al., J. Neurosci., 1995)
[5] Convergence from Hancock and Voigt, Ann. Biomed. Eng. 27, 1999 and Zheng and Voigt,
Ann. Biomed. Eng., 34, 2006. Numbers are based on models for cat and gerbil,
respectively. Adjusted to 1/2 to avoid overexciting TV cells in network model.
[6] tstellate cells have collaterals within the CN. It has been proposed that they
provide auditory-driven input to the DCN (Oertel and Young, ), and also synapse
within the VCN (Oertel, SFN abstract). These parameters may need to be adjusted
once the convergence and strength is known.
[7] In the models of Hancock and Voigt (1999) and Zheng and Voigt (2006), the TV cells
have no connections with each other. However, Kuo et al. (J. Neurophysiol., 2015)
did see connections between pairs of TV cells in the mouse.
"""
add_table_data(
"convergence",
row_key="pre_type",
col_key="post_type",
species="mouse",
data=mouse_convergence,
)
mouse_convergence_range = u"""
The convergence range table describes, for each type of connection from
presynaptic (rows) to postsynaptic (columns), the variance in frequency of
presynaptic cells relative to the postsynaptic cell.
All values are expressed as the sigma for a lognormal distribution scaled to
the CF of the postsynaptic cell.
----------------------------------------------------------------------------------------------
bushy tstellate dstellate octopus pyramidal tuberculoventral
sgc 0.05 [1] 0.1 [1] 0.4 [1] 0.5 [5] 0.1 [1] 0.1 [1]
dstellate 0.208 [2] 0.347 [2] 0.5 [1] 0 0.2 [1] 0.2 [1]
tstellate 0.1 [4] 0.1 [4] 0 0 0 0
tuberculoventral 0.069 [3] 0.111 [3] 0 0 0.15 [1] 0
pyramidal 0 0 0 0 0 0
----------------------------------------------------------------------------------------------
[1] Guess based on axonal / dendritic morphology.
[2] Calculated from Campagnola & Manis 2014 fig. 7C
Distribution widths are given in stdev(octaves), so we multiply by ln(2) to
get the sigma for a lognormal distribution.
DS->Bushy: ln(2) * 0.3 = 0.208
DS->TStellate: ln(2) * 0.5 = 0.347
[3] Calculated from Campagnola & Manis 2014 fig. 9C
Distribution widths are given in stdev(octaves), so we multiply by ln(2) to
get the sigma for a lognormal distribution.
TV->Bushy: ln(2) * 0.10 = 0.069
TV->TStellate: ln(2) * 0.16 = 0.111
[4] Guess based on very limited information in Campagnola & Manis 2014 fig. 12
[5] Octopus cells get a wide range of ANF input (but weak on a per input basis)
For example, see McGinley et al., 2012 or Spencer et al., 2012.
"""
add_table_data(
"convergence_range",
row_key="pre_type",
col_key="post_type",
species="mouse",
data=mouse_convergence_range,
)
# --------------------------------------------------------------------------------------------
guineapig_convergence = u"""
Convergence defines the average number of presynaptic cells of a particular
type (rows) that synapse onto a single postsynaptic cell of a particular
type (columns).
This connectivity matrix is currently incomplete.
Note: Bushy and pyramidal cells are known to have no (or very few)
collaterals within the CN, and so they are not listed as presynaptic cells in
this table. Octopus cells have collaterals (including in granule cell domains),
and should be added to this table when more data are available (Golding et al.,
J. Neurosci. 15: 3138, 1995)
This table is just a guess... using mouse data...
----------------------------------------------------------------------------------------------
bushy tstellate dstellate octopus pyramidal tuberculoventral mso
sgc 3.3±0.6 [2] 6.5±1.0 [2] 35±0 [3] 60±0 [2] 48±0 [5] 24±0 [5] 0
bushy 0 0 0 0 0 0 12 [8]
dstellate 7 [1] 20 [1] 3 [1] 0 [4] 15 [5] 15 [5] 0
tstellate 0 [6] 0 [6] 0 [6] 0 [6] 0 [6] 0 [6] 0
tuberculoventral 6 6 0 0 [4] 21 [5] 0 [7] 0
pyramidal 0 0 0 0 0 0 0
----------------------------------------------------------------------------------------------
[1] Guesses based on Campagnola & Manis 2014 (using mouse data on guinea pig cells)
[2] Cao, X. & Oertel, D. (2010). Auditory nerve fibers excite targets through
synapses that vary in convergence, strength, and short-term plasticity.
Journal of Neurophysiology, 104(5), 230820.
Xie and Manis (unpublished): max EPSC = 3.4 ± 1.5 nA with ~0.3 nA steps
(Cao and Oertel, 2010) = ~11 AN inputs. However neither we nor Cao and Oertel
see that many clear steps in the responses, so use lower bound.
[3] Lower bound based on estimates from unpublished data Xie and Manis (2017)
Assumptions: No discernable step sizes when increasing shock intensity
at ANFs in radiate multipolars (dstellate)
Measured: 0.034 ± 15 nA sEPSC @ -70 mV
Measured: Maximal current from AN stim = 1.2 ± 0.7 nA @ -70 mV
Assuming that each AN provides 1 input, then N = ~35
[4] Octopus cells are devoid of inhibitory input (Golding et al., J. Neurosci., 1995)
[5] Convergence from Hancock and Voigt, Ann. Biomed. Eng. 27, 1999 and Zheng and Voigt,
Ann. Biomed. Eng., 34, 2006. Numbers are based on models for cat and gerbil,
respectively. Adjusted to 1/2 to avoid overexciting TV cells in network model.
[6] tstellate cells have collaterals within the CN. It has been proposed that they
provide auditory-driven input to the DCN (Oertel and Young, ), and also synapse
within the VCN (Oertel, SFN abstract). These parameters may need to be adjusted
once the convergence and strength is known.
[7] In the models of Hancock and Voigt (1999) and Zheng and Voigt (2006), the TV cells
have no connections with each other. However, Kuo et al. (J. Neurophysiol., 2015)
did see connections between pairs of TV cells in the mouse.
[8] Bushy convergence to MSO is a guess
"""
add_table_data(
"convergence",
row_key="pre_type",
col_key="post_type",
species="guineapig",
data=guineapig_convergence,
)
guineapig_convergence_range = u"""
The convergence range table describes, for each type of connection from
presynaptic (rows) to postsynaptic (columns), the variance in frequency of
presynaptic cells relative to the postsynaptic cell.
All values are expressed as the sigma for a lognormal distribution scaled to
the CF of the postsynaptic cell.
*** This table is just a guess - using data from mouse... ****
-------------------------------------------------------------------------------------------------------
bushy tstellate dstellate octopus pyramidal tuberculoventral mso
sgc 0.05 [1] 0.1 [1] 0.4 [1] 0.5 [5] 0.1 [1] 0.1 [1] 0
bushy 0 0 0 0 0 0 0.05 [6]
dstellate 0.208 [2] 0.347 [2] 0.5 [1] 0 0.2 [1] 0.2 [1] 0
tstellate 0.1 [4] 0.1 [4] 0 0 0 0 0
tuberculoventral 0.069 [3] 0.111 [3] 0 0 0.15 [1] 0 0
pyramidal 0 0 0 0 0 0 0
--------------------------------------------------------------------------------------------------------
[1] Guess based on axonal / dendritic morphology.
[2] Calculated from Campagnola & Manis 2014 fig. 7C (Using mouse data on guinea pig cells)
Distribution widths are given in stdev(octaves), so we multiply by ln(2) to
get the sigma for a lognormal distribution.
DS->Bushy: ln(2) * 0.3 = 0.208
DS->TStellate: ln(2) * 0.5 = 0.347
[3] Calculated from Campagnola & Manis 2014 fig. 9C (Using mouse data on guinea pig cells)
Distribution widths are given in stdev(octaves), so we multiply by ln(2) to
get the sigma for a lognormal distribution.
TV->Bushy: ln(2) * 0.10 = 0.069
TV->TStellate: ln(2) * 0.16 = 0.111
[4] Guess based on very limited information in Campagnola & Manis 2014 fig. 12
[5] Octopus cells get a wide range of ANF input (but weak on a per input basis)
For example, see McGinley et al., 2012 or Spencer et al., 2012.
[6] MSO convergence from bushy cells is a guess.
"""
add_table_data(
"convergence_range",
row_key="pre_type",
col_key="post_type",
species="guineapig",
data=guineapig_convergence_range,
)

582
cnmodel/data/ionchannels.py

@ -0,0 +1,582 @@ @@ -0,0 +1,582 @@
# -*- encoding: utf-8 -*-
from ._db import add_table_data
"""
Ion channel density tables
All of the ion channel densities for the models implemented in cnmodel
are (or should be) stated here, and should not be modified in the
cnmodel code itself.
"""
add_table_data(
"RM03_channels",
row_key="field",
col_key="model_type",
species="guineapig",
data=u"""
This table describes the ion channel densities (and voltage shifts if necessary)
for different cell types in the original Rothman Manis 2003 model.
Data from Table 1, except for "octopus" cells, which is modified (see note 3)
map to cell: bushy-II bushy-II-I tstellate tstellate-t bushy-I-II octopus
-----------------------------------------------------------------------------------------------------------------------------------
II II-I I-c I-t I-II II-o
nacn_gbar 1000. [1] 1000. [1] 1000. [1] 1000. [1] 1000. [2] 1000. [3]
kht_gbar 150.0 [1] 150.0 [1] 150.0 [1] 80.0 [1] 150.0 [2] 150.0 [3]
klt_gbar 200.0 [1] 35.0 [1] 0.0 [1] 0.0 [1] 20.0 [2] 1000. [3]
ka_gbar 0.0 [1] 0.0 [1] 0.0 [1] 65.0 [1] 0.0 [2] 0.0 [3]
ih_gbar 20.0 [1] 3.5 [1] 0.5 [1] 0.5 [1] 2.0 [2] 30.0 [3]
leak_gbar 2.0 [1] 2.0 [1] 2.0 [1] 2.0 [1] 2.0 [2] 2.0 [3]
leak_erev -65 [1] -65 [1] -65 [1] -65 [1] -65 [2] -65 [3]
na_type nacn [1] nacn [1] nacn [1] nacn [1] nacn [2] nacn [3]
ih_type ihvcn [1] ihvcn [1] ihvcn [1] ihvcn [1] ihvcn [2] ihvcn [3]
soma_Cap 12.0 [1] 12.0 [1] 12.0 [1] 12.0 [1] 12.0 [2] 25.0 [3]
e_k -84 [1] -84 [1] -84 [1] -84 [2] -84 [2] -84 [2]
e_na 50. [1] 50. [1] 50. [1] 50. [2] 50. [2] 50. [2]
ih_eh -43 [1] -43 [1] -43 [1] -43 [2] -43 [2] -43 [2]
-----------------------------------------------------------------------------------------------------------------------------------
[1] Rothman and Manis, 2003
Age "adult", Temperature=22C
Units are nS.
[2] Rothman and manis, 2003, model I-II
Some low-voltage K current, based on observations of
a single spike near threshold and regular firing for higher
currents (Xie and Manis, 2017)
[3] Derived from Rothman and Manis, 2003, model II
Large amounts of low-voltage K current, and elevated HCN. Conductances
based on Rothman and Manis, 2003; concept from Cao and Oertel
[4] Designation for elevated LTK and Ih for octopus cells
""",
)
add_table_data(
"XM13_channels",
row_key="field",
col_key="model_type",
species="mouse",
data=u"""
This table describes the REFERENCE ion channel densities (and voltage shifts if necessary)
for different cell types based on the Xie and Manis 2013 models for mouse.
The REFERENCE values are applied to "point" models, and to the soma of
compartmental models.
The names of the mechanisms must match a channel mechanism (Neuron .mod files)
and the following _(gbar, vshift, etc) must match an attribute of that channel
that can be accessed.
-----------------------------------------------------------------------------------------------------------------------------------
II II-I I-c I-II I-t
nav11_gbar 0000. [4] 0000. [4] 000. [4] 0. [4] 3000. [4]
nacn_gbar 1000. [1] 1000. [1] 3000. [1] 0000. [2] 0000. [1]
na_gbar 1000. [1] 1000. [1] 3000. [1] 1800. [2] 0000. [1]
kht_gbar 58.0 [1] 58.0 [1] 500.0 [1] 150.0 [2] 500.0 [1]
klt_gbar 80.0 [1] 20.0 [1] 0.0 [1] 14.0 [3] 0.0 [1]
ka_gbar 0.0 [1] 0.0 [1] 0.0 [1] 0.0 [2] 125.0 [1]
ihvcn_gbar 30.0 [1] 30.0 [1] 18.0 [1] 2.0 [2] 18.0 [1]
leak_gbar 2.0 [1] 2.0 [1] 8.0 [1] 2.0 [2] 8.0 [1]
leak_erev -65 [1] -65 [1] -65 [1] -65 [2] -65 [1]
na_type nacn [1] nav11 [1] nacn [1] na [3] nav11 [1]
ih_type ihvcn [1] ihvcn [1] ihvcn [1] ihvcn [2] ihvcn [1]
soma_Cap 26.0 [1] 26.0 [1] 25.0 [1] 25.0 [2] 25.0 [1]
nav11_vshift 4.3 [1] 4.3 [1] 4.3 [1] 4.3 [1] 4.3 [1]
e_k -84 [1] -84 [1] -84 [1] -70 [3] -84 [1]
e_na 50. [1] 50. [1] 50. [1] 55. [3] 50. [1]
ih_eh -43 [1] -43 [1] -43 [1] -43 [2] -43 [1]
-----------------------------------------------------------------------------------------------------------------------------------
[1] Uses channels from Rothman and Manis, 2003
Conductances are for Mouse bushy cells
Xie and Manis, 2013
Age "adult", Temperature=34C
Units are nS.
[2] Rothman and manis, 2003, model I-II
Some low-voltage K current, based on observations of
a single spike near threshold and regular firing for higher
currents (Xie and Manis, 2017)
[3] These values for the I-II (dstellate) are from the original checkpoint test
for cnmodel 12/2017.
[4] nav11 channels were used in original Xie and Manis (2013) ms, but are not
used for mice in the master distribution of cnmodel, which used only the nacn
channels.
""",
)
add_table_data(
"XM13_channels_compartments",
row_key="parameter",
col_key="compartment",
species="mouse",
model_type="II",
data=u"""
This table describes the ion channel densities relative to somatic densities,
e.g., relative to REFERENCE densities in the table XM13_channels.
and voltage shifts, for different compartments of the specified neuron,
Conductances will be calculated from the Model derived from Xie and Manis 2013 for mouse
(data table: mGVC_channels).
------------------------------------------------------------------------------------------------------------------------------------------------------------------
axon unmyelinatedaxon myelinatedaxon initialsegment hillock soma dendrite primarydendrite secondarydendrite
nav11_gbar 3.0 [1] 3.0 [1] 0.0 [1] 5.0 [1] 5.0 [1] 1.0 [1] 0.5 [1] 0.50 [1] 0.25 [1]
kht_gbar 1.0 [1] 2.0 [1] 0.01 [1] 2.0 [1] 2.0 [1] 1.0 [1] 0.5 [1] 0.5 [1] 0.25 [1]
klt_gbar 1.0 [1] 1.0 [1] 0.01 [1] 1.0 [1] 1.0 [1] 1.0 [1] 0.5 [1] 0.5 [1] 0.25 [1]
ihvcn_gbar 0.0 [1] 0.0 [1] 0.0 [1] 0.5 [1] 0.0 [1] 1.0 [1] 0.5 [1] 0.5 [1] 0.5 [1]
leak_gbar 1.0 [1] 0.25 [1] 0.25e-3 [1] 1.0 [1] 1.0 [1] 1.0 [1] 0.5 [1] 0.5 [1] 0.5 [1]
leak_erev -65. [1] -65. [1] -65. [1] -65. [1] -65. [1] -65. [1] -65. [1] -65. [1] -65. [1]
nav11_vshift 4.3 [1] 4.3 [1] 0.0 [1] 4.3 [1] 4.3 [1] 0.0 [1] 0.0 [1] 0.0 [1] 0.0 [1]
na_type nav11 nav11 nav11 nav11 nav11 nav11 nav11 nav11 nav11
ih_type ihvcn ihvcn ihvcn ihvcn ihvcn ihvcn ihvcn ihvcn ihvcn
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
[1] Scaling is relative to soma scaling. Numbers are estimates based on general distribution from literature on cortical neurons.
""",
)
# ***** BEGINNING OF XM13_Channels for nacncoop version of model
add_table_data(
"XM13nacncoop_channels",
row_key="field",
col_key="model_type",
species="mouse",
data=u"""
This table describes the REFERENCE ion channel densities (and voltage shifts if necessary)
for different cell types based on the Xie and Manis 2013 models for mouse, but using
the nacncoop mechanism (coooperative sodium channels)
!!!!!!!!!!!! USAGE OF THIS TABLE SHOULD BE CONSIDERED EXPERIMENTAL !!!!!!!!!!!!!!
The REFERENCE values are applied to "point" models, and to the soma of
compartmental models.
The names of the mechanisms must match a channel mechanism (Neuron .mod files)
and the following _(gbar, vshift, etc) must match an attribute of that channel
that can be accessed.
-----------------------------------------------------------------------------------------------------------------------------------
II II-I I-c I-II I-t
nacncoop_gbar 3000. [4] 1000. [4] 1000. [4] 1000. [4] 1000. [4]
kht_gbar 58.0 [1] 58.0 [1] 500.0 [1] 150.0 [2] 500.0 [1]
klt_gbar 80.0 [1] 20.0 [1] 0.0 [1] 14.0 [3] 0.0 [1]
ka_gbar 0.0 [1] 0.0 [1] 0.0 [1] 0.0 [2] 125.0 [1]
ihvcn_gbar 30.0 [1] 30.0 [1] 18.0 [1] 2.0 [2] 18.0 [1]
leak_gbar 2.0 [1] 2.0 [1] 8.0 [1] 2.0 [2] 8.0 [1]
leak_erev -65 [1] -65 [1] -65 [1] -65 [2] -65 [1]
na_type nacncoop [1] nacncoop [1] nacncoop [1] nacncoop [3] nacncoop [1]
ih_type ihvcn [1] ihvcn [1] ihvcn [1] ihvcn [2] ihvcn [1]
soma_Cap 26.0 [1] 26.0 [1] 25.0 [1] 25.0 [2] 25.0 [1]
nacncoop_vshift 0.0 [1] 0.0 [1] 0.0 [1] 0.0 [1] 0.0 [1]
e_k -84 [1] -84 [1] -84 [1] -70 [3] -84 [1]
e_na 50. [1] 50. [1] 50. [1] 55. [3] 50. [1]
ih_eh -43 [1] -43 [1] -43 [1] -43 [2] -43 [1]
-----------------------------------------------------------------------------------------------------------------------------------
[1] Uses channels from Xie and Manis, 2013
Age "adult", Temperature=34C
Units are nS.
[2] Rothman and manis, 2003, model I-II
Some low-voltage K current, based on observations of
a single spike near threshold and regular firing for higher
currents (Xie and Manis, 2017)
[3] These values for the I-II (dstellate) are from the original checkpoint test
for cnmodel 12/2017.
[4] nav11 channels were used in original Xie and Manis (2013) ms,
However, this version uses cooperative na channels for faster activation
""",
)
add_table_data(
"XM13nacncooop_channels_compartments",
row_key="parameter",
col_key="compartment",
species="mouse",
model_type="II",
data=u"""
!!!!!!!!!!!! USAGE OF THIS TABLE SHOULD BE CONSIDERED EXPERIMENTAL !!!!!!!!!!!!!!
This table describes the ion channel densities relative to somatic densities,
e.g., relative to REFERENCE densities in the table XM13_nacncoop_channels.
and voltage shifts, for different compartments of the specified neuron,
Conductances will be calculated from the Model derived from Xie and Manis 2013 for mouse
------------------------------------------------------------------------------------------------------------------------------------------------------------------
axon unmyelinatedaxon myelinatedaxon initialsegment hillock soma dendrite primarydendrite secondarydendrite
nacncoop_gbar 3.0 [1] 3.0 [1] 0.0 [1] 5.0 [1] 5.0 [1] 1.0 [1] 0.5 [1] 0.50 [1] 0.25 [1]
kht_gbar 1.0 [1] 2.0 [1] 0.01 [1] 2.0 [1] 2.0 [1] 1.0 [1] 0.5 [1] 0.5 [1] 0.25 [1]
klt_gbar 1.0 [1] 1.0 [1] 0.01 [1] 1.0 [1] 1.0 [1] 1.0 [1] 0.5 [1] 0.5 [1] 0.25 [1]
ihvcn_gbar 0.0 [1] 0.0 [1] 0.0 [1] 0.5 [1] 0.0 [1] 1.0 [1] 0.5 [1] 0.5 [1] 0.5 [1]
leak_gbar 1.0 [1] 0.25 [1] 0.25e-3 [1] 1.0 [1] 1.0 [1] 1.0 [1] 0.5 [1] 0.5 [1] 0.5 [1]
leak_erev -65. [1] -65. [1] -65. [1] -65. [1] -65. [1] -65. [1] -65. [1] -65. [1] -65. [1]
nacncoop_vshift 0.0 [1] 0.0 [1] 0.0 [1] 0.0 [1] 0.0 [1] 0.0 [1] 0.0 [1] 0.0 [1] 0.0 [1]
na_type nacncoop nacncoop nacncoop nacncoop nacncoop nacncoop nacncoop nacncoop nacncoop
ih_type ihvcn ihvcn ihvcn ihvcn ihvcn ihvcn ihvcn ihvcn ihvcn
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
[1] Scaling is relative to soma scaling. Numbers are estimates based on general distribution from literature on cortical neurons.
""",
)
# ***** END OF XM13_Channels for nacncoop version of model
add_table_data(
"mGBC_channels",
row_key="field",
col_key="model_type",
species="mouse",
data=u"""
This table describes the REFERENCE ion channel densities (and voltage shifts if necessary)
for different cell types based on the Xie and Manis 2013 models for mouse.
The REFERENCE values are applied to "point" models, and to the soma of
compartmental models.
The names of the mechanisms must match a channel mechanism (Neuron .mod files)
and the following _(gbar, vshift, etc) must match an attribute of that channel
that can be accessed.
-----------------------------------------------------------------------------------------------------------------------------------
II II-I I-c I-II I-t
nav11_gbar 1600. [1] 1600. [1] 3000. [1] 1600. [2] 3000. [1]
kht_gbar 58.0 [1] 58.0 [1] 500.0 [1] 150.0 [2] 500.0 [1]
klt_gbar 80.0 [1] 14.0 [1] 0.0 [1] 20.0 [2] 0.0 [1]
ka_gbar 0.0 [1] 0.0 [1] 0.0 [1] 0.0 [2] 125.0 [1]
ihvcn_gbar 30.0 [1] 30.0 [1] 18.0 [1] 2.0 [2] 18.0 [1]
leak_gbar 2.0 [1] 2.0 [1] 8.0 [1] 2.0 [2] 8.0 [1]
leak_erev -65 [1] -65 [1] -65 [1] -65 [2] -65 [1]
na_type nav11 [1] nav11 [1] nav11 [1] nav11 [1] nav11 [1]
ih_type ihvcn [1] ihvcn [1] ihvcn [1] ihvcn [2] ihvcn [1]
soma_Cap 26.0 [1] 26.0 [1] 25.0 [1] 26.0 [2] 25.0 [1]
nav11_vshift 4.3 [1] 4.3 [1] 4.3 [1] 4.3 [1] 4.3 [1]
e_k -84 [1] -84 [1] -84 [1] -84 [2] -84 [1]
e_na 50. [1] 50. [1] 50. [1] 50. [2] 50. [1]
ih_eh -43 [1] -43 [1] -43 [1] -43 [2] -43 [1]
-----------------------------------------------------------------------------------------------------------------------------------
[1] Uses channels from Rothman and Manis, 2003, except for Na channels
Conductances are for Mouse bushy cells
Xie and Manis, 2013
Age "adult", Temperature=34C
Units are nS.
[2] Rothman and Manis, 2003, model I-II
Some low-voltage K current, based on observations of
a single spike near threshold and regular firing for higher
currents (Xie and Manis, 2017)
""",
)
add_table_data(
"mGBC_channels_compartments",
row_key="parameter",
col_key="compartment",
species="mouse",
model_type="II",
data=u"""
This table describes the ion channel densities relative to somatic densities,
e.g., relative to REFERENCE densities in the table XM13_channels.
and voltage shifts, for different compartments of the specified neuron,
Conductances will be calculated from the Model for Xie and Manis 2013 for mouse
(data table: XM13_channels).
------------------------------------------------------------------------------------------------------------------------------------------------------------------
axon unmyelinatedaxon myelinatedaxon initialsegment hillock soma dendrite primarydendrite secondarydendrite
nav11_gbar 3.0 [1] 3.0 [1] 0.0 [1] 3.0 [1] 2.0 [1] 1.0 [1] 0.25 [1] 0.25 [1] 0.25 [1]
kht_gbar 1.0 [1] 2.0 [1] 0.01 [1] 2.0 [1] 2.0 [1] 1.0 [1] 0.5 [1] 0.5 [1] 0.25 [1]
klt_gbar 1.0 [1] 1.0 [1] 0.01 [1] 1.0 [1] 1.0 [1] 1.0 [1] 0.5 [1] 0.5 [1] 0.25 [1]
ihvcn_gbar 0.0 [1] 0.0 [1] 0.0 [1] 0.5 [1] 0.0 [1] 1.0 [1] 0.5 [1] 0.5 [1] 0.5 [1]
leak_gbar 1.0 [1] 0.25 [1] 0.25e-3 [1] 1.0 [1] 1.0 [1] 1.0 [1] 0.5 [1] 0.5 [1] 0.5 [1]
leak_erev -65. [1] -65. [1] -65. [1] -65. [1] -65. [1] -65. [1] -65. [1] -65. [1] -65. [1]
nav11_vshift 4.3 [1] 4.3 [1] 0.0 [1] 4.3 [1] 4.3 [1] 0.0 [1] 0.0 [1] 0.0 [1] 0.0 [1]
na_type nav11 nav11 nav11 nav11 nav11 nav11 nav11 nav11 nav11
ih_type ihvcn ihvcn ihvcn ihvcn ihvcn ihvcn ihvcn ihvcn ihvcn
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
[1] Scaling is relative to soma scaling. Numbers are estimates based on general distribution from literature on cortical neurons.
""",
)
add_table_data(
"POK_channels",
row_key="field",
col_key="cell_type",
species="rat",
data=u"""
This table describes the ion channel densities and voltage shifts for rat DCN pyramidal cells,
from Kanold and Manis, 2001
------------------------------------------------------------------------------------------------------------------------------------------
pyramidal
soma_napyr_gbar 350.0 [1]
soma_nap_gbar 0.
soma_kdpyr_gbar 80.0 [1]
soma_kcnq_gbar 0.
soma_kif_gbar 150.0 [1]
soma_kis_gbar 40.0 [1]
soma_ihpyr_gbar 2.8 [1]
soma_leak_gbar 2.8 [1]
soma_leak_erev -62.0 [1]
soma_e_na 50. [1]
soma_e_k -81.5 [1]
soma_e_h -43.0 [1]
soma_natype napyr
soma_Cap 12 [1]
------------------------------------------------------------------------------------------------------------------------------------------
[1] Kanold and Manis, 1999, 2001, 2005
Age P11-14, Temperature=22C
Units are nS.
[2] Adjustable q10 added for fitting
soma_ihpyr_adj_q10 1.0 [2] (removed for testing)
""",
)
add_table_data(
"CW_channels",
row_key="field",
col_key="cell_type",
species="mouse",
data=u"""
This table describes the ion channel densities and voltage shifts
for a mouse carthweel cell model.
Ad-hoc model, based on a Purkinje cell model (ref [1]).
-----------------------------------------------------------------------------------------------------------------------------------
cartwheel
soma_narsg_gbar 500.0 [1]
soma_bkpkj_gbar 2.0
soma_kpkj_gbar 100. [1]
soma_kpkj2_gbar 50.
soma_kpkjslow_gbar 150 [1]
soma_kpksk_gbar 25.0 [1]
soma_lkpkj_gbar 5.0 [1]
soma_hpkj_gbar 5.0 [1]
soma_e_na 50. [1]
soma_e_k -80.0 [1]
soma_hpkj_eh -43.0 [1]
soma_lkpkj_e -65.0 [1]
soma_e_ca 50.
soma_na_type narsg
soma_pcabar 0.00015 [1]
soma_Dia 18
-----------------------------------------------------------------------------------------------------------------------------------
[1] Channels from Khaliq, Gouwens and Raman, J. Neurosci. 2003
Conductance levels modified.
""",
)
add_table_data(
"TV_channels",
row_key="field",
col_key="cell_type",
species="mouse",
data=u"""
This table describes the ion channel densities and voltage shifts
for a mouse tuberculoventral cell model.
Ad-hoc model, based on the t-stellate cell model, but adjusted
to match the data from Kuo and Trussell.
-----------------------------------------------------------------------------------------------------------------------------------
TVmouse
soma_nacncoop_gbar 5800.0 [2]
soma_kht_gbar 400.0 [1]
soma_ihvcn_gbar 2.5 [2]
soma_ka_gbar 65.0 [1]
soma_leak_gbar 4.5 [1]
soma_leak_erev -72.0 [1]
soma_e_na 50. [1]
soma_e_k -81.5 [1]
soma_ihvcn_eh -43.0 [1]
soma_na_type nacncoop [2]
soma_Cap 35 [1]
-----------------------------------------------------------------------------------------------------------------------------------
[1] Values obtained from brute force runs and comparision to
FI curve from Kuo, Lu and Trussell, J Neurophysiol. 2012 Aug 15;
108(4): 11861198.
[2] Cooperative sodium channel model, based on (see the mechanisms folder)
concepts and implementation similar to Oz et al. J.Comp. Neurosci. 39: 63, 2015,
and Huang et al., PloSOne 7:e37729, 2012.
""",
)
add_table_data(
"sgc_mouse_channels",
row_key="field",
col_key="cell_type",
species="mouse",
data=u"""
This table describes the ion channel densities (and voltage shifts if necessary)
for SGC cells, based on
-----------------------------------------------------------------------------------------------------------------------------------
sgc-a sgc-bm
sgc_name a bm
soma_na_gbar 350. [2] 350. [2]
soma_kht_gbar 58.0 [1] 58.0 [1]
soma_klt_gbar 80.0 [1] 80.0 [1]
soma_ihap_gbar 3.0 [3] 0.0 [1]
soma_ihap_eh -41.0 [3] -41.0 [3]
soma_ihbm_gbar 0.0 [3] 3.0 [3]
soma_ihbm_eh -41.0 [3] -41.0 [3]
soma_leak_gbar 2.0 [1] 2.0 [1]
soma_leak_erev -65 [1] -65 [1]
soma_na_type jsrna [2] jsrna [2]
soma_Cap 12.0 [1] 12.0 [1]
soma_e_k -84 [1] -84 [1]
soma_e_na 50. [1] 50. [1]
-----------------------------------------------------------------------------------------------------------------------------------
[1] Model is based on the mouse bushy cell model (XM13, above),
but with a fast sodium channel from Rothman et al, 1993. and Ih currents
from Liu et al. 2014
[2] Sodium channel from Rothman, Young and Manis, J Neurophysiol. 1993 Dec;70(6):2562-83.
[3] Ih Currents from Liu, Manis, Davis, J Assoc Res Otolaryngol. 2014 Aug;15(4):585-99.
doi: 10.1007/s10162-014-0446-z. Epub 2014 Feb 21.
Age "P10" (cultured SGC cells), Original data temperature=22C.
Units are nS.
""",
)
add_table_data(
"sgc_guineapig_channels",
row_key="field",
col_key="cell_type",
species="guineapig",
data=u"""
This table describes the ion channel densities (and voltage shifts if necessary)
for a model SGC cell, which is based on a bushy cell with a different Na channel.
-----------------------------------------------------------------------------------------------------------------------------------
sgc-a sgc-bm
sgc_name a bm
soma_na_gbar 1000. [2] 1000. [2]
soma_kht_gbar 150.0 [1] 150.0 [1]
soma_klt_gbar 200.0 [1] 200.0 [1]
soma_ihap_gbar 3.0 [3] 0.0 [3]
soma_ihap_eh -41.0 [3] -41.0 [3]
soma_ihbm_gbar 0.0 [3] 3.0 [3]
soma_ihbm_eh -41.0 [3] -41.0 [3]
soma_leak_gbar 2.0 [1] 2.0 [1]
soma_leak_erev -65 [1] -65 [1]
soma_na_type jsrna [2] jsrna [2]
soma_Cap 12.0 [1] 12.0 [1]
soma_e_k -84 [1] -84 [1]
soma_e_na 50. [1] 50. [1]
-----------------------------------------------------------------------------------------------------------------------------------
[1] Model is based on the guinea pig bushy cell model (RM03, above),
but with a fast sodium channel from Rothman et al, 1993. and Ih currents
from Liu et al. 2014
[2] Sodium channel from Rothman, Young and Manis, J Neurophysiol. 1993 Dec;70(6):2562-83.
[3] Ih Currents from Liu, Manis, Davis, J Assoc Res Otolaryngol. 2014 Aug;15(4):585-99.
doi: 10.1007/s10162-014-0446-z. Epub 2014 Feb 21.
Age "P10" (cultured SGC cells), Temperature=22C.
Units are nS.
""",
)
add_table_data(
"MSO_principal_channels",
row_key="field",
col_key="cell_type",
species="guineapig",
data=u"""
This table describes the ion channel densities
for a putative MSO principal neuron based on the original Rothman Manis 2003 model for bushy cells.
-----------------------------------------------------------------------------------------------------------------------------------
MSO-principal
MSO_name Principal
soma_na_gbar 1000. [1]
soma_kht_gbar 150.0 [1]
soma_klt_gbar 200.0 [1]
soma_ka_gbar 0.0 [1]
soma_ih_gbar 20.0 [1]
soma_leak_gbar 2.0 [1]
soma_leak_erev -65 [1]
soma_na_type nacn [1]
soma_ih_type ihvcn [1]
soma_Cap 12.0 [1]
soma_e_k -84 [1]
soma_e_na 50. [1]
soma_ih_eh -43 [1]
-----------------------------------------------------------------------------------------------------------------------------------
[1] This MSO neuron model is basied on Rothman and Manis, 2003 bushy cell, type II
Age "adult", Temperature=22C
Units are nS.
""",
)

37
cnmodel/data/populations.py

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
# -*- encoding: utf-8 -*-
from ._db import add_table_data
add_table_data(
"populations",
row_key="field",
col_key="cell_type",
species="mouse",
data=u"""
-----------------------------------------------------------------------------------------------------
sgc bushy tstellate dstellate octopus pyramidal tuberculoventral
n_cells 10000 [1] 6500 [2] 6500 [2] 650 [3] 5000 3000 5000
cf_min 2000 2000 2000 2000 2000 2000 2000
cf_max 90000 90000 90000 90000 90000 90000 90000
-----------------------------------------------------------------------------------------------------
[1] ?
[2] Rough estimate from allen brain atlas data:
Volume of VCN is 0.377 mm^3, by counting voxels with 'VCO' (101) label in Common Coordinate Framework atlas.
753370 voxels * 0.5 * 10e-6**3 m^3/vox = 0.377 mm^3
Counted Slc17a7 (pan-excitatory) cell bodies in a 500x500 um chunk of VCN
http://mouse.brain-map.org/experiment/siv?id=69014470&imageId=68856767&initImage=ish&coordSystem=pixel&x=7616.5&y=4144.5&z=1
266 cells in 500x500 um = 34707 cells / mm^2
34707**3/2 * 0.377 mm^3 = 13084 cells total
Assume half are bushy, half are T-stellate
[3] Rough estimate from allen brain atlas data:
Similar to [2], using Gad1 inhibitory marker
http://mouse.brain-map.org/experiment/siv?id=75492764&imageId=75405134&initImage=ish&coordSystem=pixel&x=5320.5&y=3232.5&z=1
36 cells in 500x500 um = 144e6 / m^2 ~= 1728 / mm^2
= 651 cells total (VCN, unilateral)
""",
)

503
cnmodel/data/synapses.py

@ -0,0 +1,503 @@ @@ -0,0 +1,503 @@
# -*- encoding: utf-8 -*-
from ._db import add_table_data
# sgc old weights:
# bushy tstellate dstellate octopus pyramidal tuberculoventral
# weight 0.027 [12] 0.006 [12] 0.00064 [12] 0.0011 [12] 0.0023 [12] 0.0029 [12]
# tau1 0.1 [5] 0.1 [5] 0.2 [5] 0.1 [5] 0.1 [5] 0.1 [5]
# tau2 0.3 [5] 0.3 [5] 0.5 [5] 0.3 [5] 0.3 [5] 0.3 [5]
# erev 0 [5] 0 [5] 0 [5] 0 [5] 0 [5] 0 [5]
add_table_data(
"sgc_synapse",
row_key="field",
col_key="post_type",
species="mouse",
data=u"""
AMPA_gmax and NMDA_gmax are the estimated average peak conductances (in nS)
resulting from an action potential in a single auditory nerve terminal, under
conditions that minimize the effects of short-term plasticity.
AMPA_gmax are from values measured at -65 mV (or -70mV), and represent SINGLE TERMINAL
conductances
AMPAR_gmax are the individual synapse postsynaptic conductance
NMDA_gmax values are taken as the fraction of the current that is NMDAR dependent
at +40 mV (see below)
n_rsites is the number of release sites per SGC terminal.
---------------------------------------------------------------------------------------------------------------------------------------
bushy tstellate dstellate octopus pyramidal tuberculoventral cartwheel
AMPA_gmax 21.05±15.4 [1] 4.6±3.1 [2] 0.49±0.29 [7] 0.87±0.23 [3] 0.6±0.3 [8] 2.2±1.5 [8] 0
AMPAR_gmax 4.6516398 [10] 4.632848 [10] 1.7587450 [10] 16.975147 [10] 0.9 [8] 2.2 [8] 0
NMDA_gmax 10.8±4.6 [1] 2.4±1.6 [2] 0.552±0.322 [7] 0.17±0.046 [3] 0.4±0.33 [8] 2.4±1.6 [8] 0
NMDAR_gmax 0.4531933 [10] 1.2127097 [10] 0.9960820 [10] 0.6562702 [10] 0.2 [8] 1.2127097 [8] 0
NMDAR_vsh -15.0 [12] -15.0 [12] -15.0 [12] -15.0 [12] -15.0 [12] -15.0 [12] 0
NMDAR_vshift 0.0 [12] 0.0 [12] 0.0 [12] 0.0 [12] 0.0 [12] 0.0 [12] 0
EPSC_cv 0.12 [8] 0.499759 [9] 0.886406 [9] 1.393382 [9] 0.499 [8] 0.499 [8] 0
Pr 1.000 [11] 1.000 [11] 1.000 [11] 1.000 [11] 1.000 [8] 1.000 [8] 0
n_rsites 100 [5] 4 [6] 1 [4] 1 [4] 2 [8] 2 [8] 0
delay 0.600 0.600 0.600 0.600 0.600 0.600 0
weight 0.020377 0.003679 0.000457 0.001311 0.000327 0.000808 0
tau1 0.158 0.174 0.152 0.125 0.167 0.157 0
tau2 0.246 1.501 1.652 0.251 1.489 1.641 0
erev 0.0 0.0 0.0 0.0 0.0 0.0 0
----------------------------------------------------------------------------------------------------------------------------------------
[1] Derived from Cao, X. & Oertel, D. (2010). Single-terminal conductance was
reported as 21.5±15.4 nS (1.4±1.0 nA at -65 mV). The ratio of NMDA current to
total current is 0.3, so AMPA and NMDA currents are:
AMPA_gmax = 21.5±15.4 nS (measured at -65 mV)
NMDA_gmax = 21.5±15.4 nS * 0.3 = 10.8±4.6 nS
Age>p17, Temperature=33C, [Mg2+]=1.3mM, [Ca2+]=2.4mM
Units are nS.
See also Pliss et al., J. Neurophys., 2009 (and note [12])
[2] Derived from Cao, X. & Oertel, D. (2010). Single-terminal conductance was
estimated as 4.6±3.1 nS. The ratio of NMDA current to
total current is 0.53, so AMPA and NMDA currents are:
AMPA_gmax = 4.6±3.1 nS
NMDA_gmax = 4.6±3.1 nS * 0.53 = 2.4±1.6 nS
Estimated number of inputs per AN fiber:
0.3 nA step, 0.08 nA mini size = ~ 4 inputs per AN fiber
Age>p17, Temperature=33C, [Mg2+]=1.3mM, [Ca2+]=2.4mM
Units are nS
[3] Derived from Cao, X. & Oertel, D. (2010). Single-terminal conductance was
estimated as 52±14 nS / 60 = 0.87±0.23 nS. The ratio of NMDA current to
total current is 0.2, so AMPA and NMDA currents are:
AMPA_gmax = 0.87±0.23 nS
NMDA_gmax = 0.87±0.23 nS * 0.2 = 0.17±0.046 nS
Age>p17, Temperature=33C, [Mg2+]=1.3mM, [Ca2+]=2.4mM
Units are nS
[4] Assumption based on mini size and lack of discernable EPSC step (guess).
Should be verified.
[5] Oleskevich & Walmsley ~2002, Wang & Manis 2005. Units are nS
[6] A value of 45 would be chosen to satisfy the CV of EPSC amplitude determined in [9].
However, those measures are for simultaneous stimulation of multiple AN fibers.
A value of 4 is included here to correspond to measures in Cao and Oertel (2010)
(see note [2])
[7] (Xie and Manis, Frontiers in Neural Circuits, 2017):
Measurements from CBA/CaJ mouse "radiate" multipolar cells in the AVCN.
Single terminal conductance = (1.2 ± 0.70 nA/70 mV)/ 35 inputs = 0.490 ± 0.286 nS
(see connections.py)
Single terminal conductance from mini = 34 pA/70 mV = 0.486 nS (single mini)
Assume same AMPA/NMDA ratio as tstellate cells, but measures made where NMDA = 0
(at negative V):
AMPA_gmax = 0.490±0.286 nS
NMDA_gmax = 0.490±0.286 nS * 0.53/0.47 = 0.552±0.322 nS
Age > P35, Temperature=34C, [Mg2+]=1.5mM, [Ca2+]=2.5mM
[8] Thin air. These are for testing the software, not necessarily for performing
real simulations. Note: Pyramidal cell strength has been reduced
because of large convergence and high input resistance of the reference cell model.
Release 1 (Nov 2017):
pyramidal
0.6 ±1.05 [8]
1.8 [8]
0.8±0.66 [8]
0.4 [8]
-15.0 [12]
0.499 [8]
1.000 [8]
2 [8]
[9] Reanalysis of evoked EPSCs in stellate cells (Manis/Xie, 2014)
[10] Maximum AMPA open conductance per synaptic site (units are pS).
These values are calculated by running python cnmodel/synapses/tests/test_psd.py
for a specific cell type (if the cell uses the receptor mechanisms; this is
not necessary for simple exp2syn style mechanisms)
to ensure that maximum AMPA conductance during PSG matches [1, 2 or 3]
For a bushy cell, the original default values (bushy cell) were:
AMPAR_gmax 3.314707700918133
NMDAR_gmax 0.4531929783503451
These values will also depend on the number of release sites per
synapse (the total conductance is produce of site gmax and nsites).
A note on the precision of these values: This precision is only
required for the tests of the model, as a way of ensuring numerical
equivalency after potential modifications of the code. The precision
of the value is in no way intended to specificy biological precision.
For example, a change in the rate constants in the AMPA_Trussell AMPA
receptor model could (and probably would) change the open probability,
and therefore the maximal conductance of an EPSC. However, as this is
only a representation of the EPSC, the "receptor" conductance should
be scaled so that the computed EPSC has the same maximal conductance
as prior to the kinetic modifications. Because the receptor model is
numerically computed (and not analytically tractable without
additional knowledge of the ligand time course), a numerical solution
is required.
[11] Pr is the initial release probability. The value can be computed by
setting Pr to 1 in this file, and running the cnmodel test_synapses.py
with the appropriate presynaptic source and postsynaptic target,
once all other parameters are set. The Pr is used to rescale
the AMPAR_gmax so that the total current matches the data in
AMPA_gmax in the table (on average).
[12] NMDA_vshift is the voltage shift for the activation of the NMDAR's, relative
to 0 (standard in the NMDA_Kampa model). A negative value shifts the voltage
dependence to the right (depolarizing).
The value of the shift here (-15 mV) was chosen based on an exploration
of fitting functions against the NMDA-Kampa IV curve in an SGC-bushy cell
model, and comparing them against data. The functions were the modified
Woodhull function and a Boltzmann function, yielding values of 1.19 mM for
k0 and 0.78 for delta (tau decay at +40 mV of 16.4 ms), and Vr -3 mV, Vh
16 mV for the Boltzmann fit. These are close to the values reported in
for NMDA currents in p14-p26 CBA/CaJ mice in Pliss et al. (J. Neurophys.
102, 2627, 2009). Note: Pliss et al. agree with Cao and Oertel regarding
an approximate 10-fold difference between AMPA and NMDA conductance in
mouse bushy cells. An exact fit was not obtained, but no other parameters
of the NMDA_Kampa model were changed.
[13] weight is the weight to use in a netcon object (NEURON) for "simple"
synapses based on the exp2syn mechanism.
Parameters Weight, tau1, tau2, delay and erev from comare_simple_multisynapses
run and curve fitting (all cells)
""",
)
add_table_data(
"sgc_ampa_kinetics",
row_key="field",
col_key="post_type",
species="mouse",
data=u"""
AMPA receptor kinetic values obtained by fitting the model of Raman and
Trussell (1992) to measured EPSCs in the mouse VCN.
Ro1, Ro2, Rc1, Rc2, and PA are kinetic constants affecting the AMPA receptor
mechanism. tau_g and A affect the speed and amplitude of transmitter release
(implemented in the presynaptic release mechanism).
These parameters were selected to fit the model output to known EPSC shapes.
PA is a polyamine block parameter ued in the AMPAR mechanism (concentration in micromolar).
------------------------------------------------------------------------------------------------
bushy tstellate dstellate pyramidal octopus tuberculoventral mso
Ro1 107.85 [4] 39.25 [4] 39.25 [7] 39.25 [4] 107.85 [5] 39.25 [7] 107.85 [4]
Ro2 0.6193 [4] 4.40 [4] 4.40 [7] 4.40 [4] 0.6193 [5] 4.40 [7] 0.6193 [4]
Rc1 3.678 [4] 0.667 [4] 0.667 [7] 0.667 [4] 3.678 [5] 0.667 [7] 3.678 [4]
Rc2 0.3212 [4] 0.237 [4] 0.237 [7] 0.237 [4] 0.3212 [5] 0.237 [7] 0.3212 [4]
tau_g 0.10 [4] 0.25 [4] 0.25 [7] 0.25 [4] 0.10 [5] 0.25 [4] 0.10 [4]
amp_g 0.770 [4] 1.56625 [4] 1.56625 [7] 1.56625 [4] 0.770 [5] 1.56625 [4] 0.770 [4]
PA 45 [12] 0.1 [12] 0.1 [7] 0.1 [12] 45 [5] 0.1 [7] 45 [12]
------------------------------------------------------------------------------------------------
[4] Xie & Manis 2013, Table 2
[5] copied from bushy cells; no direct data.
[7] Data copied from t-stellate column (no literature on these cells). Unpublished data suggests these
should be slightly different, but is complicated by electrotonically distant synaptic sites that
preclude accurate measurement of kinetics.
[12] Wang & Manis (unpublished)
""",
)
add_table_data(
"sgc_epsp_kinetics",
row_key="field",
col_key="post_type",
species="mouse",
data=u"""
EPSC shape parameters obtained from fits of Xie & Manis 2013 Equation 3 to measured EPSCs.
------------------------------------------------------------------------------------------------
bushy tstellate dstellate pyramidal octopus tuberculoventral
tau_r 0.253 [11] 0.19 [11] 0.253 [13]
tau_f 0.16 [11] 1.073 [11] 0.16 [13]
tau_s 0.765 [11] 3.3082 [11] 0.765 [13]
F 0.984 [11] 0.917 [11] 0.984 [13]
------------------------------------------------------------------------------------------------
[11] Xie & Manis 2013, Table 3
[13] Copied from bushy cells; no direct data
""",
)
add_table_data(
"sgc_release_dynamics",
row_key="field",
col_key="post_type",
species="mouse",
data=u"""
Kinetic parameters correspond to variables as described by Dittman et al.
(2000), their Table 1.
F: ~ Resting release probability
---------------------------------------------------------------------------------------------------------------
bushy tstellate dstellate pyramidal octopus tuberculoventral
F 0.29366 [1] 0.43435 [1] 0.43435 [2] 0.43435 [1] 0.29366 [14] 0.43435 [1]
k0 0.52313 [1] 0.06717 [1] 0.06717 [2] 0.06717 [1] 0.52313 [14] 0.06717 [1]
kmax 19.33805 [1] 52.82713 [1] 52.82713 [2] 52.82713 [1] 19.33805 [14] 52.82713 [1]
kd 0.11283 [1] 0.08209 [1] 0.08209 [2] 0.08209 [1] 0.11283 [14] 0.08209 [1]
ks 11.531 [1] 14.24460 [1] 14.24460 [2] 14.24460 [1] 11.531 [14] 14.24460 [1]
kf 17.78 [1] 18.16292 [1] 18.16292 [2] 18.16292 [1] 17.78 [14] 18.16292 [1]
taud 15.16 [1] 3.98 [1] 3.98 [2] 3.98 [1] 15.16 [14] 3.98 [1]
taus 17912.2 [1] 16917.120 [1] 16917.120 [2] 16917.120 [1] 17912.2 [14] 16917.120 [1]
tauf 9.75 [1] 11.38 [1] 11.38 [2] 11.38 [1] 9.75 [14] 11.38 [1]
dD 0.57771 [1] 2.46535 [1] 2.46535 [2] 2.46535 [1] 0.57771 [14] 2.46535 [1]
dF 0.60364 [1] 1.44543 [1] 1.44543 [2] 1.44543 [1] 0.60364 [14] 1.44543 [1]
---------------------------------------------------------------------------------------------------------------
[1] Xie & Manis 2013, Table 1. Although independently measured in > P30 CBA/CaJ mice,
the values are similar to the measurements from Yang and Xu-Friedman, 2008
in P14-P21 CBA/CaJ mice.
[2] Data copied from t-stellate column (no literature on these cells)
[14] Data copied from bushy cell column (no literature on these cells)
""",
)
add_table_data(
"gly_kinetics",
row_key="field",
col_key="post_type",
species="mouse",
data=u"""
Kinetic parameters for glycine receptor mechanisms.
These are currently used for both DS and TV synapses, but should probably be
separated in the future.
KV, KU, and XMax are kinetic parameters for the cleft transmitter mechanism.
------------------------------------------------------------------------------------------------
bushy tstellate dstellate pyramidal tuberculoventral
KV 1e9 [1] 531.0 [1] 531.0 [1] 531.0 [2] 531.0 [2]
KU 4.46 [1] 4.17 [1] 4.17 [1] 4.17 [2] 4.17 [2]
XMax 0.733 [1] 0.731 [1] 0.731 [1] 0.731 [2] 0.731 [2]
------------------------------------------------------------------------------------------------
[1] Xie & Manis 2013
[2] Copied from tstellate data (Kuo et al., J. Neurophysiol. indicate glycinergic IPSCs in TV
and pyramidal cells are fast, with a decay time constant similar to that seen in tstellate
cells). In pyramidal cells, this is consistent with the brief cross-correlation tip (Voigt
and Young, 1980) and brief somatic current source (Manis and Brownell, 1983).
""",
)
add_table_data(
"dstellate_synapse",
row_key="field",
col_key="post_type",
species="mouse",
data=u"""
DStellate Synapse values
gly_gmax is the default value in the program (scaled by Po for the receptors). See synapses/gly_psd.py
IPSC_cv is the coefficient of variation of the IPSC. (Not currently used in the model)
Pr is the release probabilty (not currently used); built into release mechanism for multisite synapses.
n_rsites is the number of release sites per dstellate terminal.
---------------------------------------------------------------------------------------------------------------------------------------
bushy tstellate dstellate octopus pyramidal tuberculoventral cartwheel
gly_gmax 2.5 [1] 1.0 [5] 1.0 [2] 0. [2] 2.0 [3] 2.0 [3] 0±0 [2]
IPSC_cv 0.3 [3] 0.3 [3] 0.3 [3] 0.3 [3] 0.3 [3] 0.3 [3] 0.3 [3]
Pr 1.000 [4] 1.000 [4] 1.000 [4] 1.000 [4] 1.000 [4] 1.000 [4] 1.000 [4]
n_rsites 10 [5] 5 [5] 5 [5] 0 [2] 5 [5] 25 [5] 0 [2]
delay 0.000 0.000 0.000 0 0.000 0.000 0
weight 0.004131 0.004455 0.0 0 0.002228 0.012097 0
tau1 0.187 0.152 0.152 0 0.152 0.152 0
tau2 7.953 1.247 1.247 0 1.247 1.247 0
erev -70.0 -70.0 -70.0 0 -70.0 -70.0 0
---------------------------------------------------------------------------------------------------------------------------------------
[1] Estimate
[2] No evidence for dstellate inputs to other d stellate cells or cartwheel cells.
Octopus cells do not get inhibitory input
[3] Guess
[4] Default value
[5] Guess *educated* DS->TS from Xie and Manis, 2013. 99 pA mini @ 50 mV driving ~ 2 nS
[6] delay from pre to post; default is 0
[7] Parameters Weight, tau1, tau2, delay and erev from comare_simple_multisynapses run and curve fitting (all cells)
""",
)
add_table_data(
"tuberculoventral_synapse",
row_key="field",
col_key="post_type",
species="mouse",
data=u"""
Tuberculventral Synapse values
gly_gmax is the default value in the program (scaled by Po for the receptors). See synapses/gly_psd.py
IPSC_cv is the coefficient of variation of the IPSC. (Not currently used in the model)
Pr is the release probabilty (not currently used)
n_rsites is the number of release sites per tuberculoventral terminal.
-----------------------------------------------------------------------------------------------------------------------------------
bushy tstellate dstellate octopus pyramidal tuberculoventral cartwheel
gly_gmax 5.0 [3] 3.0 [3] 3.0 [3] 0. [2] 2.1±2.9 [6] 1.8±2.3 [6] 0±0 [6]
IPSC_cv 0.3 [3] 0.3 [3] 0.3 [3] 0.3 [3] 1.0 [3] 0.3 [3] 0.3 [3]
Pr 1.000 [4] 1.000 [4] 1.000 [4] 1.000 [4] 1.000 [4] 1.000 [4] 1.000 [4]
n_rsites 6 [5] 6 [5] 0 [1] 0 [2] 6 [5] 6 [5] 6 [5]
delay 0.600 0.600 0 0 0.600 0.600 0
weight 0.002371 0.008114 0 0 0.002705 0.002705 0
tau1 0.190 0.149 0 0 0.149 0.149 0
tau2 7.952 1.250 0 0 1.250 1.250 0
erev -70.0 -70.0 0 0 -70.0 -70.0 0
-----------------------------------------------------------------------------------------------------------------------------------
[1] Default value from GlyPSD
[2] No evidence for tuberculo inputs to other d stellate cells or cartwheel cells.
Octopus cells do not get inhibitory input
[3] Guess
[4] Default value
[5] Guess
[6] Mouse data
TV conductance onto pyr cells: 2.1 nS SD 2.9 nS (Kuo et al., 2012)
TV conductance onto TV cells: 1.8 ns SD 2.3 nS.
[7] Parameters Weight, tau1, tau2, delay and erev from comare_simple_multisynapses run and curve fitting (all cells)
Fitting done against 200 rep average for bushy, 500 rep average for all others.
""",
)
add_table_data(
"cartwheel_synapse",
row_key="field",
col_key="post_type",
species="mouse",
data=u"""
Cartwheel cell synapse values
gly_gmax is the default value in the program (scaled by Po for the receptors). See synapses/gly_psd.py
IPSC_cv is the coefficient of variation of the IPSC. (Not currently used in the model)
Pr is the release probabilty (not currently used)
n_rsites is the number of release sites per cartwheel cell terminal.
-----------------------------------------------------------------------------------------------------------------------------------
bushy tstellate dstellate octopus pyramidal tuberculoventral cartwheel
gly_gmax 0.0 [3] 0.0 [3] 0.0 [3] 0. [2] 2.1±2.9 [6] 0±0 [6] 1.8±2.3 [6]
IPSC_cv 0.3 [3] 0.3 [3] 0.3 [3] 0.3 [3] 1.0 [3] 0.3 [3] 0.3 [3]
Pr 1.000 [4] 1.000 [4] 1.000 [4] 1.000 [4] 1.000 [4] 1.000 [4] 1.000 [4]
n_rsites 6 [5] 6 [5] 0 [1] 0 [2] 6 [5] 6 [5] 6 [5]
delay 0 [7] 0 0 0 0 0 0
weight 0.01 0.01 0.01 0.0 0.01 0.01 0.01
tau1 0.3 [5] 0.3 [5] 0.3 [5] 0.3 [5] 0.3 [5] 0.3 [5] 0.3 [5]
tau2 2.0 [5] 2.0 [5] 2.0 [5] 2.0 [5] 2.0 [5] 2.0 [5] 2.0 [5]
erev -70 [5] -70 [5] -70 [5] -70 [5] -70 [5] -70 [5] -70 [5]
-----------------------------------------------------------------------------------------------------------------------------------
[1] Default value from GlyPSD
[2] No evidence for cartwheel inputs to Dstellate, bushy or tstellate cells.
Octopus cells do not get inhibitory input
[3] Guess
[4] Default value
[5] Guess
[6] Mouse data
TV conductance onto pyr cells: 2.1 nS SD 2.9 nS (Kuo et al., 2012)
TV conductance onto TV cells: 1.8 ns SD 2.3 nS.
[7] delay from pre to post; default is just 0
""",
)
add_table_data(
"bushy_synapse",
row_key="field",
col_key="post_type",
species="mouse",
data=u"""
AMPA_gmax and NMDA_gmax are the estimated average peak conductances (in nS)
resulting from an action potential in a single presynaptic terminal under
conditions that minimize the effects of short-term plasticity.
AMPA_gmax are from values measured at -65 mV (or -70mV), and represent SINGLE TERMINAL
conductances
AMPAR_gmax are the individual synapse postsynaptic conductance
NMDA_gmax values are taken as the fraction of the current that is NMDAR dependent
at +40 mV (see below)
n_rsites is the number of release sites per terminal.
-----------------------------------------------------------------------------------------------------------------------------------
mso
AMPA_gmax 21.05±15.4 [1]
AMPAR_gmax 4.6516398 [2]
NMDA_gmax 0 [3]
NMDAR_gmax 0 [3]
EPSC_cv 0.12 [4]
Pr 1.000 [5]
n_rsites 36 [6]
weight 0.01
delay 0
-----------------------------------------------------------------------------------------------------------------------------------
[1] Taken from the mouse bushy cell model.
Units are nS.
[2] See note [10] for the SGC-bushy synapse
[3] Assume no NMDA receptors at this synapse
[4] See SGC-bushy synapse
[5] Just to scale with the multisite synapse model
[6] This is a guess.
""",
)

72
cnmodel/data/tests/test_db.py

@ -0,0 +1,72 @@ @@ -0,0 +1,72 @@
# -*- encoding: utf-8 -*-
import pytest
import sys
from cnmodel import data
table = u"""
Description of data
It has multiple lines
And empty lines.
-------------------------------------------------------------------------------
col1 col2 col3
param1 15±6.5 [1] 2.2±1.5 [2] 0.87±0.23 [3]
param2 3 5 0.87±0.23 [3]
param3 3.4 7 [2]
param4 1 [12]
-------------------------------------------------------------------------------
[1] Source 1
[2] Multiline source
#2
end of #2
[3] Multiline source
#3
end of #3
[12] another
source
"""
data.add_table_data(
"test_data", row_key="param", col_key="col", data=table, extra="test_kwd"
)
def test_db():
# this should only be a problem with Python 2, so we need to
# check which version we are running under before letting the test
# throw the exception:
if sys.version_info[0] == 2:
with pytest.raises(TypeError):
# raise exception if unicode is given in ono-unicode string
data.add_table_data("test_data", row_key="param", col_key="col", data=u"±")
d = data.get("test_data", param="param1", col="col2", extra="test_kwd")
assert d == (2.2, 1.5)
d = data.get(
"test_data", param="param1", col=["col1", "col2", "col3"], extra="test_kwd"
)
assert d == {"col1": (15, 6.5), "col2": (2.2, 1.5), "col3": (0.87, 0.23)}
d = data.get(
"test_data", param="param2", col=["col1", "col2", "col3"], extra="test_kwd"
)
assert d == {"col1": 3, "col2": 5, "col3": (0.87, 0.23)}
d = data.get(
"test_data", param="param3", col=["col1", "col2", "col3"], extra="test_kwd"
)
assert d == {"col1": 3.4, "col2": None, "col3": 7}
s = data.get_source("test_data", param="param1", col="col2", extra="test_kwd")
assert "end of #2" in s
s = data.get_source("test_data", param="param2", col="col2", extra="test_kwd")
assert s is None

9
cnmodel/decorator/__init__.py

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
#!/usr/bin/python
#
# Channel decorator class for cnmodel
#
# Paul B. Manis, Ph.D. January 2016
#
from neuron import h
from .decorator import Decorator

392
cnmodel/decorator/decorator.py

@ -0,0 +1,392 @@ @@ -0,0 +1,392 @@
from __future__ import print_function
__author__ = "pbmanis"
"""
Decorator:
A class to insert biophysical mechanisms into a model.
This function attempts to automatically decorate a hoc-imported model set of sections
with appropriate conductances.
The class takes as input the object hf, which is an instance of morphology
It also takes the cellType, a string that directs how conductances should be inserted.
"""
import string
import numpy as np
import cnmodel.util as nu
from cnmodel.util import Params
class Decorator:
def __init__(self, cell, parMap=None, verify=False):
cellType = cell.type.lower()
self.channelInfo = Params(
newCm=1.0,
newRa=150.0, # standard value
newg_leak=0.000004935,
eK_def=-85,
eNa_def=50,
ca_init=70e-6, # free calcium in molar
v_init=-80, # mV
pharmManip={
"TTX": False,
"ZD": False,
"Cd": False,
"DTX": False,
"TEA": False,
"XE": False,
},
cellType=cell.status["cellClass"],
modelType=cell.status["modelType"],
modelName=cell.status["modelName"],
distanceMap=cell.hr.distanceMap,
parMap=parMap,
)
self.excludeMechs = [] # ['ihvcn', 'kht', 'klt', 'nav11']
print("modelType in dec: ", cell.status["modelType"])
print("modelName in dec is ", cell.status["modelName"])
print("cell type in dec: ", cellType)
cell.channel_manager(
modelName=cell.status["modelName"], modelType=cell.status["modelType"]
)
# print 'Cell: \n', dir(cell)
# print 'mechanisms: ', cell.hr.mechanisms
# gmapper allows us tor remap the names of mechanisms and their conductance names, which may
# vary in the mod files.
# The versions in the mechanisms directory here have been systematized, but this
# dictionary may help when adding other conductances.
self.gbar_mapper = {
"nacn": "gbar",
"kht": "gbar",
"klt": "gbar",
"leak": "gbar",
"ihvcn": "gbar",
"jsrna": "gbar",
"nav11": "gbar",
"nacncoop": "gbar",
"hcnobo": "gbar",
}
self.erev_mapper = {
"nacn": "ena",
"kht": "ek",
"klt": "ek",
"leak": "erev",
"ihvcn": "eh",
"jsrna": "ena",
"nav11": "ena",
"nacncoop": "ena",
"hcnobo": "eh",
}
self.vshift_mapper = {
"nacn": None,
"kht": None,
"klt": None,
"leak": None,
"ihvcn": None,
"jsrna": None,
"nav11": "vsna",
"nacncoop": "vsna",
"hcnobo": None,
}
self._biophys(cell, verify=verify)
print(
"\033[1;31;40m Decorator: Model Decorated with channels (if this appears more than once per cell, there is a problem)\033[0m"
)
def _biophys(self, cell, verify=False):
"""
Inputs: run parameter structure, model parameter structure
verify = True to run through the inserted mechanisms and see that they are really there.
Outputs: None
Action: Channel insertion into model
Side Effects:
Sets conductances in every different kind of section
Does not update any class variables (via self).
original hoc code: Paul B. Manis, Ph.D.
25 Sept. 2007
Modified to use gca for HH formulation of calcium current
14 Oct 2007
converted for Python, 17 Oct 2012 (PB Manis)
modified to use new hf hoc_reader class to access section types and mechanisms 10-14 Feb 2014 pbmanis
"""
# check to see if we already did this
# createFlag = False
cellType = self.channelInfo.cellType
parMap = self.channelInfo.parMap
dmap = self.channelInfo.distanceMap
if self.channelInfo is None:
raise Exception("biophys - no parameters or info passed!")
if verify:
print(
"Biophys: Inserting channels as if cell type is {:s} with modelType {:s}".format(
cellType, self.channelInfo.modelType
)
)
cell.hr.mechanisms = []
for s in list(cell.hr.sec_groups.keys()):
sectype = self.remapSectionType(s.rsplit("[")[0])
if sectype not in cell.channelMap.keys():
print(
"encountered unknown section group type: %s Not decorating"
% sectype
)
print("channels in map: ", cell.channelMap.keys())
continue
# print 'Biophys: Section type: ', sectype, 'from: ', s
# print sectype
# print 'channel mapping keys: ', cell.channelMap[sectype].keys()
# here we go through all themechanisms in the ionchannels table for this cell and compartment type
# note that a mechanism may have multiple parameters in the table (gbar, vshft), so we:
# a. only insert the mechanism once
# b. only adjust the relevant parameter
for mechname in list(cell.channelMap[sectype].keys()):
mech = mechname.split("_")[0] # get the part before the _
parameter = mechname.split("_")[1] # and the part after
if mech not in self.gbar_mapper.keys():
print("Mechanism %s not found? " % mech)
continue
if mech in self.excludeMechs:
continue
if verify:
print(
"Biophys: section group: {:s} insert mechanism: {:s} at {:.8f}".format(
s, mech, cell.channelMap[sectype][mech]
)
)
if mech not in cell.hr.mechanisms:
cell.hr.mechanisms.append(
mech
) # just add the mechanism to our list
x = nu.Mechanism(mech)
if cell.hr.sec_groups[s] == set():
continue # no sections of this type
for sec in cell.hr.sec_groups[
s
]: # insert into all the sections of this type (group)
try:
x.insert_into(cell.hr.get_section(sec))
except:
raise ValueError(
"Failed with mech: %s " % mech
) # fail if cannot insert.
if verify:
print(" inserted %s into section " % mech, sec)
gbar_setup = None
gbar = 0.0
if parameter == "gbar":
gbar = self.gbarAdjust(
cell, sectype, mechname, sec
) # map density by location/distance
gbar_setup = "%s_%s" % (
self.gbar_mapper[mech],
mech,
) # map name into .mod file name
# if parMap is not None and mech in parMap.keys(): # note, this allows parmap to have elements BESIDES mechanisms
# if verify:
# print 'parMap[mech]', mech, parMap[mech], gbar,
# gbar = gbar * parMap[mech] # change gbar here...
# if verify:
print("####### new gbar: ", gbar)
vshift_setup = None
vshift = 0.0
# print 'Parameter: ', parameter, mech, self.vshift_mapper[mech]
if parameter == "vshift" and self.vshift_mapper[mech] is not None:
vshift_setup = "%s_%s" % (
self.vshift_mapper[mech],
mech,
) # map voltage shift
vshift = cell.channelMap[sectype][mechname]
print(
"********* mech: gbar, vshift: ", gbar, vshift, vshift_setup
)
exit()
cell.hr.h.Ra = self.channelInfo.newRa
for sec in cell.hr.sec_groups[
s
]: # now set conductances and other parameters as requested
cell.hr.get_section(sec).Ra = self.channelInfo.newRa # set Ra here
if gbar_setup is not None:
setattr(
cell.hr.get_section(sec), gbar_setup, gbar
) # set conductance magnitude
# print('gbar_setup: %s %s' % (sectype, gbar_setup), gbar)
if vshift_setup is not None:
try:
setattr(
cell.hr.get_section(sec), vshift_setup, vshift
) # set conductance magnitude
except:
print(dir(cell.hr.get_section(sec)))
raise ValueError(
" cannot set mechanism attribute %s ... %s "
% (vshift_setup, vshift)
)
# print('vshift_setup: %s %s' % (sectype, vshift_setup), vshift)
if hasattr(
cell, "channelErevMap"
): # may not always have this mapping
secobj = cell.hr.get_section(
sec
) # get the NEURON section object
mechsinsec = cell.get_mechs(
secobj
) # get list of mechanisms in this section
if (
mech in mechsinsec
): # confirm that the mechanism is really there
setrev = (
False
) # We try two ways for different mechanisms - just flag it
try:
setattr(
secobj,
self.erev_mapper[mech],
cell.channelErevMap[sectype][mech],
)
setrev = True
continue # don't bother with second approach
except:
raise ValueError("erev set failed")
pass # no error
try:
setattr(
secobj(),
self.erev_mapper[mech] + "_" + mech,
cell.channelErevMap[sectype][mech],
)
setrev = True
except:
raise ValueError("Erev2 set failed")
pass # no error report
if (
not setrev
): # here is our error report - soft, not crash.
print(
"Failed to set reversal potential in section %s for mechanism %s"
% (sec, mech)
)
# if mech in mechinsec and mech in self.vshift_mapper.keys():
# try:
# setattr(secobj, self.vshift_mapper[mech], cell.channelVshiftMap[sectype][mech])
# except:
# raise ValueError('Failed to set vshift for mech: %s sectpe: %s' % (mech, sectype[mech]))
if verify:
self.channelValidate(cell)
return cell
def gbarAdjust(self, cell, sectype, mech, sec):
gbar = cell.channelMap[sectype][mech]
gbar_orig = gbar
if sectype not in cell.distMap.keys(): # no map for this section type
return gbar
elif mech not in cell.distMap[sectype].keys():
return gbar
# mecanism exists in the distMap, so we will map gbar to distance from soma
method = cell.distMap[sectype][mech]["gradient"] # grab the type
gminf = cell.distMap[sectype][mech]["gminf"]
rate = cell.distMap[sectype][mech]["lambda"]
# print('sectype: %s mech: %s method: %s rate: %s' % (sectype, mech, method, rate))
if method == "flat":
return gbar
if sec in self.channelInfo.distanceMap.keys():
dist = self.channelInfo.distanceMap[sec]
else: # the sec should be in the map, but there could be a coding error that would break that relationship
raise NameError(
"gbarAdjust in channel_decorate.py: section %s not in distance map"
% sec
)
if method == "linear": # rate is "half" point drop
# print('doing linear, orig gbar: ', gbar)
gbar = gbar - dist * (gbar - gminf) / rate
if gbar < 0.0:
gbar = 0.0 # clip
# print('sec dist: %f final gbar: %f' % (dist, gbar))
elif method in ["exp", "expdown"]:
gbar = (gbar - gminf) * np.exp(-dist / rate) + gminf
if gbar < 0.0:
gbar = 0.0
# print 'gbaradjust: orig/adj: ', gbar_orig, gbar, method, dist, sectype
return gbar
def channelValidate(self, cell, verify=False):
"""
verify mechanisms insertions -
go through all the groups, and find inserted conductances and their values
print the results to the terminal
"""
print("\nChannel Validation")
print(" Looking for sec_groups: ", sorted(cell.hr.sec_groups.keys()))
print(" Available Channel Maps: ", sorted(cell.channelMap.keys()))
secstuff = {}
for s in list(cell.hr.sec_groups.keys()):
sectype = self.remapSectionType(s.rsplit("[")[0])
if sectype not in cell.channelMap.keys():
if sectype in ["undefined"]: # skip undefined sections
continue
print(
"\033[1;31;40m Validation: encountered unknown section group type: %s Cannot Validate"
% sectype
)
print("Cell morphology file: %s \033[0m" % cell.morphology_file)
continue
# print 'Validating Section: %s' % s
for mech in list(cell.channelMap[sectype].keys()):
if mech not in self.gbar_mapper.keys():
continue
if mech in self.excludeMechs:
continue
if verify:
print(
"\tSection: %-15ss found mechanism: %-8ss at %.5f"
% (s, mech, cell.channelMap[sectype][mech])
)
x = nu.Mechanism(
mech
) # , {gmapper[mech]: self.channelMap[cellType][sectype][mech]})
setup = "%s_%s" % (self.gbar_mapper[mech], mech)
for sec in cell.hr.sec_groups[s]:
bar = getattr(cell.hr.get_section(sec), setup)
# print 'mech', mech
# print 'bar: ', bar
try:
Erev = getattr(cell.hr.get_section(sec), self.erev_mapper[mech])
except:
Erev = -999.0
# print 'erev: ', Erev
if sec in secstuff.keys():
secstuff[sec] += ", g_%s = %g [%.1f]" % (mech, bar, Erev)
else:
secstuff[sec] = "(%10s) g_%-6s = %g [%.1f] " % (
sectype,
mech,
bar,
Erev,
)
if verify:
for i, k in enumerate(secstuff.keys()):
print("**%-20s " % k, secstuff[k])
def remapSectionType(self, sectype):
if sectype in ["AXON_0"]:
sectype = "axon"
if sectype in ["initseg", "initialsegment"]:
sectype = "initialsegment"
if sectype in ["dendscaled_0", "dendscaled_1", "dendscaled_2", "dendrite"]:
sectype = "dendrite"
if sectype in ["apical_dendrite"]:
sectype = "secondarydendrite"
return sectype

109
cnmodel/mechanisms/CaPCalyx.mod

@ -0,0 +1,109 @@ @@ -0,0 +1,109 @@
TITLE CaPCalyx.mod The presynaptic calcium current at the MNTB calyx of Held
COMMENT
NEURON implementation of Calcium current from Borst and Sakmann, 1998.
Equations are basic HH; parameters are taken from Figure 8 legend in that paper.
Original implementation by Paul B. Manis, October 2007
Contact: pmanis@med.unc.edu
Modified 2/2014: Use Derivative block format.
ENDCOMMENT
UNITS {
(mA) = (milliamp)
(mV) = (millivolt)
(nA) = (nanoamp)
}
NEURON {
THREADSAFE
SUFFIX CaPCalyx
USEION ca READ eca WRITE ica
RANGE gbar, gcap, ica
GLOBAL minf, taum, alpha, beta
}
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
PARAMETER {
v (mV)
: celsius = 22 (degC) : model is defined on measurements made at 23-24 deg in Germany
celsius (degC)
dt (ms)
: eca = 43.9 (mV)
eca (mV)
gbar = 0.01 (mho/cm2) <0,1e9> : target is 48.9 nS total
alpha (1/ms)
beta (1/ms)
}
STATE {
m
}
ASSIGNED {
ica (mA/cm2)
gcap (mho/cm2)
minf (1)
taum (ms)
}
LOCAL mexp
BREAKPOINT {
SOLVE states METHOD cnexp
gcap = gbar*m*m
ica = gcap*(v - eca)
}
UNITSOFF
INITIAL {
trates(v)
m = minf
}
DERIVATIVE states { : Computes state variables m
rates(v) : at the current v and dt.
m' = (minf - m)/taum
:m = m + mexp*(minf-m)
:VERBATIM
: return 0;
:ENDVERBATIM
}
LOCAL q10
PROCEDURE rates(v) { :Computes rate and other constants at current v.
:Call once from HOC to initialize inf at resting v.
q10 = 3^((celsius - 24)/10) : if you don't like room temp, it can be changed!
minf = (1 / (1 + exp(-(v + 23.2) / 9.1)))
alpha = 1.78*exp(v/23.3)
beta = 0.140*exp(-v/15.0)
taum = 1/(alpha + beta)
}
PROCEDURE trates(v) { :Computes rate and other constants at current v.
:Call once from HOC to initialize inf at resting v.
LOCAL minc
TABLE minf, mexp
DEPEND dt, celsius FROM -150 TO 150 WITH 300
rates(v) : not consistently executed from here if usetable_hh == 1
: so don't expect the tau values to be tracking along with
: the inf values in hoc
minc = -dt * q10
mexp = 1 - exp(minc/taum)
}
UNITSON

134
cnmodel/mechanisms/Gly5GC.mod

@ -0,0 +1,134 @@ @@ -0,0 +1,134 @@
TITLE detailed model of Glycine receptors
COMMENT
-----------------------------------------------------------------------------
Kinetic model of Glycine-A receptors
====================================
C -- C1 -- C2 -- O1
| |
D1 -- D2 -- D3
-----------------------------------------------------------------------------
This Model is based on:
Gentet LJ, Clements JD Binding site stoichiometry and the effects of
phosphorylation on human alpha1 homomeric glycine receptors J Physiol (Lond)
2002 vol. 544 (Pt 1) pp. 97-106, Figure 7.
Written by Paul Manis, UNC Chapel Hill, 2009
Kinetic values are estimated from VCN glycine receptors.
This model has desensitization states.
-----------------------------------------------------------------------------
This mod file does not include mechanisms for the release and time course
of transmitter; it is to be used in conjunction with a sepearate mechanism
to describe the release of transmitter and that provides the concentration
of transmitter in the synaptic cleft (to be connected to pointer C here).
-----------------------------------------------------------------------------
ENDCOMMENT
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
NEURON {
POINT_PROCESS GLYaGC
POINTER XMTR
RANGE C0, C1, C2, D1, D2, D3, O1, Open
RANGE g, gmax, f1, f2
RANGE Erev
RANGE k1, km1, a1, b1, d1, r1, d2, r2, d3, r3, rd, dd
NONSPECIFIC_CURRENT i
}
UNITS {
(nA) = (nanoamp)
(mV) = (millivolt)
(pS) = (picosiemens)
(umho) = (micromho)
(mM) = (milli/liter)
(uM) = (micro/liter)
}
PARAMETER {
Erev = -70 (mV) : reversal potential
gmax = 500 (pS) : maximal conductance
: Rates
: bushy cell
k1 = 12.81 (/uM /ms) : binding
km1 = 0.0087 (/ms) : unbinding
a1 = 0.0194 (/ms) : opening
b1 = 1.138 (/ms) : closing
r1 = 5.19 (/ms) : desense 1
d1 = 0.000462 (/ms) : return from d1
r2 = 0.731 (/ms) : return from deep state
d2 = 1.641 (/ms) : going to deep state
r3 = 3.817 (/ms) : return from deep state
d3 = 1.806 (/ms) : going to deep state
rd = 1.0 (/ms)
dd = 1.0 (/ms)
}
ASSIGNED {
v (mV) : postsynaptic voltage
i (nA) : current = g*(v - Erev)
g (pS) : conductance
XMTR (mM) : pointer to glycine concentration
f1 (/ms) : binding
f2 (/ms) : binding
Open (1)
}
STATE {
: Channel states (all fractions)
C0 : unbound
C1 : single bound
C2 : double bound
D1 : desense, bound
O1 : open
D2 : Desense
D3 : Desense
}
INITIAL {
XMTR = 0
C0 = 1
C1 = 0
C2 = 0
O1 = 0
D1 = 0
D2 = 0
D3 = 0
}
BREAKPOINT {
SOLVE kstates METHOD sparse
Open = (O1)
g = gmax * Open
i = (1e-6) * g * (v - Erev)
}
KINETIC kstates {
f1 = k1 * (1e3) * XMTR
f2 = k1 * (1e3) * XMTR
~ C0 <-> C1 (f1,km1)
~ C1 <-> C2 (f2,12.5*km1)
~ C2 <-> O1 (a1,b1)
~ C1 <-> D1 (r1, d1)
~ C2 <-> D2 (r2, d2)
~ D1 <-> D2 (rd, dd)
~ D2 <-> D3 (r3, d3)
CONSERVE C0+C1+C2+D1+D2+D3+O1 = 1
}

149
cnmodel/mechanisms/Gly5PL.mod

@ -0,0 +1,149 @@ @@ -0,0 +1,149 @@
TITLE detailed model of Glycine receptors
COMMENT
-----------------------------------------------------------------------------
Kinetic model of Glycine-A receptors: Pascal Legendre (Mauthner Cell)
====================================
C0--C1--C2--O1
|
C3--O2
-----------------------------------------------------------------------------
This mod file does not include mechanisms for the release and time course
of transmitter; it is to be used in conjunction with a sepearate mechanism
to describe the release of transmitter and that provides the concentration
of transmitter in the synaptic cleft (to be connected to pointer C here).
-----------------------------------------------------------------------------
Modified Paul Manis, UNC Chapel Hill, 2009
Name, pointer name, kinetics are range variables, and kinetic values
are estimated from VCN glycine receptors.
Note: This model does not have a desensitization state.
-----------------------------------------------------------------------------
ENDCOMMENT
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
NEURON {
POINT_PROCESS GLYaPL
POINTER XMTR
RANGE C0, C1, C2, C3, O1, O2, Open
RANGE g, gmax, f1, f2
RANGE Erev
RANGE kon, koff, a1, b1, a2, b2, r, d
RANGE CellType : 0 for bushy, 1 for stellate
NONSPECIFIC_CURRENT i
}
UNITS {
(nA) = (nanoamp)
(mV) = (millivolt)
(pS) = (picosiemens)
(umho) = (micromho)
(mM) = (milli/liter)
(uM) = (micro/liter)
}
PARAMETER {
Erev = -70 (mV) : reversal potential
gmax = 500 (pS) : maximal conductance
CellType = 1 (1) : define cell type parameters
: Rates
: Stellate cell fit (1/1/10; excellent fit)
: kon = 0.0236 (/uM /ms) : binding
: koff = 2.4 (/ms) : unbinding
: a1 = 1.707 (/ms) : opening
: b1 = 8.95 (/ms) : closing
: a2 = 0.325 (/ms) : opening
: b2 = 5.871 (/ms) : closing
: r = 2.019 (/ms) : return from deep state
: d = 28.87 (/ms) : going to deep state
:if psdtype == 'glyfast': fit from 3/5/2010. error = 0.174 maxopen = 0.0385
: See synapses.py
a1 = 1.000476 (/ms) : opening
a2 = 0.137903 (/ms) : opening
b1 = 1.700306 (/ms) : closing
koff = 13.143132 (/ms) : unbinding
kon = 0.038634 (/ms) : binding
r = 0.842504 (/ms) : return from deep state
b2 = 8.051435 (/ms) : closing
d = 12.821820 (/ms) : going to deep state
}
ASSIGNED {
v (mV) : postsynaptic voltage
i (nA) : current = g*(v - Erev)
g (pS) : conductance
XMTR (mM) : pointer to glycine concentration
f1 (/ms) : binding
f2 (/ms) : binding
koff2 (/ms)
Open (1)
}
STATE {
: Channel states (all fractions)
C0 : unbound
C1 : single bound
C2 : double bound
C3 : bound but closed state to O2
O1 : open
O2 : open
}
INITIAL {
XMTR = 0.0
C0 = 1
C1 = 0
C2 = 0
C3 = 0
O1 = 0
O2 = 0
}
BREAKPOINT {
SOLVE kstates METHOD sparse
:VERBATIM
: if (CGly > 0.0) {
: fprintf(stderr, "t = %f Xmtr = %f\n", t, XMTR);
: }
: ENDVERBATIM
Open = (O1 + O2)
g = gmax * Open
i = (1e-6) * g * (v - Erev)
}
KINETIC kstates {
f1 = 2.0 * kon * (1e3) * XMTR
f2 = kon * (1e3) * XMTR
koff2 = 2.0 * koff
~ C0 <-> C1 (f1,koff)
~ C1 <-> C2 (f2,koff2)
~ C2 <-> O1 (a1,b1)
~ C2 <-> C3 (d, r)
~ C3 <-> O2 (a2,b2)
CONSERVE C0+C1+C2+C3+O1+O2 = 1
}

147
cnmodel/mechanisms/Gly5State.mod

@ -0,0 +1,147 @@ @@ -0,0 +1,147 @@
TITLE detailed model of Glycine receptors
COMMENT
-----------------------------------------------------------------------------
Kinetic model of Glycine-A receptors
====================================
C -- C1 -- C2
| |
O1 O2
-----------------------------------------------------------------------------
This mod file does not include mechanisms for the release and time course
of transmitter; it is to be used in conjunction with a sepearate mechanism
to describe the release of transmitter and that provides the concentration
of transmitter in the synaptic cleft (to be connected to pointer C here).
-----------------------------------------------------------------------------
Based on models
Destexhe, A., Mainen, Z.F. and Sejnowski, T.J. Kinetic models of
synaptic transmission. In: Methods in Neuronal Modeling (2nd edition;
edited by Koch, C. and Segev, I.), MIT press, Cambridge, 1998, pp. 1-25.
(electronic copy available at http://cns.iaf.cnrs-gif.fr)
Written by Alain Destexhe, Laval University, 1995
-----------------------------------------------------------------------------
Modified Paul Manis, UNC Chapel Hill, 2009
Changed name, pointer name, kinetics are range variables, and kinetic values
are estimated from VCN glycine receptors.
This model does not have a desensitization state.
-----------------------------------------------------------------------------
ENDCOMMENT
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
NEURON {
POINT_PROCESS GLYa5
POINTER XMTR
RANGE C0, C1, C2, O1, O2, Open
RANGE g, gmax, f1, f2
RANGE Erev
RANGE kf1, kf2, kb1, kb2, a1, b1, a2, b2
NONSPECIFIC_CURRENT i
}
UNITS {
(nA) = (nanoamp)
(mV) = (millivolt)
(pS) = (picosiemens)
(umho) = (micromho)
(mM) = (milli/liter)
(uM) = (micro/liter)
}
PARAMETER {
Erev = -70 (mV) : reversal potential
gmax = 500 (pS) : maximal conductance
: Rates
: from fits to averaged ipsc data, stellate cells 1/1/10
: kf1 = 0.002930 (/uM /ms) : binding
: kf2 = 0.005936 (/uM /ms) : binding
: kb1 = 2.793 (/ms) : unbinding
: kb2 = 1.445 (/ms) : unbinding
: a1 = 1e-6 (/ms) : opening
: b1 = 129.0 (/ms) : closing
: a2 = 5.10 (/ms) : opening
: b2 = 2.79 (/ms) : closing
: from fits to averaged ipsc data, bushy cells 1/1/10
kf1 = 0.0278 (/uM /ms) : binding
kf2 = 1e-6 (/uM /ms) : binding
kb1 = 0.000054 (/ms) : unbinding
kb2 = 0.000855 (/ms) : unbinding
a1 = 1e-6 (/ms) : opening
b1 = 129.0 (/ms) : closing
a2 = 5.10 (/ms) : opening
b2 = 2.79 (/ms) : closing
}
ASSIGNED {
v (mV) : postsynaptic voltage
i (nA) : current = g*(v - Erev)
g (pS) : conductance
XMTR (mM) : pointer to glycine concentration
f1 (/ms) : binding
f2 (/ms) : binding
Open (1)
}
STATE {
: Channel states (all fractions)
C0 : unbound
C1 : single bound
C2 : double bound
O1 : open
O2 : open
}
INITIAL {
C0 = 1
C1 = 0
C2 = 0
O1 = 0
O2 = 0
XMTR = 0.0
}
BREAKPOINT {
SOLVE kstates METHOD sparse
Open = (O1 + O2)
g = gmax * Open
i = (1e-6) * g * (v - Erev)
}
KINETIC kstates {
f1 = kf1 * (1e3) * XMTR
f2 = kf2 * (1e3) * XMTR
~ C0 <-> C1 (f1,kb1)
~ C1 <-> C2 (f2,kb2)
~ C1 <-> O1 (a1,b1)
~ C2 <-> O2 (a2,b2)
CONSERVE C0+C1+C2+O1+O2 = 1
}

131
cnmodel/mechanisms/Gly6S.mod

@ -0,0 +1,131 @@ @@ -0,0 +1,131 @@
TITLE Model of glycine receptors
COMMENT
-----------------------------------------------------------------------------
Kinetic model of glycine receptors
===============================
6-state gating model with
2 open states provide dual exponential response.
O1
|
C0 -- C1 -- C2 -- O2
|
D1
-----------------------------------------------------------------------------
This mod file does not include mechanisms for the release and time course
of transmitter; it is to be used in conjunction with a sepearate mechanism
to describe the release of transmitter and that provides the concentration
of transmitter in the synaptic cleft (to be connected to pointer C here).
Default parameters are set for a miniature EPSC.
-----------------------------------------------------------------------------
Paul B. Manis, Ph.D. 28 Dec 2009
-----------------------------------------------------------------------------
ENDCOMMENT
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
NEURON {
POINT_PROCESS Gly6S
POINTER XMTR
RANGE C0, C1, C2, D1, O1, O2, Open
RANGE Erev
RANGE Rb, Ru1, Ru2, Rd, Rr, Ro1, Rc1, Ro2, Rc2
RANGE g, rb, gmax
RANGE CellType : 0 is bushy, 1 is stellate
NONSPECIFIC_CURRENT i
}
UNITS {
(nA) = (nanoamp)
(mV) = (millivolt)
(pS) = (picosiemens)
(umho) = (micromho)
(mM) = (milli/liter)
(uM) = (micro/liter)
}
PARAMETER {
Erev = -70 (mV) : reversal potential
gmax = 500 (pS) : maximal conductance
CellType = 0 (1) : Cell type definition.
: Rates
: Bushy cell IPSCs: (rates can be changed externally)
: Set per Fits 8 March 2010 (see Synapses.py as well)
Rd = 1.177999 (/ms) : desensitization
Rr = 0.000005 (/ms) : resensitization
Rb = 0.009403 (/mM /ms): binding
: diffusion limited
Ru2 = 0.000086 (/ms) : unbinding (2nd site)
Ro1 = 0.187858 (/ms) : opening (fast)
Ro2 = 1.064426 (/ms) : opening (slow)
Ru1 = 0.028696 (/ms) : unbinding (1st site)
Rc1 = 0.103625 (/ms) : closing
Rc2 = 1.730578 (/ms) : closing
}
ASSIGNED {
v (mV) : postsynaptic voltage
i (nA) : current = g*(v - Erev)
g (pS) : conductance
XMTR (mM) : pointer to glutamate concentration
rbind (/ms) : binding
Open (1)
}
STATE {
: Channel states (all fractions)
C0 : unbound
C1 : single gly bound
C2 : double gly bound
D1 : double gly bound, desensitized
O1 : double gly bound, open state 1
O2 : double gly bound, open state 2
}
INITIAL {
XMTR = 0
C0 = 1
C1 = 0
C2 = 0
D1 = 0
O1 = 0
O2 = 0
}
BREAKPOINT {
SOLVE kstates METHOD sparse
:VERBATIM
: if (XMTR > 0.1) {
: fprintf(stderr, "t = %f XMTR = %f\n", t, XMTR);
: }
: ENDVERBATIM
Open = (O1 + O2)
g = gmax * Open
i = (1e-6)*g*(v-Erev)
}
KINETIC kstates {
rbind = Rb * (1e3) * XMTR
~ C0 <-> C1 (rbind,Ru1)
~ C1 <-> C2 (rbind*2.0,Ru2)
~ C2 <-> O1 (Ro1,Rc1)
~ C2 <-> D1 (Rd,Rr)
~ C2 <-> O2 (Ro2,Rc2)
CONSERVE C0+C1+C2+D1+O1+O2 = 1
}

64
cnmodel/mechanisms/Iclamp2.mod

@ -0,0 +1,64 @@ @@ -0,0 +1,64 @@
COMMENT
Iclamp2.mod: Electrode current injection, revised for our own use
I specifically needed more step changes in a single waveform than
were provided by the default code. This routine gives us 5 levels:
holding, 3 steps, and a final (holding?) level.
This version generates a pulse of duration at amplitude I for
onset times in the vector onset[STEP] and durations in dur[STEP]
Each pulse is independent and pulses _could_ overlap.
Since this is an electrode current, positive values of I depolarize the cell
and in the presence of the extracellular mechanism there will be a change
in vext since I is not a transmembrane current but a current injected
directly to the inside of the cell.
(modified and borrowed extensively from other Neuron code,
2001-2002. Paul B. Manis)
ENDCOMMENT
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
DEFINE NSTEP 5 : maximum number of steps supported in this mechanism
NEURON {
POINT_PROCESS IClamp2
RANGE onset, dur, amp, i
ELECTRODE_CURRENT i
}
UNITS {
(nA) = (nanoamp)
}
PARAMETER {
}
ASSIGNED {
i (nA)
index
onset[NSTEP] (ms)
dur[NSTEP] (ms)
amp[NSTEP] (nA)
pu
}
INITIAL {
i = 0 (nA)
index = 0
pu = 0
}
:
: at each onset time, a pulse of duration dur is generated.
:
BREAKPOINT {
i = 0
FROM index = 0 TO NSTEP-1 {
if(t > onset[index]) {
if(t < (dur[index]+onset[index])) {
i = i + amp[index] : allows overlap
} : end of if condition
} :end of second if condition
} : end of "FROM" (for) loop
} : end of breakpoint

142
cnmodel/mechanisms/NMDA.mod

@ -0,0 +1,142 @@ @@ -0,0 +1,142 @@
TITLE NMDA receptor--one of the two input stimulation of our model
: This mechanism is taken from the Neuron data base "exp2syn.mod"
: The original comment are below between "COMMENT" and "ENDCOMMENT".
:
: Our modifications:
:
: 1.We added a single receptor conductance factor: "g_max=0.000045 (uS)".
: An event of weight 1 generates a peak conductance of 1*g_max.
: The weight is equal to the number of ampa receptors open at peak conductance
:
: 2.The NMDA receptors are simulated using a slow rise time constant
: and a double-expontial decay time constant
: The kinetic rate constants and channel conductance are taken from Franks KM, Bartol TM and Sejnowski TJ
: A Monte Carlo model reveals independent signaling at central glutamatergic synapses
: J Biophys (2002) 83(5):2333-48
: and Spruston N, Jonas P and Sakmann B
: Dendritic glutamate receptor channels in rat hippocampal CA3 and CA1 neurons
: J Physiol (1995) 482(2): 325-352
: correctd for physiological tempterature with Q10 from Hestrin S, Sah P and Nicoll RA
: Mechanisms generating the time course of dual component excitatory synaptic currents
: recorded in hippocampal slices
: Neuron (1990) 5: 247-253
:
: Written by Lei Tian on 04/12/06
COMMENT
Two state kinetic scheme synapse described by rise time tau1,
and decay time constant tau2. The normalized peak condunductance is 1.
Decay time MUST be greater than rise time.
The solution of A->G->bath with rate constants 1/tau1 and 1/tau2 is
A = a*exp(-t/tau1) and
G = a*tau2/(tau2-tau1)*(-exp(-t/tau1) + exp(-t/tau2))
where tau1 < tau2
If tau2-tau1 -> 0 then we have a alphasynapse.
and if tau1 -> 0 then we have just single exponential decay.
The factor is evaluated in the
initial block such that an event of weight 1 generates a
peak conductance of 1.
Because the solution is a sum of exponentials, the
coupled equations can be solved as a pair of independent equations
by the more efficient cnexp method.
ENDCOMMENT
NEURON {
THREADSAFE
POINT_PROCESS nmda
RANGE tau1, tau2, tau3, e, i, g_max, g, A, B, C ,k
NONSPECIFIC_CURRENT i
GLOBAL total,i2,g2
: EXTERNAL Area_canmda
}
UNITS {
(nA) = (nanoamp)
(mA) = (milliamp)
(mV) = (millivolt)
(uS) = (microsiemens)
}
PARAMETER {
tau1 = 3.18 (ms) <1e-9,1e9> :rise time constant
tau2 = 57.14 (ms) <1e-9,1e9> :decay time constant
tau3 = 2000 (ms) <1e-9,1e9> :decay time constant
g_max= 0.000045 (uS) : single channel conductance
e = 0 (mV)
mg = 1 (mM)
Area (cm2)
k = 1e-06 (mA/nA)
Area_canmda = 1
}
ASSIGNED {
v (mV)
i (nA)
factor
total (uS)
g (uS)
g2 (uS) : plot 'g' and 'i' in "nmda.mod".
i2 (mA/cm2) : global variables read in "canmda.mod" as 'inmda' and 'gnmda' to give us
}
STATE {
A (uS)
B (uS)
C (uS)
}
INITIAL {
LOCAL t_peak
total = 0
if (tau1/tau2 > .9999) {
tau1 = .9999*tau2
}
A = 0
B = 0
C = 0
factor=0.8279 :from matlab to make the peak of the conductance curve shape to be 1*weight (then multiply with g_max)
factor = 1/factor
Area = Area_canmda
}
BREAKPOINT {
SOLVE state METHOD cnexp
g = g_max*(B*0.8+C*0.2-A)
i = g*(v - e)*1/(1+(exp(0.08(/mV) * -v)*(mg / 0.69)))
g2=g :global variable can be read in 'canmda.mod'
i2=i*k/Area :to get a current in 'mA/cm2' and send it to 'canmda.mod'
}
DERIVATIVE state {
A' = -A/tau1
B' = -B/tau2
C' = -C/tau3
}
NET_RECEIVE(weight (uS)) {
state_discontinuity(A, weight*factor)
state_discontinuity(B, weight*factor)
state_discontinuity(C, weight*factor)
total = total+weight
}

212
cnmodel/mechanisms/NMDA_Kampa.mod

@ -0,0 +1,212 @@ @@ -0,0 +1,212 @@
TITLE kinetic NMDA receptor model
COMMENT
-----------------------------------------------------------------------------
Kinetic model of NMDA receptors
===============================
10-state gating model:
Kampa et al. (2004) J Physiol
U -- Cl -- O
\ | \ \
\ | \ \
UMg -- ClMg - OMg
| |
D1 |
| \ |
D2 \ |
\ D1Mg
\ |
D2Mg
-----------------------------------------------------------------------------
Based on voltage-clamp recordings of NMDA receptor-mediated currents in
nucleated patches of rat neocortical layer 5 pyramidal neurons (Kampa 2004),
this model was fit with AxoGraph directly to experimental recordings in
order to obtain the optimal values for the parameters.
-----------------------------------------------------------------------------
This mod file does not include mechanisms for the release and time course
of transmitter; it should to be used in conjunction with a separate mechanism
to describe the release of transmitter and timecourse of the concentration
of transmitter in the synaptic cleft (to be connected to pointer XMTR here).
-----------------------------------------------------------------------------
See details of NEURON kinetic models in:
Destexhe, A., Mainen, Z.F. and Sejnowski, T.J. Kinetic models of
synaptic transmission. In: Methods in Neuronal Modeling (2nd edition;
edited by Koch, C. and Segev, I.), MIT press, Cambridge, 1996.
Written by Bjoern Kampa in 2004
Lightly modified, Paul Manis 2010.
Note that data were taken at 23 deg C
Q10 was taken from native receptors:
Korinek M, Sedlacek M, Cais O, Dittert I, Vyklicky L Jr. Temperature
dependence of N-methyl-D-aspartate receptor channels and N-methyl-D-aspartate
receptor excitatory postsynaptic currents. Neuroscience. 2010 Feb
3;165(3):736-48. Epub 2009 Oct 31. PubMed PMID: 19883737.
-----------------------------------------------------------------------------
ENDCOMMENT
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
NEURON {
THREADSAFE
POINT_PROCESS NMDA_Kampa
POINTER XMTR
RANGE U, Cl, D1, D2, Open, MaxOpen, UMg, ClMg, D1Mg, D2Mg, OMg
RANGE g, gmax, vshift, Erev, rb, rmb, rmu, rbMg,rmc1b,rmc1u,rmc2b,rmc2u
GLOBAL mg, Rb, Ru, Rd1, Rr1, Rd2, Rr2, Ro, Rc, Rmb, Rmu
GLOBAL RbMg, RuMg, Rd1Mg, Rr1Mg, Rd2Mg, Rr2Mg, RoMg, RcMg
GLOBAL Rmd1b,Rmd1u,Rmd2b,Rmd2u,rmd1b,rmd1u,rmd2b,rmd2u
GLOBAL Rmc1b,Rmc1u,Rmc2b,Rmc2u
GLOBAL vmin, vmax, valence, memb_fraction
NONSPECIFIC_CURRENT i
}
UNITS {
(nA) = (nanoamp)
(mV) = (millivolt)
(pS) = (picosiemens)
(umho) = (micromho)
(mM) = (milli/liter)
(uM) = (micro/liter)
}
PARAMETER {
Erev = 5 (mV) : reversal potential
gmax = 500 (pS) : maximal conductance
mg = 1 (mM) : external magnesium concentration
vmin = -120 (mV)
vmax = 100 (mV)
valence = -2 : parameters of voltage-dependent Mg block
memb_fraction = 0.8
vshift = 0.0 (mV)
Q10 = 2.0 : temperature sensitivity (see above)
: Maximum open probability with Mode=0 (no rectification).
: This is determined empirically by holding XMTR at a large
: value and v=40mV for 100 timesteps and measuring the
: maximum value of Open.
MaxOpen = 0.01988893957 (1)
: Rates
Rb = 10e-3 (/uM /ms) : binding
Ru = 5.6e-3 (/ms) : unbinding
Ro = 10e-3 (/ms) : opening
Rc = 273e-3 (/ms) : closing
: Rd1 = 2.2e-3 (/ms) : fast desensitisation
Rd1 = 0.1 (/ms) : fast desensitisation
Rr1 = 1.6e-3 (/ms) : fast resensitisation
: Rd2 = 0.43e-3 (/ms) : slow desensitisation
Rd2 = 1e-4 (/ms) : slow desensitisation
Rr2 = 0.5e-3 (/ms) : slow resensitisation
Rmb = 0.05e-3 (/uM /ms) : Mg binding Open
Rmu = 12800e-3 (/ms) : Mg unbinding Open
Rmc1b = 0.00005e-3 (/uM /ms) : Mg binding Closed
Rmc1u = 2.438312e-3 (/ms) : Mg unbinding Closed
Rmc2b = 0.00005e-3 (/uM /ms) : Mg binding Closed2
Rmc2u = 5.041915e-3 (/ms) : Mg unbinding Closed2
Rmd1b = 0.00005e-3 (/uM /ms) : Mg binding Desens1
Rmd1u = 2.98874e-3 (/ms) : Mg unbinding Desens1
Rmd2b = 0.00005e-3 (/uM /ms) : Mg binding Desens2
Rmd2u = 2.953408e-3 (/ms) : Mg unbinding Desens2
RbMg = 10e-3 (/uM /ms) : binding with Mg
RuMg = 17.1e-3 (/ms) : unbinding with Mg
RoMg = 10e-3 (/ms) : opening with Mg
RcMg = 548e-3 (/ms) : closing with Mg
Rd1Mg = 2.1e-3 (/ms) : fast desensitisation with Mg
Rr1Mg = 0.87e-3 (/ms) : fast resensitisation with Mg
Rd2Mg = 0.26e-3 (/ms) : slow desensitisation with Mg
Rr2Mg = 0.42e-3 (/ms) : slow resensitisation with Mg
}
ASSIGNED {
v (mV) : postsynaptic voltage
i (nA) : current = g*(v - Erev)
g (pS) : conductance
XMTR (mM) : pointer to glutamate concentration
rb (/ms) : binding, [glu] dependent
rmb (/ms) : blocking V and [Mg] dependent
rmu (/ms) : unblocking V and [Mg] dependent
rbMg (/ms) : binding, [glu] dependent
rmc1b (/ms) : blocking V and [Mg] dependent
rmc1u (/ms) : unblocking V and [Mg] dependent
rmc2b (/ms) : blocking V and [Mg] dependent
rmc2u (/ms) : unblocking V and [Mg] dependent
rmd1b (/ms) : blocking V and [Mg] dependent
rmd1u (/ms) : unblocking V and [Mg] dependent
rmd2b (/ms) : blocking V and [Mg] dependent
rmd2u (/ms) : unblocking V and [Mg] dependent
qfac : Q10
celsius (degC)
}
STATE {
: Channel states (all fractions)
U : unbound
Cl : closed
D1 : desensitised 1
D2 : desensitised 2
Open : open
UMg : unbound with Mg
ClMg : closed with Mg
D1Mg : desensitised 1 with Mg
D2Mg : desensitised 2 with Mg
OMg : open with Mg
}
INITIAL {
U = 1
qfac = Q10^((celsius-23)/10 (degC))}
BREAKPOINT {
SOLVE kstates METHOD sparse
g = gmax * Open / MaxOpen
i = (1e-6) * g * (v - Erev)
}
KINETIC kstates {
rb = Rb * (1e3) * XMTR
rbMg = RbMg * (1e3) * XMTR
rmb = Rmb * mg * (1e3) * exp((v-40+vshift) * valence * memb_fraction /25 (mV))
rmu = Rmu * exp((-1)*(v-40+vshift) * valence * (1-memb_fraction) /25 (mV))
rmc1b = Rmc1b * mg * (1e3) * exp((v-40+vshift) * valence * memb_fraction /25 (mV))
rmc1u = Rmc1u * exp((-1)*(v-40+vshift) * valence * (1-memb_fraction) /25 (mV))
rmc2b = Rmc2b * mg * (1e3) * exp((v-40+vshift) * valence * memb_fraction /25 (mV))
rmc2u = Rmc2u * exp((-1)*(v-40+vshift) * valence * (1-memb_fraction) /25 (mV))
rmd1b = Rmd1b * mg * (1e3) * exp((v-40+vshift) * valence * memb_fraction /25 (mV))
rmd1u = Rmd1u * exp((-1)*(v-40+vshift) * valence * (1-memb_fraction) /25 (mV))
rmd2b = Rmd2b * mg * (1e3) * exp((v-40+vshift) * valence * memb_fraction /25 (mV))
rmd2u = Rmd2u * exp((-1)*(v-40+vshift) * valence * (1-memb_fraction) /25 (mV))
~ U <-> Cl (rb*qfac,Ru*qfac)
~ Cl <-> Open (Ro*qfac,Rc*qfac)
~ Cl <-> D1 (Rd1*qfac,Rr1*qfac)
~ D1 <-> D2 (Rd2*qfac,Rr2*qfac)
~ Open <-> OMg (rmb*qfac,rmu*qfac)
~ UMg <-> ClMg (rbMg*qfac,RuMg*qfac)
~ ClMg <-> OMg (RoMg*qfac,RcMg*qfac)
~ ClMg <-> D1Mg (Rd1Mg*qfac,Rr1Mg*qfac)
~ D1Mg <-> D2Mg (Rd2Mg*qfac,Rr2Mg*qfac)
~ U <-> UMg (rmc1b*qfac,rmc1u*qfac)
~ Cl <-> ClMg (rmc2b*qfac,rmc2u*qfac)
~ D1 <-> D1Mg (rmd1b*qfac,rmd1u*qfac)
~ D2 <-> D2Mg (rmd2b*qfac,rmd2u*qfac)
CONSERVE U+Cl+D1+D2+Open+UMg+ClMg+D1Mg+D2Mg+OMg = 1
}

125
cnmodel/mechanisms/adex.mod

@ -0,0 +1,125 @@ @@ -0,0 +1,125 @@
: AdEx GIF model
: This implementation is for the equations in:
: Naud R, Marcille N, Clopath C, Gerstner W. Firing patterns in the adaptive
: exponential integrate-and-fire model. Biol Cybern. 2008 Nov;99(4-5):335-47. doi:
: 10.1007/s00422-008-0264-7. Epub 2008 Nov 15. PubMed PMID: 19011922; PubMed
: Central PMCID: PMC2798047.
: Which in turn is based on:
: Brette R, Gerstner W. Adaptive exponential integrate-and-fire model as an
: effective description of neuronal activity. J Neurophysiol. 2005
: Nov;94(5):3637-42. Epub 2005 Jul 13. PubMed PMID: 16014787.
:
: Paul B. Manis
: 9 Nov 2017, Washington DC
:
NEURON {
: ARTIFICIAL_CELL AdEx
SUFFIX AdEx
RANGE gl, el, delt, vt, vr, w, b, cm, is, a, tauw
RANGE refract, Vm
NONSPECIFIC_CURRENT i
: m plays the role of voltage
}
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
PARAMETER {
cm = 200 (pF)
el = -70 (mV) : leak (RMP)
gl = 10 (nS) : resting input R
delt = 2 (mV) : spike threshold sharpness
vt = -50 (mV)
vr = -58 (mV): reset value after a spike
a = 2 (nS)
b = 0 (pA)
is = 0 (pA)
tauw = 30 (ms)
refract = 1 (ms)
}
ASSIGNED {
i (mA/cm2)
t0(ms) : time of last spike
refractory : flag indicating when in a refractory period
}
STATE {
w
Vm
}
INITIAL {
Vm = el
t0 = t
w = 0
refractory = 0 : 0-integrates input, 1-refractory
}
BREAKPOINT {
SOLVE states METHOD cnexp
if (refractory == 0 && Vm <= 0.) {
states()
}
if (refractory == 1) {
if ((t-t0) >= refract){
refractory = 0
Vm = vr
states()
}
else {
Vm = 0.
}
}
if (refractory == 0 && Vm > 0.) {
refractory = 1
t0 = t
Vm = 0.
w = w + b
}
}
DERIVATIVE states { : update adaptation variable w
LOCAL eterm, et
w' = (a*(Vm - el) - w)/tauw
eterm = (Vm-vt)/delt
if (eterm > 700 ) { : prevent overflow of the exponential term
: (it would be better to estimate the value... but for this
: implementation, not necessary as this will be the term
: that drives the model to spike - after that V is reset
: so the time evolution no longer matters)
et = 700.
}
else {
et = exp(eterm)
}
Vm' = ( -gl*(Vm-el) + gl*delt*et + is - w)/cm
}
COMMENT
NET_RECEIVE (w) {
if (refractory == 0) { : inputs integrated only when excitable
i = -gl*(v-el) + gl*delt*exp((Vm-vt)/delt) - w
m = i/cm
t0 = t
states()
if (m > 0) {
refractory = 1
m = 0
net_send(refractory, refractory)
net_event(t)
}
} else if (flag == 1) { : ready to integrate again
t0 = t
refractory = 0
m = vr
}
}
ENDCOMMENT

224
cnmodel/mechanisms/ampa_trussell.mod

@ -0,0 +1,224 @@ @@ -0,0 +1,224 @@
TITLE Model of AMPA receptors
COMMENT
-----------------------------------------------------------------------------
Kinetic model of AMPA receptors
===============================
6-state gating model:
(scheme 1 from Raman and Trussell, Neuron 9:173-186, 1992)
2 open states provide dual exponential response.
O1
|
C -- C1 -- C2 -- O2
|
D
-----------------------------------------------------------------------------
This mod file does not include mechanisms for the release and time course
of transmitter; it is to be used in conjunction with a separate mechanism
to describe the release of transmitter and that provides the concentration
of transmitter in the synaptic cleft (to be connected to pointer C here).
Default parameters are set for a miniature EPSC.
-----------------------------------------------------------------------------
Code based on Destexhe's ampa5.mod
B. Graham, Dept. of Computing Science & Maths, University of Stirling
(Contact: b.graham@cs.stir.ac.uk)
(previously IANC, Division of Informatics, University of Edinburgh)
CNS 2000 Version (19/11/02)
-----------------------------------------------------------------------------
Further modified:
Paul Manis (Otolaryngology/HNS and Cell and Molecular Physiology,
UNC Chapel Hill. contact: pmanis@med.unc.edu)
3/15/2005 Modifications:
1. Added Q10/qfac to allow temperature scaling. All rates in the state model
are changed by the same factor. A Q10 of 1.5 gives a decay tau (single
exponential fit using Praxis algorithm in NEURON; using ampa_kinetics.hoc)
of about 850 usec at 22 deg C and 570 usec at 33 deg C. These are consistent
with the Raman and Trussell 1992 measurements in avians. The 850 usec is a
bit fast for an EPSC, and could probably be tuned by adjustment of some of
the parameters below.
2. Brought several variables out to global (rather than range) so that we
can change them - Q10 and gmax in particular. note that gmax is in pS. Only
local conductance etc. is in specified as RANGE.
3. Max open probability is less than unity, so a gmax of 2500 yields 100 pA
at -60 mV. Therefore scaling by mini size must take this into account.
3/28/2005 Paul B. Manis
Added rectification to AMPA R. Rectification is controlled by
polyamine-style block of receptor. See Donevan and Rogawski, 1995; Washburn
et al., 1997. The equations used here are from Washburn et al. The values
given in the equation at the break point were determined from EPSCs in 5
21-d old DBA mice. Blocker = 45 (uM), Kd = 31.32, zd = 1.029. Note that this
should also reduce the maximal conductance. Mode: if 1, use rectifying; if
0, use non-rectifying. Default is 1
This point process uses XMTR as the transmitter concentration to operate on
the receptor kinetics. XMTR should be provided by another process that
controls release (e.g., COH calyx of Held, etc). An advantage of this is
that whatever release process is present, glutamate accumulates in the
cleft, and can drive desensitization etc.
-----------------------------------------------------------------------------
ENDCOMMENT
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
NEURON {
THREADSAFE
POINT_PROCESS AMPATRUSSELL
POINTER XMTR
RANGE C0, C1, C2, D, O1, O2
RANGE Rb, Ru1, Ru2, Rd, Rr, Ro1, Rc1, Ro2, Rc2, Open, MaxOpen
GLOBAL vmin, vmax
GLOBAL Q10, Mode
GLOBAL zd, Kd0
RANGE g, rb, gmax, PA, Erev
NONSPECIFIC_CURRENT i
}
UNITS {
(nA) = (nanoamp)
(mV) = (millivolt)
(pS) = (picosiemens)
(umho) = (micromho)
(mM) = (milli/liter)
(uM) = (micro/liter)
}
PARAMETER {
Erev = 7 (mV) : reversal potential
gmax = 10 (pS) : maximal conductance
vmin = -120 (mV)
vmax = 100 (mV)
Q10 = 1.5 : temperature sensitivity
Mode = 0 : flag to control rectification calculation
: polyamine block parameters (Wang & Manis unpublished data)
zd = 1.032
PA = 45
Kd0 = 31.e-6
: Rates
Rb = 13 (/mM /ms): binding
: diffusion limited (DO NOT ADJUST)
Ru1 = 0.3 (/ms) : unbinding (1st site)
Ru2 = 200 (/ms) : unbinding (2nd site)
Rd = 30.0 (/ms) : desensitization (WAS30.0)
Rr = 0.02 (/ms) : resensitization
Ro1 = 100 (/ms) : opening (fast)
Rc1 = 2 (/ms) : closing
Ro2 = 2 (/ms) : opening (slow)
Rc2 = 0.25 (/ms) : closing
Open = 0 (1) : total of all open states
: Maximum open probability with Mode=0 (no rectification).
: This is determined empirically by holding XMTR at a large
: value for 100 timesteps and measuring the maximum value
: of Open.
MaxOpen = 0.72418772400 (1)
aflag = 1 : Flag for control of printout of initial values.....
}
ASSIGNED {
v (mV) : postsynaptic voltage
i (nA) : current = g*(v - Erev)
g (pS) : conductance
g0 (pS) : conductance for voltage-dependent block by polyamines
gvdep (pS) : voltage-dependence of conductance
XMTR (mM) : pointer to glutamate concentration
rb (/ms) : binding
qfac : q10 factor for rate scaling
celsius (degC)
}
STATE {
: Channel states (all fractions)
C0 : unbound
C1 : single glu bound
C2 : double glu bound
D : single glu bound, desensitized
O1 : open state 1
O2 : open state 2
}
INITIAL {
usetable = 0
C0=1
C1=0
C2=0
D=0
O1=0
O2=0
Open = 0
qfac = Q10^((celsius-22)/10)
: VERBATIM
: fprintf(stdout, "AMPA.MOD gmax: %f Q10 = %f celsius = %f\n", gmax, Q10, celsius);
: ENDVERBATIM
gvdepcalc(v)
}
BREAKPOINT {
SOLVE kstates METHOD sparse
: VERBATIM
: fprintf(stderr, "kstates @ t=%7.2f Rb: %f XMTR: %f: gmax: %f, o1: %f o2: %f\n", t, Rb, XMTR, gmax, O1, O2);
: ENDVERBATIM
gvdepcalc(v)
Open = O1 + O2
g = gmax * Open / MaxOpen
if ( Mode == 1) {
g0 = 1.0 + 0.6*exp((v-50)/40) : eq. 5 of Washburn et al., 1997, slightly modified
gvdep = g0*(1/(1+PA/(Kd0*exp(-zd*v/25.3))))
i = (1e-6) * g * gvdep * (v - Erev)
}
else {
i = (1e-6)*g*(v-Erev)
}
}
KINETIC kstates {
rb = Rb * XMTR
~ C0 <-> C1 (rb*qfac,Ru1*qfac)
~ C1 <-> C2 (rb*qfac,Ru2*qfac)
~ C2 <-> D (Rd*qfac,Rr*qfac)
~ C2 <-> O1 (Ro1*qfac,Rc1*qfac)
~ C2 <-> O2 (Ro2*qfac,Rc2*qfac)
CONSERVE C0+C1+C2+D+O1+O2 = 1
}
LOCAL g0
PROCEDURE gvdepcalc(v) {
TABLE gvdep DEPEND PA, Kd0, zd FROM -100 TO 100 WITH 200
: VERBATIM
: fprintf(stderr, "gvdepcalc starts ");
: ENDVERBATIM
g0 = 1.0 + 0.6*exp((v-50)/40) : eq. 5 of Washburn et al., 1997, slightly modified
gvdep = g0*(1/(1+PA/(Kd0*exp(-zd*v/25.3))))
: VERBATIM
: fprintf(stderr, "& ends\n");
: ENDVERBATIM
}

129
cnmodel/mechanisms/atm.mod

@ -0,0 +1,129 @@ @@ -0,0 +1,129 @@
: ATM GIF model
: This implementation the adaptive theshold model (ATM) is for the equations in:
: Fontaine, B., Benichourx, V., Joris, P.X., and Brette, R. Prediciting
: spike timing in hhigy synchronous auditory neurons at different sound
: levels. J. Neurophysiol. 110: 1672-1688, 2013.
: Which in turn is based on:
: Brette R, Gerstner W. Adaptive exponential integrate-and-fire model as an
: effective description of neuronal activity. J Neurophysiol. 2005
: Nov;94(5):3637-42. Epub 2005 Jul 13. PubMed PMID: 16014787.
:
: Paul B. Manis
: 2 December 2017, Chapel Hill, NC
:
: Incomplete version
NEURON {
: ARTIFICIAL_CELL ATM
SUFFIX ATM
RANGE gl, el, delt, vt, vr, alpha, beta, cm, is, a, tauw
RANGE refract, Vm
NONSPECIFIC_CURRENT i
: m plays the role of voltage
}
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
PARAMETER {
cm = 200 (pF)
el = -70 (mV) : leak (RMP)
gl = 10 (nS) : resting input R
delt = 2 (mV) : spike threshold sharpness
vr = -58 (mV): reset value after a spike
a = 2 (1)
b = 2 (1)
beta = 0 (1)
alpha = 0
is = 0 (pA)
taut = 30 (ms) : threshold tau
refract = 1 (ms)
}
ASSIGNED {
i (mA/cm2)
t0 (ms) : time of last spike
refractory : flag indicating when in a refractory period
}
STATE {
w
Vm
vt
}
INITIAL {
Vm = el
t0 = t
a = 0
b = 0
refractory = 0 : 0-integrates input, 1-refractory
}
BREAKPOINT {
SOLVE states METHOD cnexp
if (refractory == 0 && Vm <= 0.) {
states()
}
if (refractory == 1) {
if ((t-t0) >= refract){
refractory = 0
Vm = vr
states()
}
else {
Vm = 0.
}
}
if (refractory == 0 && Vm > 0.) {
refractory = 1
t0 = t
Vm = 0.
w = w + b
}
}
DERIVATIVE states { : update adaptation variable w
LOCAL eterm, et
vt' = (a*i - vt)/taut
COMMENT
eterm = (Vm-vt)/delt
if (eterm > 700 ) { : prevent overflow of the exponential term
: (it would be better to estimate the value... but for this
: implementation, not necessary as this will be the term
: that drives the model to spike - after that V is reset
: so the time evolution no longer matters)
et = 700.
}
else {
et = exp(eterm)
}
ENDCOMMENT
Vm' = gl*( -(Vm-el) + i)/cm
}
COMMENT
NET_RECEIVE (w) {
if (refractory == 0) { : inputs integrated only when excitable
i = -gl*(v-el) + gl*delt*exp((Vm-vt)/delt) - w
m = i/cm
t0 = t
states()
if (m > 0) {
refractory = 1
m = 0
net_send(refractory, refractory)
net_event(t)
}
} else if (flag == 1) { : ready to integrate again
t0 = t
refractory = 0
m = vr
}
}
ENDCOMMENT

98
cnmodel/mechanisms/bkpkj.mod

@ -0,0 +1,98 @@ @@ -0,0 +1,98 @@
: BK-type Purkinje calcium-activated potassium current
: Created 8/19/02 - nwg
NEURON {
THREADSAFE
SUFFIX bkpkj
USEION k READ ek WRITE ik
USEION ca READ cai
RANGE gbar, ik, gbkpkj
GLOBAL minf, mtau, hinf, htau, zinf, ztau
GLOBAL m_vh, m_k, mtau_y0, mtau_vh1, mtau_vh2, mtau_k1, mtau_k2
GLOBAL z_coef, ztau
GLOBAL h_y0, h_vh, h_k, htau_y0, htau_vh1, htau_vh2, htau_k1, htau_k2
}
UNITS {
(mV) = (millivolt)
(mA) = (milliamp)
(mM) = (milli/liter)
}
PARAMETER {
v (mV)
gbar = 0.007 (mho/cm2)
m1 (ms)
m_vh = -28.9 (mV)
m_k = 6.2 (mV)
mtau_y0 = 0.505 (ms) : 0.000505 (s)
mtau_vh1 = -33.3 (mV)
mtau_k1 = -10 (mV)
mtau_vh2 = 86.4 (mV)
mtau_k2 = 10.1 (mV)
z_coef = 0.001 (mM)
ztau = 1 (ms)
h_y0 = 0.085
h_vh = -32 (mV)
h_k = 5.8 (mV)
htau_y0 = 1.9 (ms) : 0.0019 (s)
htau_vh1 = -54.2 (mV)
htau_k1 = -12.9 (mV)
htau_vh2 = 48.5 (mV)
htau_k2 = 5.2 (mV)
ek (mV)
cai (mM)
}
ASSIGNED {
gbkpkj (mho/cm2)
minf
mtau (ms)
hinf
htau (ms)
zinf
ik (mA/cm2)
}
STATE {
m FROM 0 TO 1
z FROM 0 TO 1
h FROM 0 TO 1
}
BREAKPOINT {
SOLVE states METHOD cnexp
gbkpkj = gbar * m * m * m * z * z * h
ik = gbkpkj * (v - ek)
}
DERIVATIVE states {
rates(v)
m' = (minf - m) / mtau
h' = (hinf - h) / htau
z' = (zinf - z) / ztau
}
PROCEDURE rates(Vm (mV)) {
LOCAL v
v = Vm + 5
minf = 1 / (1 + exp(-(v - (m_vh)) / m_k))
m1 = mtau_y0 + (1. (ms)/(exp((v+ mtau_vh1)/mtau_k1)))
mtau = m1 + (1. (ms)) * exp((v+mtau_vh2)/mtau_k2)
zinf = 1/(1 + z_coef / cai)
hinf = h_y0 + (1-h_y0) / (1+exp((v - h_vh)/h_k))
htau = (htau_y0 + (1 (ms))/(exp((v + htau_vh1)/htau_k1)+exp((v+htau_vh2)/htau_k2)))
}
INITIAL {
rates(v)
m = minf
z = zinf
h = hinf
}

157
cnmodel/mechanisms/cabpump.mod

@ -0,0 +1,157 @@ @@ -0,0 +1,157 @@
TITLE Calcium ion accumulation and diffusion with pump
: The internal coordinate system is set up in PROCEDURE coord_cadifus()
: and must be executed before computing the concentrations.
: The scale factors set up in this procedure do not have to be recomputed
: when diam or DFree are changed.
: The amount of calcium in an annulus is ca[i]*diam^2*vol[i] with
: ca[0] being the second order correct concentration at the exact edge
: and ca[NANN-1] being the concentration at the exact center
? interface
NEURON {
THREADSAFE
SUFFIX cadifpmp
USEION ca READ cao, ica WRITE cai, ica
RANGE ica_pmp, last_ica_pmp, k1, k2, k3, k4, DFree
GLOBAL vol, pump0
}
DEFINE NANN 10
UNITS {
(mV) = (millivolt)
(molar) = (1/liter)
(mM) = (millimolar)
(um) = (micron)
(mA) = (milliamp)
(mol) = (1)
FARADAY = (faraday) (coulomb)
PI = (pi) (1)
R = (k-mole) (joule/degC)
}
PARAMETER {
DFree = 0.6 (um2/ms) <0,1e9>
beta = 50 <0, 1e9>
k1 = 5e8 (/mM-s) <0, 1e10>:optional mm formulation
k2 = .25e6 (/s) <0, 1e10>
k3 = .5e3 (/s) <0, 1e10>
k4 = 5e0 (/mM-s) <0, 1e10>
pump0 = 3e-14 (mol/cm2) <0, 1e9> : set to 0 in hoc if this pump not wanted
}
ASSIGNED {
celsius (degC)
diam (um)
v (millivolt)
cao (mM)
cai (mM)
ica (mA/cm2)
vol[NANN] (1) : gets extra cm2 when multiplied by diam^2
ica_pmp (mA/cm2)
area1 (um2)
c1 (1+8 um5/ms)
c2 (1-10 um2/ms)
c3 (1-10 um2/ms)
c4 (1+8 um5/ms)
ica_pmp_last (mA/cm2)
}
CONSTANT {
volo = 1 (liter)
}
STATE {
ca[NANN] (mM) <1e-6> : ca[0] is equivalent to cai
pump (mol/cm2) <1e-15>
pumpca (mol/cm2) <1e-15>
}
INITIAL {LOCAL total
parms()
FROM i=0 TO NANN-1 {
ca[i] = cai
}
pumpca = cai*pump*c1/c2
total = pumpca + pump
if (total > 1e-9) {
pump = pump*(pump/total)
pumpca = pumpca*(pump/total)
}
ica_pmp = 0
ica_pmp_last = 0
}
BREAKPOINT {
SOLVE state METHOD sparse
ica_pmp_last = ica_pmp
ica = ica_pmp
: printf("Breakpoint t=%g v=%g cai=%g ica=%g\n", t, v, cai, ica)
}
LOCAL frat[NANN] : gets extra cm when multiplied by diam
PROCEDURE coord() {
LOCAL r, dr2
: cylindrical coordinate system with constant annuli thickness to
: center of cell. Note however that the first annulus is half thickness
: so that the concentration is second order correct spatially at
: the membrane or exact edge of the cell.
: note ca[0] is at edge of cell
: ca[NANN-1] is at center of cell
r = 1/2 :starts at edge (half diam)
dr2 = r/(NANN-1)/2 :half thickness of annulus
vol[0] = 0
frat[0] = 2*r
FROM i=0 TO NANN-2 {
vol[i] = vol[i] + PI*(r-dr2/2)*2*dr2 :interior half
r = r - dr2
frat[i+1] = 2*PI*r/(2*dr2) :exterior edge of annulus
: divided by distance between centers
r = r - dr2
vol[i+1] = PI*(r+dr2/2)*2*dr2 :outer half of annulus
}
}
KINETIC state {
: printf("Solve begin t=%g v=%g cai=%g ica_pmp=%g\n", t, v, cai, ica_pmp)
COMPARTMENT i, (1+beta)*diam*diam*vol[i]*1(um) {ca}
COMPARTMENT (1e10)*area1 {pump pumpca}
COMPARTMENT volo*(1e15) {cao}
? kinetics
~ pumpca <-> pump + cao (c3, c4)
ica_pmp = (1e-4)*2*FARADAY*(f_flux - b_flux)/area1
: all currents except pump
~ ca[0] << (-(ica-ica_pmp_last)*PI*diam*1(um)*(1e4)*frat[0]/(2*FARADAY))
:diffusion
FROM i=0 TO NANN-2 {
~ ca[i] <-> ca[i+1] (DFree*frat[i+1]*1(um), DFree*frat[i+1]*1(um))
}
:pump
~ ca[0] + pump <-> pumpca (c1, c2)
cai = ca[0] : this assignment statement is used specially by cvode
: printf("Solve end cai=%g ica=%g ica_pmp=%g ica_pmp_last=%g\n",
: cai, ica, ica_pmp,ica_pmp_last)
}
PROCEDURE parms() {
coord()
area1 = 2*PI*(diam/2) * 1(um)
c1 = (1e7)*area1 * k1
c2 = (1e7)*area1 * k2
c3 = (1e7)*area1 * k3
c4 = (1e7)*area1 * k4
}
FUNCTION ss() (mM) {
SOLVE state STEADYSTATE sparse
ss = cai
}
COMMENT
At this time, conductances (and channel states and currents are
calculated at the midpoint of a dt interval. Membrane potential and
concentrations are calculated at the edges of a dt interval. With
secondorder=2 everything turns out to be second order correct.
ENDCOMMENT

50
cnmodel/mechanisms/cadiff.mod

@ -0,0 +1,50 @@ @@ -0,0 +1,50 @@
: Ca diffusion in a Purkinje cell
: Created 8/15/02 - nwg
NEURON {
SUFFIX cadiff
USEION ca READ ica, cai WRITE cai
RANGE ca
GLOBAL depth, beta
}
UNITS {
(mV) = (millivolt)
(mA) = (milliamp)
(mM) = (milli/liter)
(um) = (micron)
}
CONSTANT {
F = 9.6485e4 (coul)
}
PARAMETER {
cai (mM)
dt (ms)
depth = 0.1 (um)
beta = 1 (/ms)
}
ASSIGNED {
ica (mA/cm2)
}
STATE {
ca (mM)
}
INITIAL {
ca = 0.0001
}
BREAKPOINT {
ca = ca + (10000.0) * dt * ( ( -1/(2*F)*ica / (depth)) - (0.0001) * beta * ca )
if ( ca < 1e-4 ) {: minimum 100 nM Ca
ca = 1e-4
}
cai = ca
}

100
cnmodel/mechanisms/cadyn.mod

@ -0,0 +1,100 @@ @@ -0,0 +1,100 @@
TITLE decay of submembrane calcium concentration
:
: Internal calcium concentration due to calcium currents and pump.
: Differential equations.
:
: This file contains two mechanisms:
:
: 1. Simple model of ATPase pump with 3 kinetic constants (Destexhe 1992)
:
: Cai + P <-> CaP -> Cao + P (k1,k2,k3)
:
: A Michaelis-Menten approximation is assumed, which reduces the complexity
: of the system to 2 parameters:
: kt = <tot enzyme concentration> * k3 -> TIME CONSTANT OF THE PUMP
: kd = k2/k1 (dissociation constant) -> EQUILIBRIUM CALCIUM VALUE
: The values of these parameters are chosen assuming a high affinity of
: the pump to calcium and a low transport capacity (cfr. Blaustein,
: TINS, 11: 438, 1988, and references therein).
:
: For further information about this this mechanism, see Destexhe, A.
: Babloyantz, A. and Sejnowski, TJ. Ionic mechanisms for intrinsic slow
: oscillations in thalamic relay neurons. Biophys. J. 65: 1538-1552, 1993.
:
:
: 2. Simple first-order decay or buffering:
:
: Cai + B <-> ...
:
: which can be written as:
:
: dCai/dt = (cainf - Cai) / taur
:
: where cainf is the equilibrium intracellular calcium value (usually
: in the range of 200-300 nM) and taur is the time constant of calcium
: removal. The dynamics of submembranal calcium is usually thought to
: be relatively fast, in the 1-10 millisecond range (see Blaustein,
: TINS, 11: 438, 1988).
:
: All variables are range variables
:
: Written by Alain Destexhe, Salk Institute, Nov 12, 1992
:
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
NEURON {
SUFFIX cadyn
USEION ca READ ica, cai WRITE cai
RANGE depth,kt,kd,cainf,taur
}
UNITS {
(molar) = (1/liter) : moles do not appear in units
(mM) = (millimolar)
(um) = (micron)
(mA) = (milliamp)
(msM) = (ms mM)
}
CONSTANT {
FARADAY = 96489 (coul) : moles do not appear in units
}
PARAMETER {
depth = .1 (um) : depth of shell
taur = 1e10 (ms) : remove first-order decay
cainf = 1.4e-1 (mM)
kt = 1e-4 (mM/ms)
kd = 1e-4 (mM)
}
STATE {
cai (mM)
}
INITIAL {
cai = kd
}
ASSIGNED {
ica (mA/cm2)
drive_channel (mM/ms)
drive_pump (mM/ms)
}
BREAKPOINT {
SOLVE state METHOD cnexp
}
DERIVATIVE state {
drive_channel = - (10000) * ica / (2 * FARADAY * depth)
if (drive_channel <= 0.) { drive_channel = 0. } : cannot pump inward
drive_pump = -kt * cai / (cai + kd ) : Michaelis-Menten
cai' = drive_channel + drive_pump + (cainf-cai)/taur
}

86
cnmodel/mechanisms/cap.mod

@ -0,0 +1,86 @@ @@ -0,0 +1,86 @@
: HH P-type Calcium current
: Created 8/13/02 - nwg
NEURON {
THREADSAFE
SUFFIX cap
USEION ca READ cai, cao WRITE ica
RANGE pcabar, ica
RANGE minf, mtau
RANGE monovalConc, monovalPerm
}
UNITS {
(mV) = (millivolt)
(mA) = (milliamp)
(mM) = (milli/liter)
F = 9.6485e4 (coul)
R = 8.3145 (joule/degC)
}
PARAMETER {
v (mV)
celsius (degC)
pcabar = 0.00005 (cm/s)
monovalConc = 140 (mM)
monovalPerm = 0
cai (milli/liter)
cao (milli/liter)
}
ASSIGNED {
ica (mA/cm2)
minf
mtau (ms)
T (degC)
E (volts)
}
STATE {
m
}
INITIAL {
rates(v)
m = minf
}
BREAKPOINT {
SOLVE states METHOD cnexp
ica = (1e3) * pcabar * m * ghk(v, cai, cao, 2)
}
DERIVATIVE states {
rates(v)
m' = (minf - m)/mtau
}
FUNCTION ghk( v(mV), ci(mM), co(mM), z) (coul/cm3) { LOCAL Ci
T = celsius + 273.19 : Kelvin
E = (1e-3) * v
Ci = ci + (monovalPerm) * (monovalConc) : Monovalent permeability
if (fabs(1-exp(-z*(F*E)/(R*T))) < 1e-6) { : denominator is small -> Taylor series
ghk = (1e-6) * z * F * (Ci-co*exp(-z*(F*E)/(R*T)))*(1-(z*(F*E)/(R*T)))
} else {
ghk = (1e-6) * z^2*(E*F^2)/(R*T)*(Ci-co*exp(-z*(F*E)/(R*T)))/(1-exp(-z*(F*E)/(R*T)))
}
}
PROCEDURE rates (v (mV)) {
UNITSOFF
minf = 1/(1+exp(-(v - (-19)) / 5.5))
mtau = (mtau_func(v)) * 1e3
UNITSON
}
FUNCTION mtau_func( v (mV) ) (ms) {
UNITSOFF
if (v > -50) {
mtau_func = .000191 + .00376*exp(-((v-(-41.9))/27.8)^2)
} else {
mtau_func = .00026367 + .1278 * exp(.10327*v)
}
UNITSON
}

71
cnmodel/mechanisms/capmp.mod

@ -0,0 +1,71 @@ @@ -0,0 +1,71 @@
NEURON {
SUFFIX capmp
USEION ca READ cao, ica, cai WRITE cai, ica
RANGE tau, width, cabulk, ica, pump0
}
UNITS {
(um) = (micron)
(molar) = (1/liter)
(mM) = (millimolar)
(uM) = (micromolar)
(mA) = (milliamp)
(mol) = (1)
FARADAY = (faraday) (coulomb)
}
PARAMETER {
width = 0.1 (um)
tau = 1 (ms)
k1 = 5e8 (/mM-s)
k2 = 0.25e6 (/s)
k3 = 0.5e3 (/s)
k4 = 5e0 (/mM-s)
cabulk = 0.1 (uM)
pump0 = 3e-14 (mol/cm2)
}
ASSIGNED {
cao (mM) : 2
cai (mM) : 100e-6
ica (mA/cm2)
ica_pmp (mA/cm2)
ica_pmp_last (mA/cm2)
}
STATE {
cam (uM) <1e-6>
pump (mol/cm2) <1e-16>
capump (mol/cm2) <1e-16>
}
INITIAL {
ica = 0
ica_pmp = 0
ica_pmp_last = 0
SOLVE pmp STEADYSTATE sparse
}
BREAKPOINT {
SOLVE pmp METHOD sparse
ica_pmp_last = ica_pmp
ica = ica_pmp
}
KINETIC pmp {
~ cabulk <-> cam (width/tau, width/tau)
~ cam + pump <-> capump ((1e7)*k1, (1e10)*k2)
~ capump <-> cao + pump ((1e10)*k3, (1e10)*k4)
ica_pmp = (1e-7)*2*FARADAY*(f_flux - b_flux)
: ica_pmp_last vs ica_pmp needed because of STEADYSTATE calculation
~ cam << (-(ica - ica_pmp_last)/(2*FARADAY)*(1e7))
CONSERVE pump + capump = (1e13)*pump0
COMPARTMENT width {cam} : volume has dimensions of um
COMPARTMENT (1e13) {pump capump} : area is dimensionless
COMPARTMENT 1(um) {cabulk}
COMPARTMENT (1e3)*1(um) {cao}
cai = (0.001)*cam
}

32
cnmodel/mechanisms/capump.mod

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
NEURON {
SUFFIX capump
USEION ca READ cai WRITE ica
RANGE vmax, kmp, ica
}
UNITS {
(uM) = (micro/liter)
(mM) = (milli/liter)
(mA) = (milliamp)
}
PARAMETER {
vmax = .0667 (mA/cm2) <0, 1e6>: at 6.3 deg, Q10 = 3
kmp = .2 (uM) <0, 1e6>
}
ASSIGNED {
celsius (degC)
ica (mA/cm2)
cai (mM)
}
LOCAL Q, s_celsius
BREAKPOINT {
if (s_celsius*1(degC) != celsius) {
s_celsius = celsius
Q = 3^((celsius - 6.3)/10 (degC))
}
ica = vmax*Q*cai/(cai + (.001)*kmp) / 5.18
}

88
cnmodel/mechanisms/cleftXmtr.mod

@ -0,0 +1,88 @@ @@ -0,0 +1,88 @@
COMMENT
cleftXmtr
This is simple state model that generates "cleft" transmitter, through
the following scheme:
A netreceive block receives the driving event. This forces XV (the vesicle
state) to be set to XMax to mimic the release of a vesicle.
Then:
XV --> XC --> XU
where XV is the vesicle transmitter, XC is the cleft transmitter and
XU is transmitter that has been taken up. The forward rates are finite, and the
reverse rates are 0 (XU is an absorbing state)
The forward rate kv1 mimics simple first-order diffusion across the cleft
The forward rate ku1 mimics simple first-order uptake from the cleft
The concentration XC is available to the program as Xmtr.
XMax is the max cleft concentration of transmitter.
Because vesicle release events at a single presynaptic terminal can be nearly
simultaneous, it is important that this mechanism does not have a refractory
period. We also assume that the uptake mechanism is not saturable.
Paul B. Manis, Ph.D.
UNC Chapel Hill
3 Jan 2010
ENDCOMMENT
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
DEFINE NSTEP 5
NEURON {
POINT_PROCESS cleftXmtr
POINTER pre
RANGE KV, KU, XMax
RANGE CXmtr, preThresh
}
UNITS {
(nA) = (nanoamp)
}
PARAMETER { : Parameters are chosen from best fit to stellate cell data in VCN
KV = 531 (/ms) <0,1e9> : release rate from vesicle
KU = 4.17 (/ms) <0,1e3> : uptake rate
XMax = 0.731 (mM)
preThresh = 0
}
ASSIGNED {
pre
CXmtr (mM)
preLast (1)
tLast
}
STATE {
XV : Vesicle transmitter (just released)
XC : Cleft transmitter (e.g., at receptor)
XU : Uptake state (dead state... )
}
INITIAL {
XV = 0
XC = 0 (mM)
XU = 0
CXmtr = 0.0
preLast = 0.0
tLast = 0.0
}
BREAKPOINT {
SOLVE kstates METHOD sparse
CXmtr = XC*XMax
}
KINETIC kstates {
~ XV <-> XC (KV, 0.0)
~ XC <-> XU (KU, 0.0)
: note that this mechanism has no CONSERVATION : XU can accumulate as much
: as needed.
}
NET_RECEIVE(conc (mM)) { : detect and cause a release event
XV = XV + 1
}

65
cnmodel/mechanisms/gly.mod

@ -0,0 +1,65 @@ @@ -0,0 +1,65 @@
TITLE Gly synapse
COMMENT
MODIFIED to be a faster GLY synapse, taken from GABA synapse
Paul B. Manis - 7 Feb 2000
simple alpha-synapse that generates a single PSP
*********************************************
reference: McCormick, Wang & Huguenard (1993)
Cerebral Cortex 3(5), 387-398
found in: cat reticular nucleus of thalamus
*********************************************
Assembled for MyFirstNEURON by Arthur Houweling
ENDCOMMENT
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
NEURON {
POINT_PROCESS GlySynapse
USEION cl READ ecl VALENCE 1
: negative valence not accepted by nrnivmodl
RANGE onset, gmaxIPSP, e, g, i, w
NONSPECIFIC_CURRENT i
}
UNITS {
(nA) = (nanoamp)
(mV) = (millivolt)
(nS) = (nanomho)
}
PARAMETER {
onset= 25 (ms)
gmaxIPSP= 0 (nS)
w= 1 : weight factor for gmaxIPSP
ecl (mV)
v (mV)
celsius (degC)
}
ASSIGNED {
i (nA)
g (nS)
tadj
}
UNITSOFF
INITIAL {
tadj = 3^((celsius-23.5)/10)
}
BREAKPOINT { LOCAL tt
tt= (t-onset)*tadj
if ((t>onset)&&(tt<740)) {
: the exp() function does not accept arguments smaller than -745
g = w*gmaxIPSP * exp(-tt/15) * (1-exp(-tt/0.5))/0.84
}
else {g = 0}
: -ecl because negative valences can not be specified
i = g * (v-(-ecl))
}
UNITSON

196
cnmodel/mechanisms/gly2.mod

@ -0,0 +1,196 @@ @@ -0,0 +1,196 @@
COMMENT
-----------------------------------------------------------------------------
Simple synaptic mechanism derived for first order kinetics of
binding of transmitter to postsynaptic receptors.
A. Destexhe & Z. Mainen, The Salk Institute, March 12, 1993.
Last modif. Sept 8, 1993.
Reference:
Destexhe, A., Mainen, Z. and Sejnowski, T.J. An efficient method for
computing synaptic conductances based on a kinetic model of receptor binding.
Neural Computation, 6: 14-18, 1994.
-----------------------------------------------------------------------------
During the arrival of the presynaptic spike (detected by threshold
crossing), it is assumed that there is a brief pulse (duration=Cdur)
of neurotransmitter C in the synaptic cleft (the maximal concentration
of C is Cmax). Then, C is assumed to bind to a receptor Rc according
to the following first-order kinetic scheme:
Rc + C ---(Alpha)--> Ro (1)
<--(Beta)---
where Rc and Ro are respectively the closed and open form of the
postsynaptic receptor, Alpha and Beta are the forward and backward
rate constants. If R represents the fraction of open gates Ro,
then one can write the following kinetic equation:
dR/dt = Alpha * C * (1-R) - Beta * R (2)
and the postsynaptic current is given by:
Isyn = gmax * R * (V-Erev) (3)
where V is the postsynaptic potential, gmax is the maximal conductance
of the synapse and Erev is the reversal potential.
If C is assumed to occur as a pulse in the synaptic cleft, such as
C _____ . . . . . . Cmax
| |
_____| |______ . . . 0
t0 t1
then one can solve the kinetic equation exactly, instead of solving
one differential equation for the state variable and for each synapse,
which would be greatly time consuming...
Equation (2) can be solved as follows:
1. during the pulse (from t=t0 to t=t1), C = Cmax, which gives:
R(t-t0) = Rinf + [ R(t0) - Rinf ] * exp (- (t-t0) / Rtau ) (4)
where
Rinf = Alpha * Cmax / (Alpha * Cmax + Beta)
and
Rtau = 1 / (Alpha * Cmax + Beta)
2. after the pulse (t>t1), C = 0, and one can write:
R(t-t1) = R(t1) * exp (- Beta * (t-t1) ) (5)
There is a pointer called "pre" which must be set to the variable which
is supposed to trigger synaptic release. This variable is usually the
presynaptic voltage but it can be the presynaptic calcium concentration,
or other. Prethresh is the value of the threshold at which the release is
initiated.
Once pre has crossed the threshold value given by Prethresh, a pulse
of C is generated for a duration of Cdur, and the synaptic conductances
are calculated accordingly to eqs (4-5). Another event is not allowed to
occur for Deadtime milliseconds following after pre rises above threshold.
The user specifies the presynaptic location in hoc via the statement
connect pre_GABA[i] , v.section(x)
where x is the arc length (0 - 1) along the presynaptic section (the currently
specified section), and i is the synapse number (Which is located at the
postsynaptic location in the usual way via
postsynaptic_section {loc_GABA(i, x)}
Notice that loc_GABA() must be executed first since that function also
allocates space for the synapse.
-----------------------------------------------------------------------------
GLY SYNAPSE (GLY receptors)
currently parameters are same as GABA-A until I get the Harty data in here
P. Manis 2/10/2000
-----------------------------------------------------------------------------
ENDCOMMENT
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
NEURON {
POINT_PROCESS GLY2
POINTER pre
RANGE C, R, R0, R1, g, gmax, Erev, lastrelease, Prethresh
NONSPECIFIC_CURRENT i
GLOBAL Cmax, Cdur, Alpha, Beta, Deadtime, Rinf, Rtau
}
UNITS {
(nA) = (nanoamp)
(mV) = (millivolt)
(umho) = (micromho)
(mM) = (milli/liter)
}
PARAMETER {
Cmax = 1 (mM) : max transmitter concentration
Cdur = 1 (ms) : transmitter duration (rising phase)
Alpha = 0.53 (/ms mM) : forward (binding) rate
Beta = 0.18 (/ms) : backward (unbinding) rate
Erev = -80 (mV) : reversal potential
Prethresh = 0 : voltage level nec for release
Deadtime = 1 (ms) : mimimum time between release events
gmax (umho) : maximum conductance
}
ASSIGNED {
v (mV) : postsynaptic voltage
i (nA) : current = g*(v - Erev)
g (umho) : conductance
C (mM) : transmitter concentration
R : fraction of open channels
R0 : open channels at start of release
R1 : open channels at end of release
Rinf : steady state channels open
Rtau (ms) : time constant of channel binding
pre : pointer to presynaptic variable
lastrelease (ms) : time of last spike
}
INITIAL {
R = 0
C = 0
R0 = 0
R1 = 0
Rinf = Cmax*Alpha / (Cmax*Alpha + Beta)
Rtau = 1 / ((Alpha * Cmax) + Beta)
lastrelease = -999
}
BREAKPOINT {
SOLVE release
g = gmax * R
i = g*(v - Erev)
}
PROCEDURE release() { LOCAL q
:will crash if user hasn't set pre with the connect statement
q = ((t - lastrelease) - Cdur) : time since last release ended
: ready for another release?
if (q > Deadtime) {
if (pre > Prethresh) { : spike occured?
C = Cmax : start new release
R0 = R
lastrelease = t
}
} else if (q < 0) { : still releasing?
: do nothing
} else if (C == Cmax) { : in dead time after release
R1 = R
C = 0.
}
if (C > 0) { : transmitter being released?
R = Rinf + (R0 - Rinf) * exptable (- (t - lastrelease) / Rtau)
} else { : no release occuring
R = R1 * exptable (- Beta * (t - (lastrelease + Cdur)))
}
VERBATIM
return 0;
ENDVERBATIM
}
FUNCTION exptable(x) {
TABLE FROM -10 TO 10 WITH 2000
if ((x > -10) && (x < 10)) {
exptable = exp(x)
} else {
exptable = 0.
}
}

101
cnmodel/mechanisms/hcno.mod

@ -0,0 +1,101 @@ @@ -0,0 +1,101 @@
TITLE h current for Octopus cells of Cochlear Nucleus
: From Bal and Oertel (2000)
: M.Migliore Oct. 2001
: Modified, P. Manis July 2014.
NEURON {
THREADSAFE
SUFFIX hcno
NONSPECIFIC_CURRENT i
RANGE gbar, eh, gh
GLOBAL hinf, tau1, tau2
}
UNITS {
(mA) = (milliamp)
(mV) = (millivolt)
(pS) = (picosiemens)
(um) = (micron)
R = (k-mole)(joule/degC)
F = (faraday)(kilocoulombs)
}
PARAMETER {
gbar = 0.0005 (mho/cm2)
vhalf1 = -50 (mV) : v 1/2 for forward
vhalf2 = -84 (mV) : v 1/2 for backward
gm1 = 0.3 :(mV) : slope for forward
gm2 = 0.6 : (mV) : slope for backward
zeta1 = 3 : (/ms)
zeta2 = 3 : (/ms)
a01 = 0.008 (/ms)
a02 = 0.0029 (/ms)
frac = 0.0
c0 = 273.16 (degC)
thinf = -66 (mV) : inact inf slope
qinf = 7 (mV) : inact inf slope
q10tau = 4.5 : from Magee (1998)
v (mV)
q10g = 2.0 : Rothman...
}
ASSIGNED {
celsius (degC)
i (mA/cm2)
gh (mho/cm2)
eh (mV) : must be explicitly def. in hoc
hinf
tau1 (ms)
tau2 (ms)
qg () : computed q10 for gnabar based on q10g
q10 ()
ssih
}
STATE { h1 h2 }
BREAKPOINT {
SOLVE states METHOD derivimplicit
gh = qg*gbar*(h1*frac + h2*(1.0-frac))
i = gh * (v - eh)
}
INITIAL {
qg = q10g^((celsius-33.0)/10.0 (degC)) :note original measurements made at 33 C
q10 = q10tau^((celsius - 22.0)/10.0 (degC)) : if you don't like room temp, it can be changed!
rates(v)
h1=hinf
h2=hinf
ssih = 0.
}
DERIVATIVE states {
rates(v)
h1' = (hinf - h1)/tau1
h2' = (hinf - h2)/tau2
}
PROCEDURE rates(v (mV)) {
tau1 = bet1(v)/(q10*a01*(1.0+alp1(v)))
tau2 = bet2(v)/(q10*a02*(1.0+alp2(v)))
hinf = 1.0/(1.0+exp((v-thinf)/qinf))
}
FUNCTION alp1(v(mV)) {
alp1 = exp(1e-3*zeta1*(v-vhalf1)*F/(R*(c0+celsius)))
}
FUNCTION bet1(v(mV)) {
bet1 = exp(1.e-3*zeta1*gm1*(v-vhalf1)*F/(R*(c0+celsius)))
}
FUNCTION alp2(v(mV)) {
alp2 = exp(1.e-3*zeta2*(v-vhalf2)*F/(R*(c0+celsius)))
}
FUNCTION bet2(v(mV)) {
bet2 = exp(1.e-3*zeta2*gm2*(v-vhalf2)*F/(R*(c0+celsius)))
}

103
cnmodel/mechanisms/hcno_bo.mod

@ -0,0 +1,103 @@ @@ -0,0 +1,103 @@
TITLE h current for Octopus cells of Cochlear Nucleus
: From Bal and Oertel (2000)
: Modified, P. Manis July 2014, 2017
: Parameters from McGinley et al. paper
NEURON {
THREADSAFE
SUFFIX hcnobo
NONSPECIFIC_CURRENT i
RANGE gbar, eh, gh, q10tau
GLOBAL hinf, tau1, tau2
}
UNITS {
(mA) = (milliamp)
(mV) = (millivolt)
(pS) = (picosiemens)
(um) = (micron)
R = (k-mole)(joule/degC)
F = (faraday)(kilocoulombs)
}
PARAMETER {
gbar = 0.0005 (mho/cm2)
vhalf1 = -70 (mV) : -50 (mV) : v 1/2 for forward
vhalf2 = -84 (mV) : v 1/2 for backward
gm1 = 0.3 :(mV) : slope for forward
gm2 = 0.6 : (mV) : slope for backward
zeta1 = 3 : (/ms)
: zeta2 = 3 : (/ms)
a01 = 4.8e-3 (/ms) : was 0.008
a02 = 2.9e-3 (/ms) : was 0.0029 (/ms)
frac = 0.8
c0 = 273.16 (degC)
thinf = -72.4 (mV) : inact inf slope
qinf = 5.3 (mV) : inact inf slope
q10tau = 4.5 : from Magee (1998)
v (mV)
}
ASSIGNED {
celsius (degC)
i (mA/cm2)
gh (mho/cm2)
eh (mV) : must be explicitly def. in hoc
hinf
tau1 (ms)
tau2 (ms)
q10 ()
ssih
ct
}
STATE { h1 h2 }
BREAKPOINT {
SOLVE states METHOD cnexp
: SOLVE states METHOD derivimplicit
gh = gbar*(h1*frac + h2*(1.0-frac))
i = gh * (v - eh)
}
INITIAL {
ct = 1e-3*zeta1*F/(R*(c0+celsius))
q10 = q10tau^((celsius - 33.0)/10.0 (degC)) : Measurements at 33
rates(v)
h1=hinf
h2=hinf
ssih = 0.
}
DERIVATIVE states {
rates(v)
h1' = (hinf - h1)/tau1
h2' = (hinf - h2)/tau2
}
PROCEDURE rates(v (mV)) {
tau1 = bet1(v)/(q10*a01*(1.0+alp1(v)))
tau2 = bet2(v)/(q10*a02*(1.0+alp2(v)))
hinf = 1.0/(1.0+exp((v-thinf)/qinf))
}
FUNCTION alp1(v(mV)) {
alp1 = exp((v-vhalf1)*ct)
}
FUNCTION bet1(v(mV)) {
bet1 = exp(gm1*(v-vhalf1)*ct)
}
FUNCTION alp2(v(mV)) {
alp2 = exp((v-vhalf2)*ct)
}
FUNCTION bet2(v(mV)) {
bet2 = exp(gm2*(v-vhalf2)*ct)
}

48
cnmodel/mechanisms/iStim.mod

@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
COMMENT
iStim
This is a point current injection (like an electrode).
Positive values of the amplitude depolarize the cell
and in the presence of the extracellular mechanism there will be a change
in vext since i is not a transmembrane current but a current injected
directly to the inside of the cell.
This is meant to be used with Vector Play...
ENDCOMMENT
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
DEFINE NSTEP 5
NEURON {
THREADSAFE
POINT_PROCESS iStim
RANGE dur, delay, iMax
ELECTRODE_CURRENT i
}
UNITS {
(nA) = (nanoamp)
}
PARAMETER {
dur (ms) <0,1e9>
delay (ms) <0,1e9>
iMax (nA)
}
ASSIGNED {
i (nA)
}
INITIAL {
i = 0
}
BREAKPOINT {
COMMENT
if(t < delay || t > (delay+dur)) {
i = 0
}
if(t >= delay && t <= (delay+dur)) {
i = iMax
}
ENDCOMMENT
}

56
cnmodel/mechanisms/ihpkj.mod

@ -0,0 +1,56 @@ @@ -0,0 +1,56 @@
: Ih current
: Created 8/6/02 - nwg
NEURON {
THREADSAFE
SUFFIX hpkj
NONSPECIFIC_CURRENT i
RANGE gbar, gh, eh
GLOBAL ninf, ntau
}
UNITS {
(mA) = (milliamp)
(mV) = (millivolt)
(S) = (siemens)
}
PARAMETER {
v (mV)
gbar = .0001 (S/cm2)
eh = -30 (mV)
}
ASSIGNED {
gh (mho/cm2)
i (mA/cm2)
ninf
ntau (ms)
}
STATE {
n
}
INITIAL {
rates(v)
n = ninf
}
BREAKPOINT {
SOLVE states METHOD cnexp
gh = gbar * n
i = gh*(v - eh)
}
DERIVATIVE states {
rates(v)
n' = (ninf - n)/ntau
}
PROCEDURE rates(v (mV)) {
ninf = 1/(1+exp((v+90.1(mV))/9.9(mV)))
ntau = (1000) * (0.19 (s) + 0.72 (s)*exp(-((v-(-81.5(mV)))/11.9(mV))^2))
}

134
cnmodel/mechanisms/ihpyr.mod

@ -0,0 +1,134 @@ @@ -0,0 +1,134 @@
TITLE ihpyr.mod DCN pyramidal cell model H-current
COMMENT
This model is part a Dorsal Cochlear Nucleus Pyramidal point cell
based on kinetic data from Kanold and Manis (1999) and Kanold's dissertation (1999)
-- 15 Jan 1999 P. Manis
Added export of start states for some variables to do perturbation tests
These start values replace the "inf" values used in the initialization procedure
Note that if the start variable is set to a value less than 0,
then the default initialization will be done. Typically I use a value of -1 for this flagging
Note also that it is possible to set the initial values > 1 but this is meaningless in terms of
the present equations.
-- 5 Feb 1999 P. Manis
Added Patrick's version of ih as ihpyr
Model is from Destexhe and Babloyantz 1993; Destexhe et al. 1993
2/10/02. P. Manis.
7/23/2014 P. Manis - separated from pyr.mod.
ENDCOMMENT
UNITS {
(mA) = (milliamp)
(mV) = (millivolt)
}
NEURON {
THREADSAFE
SUFFIX ihpyr
USEION na READ ena WRITE ina
USEION k READ ek WRITE ik
NONSPECIFIC_CURRENT i
: USEION h READ eh WRITE ih VALENCE 1
RANGE eh
:
RANGE gh, kh_m_inf, kh_n_inf, aih, gbar, ghvshift
RANGE kh_m_tau, kh_n_tau
}
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
PARAMETER {
v (mV)
celsius (degC)
dt (ms)
ek (mV) : = -81.5 (mV)
ena (mV) : = 50.0 (mV)
gbar = 0.00025 (mho/cm2) <0,1e9>
ghvshift = 0 (mV)
eh (mV) : = -43.0(mV)
}
STATE {
khm khn
}
ASSIGNED {
gh (mho/cm2)
ina (mA/cm2)
ik (mA/cm2)
ih (mA/cm2)
i (mA/cm2)
kh_m_inf kh_n_inf
kh_m_tau kh_n_tau
aih
}
BREAKPOINT {
SOLVE states METHOD cnexp
aih = khm*khn
gh = gbar*aih
ih = gh*(v - eh)
i = ih
}
UNITSOFF
INITIAL {
rates(v)
khm = kh_m_inf
khn = kh_n_inf
}
DERIVATIVE states {
rates(v)
khm' = (kh_m_inf - khm) / kh_m_tau
khn' = (kh_n_inf - khn) / kh_n_tau
}
LOCAL q10
PROCEDURE rates(v(mV)) { :Computes rate and other constants at current v.
:Call once from HOC to initialize inf at resting v.
q10 = 3^((celsius - 22)/10 (degC))
:"kh" adaptation of Destexhe hyp-activated cation current by Patrick Kanold
kh_m_inf = kh_m(v)
kh_n_inf = kh_n(v)
kh_m_tau = kh_mt(v)
kh_n_tau = kh_nt(v)
}
: Make these as functions so we can view them from hoc, although this
: may slow things down a bit
FUNCTION kh_m(x (mV)) {
kh_m = 1/(1+exp((x+68.9+ghvshift)/6.5))
}
FUNCTION kh_n(x (mV)) {
kh_n = 1/(1+exp((x+68.9+ghvshift)/6.5)) : same as kh_m, but for completeness, compute this
}
FUNCTION kh_mt(v (mV)) {
kh_mt = exp((v+183.6+ghvshift)/15.24)
}
FUNCTION kh_nt(v (mV)) {
kh_nt = exp((v+158.6+ghvshift)/11.2)/(1+exp((v+75+ghvshift)/5.5))
}

142
cnmodel/mechanisms/ihpyr_adj.mod

@ -0,0 +1,142 @@ @@ -0,0 +1,142 @@
TITLE ihpyr_adj.mod DCN pyramidal cell model H-current
COMMENT
This model is part a Dorsal Cochlear Nucleus Pyramidal point cell
based on kinetic data from Kanold and Manis (1999) and Kanold's dissertation (1999)
-- 15 Jan 1999 P. Manis
Added export of start states for some variables to do perturbation tests
These start values replace the "inf" values used in the initialization procedure
Note that if the start variable is set to a value less than 0,
then the default initialization will be done. Typically I use a value of -1 for this flagging
Note also that it is possible to set the initial values > 1 but this is meaningless in terms of
the present equations.
-- 5 Feb 1999 P. Manis
Added Patrick's version of ih as ihpyr
Model is from Destexhe and Babloyantz 1993; Destexhe et al. 1993
2/10/02. P. Manis.
7/23/2014 P. Manis - separated from pyr.mod.
7/23/2018 P. Manis - created "ihpyr_adj"
ihpyr_adj has an adjustable q10 for fitting against experimental data
ENDCOMMENT
UNITS {
(mA) = (milliamp)
(mV) = (millivolt)
}
NEURON {
THREADSAFE
SUFFIX ihpyr_adj
USEION na READ ena WRITE ina
USEION k READ ek WRITE ik
NONSPECIFIC_CURRENT i
: USEION h READ eh WRITE ih VALENCE 1
RANGE eh
:
RANGE gh, kh_m_inf, kh_n_inf, aih, gbar, ghvshift
RANGE kh_m_tau, kh_n_tau
GLOBAL q10, q10f
}
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
PARAMETER {
v (mV)
celsius (degC)
dt (ms)
ek (mV) : = -81.5 (mV)
ena (mV) : = 50.0 (mV)
gbar = 0.00025 (mho/cm2) <0,1e9>
ghvshift = 0 (mV)
eh (mV) : = -43.0(mV)
q10 = 3.0 (1)
}
STATE {
khm khn
}
ASSIGNED {
gh (mho/cm2)
ina (mA/cm2)
ik (mA/cm2)
ih (mA/cm2)
i (mA/cm2)
kh_m_inf kh_n_inf
kh_m_tau kh_n_tau
aih
q10f (1)
}
BREAKPOINT {
SOLVE states METHOD cnexp
aih = khm*khn
gh = gbar*aih
ih = gh*(v - eh)
i = ih
}
UNITSOFF
INITIAL {
rates(v)
khm = kh_m_inf
khn = kh_n_inf
}
DERIVATIVE states {
rates(v)
khm' = (kh_m_inf - khm) / kh_m_tau
khn' = (kh_n_inf - khn) / kh_n_tau
}
: LOCAL q10f
PROCEDURE rates(v(mV)) { :Computes rate and other constants at current v.
:Call once from HOC to initialize inf at resting v.
q10f = q10^((celsius - 22)/10 (degC))
:"kh" adaptation of Destexhe hyp-activated cation current by Patrick Kanold
: adding q10 does not shift activation curves
kh_m_inf = kh_m(v)
kh_n_inf = kh_n(v)
: adding the q10 just changes the rate for the taus (1/(a+b))
kh_m_tau = kh_mt(v)/q10f
kh_n_tau = kh_nt(v)/q10f
}
: Make these as functions so we can view them from hoc, although this
: may slow things down a bit
FUNCTION kh_m(x (mV)) {
kh_m = 1/(1+exp((x+68.9+ghvshift)/6.5))
}
FUNCTION kh_n(x (mV)) {
kh_n = 1/(1+exp((x+68.9+ghvshift)/6.5)) : same as kh_m, but for completeness, compute this
}
FUNCTION kh_mt(v (mV)) {
kh_mt = exp((v+183.6+ghvshift)/15.24)
}
FUNCTION kh_nt(v (mV)) {
kh_nt = exp((v+158.6+ghvshift)/11.2)/(1+exp((v+75+ghvshift)/5.5))
}

155
cnmodel/mechanisms/ihsgc_apical.mod

@ -0,0 +1,155 @@ @@ -0,0 +1,155 @@
TITLE ihsgc-apical.mod - Spiral Ganglion Cell Ih current for Apical Region
COMMENT
Ih for Spiral ganglion cells.
Kinetcs are based on average fits to mouse SGCs,
This model is for just the apical cell group.
Data used to establish the kinetic parameters were collected by
Qing Liu and Robin Davis (Rutgers).
Data were taken at room temperature.
Kinetic parameters were extracted by curve fitting for fast and
slow components from activation and deactivation (using
the program Ihfit4b.py).
Implementation by Paul B. Manis, January-April, 2012.
Revised December 2013, January 2014.
# of parameters in the fit were decreased (tau uses one v and scale factor).
Parameters are shown in the tables in Liu et al., JARO 2014.
March 13, 2014: Corrected version with boltzmax for slow component
July 2014: made threadsafe, changed solver
pmanis@med.unc.edu
Note: vshift parameter is nominally 0. This parameter can
shift the entire activation and rate curves, keeping them
in register for each component of the conductance.
ENDCOMMENT
UNITS {
(mA) = (milliamp)
(mV) = (millivolt)
(nA) = (nanoamp)
}
NEURON {
THREADSAFE
SUFFIX ihsgcApical
NONSPECIFIC_CURRENT i
RANGE gbar, gh, ih, eh, vshift
RANGE vh, k, vhs, ks
RANGE rinf, rtau, sinf, stau
}
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
PARAMETER {
v (mV)
celsius = 22 (degC)
dt (ms)
gbar = 0.00318 (mho/cm2) <0,1e9>
eh = -41 (mV)
: Parameters from kinetic analysis
: Format for NEURON MOD file:
: (Run on date = 2014-01-01 12:55:35.786524 )
: lmfit, Constrained model t(v) = DC + 1/(a * exp((v+vh)/k1) + a*exp(-(v+vh)/k2))
: A. Fast component (Fast trace):
: Boltzmann:
vh = -101.831 (mV)
k = 12.431 (mV)
vshift = 0.0 (mV)
afast = 0.4225 : fraction that is fast.
: Tau
taufac = 1.0 (1)
taumin = 0 (ms)
tausc1 = 0.00445778 (/ms) : (ms)
vtau1 = 87.0705 (mV)
kfac1 = 53.0338 (mV)
kfac2 = 21.5365 (mV)
: B. Slow component (Cyan trace):
: (Run on date = 2014-01-01 12:55:35.786883 )
: Boltzmann:
svh1 = -86.762 (mV)
sk1 = 4.430 (mV) : double boltzmann
svh2 = -115.227 (mV)
sk2 = 9.675 (mV)
svshift = 0.0 (mV)
sba2 = 0.400557 : relative amplitude slow component 2 compared to slow 1 (slow2/(slow2+slow1))
aslow = 0.5775 : total slow
boltzmax = 0.5019571 : normalization factor
: (computed numerically in Sage to make double boltz max = 1.0)
: stau
staufac = 1.0 (1)
staumin = 0 (ms)
stausc1 = 0.00093656 (/ms) : (ms)
svtau1 = 89.6097 (mV)
skfac1 = 25.392 (mV)
skfac2 = 26.4195 (mV)
}
STATE {
r
s
}
ASSIGNED {
gh (mho/cm2)
i (mA/cm2)
ih (mA/cm2)
rinf
rtau (ms)
sinf
stau (ms)
q10 ()
}
BREAKPOINT {
SOLVE states METHOD cnexp
gh = gbar*(afast*(r^2)+aslow*s) : Balance between fast and slow determined by afast and aslow
ih = gh*(v - eh)
i = ih
}
INITIAL {
q10 = 3.0^((celsius - 22.0)/10.0 (degC)) : adjust for temperature...
rates(v)
r = rinf
s = sinf
}
DERIVATIVE states {
rates(v)
r' = (rinf - r)/rtau
s' = (sinf - s)/stau
}
LOCAL rt, st
PROCEDURE rates(v (mV)) { : Computes rate and activation at voltage = v.
: fast component - standard HH-like kinetics.
rinf = 1.0 / (1+exp((v - vh + vshift) / k))^0.5
rt = tausc1*exp((v + vtau1 + vshift) / kfac1) + tausc1*exp(-(v + vtau1 + vshift) / kfac2)
rtau = (taumin + taufac/rt)
: slow component
: double boltzman activation function (decreasing conductance), unequal sharing.
sinf = 1. / (1 + exp((v - svh1 + vshift) / sk1))
st = 1. / (1 + exp((v - svh2 + vshift) / sk2))
sinf = (1-sba2)*sinf - sba2*st
sinf = sinf/boltzmax : make sinf [0..1]
stau = staufac / (stausc1*exp((v + svtau1 + vshift) / skfac1) + stausc1*exp(-(v + svtau1 + vshift) / skfac2))
stau = (stau + staumin)
}

154
cnmodel/mechanisms/ihsgc_basalmiddle.mod

@ -0,0 +1,154 @@ @@ -0,0 +1,154 @@
TITLE ihsgc-basalmiddle.mod - Spiral Ganglion Cell Ih current for basal and middle Regions
COMMENT
Ih for Spiral ganglion cells.
Kinetcs are based on average fits to mouse SGCs,
This model is for the basal and middle cell groups (averaged).
Data used to establish the kinetic parameters were collected by
Qing Liu and Robin Davis (Rutgers).
Data were taken at room temperature.
Kinetic parameters were extracted by curve fitting for fast and
slow components from activation and deactivation (using
the program Ihfit4b.py).
Implementation by Paul B. Manis, January-April, 2012.
Revised December 2013, January 2014.
# of parameters in the fit were decreased (tau uses one v and scale factor).
Parameters are shown in the tables in Liu et al., JARO 2014.
March 13, 2014: Corrected version with boltzmax for slow component
July 2014: made threadsafe, changed solver
pmanis@med.unc.edu
Note: vshift parameter is nominally 0. This parameter can
shift the entire activation and rate curves, keeping them
in register for each component of the conductance.
ENDCOMMENT
UNITS {
(mA) = (milliamp)
(mV) = (millivolt)
(nA) = (nanoamp)
}
NEURON {
THREADSAFE
SUFFIX ihsgcBasalMiddle
NONSPECIFIC_CURRENT i
RANGE gbar, gh, ih, eh, vshift
RANGE vh, k, vhs, ks
RANGE rinf, rtau, sinf, stau
}
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
PARAMETER {
v (mV)
celsius = 22 (degC)
dt (ms)
gbar = 0.00318 (mho/cm2) <0,1e9>
eh = -41 (mV)
: Parameters from kinetic analysis
: Formatted for NEURON MOD file
: (Run on date = 2014-01-01 12:52:22.776598 )
: lmfit, Constrained model t(v) = DC + 1/(a * exp((v+vh)/k1) + a*exp(-(v+vh)/k2))
: A. Fast component (Fast trace):
: Boltzmann:
vh = -105.298 (mV)
k = 12.359 (mV)
vshift = 0.0 (mV)
afast = 0.4471 : fraction that is fast.
: Tau
taufac = 1.0 (1)
taumin = 0 (ms)
tausc1 = 0.00417518 (/ms)
vtau1 = 87.0836 (mV)
kfac1 = 28.1667 (mV)
kfac2 = 21.4809 (mV)
: B. Slow component:
: (Run on date = 2014-01-01 12:52:22.777259 )
: Boltzmann:
svh1 = -91.860 (mV)
sk1 = 4.883 (mV) : double boltzmann
svh2 = -110.209 (mV)
sk2 = 3.927 (mV)
svshift = 0.0 (mV)
sba2 = 0.337216 : relative amplitude slow component 2 compared to slow 1 (slow2/(slow2+slow1))
aslow = 0.5529 : total slow
boltzmax = 0.5551729 : normalization factor
: (computed numerically in Sage to make double boltz max = 1.0)
: stau
staufac = 1.0 (1)
staumin = 0 (ms)
stausc1 = 0.00104354 (/ms)
svtau1 = 105.816 (mV)
skfac1 = 40.0291 (mV)
skfac2 = 20.2273 (mV)
}
STATE {
r
s
}
ASSIGNED {
gh (mho/cm2)
i (mA/cm2)
ih (mA/cm2)
rinf
rtau (ms)
sinf
stau (ms)
q10 ()
}
BREAKPOINT {
SOLVE states METHOD cnexp
gh = gbar*(afast*(r^2)+aslow*s) : Balance between fast and slow determined by afast and aslow
ih = gh*(v - eh)
i = ih
}
INITIAL {
q10 = 3.0^((celsius - 22.0)/10.0 (degC)) : adjust for temperature...
rates(v)
r = rinf
s = sinf
}
DERIVATIVE states { : Updates state variables r and s
rates(v) : at the current voltage
r' = (rinf - r )/rtau
s' = (sinf - s)/stau
}
LOCAL rt, st
PROCEDURE rates(v (mV)) { : Computes rate and activation at voltage = v.
: fast component - standard HH-like kinetics.
rinf = 1.0 / (1+exp((v - vh + vshift) / k))^0.5
rt = tausc1*exp((v + vtau1 + vshift) / kfac1) + tausc1*exp(-(v + vtau1 + vshift) / kfac2)
rtau = (taumin + taufac/rt)
: slow component
: double boltzman activation function (decreasing conductance), unequal sharing.
sinf = 1. / (1 + exp((v - svh1 + vshift) / sk1))
st = 1. / (1 + exp((v - svh2 + vshift) / sk2))
sinf = (1-sba2)*sinf - sba2*st
sinf = sinf/boltzmax : make sinf [0..1]
stau = staufac / (stausc1*exp((v + svtau1 + vshift) / skfac1) + stausc1*exp(-(v + svtau1 + vshift) / skfac2))
stau = (stau + staumin)
}

79
cnmodel/mechanisms/ihvcn.mod

@ -0,0 +1,79 @@ @@ -0,0 +1,79 @@
TITLE jsr.mod VCN conductances
COMMENT
Ih for VCN neurons - average from several studies in auditory neurons
Implementation by Paul B. Manis, April (JHU) and Sept, (UNC)1999.
revised 2/28/04 pbm
pmanis@med.unc.edu
Modifed implementation; includes all temperature scaling, passes modlunit
7/10/2014 pbm
ENDCOMMENT
UNITS {
(mA) = (milliamp)
(mV) = (millivolt)
(nA) = (nanoamp)
}
NEURON {
THREADSAFE
SUFFIX ihvcn
NONSPECIFIC_CURRENT i
RANGE gbar, gh, i, eh
GLOBAL rinf, rtau
}
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
PARAMETER {
v (mV)
dt (ms)
gbar = 0.00318 (mho/cm2) <0,1e9>
q10tau = 3.0
}
STATE {
r
}
ASSIGNED {
celsius (degC)
gh (mho/cm2)
eh (mV)
i (mA/cm2)
rinf
rtau (ms)
q10 ()
}
BREAKPOINT {
SOLVE states METHOD cnexp
gh = gbar*r
i = gh*(v - eh)
}
INITIAL {
q10 = q10tau^((celsius - 22)/10 (degC)) : if you don't like room temp, it can be changed!
rates(v)
r = rinf
}
DERIVATIVE states { :Computes state variables m, h, and n
rates(v) : at the current v and dt.
r' = (rinf - r)/rtau
}
PROCEDURE rates(v (mV)) { :Computes rate and other constants at current v.
:Call once from HOC to initialize inf at resting v.
rinf = 1 / (1+exp((v + 76) / 7 (mV)))
rtau = (100000 (ms)/ (237*exp((v+60) / 12 (mV)) + 17*exp(-(v+60) / 14 (mV)))) + 25
rtau = rtau/q10
}

188
cnmodel/mechanisms/inav11.mod

@ -0,0 +1,188 @@ @@ -0,0 +1,188 @@
:
: ichanWT2005.mod
:
: Alan Goldin Lab, University of California, Irvine
: Jay Lickfett - Last Modified: 6 July 2005
:
: This file is the Nav1.1 wild-type channel model described in:
:
: Barela et al. An Epilepsy Mutation in the Sodium Channel SCN1A That Decreases
: Channel Excitability. J. Neurosci. 26(10): p. 2714-2723
:
:
: The model is derived from the one described in:
:
: Spampanato et al. (2004a) Increased Neuronal Firing in Computer Simulations
: of Sodium Channel Mutations that Cause Generalized Epilepsy with Febrile Seizures Plus.
: Journal of Neurophysiology 91:2040-2050
:
: and
:
: Spampanato et al. (2004b) A Novel Epilepsy Mutation
: in the Sodium Channel SCN1A Identifies a Cytoplasmic Domain for
: Beta Subunit Interaction. J. Neurosci. 24(44):10022-10034
:
: delayed rectifier removed (p.b.manis 2/22/2009)
UNITS {
(mA) = (milliamp)
(mV) = (millivolt)
(uF) = (microfarad)
(molar) = (1/liter)
(nA) = (nanoamp)
(mM) = (millimolar)
(um) = (micron)
(S) = (siemens)
FARADAY = 96520 (coul)
R = 8.3134 (joule/degC)
}
NEURON {
THREADSAFE
SUFFIX nav11
USEION na READ ena WRITE ina VALENCE 1
RANGE gna
RANGE gbar
RANGE minf, mtau, hinf, htau, sinf, stau, inat, m, h, s
RANGE vsna : voltage shift parameter
}
INDEPENDENT {t FROM 0 TO 100 WITH 100 (ms)}
PARAMETER {
vsna = 4.3 (mV)
celsius (degC)
dt (ms)
ena (mV)
:enat = 50 (mV)
gbar = 0.1 (mho/cm2)
q10 = 3.0 (1)
}
ASSIGNED {
v (mV)
gna (mho/cm2)
ina (mA/cm2)
minf hinf sinf
mtau (ms) htau (ms) stau (ms)
mexp hexp sexp
: vsna (mV)
}
STATE {
m h s
}
BREAKPOINT {
SOLVE states METHOD cnexp
gna = gbar*m*m*m*h*s
ina = gna*(v - ena)
}
UNITSOFF
INITIAL {
trates(v)
m = minf
h = hinf
s = sinf
}
DERIVATIVE states { : Computes state variables m, h, s and n
: at the current v and dt.
rates(v)
m' = (minf - m)/mtau
h' = (hinf - h)/htau
s' = (sinf - s)/stau
}
LOCAL qt
PROCEDURE rates(v (mV)) { :Computes rate and other constants at current v.
:Call once from HOC to initialize inf at resting v.
LOCAL alpha, beta, sum
qt = q10^((celsius - 22)/10) : original recordings in Barela et al made at "room temperature"
: "m" sodium activation system
minf = f_minf(v)
mtau = f_mtau(v)/qt
: "h" sodium fast inactivation system
hinf = f_hinf(v)
htau = f_htau(v)/qt
: "s" sodium slow inactivation system
sinf = f_sinf(v)
stau = f_stau(v)/qt
}
PROCEDURE trates(v (mV)) { :Build table with rate and other constants at current v.
:Call once from HOC to initialize inf at resting v.
LOCAL tinc
TABLE minf, mexp, hinf, hexp, sinf, sexp, mtau, htau, stau
DEPEND dt, celsius FROM -100 TO 100 WITH 200
rates(v) : not consistently executed from here if usetable_hh == 1
: so don't expect the tau values to be tracking along with
: the inf values in hoc
tinc = -dt : * q10 q10 is handled in rates, above
mexp = 1 - exp(tinc/mtau)
hexp = 1 - exp(tinc/htau)
sexp = 1 - exp(tinc/stau)
}
FUNCTION f_minf(v (mV)) {
f_minf = 1/(1+exp(-(v+27.4+vsna)*4.7*0.03937))
}
FUNCTION f_mtau(v (mV)) {
f_mtau = 0.15
}
FUNCTION f_hinf(v (mV)) {
f_hinf = 1/(1+exp((v+41.9+vsna)/6.7))
}
FUNCTION f_htau(v (mV)) {
f_htau = 23.12*exp(-0.5*((v+77.58+vsna)/43.92)^2)
}
FUNCTION f_sinf(v (mV)) {
f_sinf = 1/(1+exp((v+46.0+vsna)/6.6))
}
FUNCTION f_stau(v (mV)) {
f_stau = 1000*140.4*exp(-0.5*((v+71.3+vsna)/30.9)^2)
}
UNITSON

136
cnmodel/mechanisms/jsrnaf.mod

@ -0,0 +1,136 @@ @@ -0,0 +1,136 @@
TITLE jsrnaf.mod VCN Na conductance, fast model
COMMENT
gnaf is the modified form used in his
1993 M.S. thesis (as in Rothman et al., J. Neurophysiol. 70:2562, 1993),
with rapid recovery from inactivation for potentials below rest.
Implementation by Paul B. Manis, April and Sept, 1999.
ENDCOMMENT
UNITS {
(mA) = (milliamp)
(mV) = (millivolt)
(nA) = (nanoamp)
}
? interface
NEURON {
THREADSAFE
SUFFIX jsrna
USEION na READ ena WRITE ina
RANGE gbar
RANGE gna, vsna
RANGE minf, hinf, mtau, htau
}
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
PARAMETER {
v (mV)
dt (ms)
ena = 55 (mV)
gbar = 0.25 (mho/cm2) <0,1e9>
vsna = 0 (mV)
q10 = 3.0 (1)
}
STATE {
m h
}
ASSIGNED {
gna (mho/cm2)
ina (mA/cm2)
minf hinf
mtau (ms) htau (ms)
celsius (degC)
}
LOCAL mexp, hexp
? currents
BREAKPOINT {
SOLVE states METHOD cnexp
gna = gbar*(m^3)*h
ina = gna*(v - ena)
}
UNITSOFF
INITIAL {
trates(v)
m = minf
h = hinf
}
DERIVATIVE states { :Computes state variables m, h, and n
trates(v) : at the current v and dt.
m' = (minf - m)/mtau
h' = (hinf - h)/htau
}
LOCAL qt
PROCEDURE rates(v (mV)) { :Computes rate and other constants at current v.
:Call once from HOC to initialize inf at resting v.
LOCAL alpha, beta, sum
qt = q10^((celsius - 22)/10 (degC)) : R&M'03 used 3
: Note qt temperature here cancels in minf (a/(a+b))
:"m" sodium activation system - JSR
alpha = -0.36*qt*vtrap((v+49),-3)
beta = 0.4*qt*vtrap((v+58),20)
sum = alpha + beta
mtau = 1/sum
minf = alpha/sum
:"h" sodium inactivation system - JSR
alpha = 2.4*qt/(1+exp((v+68-vsna)/3 (mV))) + 0.8*qt/(1+exp(v+61.3-vsna))
beta = 3.6*qt/(1+exp(-(v+21-vsna)/10 (mV)))
sum = alpha + beta
htau = 1/sum
hinf = alpha/sum
: jsr modified sodium channel - defined in terms of alpha and beta this time
: am = (0.36*q10*(v+49))/(1-exp(-((v+49)/3)))
: am = -(0.36*q10*vtrap(-(v+49),3))
: bm = -(0.40*q10*(v+58))/(1-exp((v+58)/20))
: bm = (0.40*q10*vtrap((v+58),20))
: ah = ((2.4*q10)/(1+exp((v+68)/3))) + (0.8*qten/(1+exp(v+61.3)))
: bh = (3.6*q10)/(1+exp(-(v+21)/10))
: minf = am/(am+bm)
: hinf = ah/(ah+bh)
: mtau = 1/(am+bm)
: htau = 1/(ah+bh)
}
PROCEDURE trates(v (mV)) { :Computes rate and other constants at current v.
:Call once from HOC to initialize inf at resting v.
LOCAL tinc
rates(v) : not consistently executed from here if usetable_hh == 1
: so don't expect the tau values to be tracking along with
: the inf values in hoc
tinc = -dt : * q10 # handled in rates now
mexp = 1 - exp(tinc/mtau)
hexp = 1 - exp(tinc/htau)
}
FUNCTION vtrap(x,y) { :Traps for 0 in denominator of rate eqns.
if (fabs(x/y) < 1e-6) {
vtrap = y*(1 - x/y/2)
}else{
vtrap = x/(exp(x/y) - 1)
}
}

104
cnmodel/mechanisms/ka.mod

@ -0,0 +1,104 @@ @@ -0,0 +1,104 @@
TITLE klt.mod The low threshold conductance of cochlear nucleus neurons
COMMENT
NEURON implementation of Jason Rothman's measurements of VCN conductances.
This file implements the transient potassium current found in ventral cochlear
nucleus "Type I" cells, which are largely "stellate" or "multipolar" cells (Manis and
Marx, 1991; Rothman and Manis, 2003a,b; Manis et al, 1996). The current is likely
mediated by Kv4.2 potassium channel subunits, but this has not been directly
demonstrated. The specific implementation is described in Rothman and Manis, J.
Neurophysiol. 2003, in the appendix. Measurements were made from isolated
neurons from adult guinea pig, under reasonably stringent voltage clamp conditions.
The measured current is sensitive to 4-aminopyridine.
Original implementation by Paul B. Manis, April (JHU) and Sept, (UNC)1999.
File split implementaiton, April 1, 2004.
Contact: pmanis@med.unc.edu
ENDCOMMENT
UNITS {
(mA) = (milliamp)
(mV) = (millivolt)
(nA) = (nanoamp)
}
NEURON {
THREADSAFE
SUFFIX ka
USEION k READ ek WRITE ik
RANGE gbar, gka, ik
GLOBAL ainf, binf, cinf, atau, btau, ctau
}
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
PARAMETER {
v (mV)
dt (ms)
gbar = 0.00477 (mho/cm2) <0,1e9>
q10tau = 3.0
q10g = 2.0
}
STATE {
a b c
}
ASSIGNED {
celsius (degC) : model is defined on measurements made at room temp in Baltimore
ik (mA/cm2)
ek (mV)
gka (mho/cm2)
ainf binf cinf
atau (ms) btau (ms) ctau (ms)
qg () : computed q10 for gnabar based on q10g
q10 ()
}
LOCAL aexp, bexp, cexp
BREAKPOINT {
SOLVE states METHOD cnexp
gka = gbar*(a^4)*b*c
ik = gka*(v - ek)
}
INITIAL {
qg = q10g^((celsius-22)/10 (degC))
q10 = q10tau^((celsius - 22)/10 (degC)) : if you don't like room temp, it can be changed!
rates(v)
a = ainf
b = binf
c = cinf
}
DERIVATIVE states { :Computes state variables m, h, and n
rates(v) : at the current v and dt.
a' = (ainf - a)/atau
b' = (binf - b)/btau
c' = (cinf - c)/ctau
}
PROCEDURE rates(v (mV)) { :Computes rate and other constants at current v.
:Call once from HOC to initialize inf at resting v.
ainf = (1 / (1 + exp(-1*(v + 31) / 6 (mV))))^0.25
binf = 1 / (1 + exp((v + 66) / 7 (mV)))^0.5
cinf = 1 / (1 + exp((v + 66) / 7 (mV)))^0.5
atau = (100 (ms)/ (7*exp((v+60) / 14 (mV)) + 29*exp(-(v+60) / 24 (mV)))) + 0.1
atau = atau/q10
btau = (1000 (ms) / (14*exp((v+60) / 27 (mV)) + 29*exp(-(v+60) / 24 (mV)))) + 1
btau = btau/q10
ctau = (90 (ms)/ (1 + exp((-66-v) / 17 (mV)))) + 10
ctau = ctau/q10
}

72
cnmodel/mechanisms/kcnq.mod

@ -0,0 +1,72 @@ @@ -0,0 +1,72 @@
TITLE KCNQ potassium channel for GPe neuron
COMMENT
modeled by Gunay et al., 2008
implemented in NEURON by Kitano, 2011
Threadsafe and unit checking, P.B. Manis, 2014
ENDCOMMENT
UNITS {
(mV) = (millivolt)
(mA) = (milliamp)
}
NEURON {
THREADSAFE
SUFFIX kcnq
USEION k READ ek WRITE ik
RANGE gbar, gk, iKCNQ
}
PARAMETER {
v (mV)
dt (ms)
gbar = 0.001 (mho/cm2)
iKCNQ = 0.0 (mA/cm2)
ek (mV)
theta_m = -61.0 (mV)
k_m = 19.5 (mV)
tau_m0 = 6.7 (ms)
tau_m1 = 100.0 (ms)
phi_m = -61.0 (mV)
sigma_m0 = 35.0 (mV)
sigma_m1 = -25.0 (mV)
}
STATE {
m
}
ASSIGNED {
ik (mA/cm2)
gk (mho/cm2)
minf
taum (ms)
}
BREAKPOINT {
SOLVE states METHOD cnexp
gk = gbar*m*m*m*m
ik = gk * (v-ek)
iKCNQ = ik
}
INITIAL {
settables(v)
m = minf
}
DERIVATIVE states {
settables(v)
m' = (minf - m)/taum
}
PROCEDURE settables(v (mV)) {
TABLE minf, taum FROM -100 TO 100 WITH 400
minf = 1.0 / (1.0 + exp((theta_m - v)/k_m))
taum = tau_m0 + (tau_m1 - tau_m0)/(exp((phi_m - v)/sigma_m0) + exp((phi_m - v)/sigma_m1))
}

92
cnmodel/mechanisms/kdpyr.mod

@ -0,0 +1,92 @@ @@ -0,0 +1,92 @@
TITLE kdpyr.mod DCN pyramidal cell model, delayed rectifier
COMMENT
This is part of a model implements a Dorsal Cochlear Nucleus Pyramidal point cell
based on kinetic data from Kanold and Manis (1999) and Kanold's dissertation (1999)
-- 15 Jan 1999 P. Manis
Added export of start states for some variables to do perturbation tests
These start values replace the "inf" values used in the initialization procedure
Note that if the start variable is set to a value less than 0,
then the default initialization will be done. Typically I use a value of -1 for this flagging
Note also that it is possible to set the initial values > 1 but this is meaningless in terms of
the present equations.
-- 5 Feb 1999 P. Manis
ENDCOMMENT
UNITS {
(mA) = (milliamp)
(mV) = (millivolt)
}
NEURON {
THREADSAFE
SUFFIX kdpyr
USEION k READ ek WRITE ik
RANGE gbar, gk : delayed rectifier
RANGE ntau: time constants delayed rectifier
RANGE kd_avh
}
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
PARAMETER {
v (mV)
celsius (degC)
dt (ms)
ek (mV) : = -81.5 (mV)
gbar = 0.006667 (mho/cm2) <0,1e9>
ntau = 0.5 (ms) <0.1,100>
kd_avh = -40 (mV)
}
STATE {
n
}
ASSIGNED {
gk (mho/cm2)
ik (mA/cm2)
ninf
}
LOCAL nexp
BREAKPOINT {
SOLVE states METHOD cnexp
gk = gbar*n*n
ik = gk*(v - ek)
}
INITIAL {
rates(v)
n = ninf
}
DERIVATIVE states {
rates(v)
n' = (ninf - n) / ntau
}
LOCAL q10
PROCEDURE rates(v(mV)) { :Computes rate and other constants at current v.
:Call once from HOC to initialize inf at resting v.
LOCAL alpha, beta, sum
TABLE ninf, ntau DEPEND celsius FROM -200 TO 100 WITH 400
q10 = 3^((celsius - 22)/10 (degC))
: "n" potassium activation system
ninf = kd_m(v)
}
: Make these as functions so we can view them from hoc, although this
: may slow things down a bit
FUNCTION kd_m(x (mV)) { : potassium activation
kd_m = 1/(1+exp(-(x-kd_avh)/(3 (mV)))) : flat time constants
}

111
cnmodel/mechanisms/kht.mod

@ -0,0 +1,111 @@ @@ -0,0 +1,111 @@
TITLE kht.mod The high threshold conductance of cochlear nucleus neurons
COMMENT
NEURON implementation of Jason Rothman's measurements of VCN conductances.
This file implements the high threshold potassium current found in several brainstem
nuclei of the auditory system, including the spherical and globular bushy cells
(Manis and Marx, 1991; Rothman and Manis, 2003a,b) and multipolar (stellate)
cells of the ventral cochlear nucleus, principal cells of the medial
nucleus of the trapzoid body (Brew and Forsythe, 1995, Wang and Kaczmarek,
1997) and neurons of the medial superior olive. The current is likely mediated by
Kv3.1 potassium channel subunits. The specific
implementation is described in Rothman and Manis, J. Neurophysiol. 2003, in the
appendix. Measurements were made from isolated neurons from adult guinea pig,
under reasonably stringent voltage clamp conditions. The measured current is
sensitive to 4-aminopyridine and TEA, but is spared by mamba snake toxi
dendrotoxin I.
Similar conductrances are found in the homologous neurons of the avian auditory
system (Reyes and Rubel; Zhang and Trussell; Rathouz and Trussell), and the
conductance described here, in the absence of more detailed kinetic measurements
, is probably suitable for use in modeling that system.
Original implementation by Paul B. Manis, April (JHU) and Sept, (UNC)1999.
File split implementation, February 28, 2004.
Contact: pmanis@med.unc.edu
ENDCOMMENT
UNITS {
(mA) = (milliamp)
(mV) = (millivolt)
(nA) = (nanoamp)
}
NEURON {
THREADSAFE
SUFFIX kht
USEION k READ ek WRITE ik
RANGE gbar, gkht, ik, q10g
GLOBAL ninf, pinf, ntau, ptau
}
:INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
ASSIGNED {
celsius (degC) : model is defined on measurements made at room temp in Baltimore: 22 degC
ik (mA/cm2)
ek (mV)
gkht (mho/cm2)
pinf ninf
ptau (ms)
ntau (ms)
qg () : computed q10 for gnabar based on q10g
q10 ()
}
PARAMETER {
v (mV)
dt (ms)
gbar = 0.01592 (mho/cm2) <0,1e9>
nf = 0.85 <0,1> :proportion of n vs p kinetics
q10tau = 3.0
q10g = 2.0
}
STATE {
n p
}
LOCAL nexp, pexp
BREAKPOINT {
SOLVE states METHOD cnexp
gkht = qg*gbar*(nf*(n^2) + (1-nf)*p)
ik = gkht*(v - ek)
}
INITIAL {
qg = q10g^((celsius-22)/10 (degC))
q10 = q10tau^((celsius - 22)/10 (degC))
rates(v)
p = pinf
n = ninf
}
DERIVATIVE states { :Computes state variables m, h, and n
rates(v) : at the current v and dt.
n' = (ninf - n)/ntau
p' = (pinf - p)/ptau
}
PROCEDURE rates(v (mV)) { :Computes rate and other constants at current v.
:Call once from HOC to initialize inf at resting v.
ninf = (1 + exp(-(v + 15) / 5 (mV)))^-0.5
pinf = 1 / (1 + exp(-(v + 23) / 6 (mV)))
ntau = (100 (ms)/ (11*exp((v+60) / 24 (mV)) + 21*exp(-(v+60) / 23 (mV)))) + 0.7
ntau = ntau/q10
ptau = (100 (ms)/ (4*exp((v+60) / 32 (mV)) + 5*exp(-(v+60) / 22 (mV)))) + 5
ptau = ptau/q10
}

128
cnmodel/mechanisms/kif.mod

@ -0,0 +1,128 @@ @@ -0,0 +1,128 @@
TITLE kif.mod DCN pyramidal cell model fast transient current
COMMENT
This model implements a fast transient potassium current from
Dorsal Cochlear Nucleus Pyramidal cells
based on kinetic data from Kanold and Manis (1999) and Kanold's dissertation (1999)
-- 15 Jan 1999 P. Manis
2/10/02. P. Manis.
Pulled from pyr.mod 7/24/2014
ENDCOMMENT
UNITS {
(mA) = (milliamp)
(mV) = (millivolt)
}
NEURON {
SUFFIX kif
USEION k READ ek WRITE ik
RANGE gkif, kif_a_inf, kif_i_inf : fast inactivating potassium current
RANGE akif, gbar
RANGE kif_a_tau, kif_i_tau
RANGE kif_a_start, kif_i_start
RANGE kif_ivh, kif_avh, kif_hivh
}
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
PARAMETER {
v (mV)
celsius (degC)
dt (ms)
ek (mV) : = -81.5 (mV)
ena (mV) : = 50.0 (mV)
gbar = 0.0125 (mho/cm2) <0,1e9>
kif_ivh = -89.6 (mV)
kif_avh = -57.0 (mV)
kif_hivh = -87.0 (mV)
kif_a_start = -1 (1)
kif_i_start = -1 (1)
}
STATE {
kifa kifi
}
ASSIGNED {
gkif (mho/cm2)
ik (mA/cm2)
kif_a_inf (1)
kif_i_inf (1)
kif_a_tau (ms)
kif_i_tau (ms)
akif ()
q10 ()
}
BREAKPOINT {
SOLVE states METHOD cnexp
akif = kifa*kifa*kifa*kifa*kifi
gkif = gbar*akif
ik = gkif*(v - ek)
}
INITIAL {
q10 = 3^((celsius - 22)/10 (degC))
rates(v)
if(kif_a_start < 0) { : if xx_(i/a)_start is > 0, then perturbation is done at onset of computations.
kifa = kif_a_inf
} else {
kifa = kif_a_start
}
if(kif_i_start < 0) {
kifi = kif_i_inf
} else {
kifi = kif_i_start
}
}
DERIVATIVE states {
rates(v)
kifa' = (kif_a_inf - kifa) / kif_a_tau
kifi' = (kif_i_inf - kifi) / kif_i_tau
}
PROCEDURE rates(v(mV)) { :Computes rate and other constants at current v.
:Call once from HOC to initialize inf at resting v.
: LOCAL alpha, beta, sum
: TABLE kif_a_inf, kif_a_tau, kif_i_inf, kif_i_tau DEPEND celsius, kif_avh, kif_ivh FROM -200 TO 100 WITH 400
: "kif" fast inactivation potassium channel - activation and inactivation
kif_a_inf = kif_m(v)
kif_i_inf = kif_h(v)
kif_a_tau = kif_mt(v)
kif_i_tau = kif_ht(v)
}
: Make these as functions so we can view them from hoc, although this
: may slow things down a bit
FUNCTION kif_m(v ) { : ikif activation
kif_m = 1.0/(1+exp(-(v-kif_avh)/25.8 (mV)))
}
FUNCTION kif_h(v (mV)) { : ikif inactivation
kif_h = 1.0/(1+exp((v-kif_ivh)/6.7 (mV)))
}
FUNCTION kif_mt(v (mV)) (ms) { : ikif activation tau
LOCAL x
x = 0.15 * exp((v-kif_avh)/10 (mV)) + 0.3 *exp(-(v-kif_avh)/10 (mV))
x = 0.5 + (1.0 /x)
kif_mt = (x * 1.0 (ms))/q10
}
FUNCTION kif_ht(v (mV)) (ms) { : ikif inactivation tau
LOCAL x
x = 0.015 * exp((v-kif_hivh)/20 (mV))+0.03*exp(-(v-kif_hivh)/20 (mV))
x = 10 + (1./x)
kif_ht = (x * 1.0 (ms)) /q10
}

108
cnmodel/mechanisms/kir.mod

@ -0,0 +1,108 @@ @@ -0,0 +1,108 @@
TITLE KIR channel
COMMENT
Reference: Steephen JE, Manchanda R (2009) Differences in biophysical
properties of nucleus accumbens medium spiny neurons emerging from
inactivation of inward rectifying potassium currents. J Comput Neurosci [PubMed]
Found on ModelDB, 1/21/2013 PBManis
ENDCOMMENT
NEURON {
SUFFIX KIR
USEION k READ ek WRITE ik
RANGE g, ik, gbar
GLOBAL minf, mtau
}
UNITS {
(mA) = (milliamp)
(uA) = (microamp)
(mV) = (millivolt)
(mS) = (millimho)
}
PARAMETER {
celsius (degC)
ek (mV)
gbar = 1.4e-4 (mho/cm2) <0,1e9>
m_vh = -82 (mV) : half activation
m_ve = 13 (mV) : slope
}
ASSIGNED {
v (mV)
g (mho/cm2)
ik (mA/cm2)
minf (1)
mtau (ms)
qt (1)
}
STATE {
m
}
BREAKPOINT {
SOLVE states METHOD cnexp
g = gbar*m
ik = g*(v - ek)
}
INITIAL {
qt = 3^((celsius-35)/10)
rates(v)
m = minf
}
DERIVATIVE states {
rates(v)
m' = (minf-m)/mtau
}
FUNCTION_TABLE tabmtau(v(mV)) (ms)
: rates() computes rate and other constants at present v
: call once from hoc to initialize inf at resting v
PROCEDURE rates(v(mV)) {
: mtau = tabmtau(v)
mtau = tabmtau(v)/qt
minf = 1/(1 + exp((v - m_vh)/m_ve))
}
COMMENT
/* TABLES
The tables here are built as vecs in hoc, and then loaded into the mod file arrays before use...
*
* Steephen, J. E., & Manchanda, R. (2009). Differences in biophysical properties of nucleus accumbens medium spiny neurons emerging from inactivation of inward rectifying potassium currents. J Comput Neurosci,
* doi:10.1007/s10827-009-0161-7
*/
//KIR
objref vecmtau_KIR, vecv_KIR
vecmtau_KIR = new Vector()
vecv_KIR = new Vector()
vecv_KIR.indgen(-120, 0, 10)
vecmtau_KIR.append(7.465, 7.465, 7.465, 8, 9.435, 10.755, 12.12, 13.795, 15.385, 14.285, 11.765, 8.89, 8) // At 35 deg C
table_tabmtau_KIR(&vecmtau_KIR.x[0], vecv_KIR.size, &vecv_KIR.x[0])
//inKIR
objref vecv_inKIR, vechinf_inKIR, vechtau_inKIR, vecv_tau_inKIR
vecv_tau_inKIR = new Vector()
vechtau_inKIR= new Vector()
vecv_tau_inKIR.append(-120,-90, -50)
vechtau_inKIR.append(7.767, 15, 25.333) // At 35 deg C
table_tabhtau_inKIR(&vechtau_inKIR.x[0],vecv_tau_inKIR.size, &vecv_tau_inKIR.x[0])
vecv_inKIR = new Vector()
vechinf_inKIR = new Vector()
vecv_inKIR.append(-120,-90, -50)
vechinf_inKIR.append(0, 0.13, 1)
table_tabhinf_inKIR(&vechinf_inKIR.x[0], vecv_inKIR.size, &vecv_inKIR.x[0])
table_tabmtau_inKIR(&vecmtau_KIR.x[0], vecv_KIR.size, &vecv_KIR.x[0])
ENDCOMMENT

123
cnmodel/mechanisms/kis.mod

@ -0,0 +1,123 @@ @@ -0,0 +1,123 @@
TITLE kis.mod DCN pyramidal cell model Slow transient K current
COMMENT
This model implements the slow transient potassium current from
Dorsal Cochlear Nucleus Pyramidal cells
based on kinetic data from Kanold and Manis (1999) and Kanold's dissertation (1999)
-- 15 Jan 1999 P. Manis
2/10/02, 7/24/2014. P. Manis.
ENDCOMMENT
UNITS {
(mA) = (milliamp)
(mV) = (millivolt)
}
NEURON {
THREADSAFE
SUFFIX kis
USEION k READ ek WRITE ik
RANGE gkis, kis_a_inf, kis_i_inf : fast inactivating potassium current
RANGE akis, gbar
RANGE kis_a_tau, kis_i_tau
RANGE kis_a_start, kis_i_start
}
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
PARAMETER {
v (mV)
celsius (degC)
dt (ms)
ek (mV) : = -81.5 (mV)
ena (mV) : = 50.0 (mV)
gbar = 0.0033333 (mho/cm2) <0,1e9>
kis_ivh = -40.9 (mV)
kis_avh = -38.4 (mV)
kis_a_start = -1
kis_i_start = -1
}
STATE {
kisa kisi
}
ASSIGNED {
gkis (mho/cm2)
ik (mA/cm2)
kis_a_inf kis_i_inf
kis_a_tau (ms)
kis_i_tau (ms)
akis
q10 ()
}
BREAKPOINT {
SOLVE states METHOD cnexp
akis = kisa*kisa*kisa*kisa*kisi
gkis = gbar*akis
ik = gkis*(v - ek)
}
INITIAL {
q10 = 3^((celsius - 22)/10 (degC))
rates(v)
if(kis_a_start < 0) { : if xx_(i/a)_start is > 0, then perturbation is done at onset of computations.
kisa = kis_a_inf
} else {
kisa = kis_a_start
}
if(kis_i_start < 0) {
kisi = kis_i_inf
} else {
kisi = kis_i_start
}
}
DERIVATIVE states {
rates(v)
kisa' = (kis_a_inf - kisa) / kis_a_tau
kisi' = (kis_i_inf - kisi) / kis_i_tau
}
PROCEDURE rates(v (mV)) { :Computes rate and other constants at current v.
:Call once from HOC to initialize inf at resting v.
: "kis" fast inactivation potassium channel - activation and inactivation
kis_a_inf = kis_m(v)
kis_i_inf = kis_h(v)
kis_a_tau = kis_mt(v)
kis_i_tau = kis_ht(v)
}
: Make these as functions so we can view them from hoc, although this
: may slow things down a bit
FUNCTION kis_m(v (mV)) { : ikis activation
kis_m = 1/(1+exp(-(v-kis_avh)/23.7 (mV)))
}
FUNCTION kis_h(v (mV)) { : ikis inactivation
kis_h = 1/(1+exp((v-kis_ivh)/9 (mV)))
}
FUNCTION kis_mt(v (mV)) (ms) { : ikis activation tau
LOCAL x
x = 0.15*exp((v-kis_avh)/10 (mV)) + 0.3*exp(-(v-kis_avh)/10 (mV))
x = 0.5 + (1.0 /x)
kis_mt = (x * 1.0 (ms))/q10
}
FUNCTION kis_ht(v (mV)) (ms) { : ikis inactivation tau
kis_ht = 200 (ms)
}

109
cnmodel/mechanisms/klt.mod

@ -0,0 +1,109 @@ @@ -0,0 +1,109 @@
TITLE klt.mod The low threshold conductance of cochlear nucleus neurons
COMMENT
NEURON implementation of Jason Rothman's measurements of VCN conductances.
This file implements the low threshold potassium current found in several brainstem
nuclei of the auditory system, including the spherical and globular bushy cells
(Manis and Marx, 1991; Rothman and Manis, 2003a,b) and octopus cells (Bal and
Oertel, 2000) of the ventral cochlear nucleus, principal cells of the medial
nucleus of the trapzoid body (Brew and Forsythe, 1995, Wang and Kaczmarek,
1997) and neurons of the medial superior olive. The current is likely mediated by
heteromultimers of Kv1.1 and Kv1.2 potassium channel subunits. The specific
implementation is described in Rothman and Manis, J. Neurophysiol. 2003, in the
appendix. Measurements were made from isolated neurons from adult guinea pig,
under reasonably stringent voltage clamp conditions. The measured current is
sensitive to the mamba snake toxin dendrotoxin-I.
Similar conductrances are found in the homologous neurons of the avian auditory
system (Reyes and Rubel; Zhang and Trussell; Rathouz and Trussell), and the
conductance described here, in the absence of more detailed kinetic measurements
, is probably suitable for use in modeling that system.
Original implementation by Paul B. Manis, April (JHU) and Sept, (UNC)1999.
File split implementation, February 28, 2004.
Contact: pmanis@med.unc.edu
ENDCOMMENT
UNITS {
(mA) = (milliamp)
(mV) = (millivolt)
(nA) = (nanoamp)
}
NEURON {
THREADSAFE
SUFFIX klt
USEION k READ ek WRITE ik
RANGE gbar, gklt, ik, q10g
GLOBAL winf, zinf, wtau, ztau
}
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
PARAMETER {
v (mV)
dt (ms)
gbar = 0.01592 (mho/cm2) <0,1e9>
zss = 0.5 <0,1> : steady state inactivation of glt
q10tau = 3.0
q10g = 2.0
}
STATE {
w z
}
ASSIGNED {
celsius (degC) : model is defined on measurements made at room temp in Baltimore
ik (mA/cm2)
ek (mV)
gklt (mho/cm2)
winf zinf
wtau (ms) ztau (ms)
qg () : computed q10 for gnabar based on q10g
q10 ()
}
LOCAL wexp, zexp
BREAKPOINT {
SOLVE states METHOD cnexp
gklt = qg*gbar*(w^4)*z
ik = gklt*(v - ek)
}
INITIAL {
qg = q10g^((celsius-22)/10 (degC))
q10 = q10tau^((celsius - 22)/10 (degC)) : if you don't like room temp, it can be changed!
rates(v)
w = winf
z = zinf
}
DERIVATIVE states { :Computes state variables m, h, and n
rates(v) : at the current v and dt.
w' = (winf - w)/wtau
z' = (zinf - z)/ztau
}
PROCEDURE rates(v (mV)) { :Computes rate and other constants at current v.
:Call once from HOC to initialize inf at resting v.
winf = (1 / (1 + exp(-(v + 48) / 6 (mV))))^0.25
zinf = zss + ((1-zss) / (1 + exp((v + 71) / 10 (mV))))
wtau = (100 (ms)/ (6*exp((v+60) / 6 (mV)) + 16*exp(-(v+60) / 45 (mV)))) + 1.5
wtau = wtau/q10
ztau = (1000 (ms)/ (exp((v+60) / 20 (mV)) + exp(-(v+60) / 8 (mV)))) + 50
ztau = ztau/q10
}

94
cnmodel/mechanisms/kpkj.mod

@ -0,0 +1,94 @@ @@ -0,0 +1,94 @@
: HH TEA-sensitive Purkinje potassium current
: Created 8/5/02 - nwg
NEURON {
THREADSAFE
SUFFIX kpkj
USEION k READ ek WRITE ik
RANGE gbar, ik, gk
GLOBAL minf, hinf, mtau, htau
}
UNITS {
(mV) = (millivolt)
(mA) = (milliamp)
}
PARAMETER {
v (mV)
gbar = .004 (mho/cm2)
mivh = -24 (mV)
mik = 15.4 (mV)
mty0 = .00012851 (s)
mtvh1 = 100.7 (mV)
mtk1 = 12.9 (mV)
mtvh2 = -56.0 (mV)
mtk2 = -23.1 (mV)
hiy0 = .31
hiA = .78
hivh = -5.802 (mV)
hik = 11.2 (mV)
ek (mV)
}
ASSIGNED {
gk (mho/cm2)
ik (mA/cm2)
minf
mtau (ms)
hinf
htau (ms)
}
STATE {
m
h
}
INITIAL {
rates(v)
m = minf
h = hinf
}
BREAKPOINT {
SOLVE states METHOD cnexp
gk = gbar * m^3 * h
ik = gk * (v - ek)
}
DERIVATIVE states {
rates(v)
m' = (minf - m) / mtau
h' = (hinf - h) / htau
}
PROCEDURE rates( Vm (mV)) {
LOCAL v
v = Vm + 11 (mV) : Account for Junction Potential
minf = 1/(1+exp(-(v-mivh)/mik))
mtau = mtau_func(v)
hinf = hiy0 + hiA/(1+exp((v-hivh)/hik))
htau = 1000 * htau_func(v)
}
FUNCTION mtau_func (v (mV)) (ms) {
if (v < -35 (mV)) {
mtau_func = (1000)*(3.4225e-5+.00498*exp(-v/-28.29 (mV)))*3 (s)
} else {
mtau_func = (1000)*(mty0 + 1(s)/(exp((v+mtvh1)/mtk1)+exp((v+mtvh2)/mtk2)))
}
}
FUNCTION htau_func(Vm (mV)) (ms) {
if ( Vm > 0) {
htau_func = (1000)*(0.0012 (s) + 0.0023(s)*exp(-0.141 *Vm / 1 (mV)))
} else {
htau_func = (1000)*(1.2202e-05(s) + .012(s) * exp(-((Vm-(-56.3 (mV)))/49.6 (mV))^2))
}
}

67
cnmodel/mechanisms/kpkj2.mod

@ -0,0 +1,67 @@ @@ -0,0 +1,67 @@
: HH Low TEA-sensitive Purkinje potassium current
: Created 8/7/02 - nwg
NEURON {
THREADSAFE
SUFFIX kpkj2
USEION k READ ek WRITE ik
RANGE gbar, ik, gk
GLOBAL ninf, ntau
}
UNITS {
(mV) = (millivolt)
(mA) = (milliamp)
}
PARAMETER {
v (mV)
gbar = .002 (mho/cm2)
nivh = -24 (mV)
nik = 20.4 (mV)
ek (mV)
}
ASSIGNED {
gk (mho/cm2)
ik (mA/cm2)
ninf (1)
ntau (ms)
}
STATE {
n
}
INITIAL {
rates(v)
n = ninf
}
BREAKPOINT {
SOLVE states METHOD cnexp
gk = gbar * n^4
ik = gk * (v - ek)
}
DERIVATIVE states {
rates(v)
n' = (ninf - n) / ntau
}
PROCEDURE rates(Vm (mV)) {
LOCAL v
v = Vm + 11 : Account for Junction Potential
ninf = 1/(1+exp(-(v-nivh)/nik))
ntau = 1000 * ntau_func(v)
}
FUNCTION ntau_func(v (mV)) (ms) {
if (v < -20) {
ntau_func = 0.000688 (ms) + 1 (ms)/(exp((v+64.2 (mV))/6.5 (mV))+exp((v-141.5 (mV))/-34.8 (mV)))
} else {
ntau_func = 0.00016 (ms) + 0.0008 (ms) *exp(-0.0267 * v /(1 (mV)))
}
}

63
cnmodel/mechanisms/kpkjslow.mod

@ -0,0 +1,63 @@ @@ -0,0 +1,63 @@
: HH Slow TEA-insensitive Purkinje potassium current
: Created 8/7/02 - nwg
NEURON {
THREADSAFE
SUFFIX kpkjslow
USEION k READ ek WRITE ik
RANGE gbar, ik, gk
GLOBAL ninf, ntau
}
UNITS {
(mV) = (millivolt)
(mA) = (milliamp)
}
PARAMETER {
v (mV)
gbar = 0.004 (mho/cm2)
nivh = -16.5 (mV)
nik = 18.4 (mV)
ek (mV)
}
ASSIGNED {
gk (mho/cm2)
ik (mA/cm2)
ninf
ntau (ms)
}
STATE {
n
}
INITIAL {
rates(v)
n = ninf
}
BREAKPOINT {
SOLVE states METHOD cnexp
gk = gbar * n^4
ik = gk * (v - ek)
}
DERIVATIVE states {
rates(v)
n' = (ninf - n) / ntau
}
PROCEDURE rates(Vm (mV)) {
LOCAL v
v = Vm + 11 : Account for Junction Potential
ninf = 1/(1+exp(-(v-nivh)/nik))
ntau = 1000 * ntau_func(v)
}
FUNCTION ntau_func(v (mV)) (ms){
ntau_func = 0.000796 (ms) + 1 (ms)/(exp((v+73.2 (mV))/11.7 (mV))+exp((v-306.7 (mV))/-74.2(mV)))
}

111
cnmodel/mechanisms/kpksk.mod

@ -0,0 +1,111 @@ @@ -0,0 +1,111 @@
TITLE Slow Ca-dependent potassium current
:
: Ca++ dependent K+ current IC responsible for slow AHP
: Differential equations
:
: Model based on a first order kinetic scheme
:
: <closed> + n cai <-> <open> (alpha,beta)
:
: Following this model, the activation fct will be half-activated at
: a concentration of Cai = (beta/alpha)^(1/n) = cac (parameter)
:
: The mod file is here written for the case n=2 (2 binding sites)
: ---------------------------------------------
:
: This current models the "slow" IK[Ca] (IAHP):
: - potassium current
: - activated by intracellular calcium
: - NOT voltage dependent
:
: A minimal value for the time constant has been added
:
: Ref: Destexhe et al., J. Neurophysiology 72: 803-818, 1994.
:
: Modifications by Arthur Houweling for use in MyFirstNEURON
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
NEURON {
THREADSAFE
SUFFIX kpksk
USEION k READ ek WRITE ik
USEION ca READ cai
RANGE m_inf, tau_m, gbar, gk
GLOBAL beta, cac
RANGE ik
}
UNITS {
(mA) = (milliamp)
(mV) = (millivolt)
(molar) = (1/liter)
(mM) = (millimolar)
}
PARAMETER {
v (mV)
celsius (degC)
dt (ms)
ek (mV)
cai (mM)
gbar = .01 (mho/cm2)
beta = 0.002 (1/ms) : backward rate constant
cac = 0.010 (mM) : middle point of activation fct
taumin = 0.1 (ms) : minimal value of the time cst
}
STATE {
m
}
ASSIGNED {
ik (mA/cm2)
gk (mho/cm2)
m_inf
tau_m (ms)
tadj ()
}
BREAKPOINT {
SOLVE states :METHOD euler
gk = gbar * m*m
ik = gk * (v - ek)
}
:DERIVATIVE states {
: evaluate_fct(v,cai)
:
: m'= (m_inf-m) / tau_m
:}
PROCEDURE states() {
evaluate_fct(v,cai)
m= m + (1-exp(-dt/tau_m))*(m_inf-m)
}
INITIAL {
:
: activation kinetics are assumed to be at 22 deg. C
: Q10 is assumed to be 3
:
tadj = 3 ^ ((celsius-22.0)/10 (degC))
evaluate_fct(v,cai)
m = m_inf
}
PROCEDURE evaluate_fct(v(mV),cai(mM)) { LOCAL car
car = (cai/cac)^2
m_inf = car / ( 1 + car )
tau_m = 1 / beta / (1 + car) / tadj
if(tau_m < taumin) { tau_m = taumin } : min value of time cst
}

32
cnmodel/mechanisms/leak.mod

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
TITLE passive (leak) membrane channel
UNITS {
(mV) = (millivolt)
(mA) = (milliamp)
}
NEURON {
THREADSAFE
SUFFIX leak
NONSPECIFIC_CURRENT i
RANGE gbar, erev, i
}
PARAMETER {
v (mV)
gbar = 0.001 (mho/cm2)
erev = -65 (mV)
}
ASSIGNED {
i (mA/cm2)
}
INITIAL {
}
BREAKPOINT {
i = gbar*(v - erev)
}

379
cnmodel/mechanisms/multisite.mod

@ -0,0 +1,379 @@ @@ -0,0 +1,379 @@
TITLE Multisite synapse
COMMENT
-----------------------------------------------------------------------------
Multi-site synapse with independent release sites. Each site operates independently
and releases a vesicle upon presynaptic depolarization with a probability
determined by the history of activity, using the Dittman and Regehr (1998, 2000)
model.
Revised from coh2.mod, coh3.mod, and coh4.mod.
The Dittman and Regeher (1998, 2000) release model with
facilitation closely fits Auditory Nerve data from mouse over
a wide range of frequencies.
The model DOES NOT include the postsynaptic receptors or desensitization, since
these should be treated separately (couple XMTR to an AMPA receptor model,
such as the Trussell-Raman model)
Range variables:
nZones: is the number of active zones simulated in this calyx model. Each zone
can be connected to a separate PSD.
F (0.4): The base release probability
k0 (1/1.75): /s, baseline recovery rate from depletion (slow rate)
kmax (1/0.025): /s, maximal recovery rate from depletion (fast rate)
td (0.05) : time constant for fast calcium-dependent recovery, sec
kd (0.7) : affinity of fast recovery process for calcium sensor
kf (0.5) : affinity of facilitation process
tf (0.01) : rate of facilitation process (slow) seconds
dD (0.02): calcium that drives recovery (ca influx per AP)
dF (0.02): calcium that drives facilitation
Added latency and variable delay (latstd, latency standard deviation in msec)
around the mean spike time. 4/5/2011 pbm.
Version 4 uses a log-normal distribution to determine release latencies.
The calculation is built-in instead of being passed through an array.
The lognormal distribution describes the individual vesicle release time
course at this synapse as measured by Isaacson and Walmsley, 1996. Note that
they used a gamma distribution in some plots, but the lognormal distribution
seems to fit their published data at least as well.
The parameters of the distribution, as well as the release latency,
are controlled by an exponential function whose parameters are initialized at
run time.
10/19/2011 Paul B. Manis, UNC Chapel Hill
ENDCOMMENT
DEFINE MAX_ZONES 1000 : maximum number of zones in this model
DEFINE EVENT_N 10000 : number of entries in the Event Distribution (e.g., as sampled)
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
NEURON {
THREADSAFE
POINT_PROCESS MultiSiteSynapse
RANGE F, k0, kmax, taud, kd, tauf, kf
RANGE nZones, multisite, rseed, latency, latstd, debug
RANGE dD, dF, XMTR, glu, CaDi, CaFi
RANGE Fn, Dn
RANGE TTotal
RANGE nRequests, nReleases
RANGE Identifier : just a number so we can report which instance is active
RANGE tau_g, amp_g
: Distributions for stochastic release and testing (Sept, Oct, 2011):
RANGE EventLatencies, EventTime : returns the first EVENT_N latencies and absolute times at which they were used
RANGE ev_index : count in the EventLatencies (in case we are "short")
: parameters for latency shift during repetitive stimulation (Oct 19, 2011)
RANGE Dep_Flag : Depression flag (0 to remove depression; 1 to allow DKR control of facilitation and depression)
RANGE Lat_Flag, Lat_t0, Lat_A0, Lat_tau : Lat_Flag = 0 means fixed latency (set by "latency" above)
: otherwise, latency = latency for t < Lat_t0
: latency = latency + Lat_A0*(1-exp(-(t-Lat_t0)/Lat_tau))
: parameters for lognorm distribution shift during repetitive stimulation (Oct 19, 2011)
RANGE LN_Flag, LN_t0, LN_A0, LN_tau : LN_Flag = 0 means fixed sigma as well
: otherwise, sigma = latstd for t < LN_t0
: sigma = latstd + LN_A0*(1-exp(-(t-LN_t0)/LN_tau))
: externally assigned pointers to RNG functions
POINTER uniform_rng : for deciding the number of active synapses when multisite==0
}
UNITS {
(mA) = (milliamp)
(mV) = (millivolt)
(mM) = (milli/liter)
(uM) = (micro/liter)
}
PARAMETER {
dt (ms)
amp_g = 1.0 (mM) : amplitude of transmitter pulse
tau_g = 0.5 (ms) : duration of transmitter pulse
dD = 0.02 (1) : calcium influx driving recovery per AP
dF = 0.02 (1) : calcium influx driving facilitation per AP
F = 0.5 (1) : basal facilitation
k0 = 0.0005714(/ms) : slow recovery from depletion (1.0/1.75)
kmax = 0.040 (/ms) : fast recovery from depletion (1/0.025)
taud = 50.0 (ms) : time constant for fast calcium dependent recovery
kd = 0.7 (1) : affinity of fast recovery process for calcium sensor
tauf = 10.0 (ms) : rate of slow facilitation process
kf = 0.5 (1) : affinity of slow facilitation process
: taus = 1 (ms) : defined by DKR but not used here
: ks = 0.5 (1)
: glu = 1 (mM)
rseed (1) : random number generator seed (for SCOP module)
latency = 0.0 (ms)
latstd = 0.0 (ms)
: Time course of latency shift in release during repetitive stimulation
Lat_Flag = 0 (1) : 0 means fixed latency, 1 means lognormal distribution
Lat_t0 = 0.0 (ms) : minimum time since simulation start before changes in latency are calculated
Lat_A0 = 0.0 (ms) : size of latency shift from t0 to infinity
Lat_tau = 100.0 (ms) : rate of change of latency shift (from fit of a+b(1-exp(-t/tau)))
: Statistical control of log-normal release shape over time during repetitive stimulation
LN_Flag = 0 (1) : 0 means fixed values for all time
LN_t0 = 0.0 (ms) : : minimum time since simulation start before changes in distribution are calculated
LN_A0 = 0.0 (ms) : size of change in sigma from t0 to infinity
LN_tau = 100.0 (ms) : rate of change of sigma over time (from fit of a+b*(1-exp(-t/tau)))
: control flags - if debug is 1, show all, if 2, just "some"
debug = 0
Identifier = 0
Dep_Flag = 1 (1) : 1 means use depression calculations; 0 means always set release probability to F
}
ASSIGNED {
: Externally set assignments
nZones (1) : number of zones in the model
multisite (1) : whether zones are modeled individually (1) or as a single, variable-amplitude zone (0)
nRequests (1)
nReleases (1)
EventLatencies[EVENT_N] (0)
EventTime[EVENT_N] (0)
tRelease[MAX_ZONES] (ms) : time of last release
: Internal calculated variables
Fn (1)
Dn (1)
CaDn (1)
CaFn (1)
CaDi (1)
CaFi (1)
eta (1)
tSpike (ms) : time of last spike
tstep(ms)
TTotal(0)
tspike (ms)
latzone (ms)
vesicleLatency (ms)
sigma (ms)
gindex (0)
ev_index (0)
scrand (0)
uniform_rng
}
: Function prototypes needed to assign RNG function pointers
VERBATIM
double nrn_random_pick(void* r);
void* nrn_random_arg(int argpos);
ENDVERBATIM
: Return a pick from uniform distribution.
: (distribution parameters are set externally)
FUNCTION rand_uniform() {
VERBATIM
_lrand_uniform = nrn_random_pick(_p_uniform_rng);
ENDVERBATIM
}
: Function to allow RNG to be externally set
PROCEDURE setUniformRNG() {
VERBATIM
{
void** pv = (void**)(&_p_uniform_rng);
*pv = nrn_random_arg(1);
}
ENDVERBATIM
}
STATE {
XMTR[MAX_ZONES] (mM) : per-zone neurotransmitter concentration
N_ACTIVE[MAX_ZONES] (1) : number of zones actively releasing
}
INITIAL {
: VERBATIM
: fprintf(stdout, "MultiSiteSynapse: Calyx #%d Initialized with Random Seed: %d\n", (int)Identifier, (int)rseed);
: ENDVERBATIM
TTotal = 0
nRequests = 0
nReleases = 0
set_seed(rseed)
tSpike = -1e9
latzone = 0.0
sigma = 0.0
vesicleLatency = 0.0
gindex = 0
ev_index = 0
scrand = 0.0
CaDi = 1.0
CaFi = 0.0
CaDn = 1.0
CaFn = 0.0
Fn = F
Dn = 1.0
FROM i = 0 TO (nZones-1) {
XMTR[i] = 0
N_ACTIVE[i] = 1
tRelease[i] = tSpike
}
update_dkr(t-tSpike)
}
BREAKPOINT {
SOLVE release
}
LOCAL tz, n_relzones, amp
PROCEDURE release() {
: Once released, the transmitter packet has a defined smooth time course in the "cleft"
: represented by the product of rising and falling exponentials.
: update glutamate in cleft
if (multisite == 1) {
: Update glutamate waveform for each active release zone
n_relzones = nZones
}
else {
: Update aggregate glutamate waveform for only the first release zone
n_relzones = 1
}
FROM i = 0 TO (nZones-1) { : for each zone in the synapse
if (t >= tRelease[i] && t < tRelease[i] + 5.0 * tau_g) {
tz = t - tRelease[i] : time since onset of release
: calculate glutamate waveform (Xie & Manis 2013 Supplementary Eq. 1)
XMTR[i] = amp_g * (1.0-exp(-tz/(tau_g/3.0))) * exp(-(tz-(tau_g/3.0))/tau_g)
}
else {
XMTR[i] = 0
}
}
}
PROCEDURE update_dkr(tstep (ms)) {
: update the facilitation and depletion variables
: from the Dittman-Regehr model.
: Updates are done with each new presynaptic AP event.
if(tstep > 0.0) {
CaDi = CaDi + dD
CaFi = CaFi + dF
CaDn = CaDi * exp (-tstep/taud)
CaFn = CaFi * exp (-tstep/tauf)
eta = (kd/CaDi + 1.0)/(kd/CaDi + exp(-tstep/taud))
eta = eta^(-(kmax-k0)*taud)
Dn = 1.0-(1.0-(1.0-Fn)*Dn)*exp(-k0*tstep)*eta
Fn = F + (1.0-F)/(1.0+kf/CaFn)
CaDi = CaDn
CaFi = CaFn
}
if (Dep_Flag == 0) { : no depression
Dn = 1.0 : set to 1
Fn = F : set to initial value to set release probability constant
}
: VERBATIM
: if (debug >= 2 ){
: fprintf(stdout, "update start t = %f ts=%f: F=%7.2f CaDi = %g CaFi = %g\n", \
: t, tstep, F, CaDi, CaFi);
: fprintf(stdout, " vars: taud=%g: tauf=%g kd = %g kmax= %g\n", taud, tauf, kd, kmax);
: fprintf(stdout, " CaDi = %g CaFi = %g\n", CaDi, CaFi);
: fprintf(stdout, " CaDn = %g CaFn = %g\n", CaDn, CaFn);
: fprintf(stdout, " eta: %g\n", eta);
: fprintf(stdout, " Fn=%7.2f Dn: %7.2f CaDi = %g CaFi = %g,\n", \
: Fn, Dn, CaDi, CaFi);
: }
: ENDVERBATIM
}
NET_RECEIVE(weight) {
: A spike has been received; process synaptic release
: First, update DKR state to determine new release probability
update_dkr(t - tSpike)
tSpike = t : save the time of spike
TTotal = 0 : reset total transmitter from this calyx for each release
nRequests = nRequests + 1 : count the number of inputs that we received
: Next, process vesicle release using new release probability
if (multisite == 1) {
release_multisite()
}
else {
release_singlesite()
}
}
PROCEDURE release_multisite() {
: Vesicle release procedure for multi-site terminal.
: Loops over multiple zones using release probability Fn*Dn to decide whether
: each site will release, and selecting an appropriate release latency.
: The synapse can release one vesicle per AP per zone, with a probability 0<p<1.
: The probability, p, is defined by the time evolution of a Dittman-Regher model
: of release, whose parameters are set during initialization.
: The vesicle can be released over a variable time interval defined by a lognormal
: distribution, plus a fixed latency.
FROM i = 0 TO (nZones-1) { : for each zone in the synapse
if(tRelease[i] < t) {
scrand = scop_random()
: look to make release if we have not already (single vesicle per zone per spike)
: check for release and release probability - assume infinite supply of vesicles
if (scrand < Fn*Dn) {
nReleases = nReleases + 1 : count number of releases since inception
TTotal = TTotal + 1 : count total releases this trial.
: Compute the median latency for this vesicle.
if (Lat_Flag == 0 || t < Lat_t0) {
vesicleLatency = latency : use a fixed value
}
else {
vesicleLatency = latency + Lat_A0*(1-exp(-(t-Lat_t0)/Lat_tau)) : latency rises during train
}
: Now compute distribution around that latency
: if LN_Flag is 1, we adjust the sigma values over time, otherwise we just use a fixed value.
: The following math applies:
: lognormal dist = exp(X), where X = gaussian(mu, sigma).
: The median of the lognormal dist. is e^mu; Note that if mu is 0, then the median is 1.0
: The mode of the lognormal dist is e^(u-sigma^2).
: Note that normrand is a SCoP function, see http://cns.iaf.cnrs-gif.fr/files/scopman.html
if (LN_Flag == 0 || t < LN_t0) { : use fixed sigma in lognormal distribution for all time.
if (latstd > 0.0) {
latzone = normrand(0.0, latstd) : set a latency for the zone with one draw from the distribution
latzone = exp(latzone) - 1.0 + vesicleLatency : the latency should not be too short....
}
else {
latzone = vesicleLatency : fixed value
}
}
else {
sigma = latstd + LN_A0*(1-exp(-(t-LN_t0)/LN_tau)) : time-dependent std shift
latzone = normrand(0.0, sigma)
latzone = exp(latzone)-1.0 + vesicleLatency
}
if (latzone < 0.0) { : this is to be safe... must have causality.
latzone = 0.0
}
if (ev_index < EVENT_N) { : save event distribution list for verification
EventLatencies[ev_index] = latzone
EventTime[ev_index] = t
ev_index = ev_index + 1
}
: release time for this event
tRelease[i] = t + latzone
}
}
}
}
PROCEDURE release_singlesite() {
LOCAL pr
tRelease[0] = t
pr = Fn * Dn
FROM i = 0 TO (nZones-1) {
if (rand_uniform() < pr) {
TTotal = TTotal + 1 : count total releases this trial.
}
}
: Tell PSD to multiply its final current by the number of active zones
N_ACTIVE[0] = TTotal
printf("Release: %f\n", TTotal)
}

100
cnmodel/mechanisms/na.mod

@ -0,0 +1,100 @@ @@ -0,0 +1,100 @@
TITLE na.mod A sodium channel for cochlear nucleus neurons
COMMENT
NEURON implementation of Jason Rothman's measurements of VCN conductances.
This file implements the average brain sodium current used in the Rothman model.
In the absence of direct measurements in the VCN, this is a fair assumption.
The model differs from the one used in Rothman et al, (1993) in that the steep
voltage dependence of recovery from inactivation in that model is missing. This
may affect the refractory period. To use the other model, use najsr.mod instead.
Original implementation by Paul B. Manis, April (JHU) and Sept, (UNC)1999.
File split implementaiton, April 1, 2004.
Contact: pmanis@med.unc.edu
Modifed implementation; includes all temperature scaling, passes modlunit
7/10/2014 pbm
ENDCOMMENT
UNITS {
(mA) = (milliamp)
(mV) = (millivolt)
(nA) = (nanoamp)
}
NEURON {
THREADSAFE
SUFFIX na
USEION na READ ena WRITE ina
RANGE gbar, gna, ina
GLOBAL hinf, minf, htau, mtau
}
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
PARAMETER {
v (mV)
dt (ms)
ena (mV)
gbar = 0.07958 (mho/cm2) <0,1e9>
q10tau = 3.0
q10g = 2.0
}
STATE {
m h
}
ASSIGNED {
celsius (degC) : model is defined on measurements made at room temp in Baltimore
ina (mA/cm2)
gna (mho/cm2)
minf hinf
mtau (ms) htau (ms)
qg () : computed q10 for gnabar based on q10g
q10 ()
}
LOCAL mexp, hexp
BREAKPOINT {
SOLVE states METHOD cnexp
gna = qg*gbar*(m^3)*h
ina = gna*(v - ena)
}
INITIAL {
qg = q10g^((celsius-22)/10 (degC))
q10 = q10tau^((celsius - 22)/10 (degC)) : if you don't like room temp, it can be changed!
rates(v)
m = minf
h = hinf
}
DERIVATIVE states { :Computes state variables m, h, and n
rates(v) : at the current v and dt.
m' = (minf - m)/mtau
h' = (hinf - h)/htau
}
PROCEDURE rates(v (mV)) { :Computes rate and other constants at current v.
:Call once from HOC to initialize inf at resting v.
: average sodium channel
minf = 1 / (1+exp(-(v + 38) / 7 (mV)))
hinf = 1 / (1+exp((v + 65) / 6 (mV)))
mtau = (10 (ms)/ (5*exp((v+60) / 18 (mV)) + 36*exp(-(v+60) / 25 (mV)))) + 0.04
mtau = mtau/q10
htau = (100 (ms)/ (7*exp((v+60) / 11 (mV)) + 10*exp(-(v+60) / 25 (mV)))) + 0.6
htau = htau/q10
}

103
cnmodel/mechanisms/nacn.mod

@ -0,0 +1,103 @@ @@ -0,0 +1,103 @@
TITLE nacn.mod A sodium conductance for a ventral cochlear nucleus neuron model
COMMENT
NEURON implementation of Jason Rothman's measurements of VCN conductances.
This file implements the average brain sodium current used in the Rothman model.
In the absence of direct measurements in the VCN, this is a fair assumption.
The model differs from the one used in Rothman et al, (1993) in that the steep
voltage dependence of recovery from inactivation in that model is missing. This
may affect the refractory period. To use the other model, use najsr.mod instead.
Original implementation by Paul B. Manis, April (JHU) and Sept, (UNC)1999.
File split implementaiton, April 1, 2004.
Does not pass modlunit.
Should work at 22C and scales by Rothman and Manis, 2003c for temperature
Contact: pmanis@med.unc.edu
ENDCOMMENT
UNITS {
(mA) = (milliamp)
(mV) = (millivolt)
(nA) = (nanoamp)
}
NEURON {
THREADSAFE
SUFFIX nacn
USEION na READ ena WRITE ina
RANGE gbar, gna, ina
GLOBAL hinf, minf, htau, mtau
}
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
PARAMETER {
v (mV)
celsius (degC) : 22 (degC) model is defined on measurements made at room temp in Baltimore
dt (ms)
ena (mV)
gbar = 0.07958 (mho/cm2) <0,1e9>
q10tau = 3.0 : q10 for rates
}
STATE {
m h
}
ASSIGNED {
ina (mA/cm2)
gna (mho/cm2)
minf hinf
mtau (ms) htau (ms)
q10 ()
}
LOCAL mexp, hexp
BREAKPOINT {
SOLVE states METHOD cnexp
gna = gbar*(m^3)*h
ina = gna*(v - ena)
}
UNITSOFF
INITIAL {
rates(v)
m = minf
h = hinf
}
DERIVATIVE states { :Computes state variables m, h, and n
rates(v) : at the current v and dt.
m' = (minf - m)/mtau : m = m + mexp*(minf-m)
h' = (hinf - h)/htau : h = h + hexp*(hinf-h)
}
LOCAL qt
PROCEDURE rates(v) { :Computes rate and other constants at current v.
:Call once from HOC to initialize inf at resting v.
q10 = q10tau^((celsius - 22)/10) : if you don't like room temp, it can be changed!
: average sodium channel
minf = 1 / (1+exp(-(v + 38) / 7))
hinf = 1 / (1+exp((v + 65) / 6))
mtau = (10 / (5*exp((v+60) / 18) + 36*exp(-(v+60) / 25))) + 0.04
mtau = mtau/q10
htau = (100 / (7*exp((v+60) / 11) + 10*exp(-(v+60) / 25))) + 0.6
htau = htau/q10
}
UNITSON

138
cnmodel/mechanisms/nacncoop.mod

@ -0,0 +1,138 @@ @@ -0,0 +1,138 @@
TITLE nacn.mod A sodium conductance for a ventral cochlear nucleus neuron model
COMMENT
NEURON implementation of Jason Rothman's measurements of VCN conductances.
This file implements a modified version of the average brain sodium current
used in the Rothman and Manis 2003 models.
The model differs from the one used in Rothman et al, (1993) in that the steep
voltage dependence of recovery from inactivation in that model is missing. This
may affect the refractory period. To use the other model, use jsrnaf.mod instead.
Original implementation by Paul B. Manis, April 1999 (JHU) and Sept 1999 (UNC-CH).
File split implementation, April 1, 2004.
Version nacncoop implements a cooperative sodium channel model built on the kinetics
of the original nacn model (R&M2003c). The motivation is to make a sodium channel with
faster activation kinetics, by introducing cooperativity between a subset of channels.
The model is based on concepts and implementation similar to Oz et al.
J.Comp. Neurosci. 39: 63, 2015, and Huang et al., PloSOne 7:e37729, 2012.
The cooperative channels are modeled with the same kinetics as the non-cooperative
channels, but are treated as a separate subset (fraction: p). The cooperativity is
introduced by shifting the voltage "seen" by the channels by KJ*m^3*h, which moves
the channels to a faster regime (essentially, they experience a depolarized membrane
potential that depends on their current gating state, relative to the main population
of channels).
A subpopulation of Na channels (p [0..1]) experiences a small voltage-dependent shift
in the gating kinetics. The shift is determined by KJ
This version does not have all the temperature scaling. Does not pass modlunit.
Should work at 22C, appears to work at other temperatures ok.
Contact: pmanis@med.unc.edu
ENDCOMMENT
UNITS {
(mA) = (milliamp)
(mV) = (millivolt)
(nA) = (nanoamp)
}
NEURON {
THREADSAFE
SUFFIX nacncoop
USEION na READ ena WRITE ina
RANGE gbar, gna, ina, p, KJ
RANGE vsna : voltage shift parameter
GLOBAL hinf, minf, htau, mtau, hinf2, minf2, htau2, mtau2
}
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
PARAMETER {
v (mV)
celsius (degC) : 22 (degC) model is defined at room temp in Baltimore
dt (ms)
ena (mV)
gbar = 0.07958 (mho/cm2) <0,1e9>
q10 = 3.0 : q10 for rates
p = 0.0 (): fraction of cooperative channels (0-1)
KJ = 0 (mV) : coupling strength between cooperative channels (0-1000mV is usable range)
: setting either KJ = 0 or p = 0 will remove cooperativity.
vsna = 0 (mV)
}
STATE {
m h m2 h2
}
ASSIGNED {
ina (mA/cm2)
gna (mho/cm2)
vNa (mV) : shifted V for cooperative behavior
minf hinf minf2 hinf2
mtau (ms) htau (ms) mtau2 (ms) htau2 (ms)
}
LOCAL mexp, hexp, mexp2, hexp2
BREAKPOINT {
SOLVE states METHOD cnexp
gna = gbar*(p*(m2^3*h2) + (1.-p)*(m^3)*h)
ina = gna*(v - ena)
}
UNITSOFF
INITIAL {
rates(v)
m = minf
h = hinf
m2 = minf2
h2 = hinf2
vNa = v + vsna + KJ*m^3*h
}
DERIVATIVE states { :Computes state variables m, h, and n
rates(v) : at the current v and dt.
m' = (minf - m)/mtau
h' = (hinf - h)/htau
m2' = (minf2 - m2)/mtau2
h2' = (hinf2 - h2)/htau2
vNa = v + vsna + KJ*m^3*h : note addition of vsna shift here so that we do not add it in rates
}
LOCAL qt
PROCEDURE rates(v) { :Computes rate and other constants at current v.
:Call once from HOC to initialize inf at resting v.
qt = q10^((celsius - 22)/10) : if you don't like room temp, it can be changed!
: average sodium channel
minf = 1 / (1+exp(-(v + 38 + vsna) / 7))
hinf = 1 / (1+exp((v + 65 + vsna) / 6))
mtau = (10 / (5*exp((v + 60 + vsna) / 18) + 36*exp(-(v + 60+vsna) / 25))) + 0.04
mtau = mtau/qt
htau = (100 / (7*exp((v + 60 + vsna) / 11) + 10*exp(-(v + 60 + vsna) / 25))) + 0.6
htau = htau/qt
: cooperative group of channels
minf2 = 1 / (1+exp(-(vNa + 38) / 7))
hinf2 = 1 / (1+exp((vNa + 65) / 6))
mtau2 = (10 / (5*exp((vNa+60) / 18) + 36*exp(-(vNa+60) / 25))) + 0.04
mtau2 = mtau2/qt
htau2 = (100 / (7*exp((vNa+60) / 11) + 10*exp(-(vNa+60) / 25))) + 0.6
htau2 = htau2/qt
}
UNITSON

130
cnmodel/mechanisms/nap.mod

@ -0,0 +1,130 @@ @@ -0,0 +1,130 @@
TITLE nap.mod Persistent sodium conductance
COMMENT
Persistent sodium current from deSchutter and Bower, J. Neurophys.
71:375, 1994.
2/10/02, 10/10/2014. P. Manis.
ENDCOMMENT
UNITS {
(mA) = (milliamp)
(mV) = (millivolt)
}
NEURON {
THREADSAFE
SUFFIX nap
USEION na READ ena WRITE ina
RANGE nap_inf, nap_tau, napi_inf, napi_tau
RANGE gbar, gnap
RANGE nap_A, nap_B, nap_C, nap_D, nap_E, nap_F, nap_G, nap_H
}
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
PARAMETER {
v (mV)
celsius (degC)
dt (ms)
ena (mV) : = 50.0 (mV)
gbar = 0.00001 (mho/cm2) <0,1e9>
q10tau = 3.0
q10g = 2.0
nap_shift = 0 (mV)
nap_A = 200 (/ms): parameters from Bowers et al.
nap_B = 1
nap_C = -18 (mV)
nap_D = -16 (mV)
nap_E = 25 (/ms)
nap_F = 1
nap_G = 58 (mV)
nap_H = 8 (mV)
}
STATE {
nap napi
}
ASSIGNED {
gnap (mho/cm2)
ina (mA/cm2)
nap_inf
nap_tau (ms)
nap_tau1 (/ms)
nap_tau2 (/ms)
napi_inf
napi_tau (ms)
napi_tau1 (/ms)
napi_tau2 (/ms)
qg () : computed q10 for gnabar based on q10g
q10 ()
}
BREAKPOINT {
SOLVE states METHOD cnexp
gnap = gbar*nap*nap*nap*napi
ina = gnap*(v-ena)
}
INITIAL {
qg = q10g^((celsius-22)/10 (degC))
q10 = q10tau^((celsius - 22)/10 (degC)) : if you don't like room temp, it can be changed!
rates(v)
nap = nap_inf
napi = napi_inf
}
DERIVATIVE states {
rates(v)
nap' = (nap_inf - nap) / nap_tau
napi' = (napi_inf - napi) / napi_tau
}
PROCEDURE rates(v (mV)) { :Computes rate and other constants at current v.
:Call once from HOC to initialize inf at resting v.
LOCAL x
: "nap" persistent sodium system
nap_inf = na_p(v + nap_shift)
nap_tau1 = nap_A/(nap_B + exp((v + nap_shift + nap_C)/nap_D))
nap_tau2 = nap_E/(nap_F + exp((v + nap_shift + nap_G)/nap_H))
nap_tau = 1./(nap_tau1 + nap_tau2)
:nap_tau = na_ptau(v + nap_shift)
: "nap" persistent sodium system - inactivation...
napi_inf = na_pi(v + nap_shift)
napi_tau1 = (1 (/ms)) /(0.06435/(1+exp((v + nap_shift + 73.26415)/3.71928 (mV))))
napi_tau2 = (0.13496 (/ms))/(1 +exp((v + nap_shift + 10.27853)/(-9.09334 (mV))))
napi_tau = 1 /(napi_tau1 + napi_tau2)
}
LOCAL p
FUNCTION na_p(v (mV)) { : persistent sodium activation
: Bowers
p = nap_A/(nap_B + exp((v + nap_shift + nap_C)/nap_D))
na_p = p/(p+nap_E/(nap_F + exp((v + nap_shift + nap_G)/nap_H)))
}
FUNCTION na_pi(x (mV)) { : persistent sodium inactivation
: Bowers
na_pi = 0.06435/(1+exp((x+73.26415)/3.71928 (mV)))
na_pi = na_pi/(na_pi + (0.13496/(1+exp((v+10.27853)/(-9.09334 (mV))))))
}

137
cnmodel/mechanisms/napyr.mod

@ -0,0 +1,137 @@ @@ -0,0 +1,137 @@
TITLE pyrna.mod DCN pyramidal cell model sodium channel
COMMENT
Revised version of DCN Pyramidal cell model sodium channel
This model implements part of a Dorsal Cochlear Nucleus Pyramidal point cell
based on kinetic data from Kanold and Manis (1999) and Kanold's dissertation (1999)
-- 15 Jan 1999 P. Manis
This mechanism is the fast sodium channel portion of the model.
Orignal: 2/10/02. P. Manis.
Extraced from Pyr.mod, 7/24/2014.
ENDCOMMENT
UNITS {
(mA) = (milliamp)
(mV) = (millivolt)
}
NEURON {
THREADSAFE
SUFFIX napyr
USEION na READ ena WRITE ina
RANGE gna, minf, hinf, ninf, gbar : sodium channels and delayed rectifier
RANGE mtau, htau, ntau : time constants for sodium channels and delayed rectifier
}
INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
PARAMETER {
v (mV)
celsius (degC)
dt (ms)
ek (mV) : = -81.5 (mV)
ena (mV) : = 50.0 (mV)
gbar = 0.02857 (mho/cm2) <0,1e9>
mtau0 = 0.05 (ms) <0.01,100>
htau0 = 0.5 (ms) <0.1,100>
ntau = 0.5 (ms) <0.1,100>
}
STATE {
m h
}
ASSIGNED {
gna (mho/cm2)
ina (mA/cm2)
minf hinf mtau htau
}
LOCAL mexp, hexp
BREAKPOINT {
SOLVE states METHOD cnexp
gna = gbar*m*m*h
ina = gna*(v - ena)
}
UNITSOFF
INITIAL {
rates(v)
m = minf
h = hinf
}
DERIVATIVE states {
rates(v)
m' = (minf - m) / mtau
h' = (hinf - h) / htau
}
LOCAL q10
PROCEDURE rates(v(mV)) { :Computes rate and other constants at current v.
:Call once from HOC to initialize inf at resting v.
LOCAL alpha, beta, sum
TABLE minf, mtau, hinf, htau DEPEND celsius FROM -200 TO 100 WITH 400
UNITSOFF
q10 = 3^((celsius - 22)/10)
: "m" sodium activation system
minf = na_m(v)
mtau = na_mt(v)
: "h" sodium inactivation system
hinf = na_h(v)
htau = na_ht(v)
}
: Make these as functions so we can view them from hoc, although this
: may slow things down a bit
FUNCTION na_m(x) { : sodium activation
na_m = 1/(1+exp(-(x+38)/3.0)) : POK version
: na_m = alphbet(x,35,0,5,-10) :de Schutter (doesn't work well in our version)
: na_m = na_m/(na_m + alphbet(x,7,0,65,20))
}
FUNCTION na_mt(x) { : sodium activation with taus
na_mt = mtau0 : flat time constants
: na_mt = alphbet(x,35,0,5,-10)
: na_mt = 1/(na_mt + alphbet(x,7,0,65,20))
}
FUNCTION na_h(x) { : sodium inactivation
na_h = 1/(1+exp((x+43)/3.0)) : flat time constants (POK version)
: na_h = alphbet(x,0.225,1,80,10)
: na_h = na_h/(na_h + alphbet(x,7.5,0,-3,-18))
}
FUNCTION na_ht(x) { : sodium inactivation tau
na_ht = htau0 : POK: flat time constants
: na_ht = alphbet(x,0.225,1,80,10) : de Schutter version (doesn't work well with other stuff)
: na_ht = 1/(na_ht + alphbet(x,7.5,0,-3,-18))
}
FUNCTION alphbet(x,A,B,C,D) { : alpha/beta general functions for
: transcrbing GENESIS models
alphbet = A/(B+exp((x+C)/D))
}
UNITSON

17
cnmodel/mechanisms/pkjlk.mod

@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
TITLE Purkinje Leak Current
: A passive purkinje cell leak current
NEURON {
SUFFIX lkpkj
NONSPECIFIC_CURRENT i
RANGE i, e, gbar
}
PARAMETER {
gbar = 5e-5 (siemens/cm2) < 0, 1e9 >
e = -60.5 (millivolt)
}
ASSIGNED {
i (milliamp/cm2)
v (millivolt)
}
BREAKPOINT { i = gbar*(v - e) }

196
cnmodel/mechanisms/rsg.mod

@ -0,0 +1,196 @@ @@ -0,0 +1,196 @@
TITLE Rsg sodium channel
: Resurgent sodium channel (with blocking particle)
: with updated kinetic parameters from Raman and Bean
NEURON {
SUFFIX naRsg
USEION na READ ena WRITE ina
RANGE gna, gbar
}
UNITS {
(mV) = (millivolt)
(S) = (siemens)
}
PARAMETER {
gbar = .015 (S/cm2)
: kinetic parameters
Con = 0.005 (/ms) : closed -> inactivated transitions
Coff = 0.5 (/ms) : inactivated -> closed transitions
Oon = .75 (/ms) : open -> Ineg transition
Ooff = 0.005 (/ms) : Ineg -> open transition
alpha = 150 (/ms) : activation
beta = 3 (/ms) : deactivation
gamma = 150 (/ms) : opening
delta = 40 (/ms) : closing, greater than BEAN/KUO = 0.2
epsilon = 1.75 (/ms) : open -> Iplus for tau = 0.3 ms at +30 with x5
zeta = 0.03 (/ms) : Iplus -> open for tau = 25 ms at -30 with x6
: Vdep
x1 = 20 (mV) : Vdep of activation (alpha)
x2 = -20 (mV) : Vdep of deactivation (beta)
x3 = 1e12 (mV) : Vdep of opening (gamma)
x4 = -1e12 (mV) : Vdep of closing (delta)
x5 = 1e12 (mV) : Vdep into Ipos (epsilon)
x6 = -25 (mV) : Vdep out of Ipos (zeta)
}
ASSIGNED {
alfac : microscopic reversibility factors
btfac
: rates
f01 (/ms)
f02 (/ms)
f03 (/ms)
f04 (/ms)
f0O (/ms)
fip (/ms)
f11 (/ms)
f12 (/ms)
f13 (/ms)
f14 (/ms)
f1n (/ms)
fi1 (/ms)
fi2 (/ms)
fi3 (/ms)
fi4 (/ms)
fi5 (/ms)
fin (/ms)
b01 (/ms)
b02 (/ms)
b03 (/ms)
b04 (/ms)
b0O (/ms)
bip (/ms)
b11 (/ms)
b12 (/ms)
b13 (/ms)
b14 (/ms)
b1n (/ms)
bi1 (/ms)
bi2 (/ms)
bi3 (/ms)
bi4 (/ms)
bi5 (/ms)
bin (/ms)
v (mV)
ena (mV)
ina (milliamp/cm2)
gna (S/cm2)
}
STATE {
C1 FROM 0 TO 1
C2 FROM 0 TO 1
C3 FROM 0 TO 1
C4 FROM 0 TO 1
C5 FROM 0 TO 1
I1 FROM 0 TO 1
I2 FROM 0 TO 1
I3 FROM 0 TO 1
I4 FROM 0 TO 1
I5 FROM 0 TO 1
O FROM 0 TO 1
B FROM 0 TO 1
I6 FROM 0 TO 1
}
BREAKPOINT {
SOLVE activation METHOD sparse
gna = gbar * O : O is "open state"
ina = gna * (v - ena)
}
INITIAL {
rates(v)
SOLVE seqinitial
}
KINETIC activation
{
rates(v)
~ C1 <-> C2 (f01,b01)
~ C2 <-> C3 (f02,b02)
~ C3 <-> C4 (f03,b03)
~ C4 <-> C5 (f04,b04)
~ C5 <-> O (f0O,b0O)
~ O <-> B (fip,bip)
~ O <-> I6 (fin,bin)
~ I1 <-> I2 (f11,b11)
~ I2 <-> I3 (f12,b12)
~ I3 <-> I4 (f13,b13)
~ I4 <-> I5 (f14,b14)
~ I5 <-> I6 (f1n,b1n)
~ C1 <-> I1 (fi1,bi1)
~ C2 <-> I2 (fi2,bi2)
~ C3 <-> I3 (fi3,bi3)
~ C4 <-> I4 (fi4,bi4)
~ C5 <-> I5 (fi5,bi5)
CONSERVE C1 + C2 + C3 + C4 + C5 + O + B + I1 + I2 + I3 + I4 + I5 + I6 = 1
}
LINEAR seqinitial { : sets initial equilibrium
~ I1*bi1 + C2*b01 - C1*( fi1+f01) = 0
~ C1*f01 + I2*bi2 + C3*b02 - C2*(b01+fi2+f02) = 0
~ C2*f02 + I3*bi3 + C4*b03 - C3*(b02+fi3+f03) = 0
~ C3*f03 + I4*bi4 + C5*b04 - C4*(b03+fi4+f04) = 0
~ C4*f04 + I5*bi5 + O*b0O - C5*(b04+fi5+f0O) = 0
~ C5*f0O + B*bip + I6*bin - O*(b0O+fip+fin) = 0
~ O*fip + B*bip = 0
~ C1*fi1 + I2*b11 - I1*( bi1+f11) = 0
~ I1*f11 + C2*fi2 + I3*b12 - I2*(b11+bi2+f12) = 0
~ I2*f12 + C3*fi3 + I4*bi3 - I3*(b12+bi3+f13) = 0
~ I3*f13 + C4*fi4 + I5*b14 - I4*(b13+bi4+f14) = 0
~ I4*f14 + C5*fi5 + I6*b1n - I5*(b14+bi5+f1n) = 0
~ C1 + C2 + C3 + C4 + C5 + O + B + I1 + I2 + I3 + I4 + I5 + I6 = 1
}
PROCEDURE rates(v(mV) )
{
alfac = (Oon/Con)^(1/4)
btfac = (Ooff/Coff)^(1/4)
f01 = 4 * alpha * exp(v/x1)
f02 = 3 * alpha * exp(v/x1)
f03 = 2 * alpha * exp(v/x1)
f04 = 1 * alpha * exp(v/x1)
f0O = gamma * exp(v/x3)
fip = epsilon * exp(v/x5)
f11 = 4 * alpha * alfac * exp(v/x1)
f12 = 3 * alpha * alfac * exp(v/x1)
f13 = 2 * alpha * alfac * exp(v/x1)
f14 = 1 * alpha * alfac * exp(v/x1)
f1n = gamma * exp(v/x3)
fi1 = Con
fi2 = Con * alfac
fi3 = Con * alfac^2
fi4 = Con * alfac^3
fi5 = Con * alfac^4
fin = Oon
b01 = 1 * beta * exp(v/x2)
b02 = 2 * beta * exp(v/x2)
b03 = 3 * beta * exp(v/x2)
b04 = 4 * beta * exp(v/x2)
b0O = delta * exp(v/x4)
bip = zeta * exp(v/x6)
b11 = 1 * beta * btfac * exp(v/x2)
b12 = 2 * beta * btfac * exp(v/x2)
b13 = 3 * beta * btfac * exp(v/x2)
b14 = 4 * beta * btfac * exp(v/x2)
b1n = delta * exp(v/x4)
bi1 = Coff
bi2 = Coff * btfac
bi3 = Coff * btfac^2
bi4 = Coff * btfac^3
bi5 = Coff * btfac^4
bin = Ooff
}

40
cnmodel/mechanisms/tests/test_mechanisms.py

@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
import numpy as np
from neuron import h
from cnmodel.util import reset
def test_max_open_probability():
reset(
raiseError=False
) # reset() fails as unable to remove all neuron objects, unless we ignore the error
sec = h.Section()
# Create AMPA and NMDA mechanisms
# AMPA uses mode=0; no rectification
apsd = h.AMPATRUSSELL(0.5, sec=sec)
# For NMDA we will hold the cell at +40 mV
npsd = h.NMDA_Kampa(0.5, sec=sec)
# And a presynaptic terminal to provide XMTR input
term = h.MultiSiteSynapse(0.5, sec=sec)
term.nZones = 1
h.setpointer(term._ref_XMTR[0], "XMTR", apsd)
h.setpointer(term._ref_XMTR[0], "XMTR", npsd)
h.celsius = 34.0
h.finitialize()
op = [[], []]
for i in range(100):
# force very high transmitter concentration for every timestep
term.XMTR[0] = 10000
sec.v = 40.0
h.fadvance()
op[0].append(apsd.Open)
op[1].append(npsd.Open)
assert np.allclose(max(op[0]), apsd.MaxOpen)
assert np.allclose(max(op[1]), npsd.MaxOpen)
if __name__ == "__main__":
test_max_open_probability()

72
cnmodel/mechanisms/vecevent.mod

@ -0,0 +1,72 @@ @@ -0,0 +1,72 @@
: Vector stream of events
: From NEURON source: nrn/examples/nrniv/netcon/vecevent.mod
NEURON {
ARTIFICIAL_CELL VecStim
}
ASSIGNED {
index
etime (ms)
space
}
INITIAL {
index = 0
element()
if (index > 0) {
net_send(etime - t, 1)
}
}
NET_RECEIVE (w) {
if (flag == 1) {
net_event(t)
element()
if (index > 0) {
net_send(etime - t, 1)
}
}
}
VERBATIM
extern double* vector_vec();
extern int vector_capacity();
extern void* vector_arg();
ENDVERBATIM
PROCEDURE element() {
VERBATIM
{ void* vv; int i, size; double* px;
i = (int)index;
if (i >= 0) {
vv = *((void**)(&space));
if (vv) {
size = vector_capacity(vv);
px = vector_vec(vv);
if (i < size) {
etime = px[i];
index += 1.;
}else{
index = -1.;
}
}else{
index = -1.;
}
}
}
ENDVERBATIM
}
PROCEDURE play() {
VERBATIM
void** vv;
vv = (void**)(&space);
*vv = (void*)0;
if (ifarg(1)) {
*vv = vector_arg(1);
}
ENDVERBATIM
}

12
cnmodel/morphology/__init__.py

@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
#!/usr/bin/python
#
# Morphology definitions for models.
#
# This file includes readers for
#
# Paul B. Manis, Ph.D. 2009 (August - November 2009)
#
from neuron import h
from .morphology import Morphology
from .hoc_reader import HocReader

90
cnmodel/morphology/bushy_stick.hoc

@ -0,0 +1,90 @@ @@ -0,0 +1,90 @@
objref soma
soma = new SectionList()
objref primarydendrite
primarydendrite = new SectionList()
objref secondarydendrite
secondarydendrite = new SectionList()
objref hillock
hillock = new SectionList()
objref unmyelinatedaxon
unmyelinatedaxon = new SectionList()
objref myelinatedaxon
myelinatedaxon = new SectionList()
create sections[9]
access sections[0]
soma.append()
sections[0] {
pt3dadd(0., 0., 0., 25.)
pt3dadd(0., 25., 0., 25.)
}
// axon hillock, 15 microns long, tapered
access sections[1]
hillock.append()
connect sections[1](0), sections[0](0)
sections[1] {
pt3dadd(0., 0., 0., 2.5)
pt3dadd(0., -15., 0., 1.0)
}
// initial segment, unmyelinated, 10 microns long, not tapering
access sections[2]
unmyelinatedaxon.append()
connect sections[2](0), sections[1](1)
sections[2] {
pt3dadd(0., -15., 0., 1.0)
pt3dadd(0., -25., 0., 1.0)
}
// beginning of myelinated axon, 20 micron, enlarging with distance
access sections[3]
myelinatedaxon.append()
connect sections[3](0), sections[2](1)
sections[3] {
pt3dadd(0., -25., 0., 1.0)
pt3dadd(0., -45., 0., 2.0)
}
access sections[4]
primarydendrite.append()
connect sections[4](0), sections[0](1)
sections[4] {
pt3dadd(0., 25., 0., 3.0)
pt3dadd(0., 45., 0., 2.0)
}
access sections[5]
secondarydendrite.append()
connect sections[5](0), sections[4](1)
sections [5] {
pt3dadd(0., 45., 0., 2.0)
pt3dadd(0., 55., -50., 1.5)
}
access sections[6]
secondarydendrite.append()
connect sections[6](0), sections[4](1)
sections [6] {
pt3dadd(0., 45., 0., 2.0)
pt3dadd(0., 55., 50., 1.5)
}
access sections[7]
secondarydendrite.append()
connect sections[7](0), sections[4](1)
sections [7] {
pt3dadd(0., 45., 0., 2.0)
pt3dadd(-50., 55., 0., 1.5)
}
access sections[8]
secondarydendrite.append()
connect sections[8](0), sections[4](1)
sections [8] {
pt3dadd(0., 45., 0., 2.0)
pt3dadd(50., 55., 0, 1.5)
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save