Python/NEURON and MATLAB scripts for running single-cell simulations of layer V pyramidal cells while recording the trans-membrane currents

with a high spatial resolution.

Tuomo Maki-Marttunen, 2014-2016

CC BY 3.0


HOC-commands for the simulations based on scripts by E. Hay (Hay et al. 2011, Models of Neocortical Layer

                                                                              5b Pyramidal Cells Capturing a Wide Range of 

                                                                              Dendritic and Perisomatic Active Properties,

                                                                              PLoS Comput Biol 7:e1002107)


Files included:

 models/TTC.hoc                                       #HOC-file for simulations with reduced-morphology model and in vivo-like

                                                      # synaptic inputs

 CaDynamics_E2.mod                                    #mod-file for Ca2+ dynamics. From http://modeldb.yale.edu/139653

 Ca_HVA.mod                                           #mod-file for HVA Ca2+ currents. From http://modeldb.yale.edu/139653

 Ca_LVAst.mod                                         #mod-file for LVA Ca2+ currents. From http://modeldb.yale.edu/139653

 Ih.mod                                               #mod-file for HCN currents. From http://modeldb.yale.edu/139653

 Im.mod                                               #mod-file for Muscarinic K+ currents. From http://modeldb.yale.edu/139653

 K_Pst.mod                                            #mod-file for Persistent K+ currents. From http://modeldb.yale.edu/139653

 K_Tst.mod                                            #mod-file for Transient K+ currents. From http://modeldb.yale.edu/139653

 NaTa_t.mod                                           #mod-file for Transient Na+ currents. From http://modeldb.yale.edu/139653

 Nap_Et2.mod                                          #mod-file for Persisent Na+ currents. From http://modeldb.yale.edu/139653

 SK_E2.mod                                            #mod-file for SK currents. From http://modeldb.yale.edu/139653

 SKv3_1.mod                                           #mod-file for Kv3.1 currents. From http://modeldb.yale.edu/139653

 calcsumcurr_manyareagsynmediumtau_parts_fixeddt.py   #Python script for running the simulations

 combinemattomat_fixeddt.m                            #MATLAB script for combining fifty 200-ms runs to a single 10-second run

 sumrepetitions_seed.m                                #MATLAB script for summing up ionic currents from ten 10-second individual

                                                      # neuron simulations into a single data file

 interpolate.m                                        #MATLAB function for interpolating 1-D signal

 interpolate_multidim.m                               #MATLAB function for interpolating multidimensional signal


To perform a single 10000-ms simulation, run the following command:



nrnivmodl                                                                                           #Compile the NEURON mechanisms

SEED=1                                                                                              #In this example, only seed 1 performed

python calcsumcurr_manyareagsynmediumtau_parts_fixeddt.py 20 0.025 0.000042 10000 10000 2 $SEED 200 #Run a single pyramidal cell simulation

                                                                                                    #with 20 segments/compartment,

                                                                                                    #0.025ms time step, 0.042 nS synaptic

                                                                                                    #conductance, 10000 ms biological

                                                                                                    #time, with 10000 synapses of type 2

                                                                                                    #(scattered on both apical and

                                                                                                    #basal dendrites), random number seed 1, 

                                                                                                    #and performing the simulation

                                                                                                    #in units of 200ms



The script saves the amounts of each current type exiting the cell into the 13 extracellular compartments. The bordering extracellular

compartments do not contain any membrane segments, and thus 13 compartments are enough. The results are saved into MATLAB files


currsums_parts_10000areagsynsmediumtau_fixeddt_type2_amp4.2e-5_tstop10000_nseg20_dt0.025_seed${SEED}_sim0x200.mat

currsums_parts_10000areagsynsmediumtau_fixeddt_type2_amp4.2e-5_tstop10000_nseg20_dt0.025_seed${SEED}_sim1x200.mat

...

currsums_parts_10000areagsynsmediumtau_fixeddt_type2_amp4.2e-5_tstop10000_nseg20_dt0.025_seed${SEED}_sim49x200.mat


To combine the obtained files, run:


matlab -r "myseed=$SEED; combinemattomat_fixeddt; exit"



As a result, we have the file

currsums_parts_10000areagsynsmediumtau_fixeddt_type2_amp4.2e-05_tstop10000.0_nseg20_dt0.025_seed${SEED}_comb200.0.mat.


These commands should be repeated for SEED 1...10 and then the resulting current data can be summed up with the following script:


matlab -r "synloctype=2; iseed=1; sumrepetitions_seed; exit"



As a result, the file currsums_parts_10000areagsynsmediumtau_fixeddt_type2_amp4.2e-05_tstop10000.0_nseg20_dt0.025_seed1_comb_summed.mat

is created. It contains the summed currents of 10 L5PCs in the 13 extracellular compartments for the biological time from 0 to 10000 ms.

In order to give longer current sum data to the diffusion simulator, the whole procedure should be repeated e.g. for SEED 11...100.

(The script sumrepetitions_seed.m combines seeds 1...10 to be the a "iseed" number 1, seeds 11...20 to be the "iseed" number 2, etc.)


These files can finally be combined using the script:


matlab -r "summondata; exit"


This will save all necessary data in a file revdata.mat which will be used for the extracellular simulations. When combining the data (see summondata.m), the first 1600 ms of each run are ignored due to a possible delay in transition to a steady state spiking dynamics.