Computer models of corticospinal neurons replicate in vitro dynamics (Neymotin et al. 2017)

 Download zip file 
Help downloading and running models
Accession:195615
"Corticospinal neurons (SPI), thick-tufted pyramidal neurons in motor cortex layer 5B that project caudally via the medullary pyramids, display distinct class-specific electrophysiological properties in vitro: strong sag with hyperpolarization, lack of adaptation, and a nearly linear frequency-current (FI) relationship. We used our electrophysiological data to produce a pair of large archives of SPI neuron computer models in two model classes: 1. Detailed models with full reconstruction; 2. Simplified models with 6 compartments. We used a PRAXIS and an evolutionary multiobjective optimization (EMO) in sequence to determine ion channel conductances. ..."
Reference:
1 . Neymotin SA, Suter BA, Dura-Bernal S, Shepherd GM, Migliore M, Lytton WW (2017) Optimizing computer models of corticospinal neurons to replicate in vitro dynamics. J Neurophysiol 117:148-162 [PubMed]
Model Information (Click on a link to find other models with that property)
Model Type: Neuron or other electrically excitable cell;
Brain Region(s)/Organism: Neocortex;
Cell Type(s): Neocortex M1 L5B pyramidal pyramidal tract cell; Neocortex primary motor area pyramidal layer 5 corticospinal cell;
Channel(s): I A; I h; I_KD; I K,Ca; I L high threshold; I Na,t; I N; Ca pump; Kir;
Gap Junctions:
Receptor(s):
Gene(s):
Transmitter(s):
Simulation Environment: NEURON; Python;
Model Concept(s): Parameter Fitting; Activity Patterns; Active Dendrites; Detailed Neuronal Models; Simplified Models;
Implementer(s): Suter, Benjamin ; Neymotin, Sam [samn at neurosim.downstate.edu]; Dura-Bernal, Salvador [salvadordura at gmail.com]; Forzano, Ernie ;
Search NeuronDB for information about:  Neocortex M1 L5B pyramidal pyramidal tract cell; I Na,t; I L high threshold; I N; I A; I h; I K,Ca; I_KD; Ca pump; Kir;
/
spidemo
data
readme.html
cadad.mod
cal2.mod
can_mig.mod
h_kole.mod
kap_BS.mod
kBK.mod
kdmc_BS.mod
kdr_BS.mod
misc.mod *
nax_BS.mod
savedist.mod
vecst.mod *
archfig.py
axonMorph.py
BS0284.ASC
BS0409.ASC
conf.py
Fig6.py
figure_1.png
misc.h
morph.py
mosinit.py
PTcell.BS0284.cfg *
PTcell.BS0409.cfg
PTcell.cfg *
sim.py
SPI6.cfg
SPI6.py
utils.py
                            
# written by sam neymotin, modified by ernie forzano
from neuron import h
h.load_file("stdrun.hoc")
from pylab import *
import time 
from time import time, clock
import datetime # to format time of run
import sys
import pickle
import numpy
h.install_vecst() # for samp and other NQS/vecst functions
from conf import *
import os

# determine config file name
def setfcfg ():
  fcfg = "PTcell.BS0284.cfg" # default config file name
  for i in xrange(len(sys.argv)):
    if sys.argv[i].endswith(".cfg") and os.path.exists(sys.argv[i]):
      fcfg = sys.argv[i]
  print "config file is " , fcfg
  return fcfg

fcfg=setfcfg() # config file name
dconf = readconf(fcfg)
dprm = dconf['params']
dfixed = dconf['fixed']
sampr = dconf['sampr'] # sampling rate

exec('from ' + dconf['cellimport'] + ' import ' + dconf['cellfunc']) # import cell creation function
if fcfg.startswith('PTcell'):
  exec('cell = ' + dconf['cellfunc'] + '(' + str(dconf['cellfuncargs']) + ')') # create the cell - can use different morphologies)
else:
  exec('cell = ' + dconf['cellfunc'] + '()') # create the cell

exec('import ' + dconf['cellimport']) # import the file's variables too, so can access them

for p in dfixed.values(): exec(p.assignstr(p.origval)) # fixed values
try:
  ic = h.IClamp(0.5,sec=cell.soma[0])
except:
  ic = h.IClamp(0.5,sec=cell.soma)


voltLoc = None # voltage location used for optimization
voltLocInterp = None

# record variables (includes voltage, spike times, etc.)
def setrec (cell):
  global voltLoc,voltLocInterp
  rd = {}
  rd['vt'] = h.Vector(); rd['vt'].record(h._ref_t) # Record simulation time
  # Record cell voltages
  for i,loc in enumerate(dconf['recordV']):
    sloc = loc + '.v' # easier to read string representation
    ploc = loc + '._ref_v' # pointer location
    if i == 0:
      voltLoc = sloc # v
      voltLocInterp = voltLoc + '_interp'
    rd[sloc] = h.Vector()
    cmd = 'rd[sloc].record(' + ploc + ')'#
    exec(cmd)
  # record spikes at specified Section(location)
  vspike = h.Vector()
  sloc = dconf['recordSpike']
  cmd = 'spikerec = h.NetCon(' + sloc + '._ref_v, None, sec=' + sloc.split('(')[0] +')'
  exec(cmd)
  spikerec.record(vspike)
  spikerec.threshold = 0 # 0 mV threshold
  rd['vspike'] = vspike
  rd['spikerec'] = spikerec
  return rd

rd = setrec(cell)
vt = rd['vt']

# look at output
def plotout (rd,lk = [voltLoc],clr = ['r','g'],drdot=False):
  tt = rd['vt'].as_numpy()
  for gn,k in enumerate(lk):
    if k.count('interp') > 0: plot(rd['vt_interp'],rd[k],clr[gn],linewidth=1);
    else: plot(tt,rd[k],clr[gn],linewidth=1);
    if drdot: plot(tt,rd[k],clr[gn]+'o',markersize=5)
    xlabel('Time (ms)',fontsize=16); ylabel('Vm',fontsize=16); xlim((0,mytstop-mybase))

if dconf['usecvode']: h.cvode.active(1) #much faster

mytstop = dconf['tstop'] 
mybase = dconf['baset'] 
stimdel = dconf['stimdel']
stimdur = dconf['stimdur']
I = numpy.load(dconf['lstimamp']) # somatic current injection levels

# interpolate voltage recorded in simulation to a fixed grid (dt millisecond spacing)
# output voltage,time is stored in rd (dictionary) with keys voltLocInterp, vt_interp
def interpvolt (rd,dt):
  tsrc,vsrc = rd['vt'], rd[voltLoc]
  tdest = h.Vector(); tdest.indgen(mybase,mytstop,dt)
  vdest = h.Vector(); vdest.interpolate(tdest,tsrc,vsrc)
  tdest.sub(mybase)
  rd['vt_interp'] = tdest
  rd[voltLocInterp] = vdest
 
# 
def myrun (tstop=mytstop,inj=0.75,draw=True,prtime=False):
  if prtime: clockStart = time()
  h.tstop = tstop 
  ic.amp = inj
  ic.delay = mybase + stimdel
  ic.dur = stimdur # BS0284 experiment has only 1 s of stim
  h.run()
  interpvolt(rd,1e3/sampr) # interpolate recorded voltage to fixed temporal grid
  if draw: plotout(rd)
  if prtime:
    print rd['vspike'].size()*1e3/ic.dur , 'Hz, during stim.'
    clockEnd = time()
    print '\nsim runtime:',str(round(clockEnd-clockStart,2)),'secs'   

# run all current injections and return output voltage 
def gathertraces ():
  dvec = {}
  for i,inj in enumerate(I):
    print i,inj
    myrun(tstop=mytstop,inj=inj,draw=False,prtime=True)
    if i == 0: dvec['vt'] = rd['vt_interp'].to_python()
    dvec[inj] = rd[voltLocInterp].to_python()
  return dvec

evolts = numpy.load(dconf['evolts']) # experimental voltage traces
  
if __name__ == "__main__":
  if len(sys.argv) < len(dprm.keys()):
    print 'usage: sim.py [cfg file] [params] [fout]'
  else:
    i = 1
    if sys.argv[i].count('python') > 0: i += 1 # skip -python or python
    if sys.argv[i].count('sim.py') > 0: i += 1 # skip sim.py
    if sys.argv[i].count('.cfg') > 0: i += 1 # skip cfg file
    for j,p in enumerate(dprm.keys()): # parameter values to evaluate - optimized by evolution
      print i,j,p,sys.argv[i]
      exec(dprm[p].assignstr(float(sys.argv[i])))
      i += 1
    if 'postassign' in dconf: exec(dconf['postassign'])
    while i < len(sys.argv): # check optional args
      if sys.argv[i].count('.cfg') > 0:
        pass # config file - skip it since read above
      elif sys.argv[i].count('python') > 0 or sys.argv[i].count('sim.py') > 0:
        pass # pass, it's call from commandline
      i += 1
  print 'running sim ... '
  dvec = gathertraces()
  pickle.dump(dvec,open(os.path.join('data',dconf['cellimport'].split('.cfg')[0]+'.pkl'),'w'))

Loading data, please wait...