20190926 Note from the ModelDB administrator: this model was updated so that running the model is easier than described below: just start mosinit.hoc with nrngui (see top-level readme for more instructions and below for additional details).
Copyright (c) California Institute of Technology, 2006 -- All Rights Reserved
Royalty free license granted for non-profit research and educational purposes.
Extracellular Action Potential Simulation
- Overview
- References
- Setup
- Linux
- Macintosh
- Windows
- Running the NEURON Simulation
- Choosing the Parameters
- Running the Simulation
- Program Output
- Running Additional Simulations
- Running the Matlab Program
- Calculating and Plotting Extracellular Action Potentials
- Comparing Simulation Parameter
- Comparing Extracellular Action Potentials
- Comparing Intracellular Action Potentials
- Plotting Intracellular Details
- Measuring Extracellular Action Potential Features
- How To "Undo" a Trial
- Analyzing Voltage Gradients
- Running the Simplified Neuron Simulation
- Plotting the Voltage Gradients in Matlab
- Setting Up Your Own Simulations
- Running Simulations with Different Cell Morphologies
- Running Simulations with Different Types of Cells
- Running Simulations with Different Channel Models
- Getting Help and Helping with EAPS
The Extracellular Action Potential Simulation (EAPS) package
consists of two sections:
- A NEURON Simulation Environment program that runs simulations,
producing the output necessary to calculate EAP's. The NEURON
simulation is designed to run from the command line, although it
can also be run using the NEURON gui.
- Several Matlab scripts that calculates the EAP's using the Line
Source Approximation (LSA) and plots and analyzes the results. There
are also a set of functions for plotting intracellular data produced
by the simulation.
In principal the Matlab code can be re-used for simulation
environments other than NEURON, as long as they produce output
(membrane currents and geometry) in the same format.
These instruction assume that you have the NEURON Simulation
Environment and Matlab installed.
(top)
For background reading, the publications concerning the development of
the EAPS pacakge are (in chronological order):
- Holt G. (1998). A Critical Reexamination of Some Assumptions and
Implications of Cable Theory in Neurobiology. PhD thesis, California
Insitute of Technology.
- Holt G and Koch C (1999). Electrical interactions via the
extracellular potential near cell bodies. Journal of
Computational Neuroscience, 6:169-184.
- Gold C, Henze DA, Koch C, and Buzsáki G. (2006).
On the original of the extracellular action potential waveform: a
modeling study. Journal of Neurophysiology, 95:3113--3128.
- Gold C, Henze DA, Koch C. (2007). Using Extracellular Action
Potential Recordings to Tune Compartmental Models. Journal of
Computational Neuroscience. In Press.
Publications based on the EAPS package should always reference
2 (Holt and Koch, 1999) and 3 (Gold et al., 2006)
and may also reference 1 and 4 if they are related to
the detailed issues analyzed in those papers.
(top)
Change to the eaps/mod directory and type:
nrnivmodl
You should see a lot of status messages generated by the compiler ending
with
Successfully created i686/special
If you don't get this result consult the documentation for
NMODL in the NEURON book.
- Note: You must have the XCode Developer Tools installed to create
the custom dll with the NMODL mechanisms
- Open the eaps directory, and the directory containing your NEURON
installation.
- Drag the folder 'mod' on to the mknrndll icon. You should see a
terminal open,and spew a lot of status messages generated by the
compiler ending with
Successfully created i686/special
(Or if your Macintosh has a powerpc chip that would be '...powerpc/special'. You may
have to modify some of the commands below based on your processor type.)
Important note for Window's users: If you unpack the
archive with Winzip you must create two folders in the eaps directory
structure:
- eaps\output
- eaps\mat\lsa\temp
The reason for this is that Winzip does not create empty folders that
were part of the archive.
After unpacking the archive and creating those two empty folders,
- Run the program mknrndll and choose the directory eaps/mod.
A terminal window will open and you willsee a lot of status messages generated by the compiler ending
with
nrnmech.dll was built successfully.
(top)
To run the NEURON simulation you first choose the parameters
by editing/creating a parameter definition file, then run
the simulation in the manner appropriate for your platform.
Change to the directory eaps/hoc/params. There should
be 11 files:
- ca1pyr_standard_parms.hoc - This defines all parameters
that are the same for all CA1 pyramidal cells.
- d151_param.hoc - this is initially the same as d151_params_a.hoc
- d151_params_a.hoc, d151_params_b.hoc,
d151_params_c.hoc, d151_params_d.hoc - These files
define the parameters for simulations A-D in (Gold, Henze and Koch, 2007).
- line_standard_parms.hoc - This defines all parameters
that are the same for all simplified neuron simulations. (see Analyzing Voltage Gradients below.)
- line_param.hoc - this is initially the same as line_params_b.hoc
- line_params_b.hoc, line_params_c.hoc,
line_params_d.hoc - These files define the parameters for the
simplifed cylinder simulations B-D in (Gold, Henze and Koch, 2007).
The parameters that will be used for the simulation are the file named
d151_params.hoc. To choose different parameters for the simulation,
copy one of the files d151_params_x.hoc to the name
d151_params.hoc (i.e. remove the _x extension).
When simulating a cell with name foo.hoc the program will use
the parameters in the file foo_params.hoc
To run the program you start the compiled mod file executable
mod/i686/special (or mod/powerpc/special for
Macintosh) with the following files as parameters:
- refs.hoc - this contains references to objects that are
used in the rest of the code (all object references are declared here)
- cells/d151.hoc - this contains the neuron geometry
definition; if you are using a different cell than the one provided
you substitute the cell name
- file_util.hoc - this contains a number of routines used
by the main program to load other code files and create output files
- main.hoc - this is the main program; it loads additional
code files, creates output files, sets up the NEURON (i.e. with the
active conductances and passive parameters defined in the parameter
files), and runs the main loop of the simulation.
The following describes the procedure for Linux, Macintosh and
Windows.
Linux
Change to the root eaps directory and enter the command line:
mod/i686/special hoc/src/refs.hoc cells/d151.hoc hoc/src/file_util.hoc hoc/src/main.hoc
You will first see some text describing the stages of the setup
procedure, followed by many lines like this:
d151(0001).171: t=13.19 / dt=0.0147, soma.v(.5)=7.1 [Soma_vmax=7.1 @ t=13.2]
If you read these you should see that the cell starts at rest, fires a
single action potential, and then repolarizes.
Macintosh
Run the Terminal application (in the Utilities folder, under
Applications.) Change to the root eaps directory with the cd
command. Enter the command line:
mod/powerpc/special hoc/src/refs.hoc cells/d151.hoc hoc/src/file_util.hoc hoc/src/main.hoc
You will first see some text describing the stages of the setup
procedure, followed by many lines like this:
d151(0001).171: t=13.19 / dt=0.0147, soma.v(.5)=7.1 [Soma_vmax=7.1 @ t=13.2]
If you read these you should see that the cell starts at rest, fires a
single action potential, and then repolarizes.
Windows
- (20190926 Note from the ModelDB Administrator: the following edit is no longer necessary as an upgrade to this archive
includes the use of the function unix_mac_pc() provided by NEURON to detect the platform and set the WINDOWS variable.)
You must first make a small edit to one of the .hoc
files. With any text editor, open the file
eaps\hoc\src\file_util.hoc
Near the top of the file, location the section "LINUX/MAC VS. WINDOWS" and change the line
to
Save the file.
- Run the Command Prompt application (under Accessories, on the start menu)
- Change the directory to eaps. If you put the EAPS package
in c:\ (the root directory) then you would use the command:
- Enter the following command and parameters (copy & paste):
c:\nrn59\bin\neuron.exe -dll mod\nrnmech.dll hoc/src/refs.hoc cells/d151.hoc hoc/src/file_util.hoc hoc/src/main.hoc
A NEURON shell will open. You will first see some text describing the
stages of the setup procedure, followed by many lines like this:
d151(0001).171: t=13.19 / dt=0.0147, soma.v(.5)=7.1 [Soma_vmax=7.1 @ t=13.2]
If you read these you should see that the cell starts at rest, fires a
single action potential, and then repolarizes.
Running the simulation should have created the directory
eaps/output/d151_0001/nrn and generated the following files:
- d151_0001_geom.dat - coordinates and diameters for each
line segment that makes up the cell. The header of the file contains
a list of all the parameters for the simulation (as a comment, using the
Matlab comment character '%'). After the header
format of the data is, for each line segment in the geometry:
x1 y1 z1 diam1 arc1 x2 y2 z2 diam2 arc2
- d151_0001_param_names.txt - the names of all the parameters
in the simulation, one per line
- d151_0001_param_values.dat - the values of all numerical
parameters corresponding to the names in d151_0001_param_names.txt
- d151_0001_txx.xxx.dat - the net membrane current
associated with each line segment as listed in
d151_0001_geom.dat for the time step which ended at t=xx.xxx
- d151_0001_times.dat - a complete list of all the times
at which line segment current data was exported (all the times for
which there exists a file d151_0001_txx.xxx.dat)
- d151_0001_secnames.txt - the name of every section in
the neuron geometry (meaning an unbranched piece of neurite - not to
be confused with line segments!)
- d151_0001_secnums.txt - the first line segment in the
geometry file and the number of line segments corresponding to each
section listed in d151_0001_segnames.txt. With
d151_0001_segnames.txt and d151_0001_segnums.dat
every line segment can be associated with the it's section.
- d151_0001_sec_0.xx.dat (multiple files of this type) -
these files contain details of the simulation for the section
indicated by 'sec' and the compartment referenced by x=0.xx. The
first column of these files is always the time steps for export (i.e.
the first column is redundant with the file
d151_0001_times.dat) The content of the remaining columns is
described by the files d151_0001_curr_types.txt and
d151_0001_mech_gates.txt
- d151_0001_curr_types.txt - the rows of this file
describe the 2nd through 10th column of the compartment details files
(d151_0001_name_0.xx.dat). At time of this writing these
columns are:
- I_tot - the total membrane current
- V - the membrane potential
- I_cap - capacitive component of the membrane current
- I_k - potassium component of the membrane current
- I_na - sodium component of the membrane current
- I_ca - calcium component of the membrane current
- I_pas - passive mechanism component of the membrane current (leak current)
- I_in - axial current from the "0" end of the compartment
- I_out - axial current going to the "1" end the compartment
- d151_0001_mech_gates.txt - the names in each row
describes the remaining columns of the compartment details files
(d151_0001_name_0.xx.dat). These will typically list the
gating particles and conductance for every mechanism used in the
simulation. See the template in mechdesc.hoc and the code in
current_util.hoc for details of how this is organized. At the
time of writing there were 51 variables, making a total of 61 columns in the
compartment detail files d151_0001_sec_0.xx.dat
The directory and all the files were all numbered one
("d151_0001") because this was your first simulation for cell
d151. In the folder eaps/cells there is now a file
d151_trial_trial_num.txt that will keep track of the number
of trials and provide each new experiment a new number. (Note to windows
users: Notepad does not properly display this file. Use wordpad
or a programming text editor such as emacs to view/modify this file.)
Go back to the directory eaps/hoc/params and re-name a
different file as d151_params.hoc (or modify the numbers
but not the code in the d151_params.hoc file directly.)
Rerun the NEURON simulation to create the directory
eaps/output/d151_0002/nrn and a new set of output files.
(top)
To examine the results and calculate the EAP's start Matlab and change
to the directory eaps/mat. Run the script
addpaths.m - this will add all the sub-directories to the
search path. You can then run all the scripts which are in
sub-directories.
Note: when using the Matlab functions you should keep
eaps/mat as the current directory, because many files are
loaded or saved using relative directory paths based on that
assumption. If this is inconvenient, you can switch to using absolute
paths by modifying the file
eaps/mat/file_util/get_root_path.m
Run the following script:
zplane_eap_calc('d151', 1, [], 0.3, [-100 100 -100 100], 0, 20);
Then:
plot_eap_grid('d151', 1, [], 0.3, [-100 100 -100 100], 0, 20);
This should make a plot showing the extracellular action potentials
similar to the bottom of Figure 3 but showing the EAP's at many more
locations. (Note that the cell is reflected along the Y
axis in comparison with the figure in (Gold, Henze and Koch, 2007).)
The parameters are as follows:
- The first parameter is the cell name.
- The second parameter is the trial number. You can leave this empty ('[]')
and it will default to the last trial run for the cell.
- The third parameter are the start and ending time from the simulation to
calculate for. When empty (as in the example above) this defaults to a 4 ms
window starting 1 ms before the maximum soma potential. This is usually a good
window for calculating EAPs.
- The fourth parameter "0.3" controls the extracellular
conductivity, in Seimens-1 meters. (To get the more familiar
Ωcm from S-1m take 100/σ.)
- The fifth (array) parameter are the minimum and maximum X and Y
coordinates for the grid of points to calculate and plot - measured in
μm.
- The sixth parameter is the Z plane in μm (the soma is at Z=0 so this
is the standard plane for the calculation.)
- The final parameter is the grid spacing in μm at which to calculate.
You can specify the bounds in plot_eap_grid (the 5th
parameter) to be smaller than those you used in
zplane_eap_calc but not greater.
Read the header in the Matlab code file
eaps/mat/lsa/zplane_eap_calc.m and
eaps/mat/plot_extra/plot_eap_grid.m for details on these
function and the parameters.
Assuming you have run two different simulations, run the script:
diff_neuron_params('d151',1,'d151',2);
This will print out all the parameters that are not the same for the
two simulations. Note that the default units of conductance density
are S/cm2. There are shortcuts for using this script: you
can enter simply
diff_neuron_params('d151');
and it will compare the two most recent trials for the cell. Also, you
can use
diff_neuron_params('d151',1);
and the script will compare the most recent trial (whatever it is)
with the trial number you entered.
Run the following script:
compare_extra_trials('d151', [1 2], [0 20 0],[-100 100 -100 100], 0.3, 20, [])
This should make a plot of two extracellular action potential traces as
in Figure 1(iv) from (Gold, Henze and Koch, 2007). The . If you run four
simulations with the different parameters in eaps/hoc/params
and enter the additional trial numbers for the second parameter of
compare_extra_trials you will fully re-create Figure 1(iv).
In order to re-create Figures 1(v) and 1(vi) you will first need to
re-calculate the extracellular potentials on a finer grid. Use
the command:
zplane_eap_calc('d151', 1, [], 0.3, [-100 0 0 50], 0, 10);
This will calculate the EAP's on a grid spanning x=-100 to 0, y=0 to
50, spaced at 10 micrometers. Repeat this for any other NEURON trials
you have run (the trial number is the second parameter.) Now run the
following two comparisons:
compare_extra_trials('d151', [1 2], [-50 30 0], [-100 0 0 50], 0.3, 10, []);
compare_extra_trials('d151', [1 2], [-100 40 0], [-100 0 0 50], 0.3, 10, []);
These will re-create Figures 1(v) and 1(vi) (if you have run all four
parameter sets, set the second parameter to to include all 4 trials,
i.e. [1 2 3 4]).
Note that the percentage errors do not match those in (Gold, Henze and
Koch, 2007). That's because we have not included the parameters for
weighting the peak in the error calculation. For the last parameter
(empty brackets, above) use the array [10 0.5]. That incdicates to
weight the peak 10x, and for subsequent points next to the peak
decrease the weight by a factor of 0.5 (1/2) until it is below 1 (at
which point the weight will be 1 for all remaining points.) For example:
compare_extra_trials('d151', [1 2], [0 20 0], [-100 100 -100 100], 0.3, 20, [10 0.5]);
Also note that the orientation of the Y axis in the simulation is the
reverse of that described in (Gold, Henze and Koch, 2007).
Run the following script:
compare_intra_trials('d151', [1 2], 'soma', 0.5, [])
This should make a plot of two intracellular action potential traces as
in Figure 1(i) from (Gold, Henze and Koch, 2007). If you run four
simulations with the different parameters in eaps/hoc/params
and enter the additional trial numbers for the second parameter of
compare_intra_trials you will fully re-create Figure 1(i).
In order to re-create Figures 1(ii) and 1(iii) re-run the script
replacing the parameter 'soma' with 'apical1_0222'
and 'apical1_02222211111'. These are the name of sections in
the apical trunk approximately 100 and 200 micro-meters from the soma.
Use the same parameters to apply the peak weighting to the error
calculating, as described in the previous section.
Read the header of the Matlab code file
eaps/mat/plot_intra/compare_intra_trials.m for details on
the function and the parameters.
To plot the intra-cellular details produced by the first simulation
try the following command:
plot_intra_detail('d151', 1, 'approx', {'ax';'k'}, [])
This should open a plot similar to Figure 3 in the paper (there is
actually an additional column showing the state of the gating
particles for the K+ currents.) The exact details will
depend on which simulation you ran. The parameter 1 (2nd parameter)
controls which trial number to plot. Each row in the plot shows the
details for a given section, the name of which is showed in the title
for each row.
The parameters 'ax' and 'k' indicate that the plot should show details
for the axial currents and the K+ currents. In this
parameters list you can also add 'na' and 'ca' to
show details for the Na+ and Ca2+ currents.
Depending on your screen size you may want to use only one of these
options at a time. Every plot will show the membrane potential and
membrane currents.
Note that the orientation of the axial currents in the soma is the
reverse of that described in (Gold, Henze and Koch, 2007). The NEURON
program defines inward axial current as coming from the '0'
end of the compartment and outward current is defined as coming from
the '1' end of the compartment. However, in the
.hoc file cells/d151.hoc the 0 end of the
soma is the one connected to the apical dendrites while the 1
end is connected to the basal dendrites and axon: this is the reverse
of the orientation used in the paper. The orientation in the paper
was switched to match the circuit diagram, Figure 1.
You can make the same plots for different parts of the cell.
Try replacing the parameter 'approx' (for "apical proximal")
with 'axon', 'apdist' or 'basal'.
In order to see a picture of the cell showing where the named
sections are run the script:
plot_cell_labels('d151',1,[-200 100 -100 100])
this will create a flattened picture of the cell with the
names of the sections next to them.
The last parameter (empty []) is the start/end times for
the plot, which defaults to a 4 ms window starting 1 ms before the
maximum soma potential.
Read the header of the Matlab code file
eaps/mat/plot_intra/plot_intra_trials.m and
eaps/mat/plot_cell/plot_cell_labels.m for details on
these function and the parameters.
To measure the features of a single sample of an EAP run the script:
plot_eap_measure('d151', [], [], [0 20 0], [-100 100 -100 100], 0.3, 20);
This will plot the single EAP at the location x=0, y=20, z=0 the set
of measurements described in (Gold, Henze and Koch, 2007) and some
others that were not used in the publication. You can run the script
for other trials or locations by changing the parameters. (The second
parameter is the trial number, and the 4th is the location in µm.)
Note: in order to measure the decay from the K+ phase peak
you must have Matlab Curve Fitting Toolbox installed. If you do not
have the toolbox, you can comment out this part of the code. See
the file eaps/mat/meas_eap/measure_eap.m for details.
To make boxplots of the measurements as in (Gold, Henze and Koch, 2007)
run the script
plot_meas_compare('d151', [1 2 3 4], 0.3, [-100 100 -100 100], 0, 20, 0.04);
This assumes that you have run trials 1-4 with the 4 different
parameter files provided. If you have run fewer trials, than change
the second parameter to reflect the correct trial numbers. The last
parameter sets a threshold of 0.04 mV (40 µV) for EAP's to
be included in the statistics.
Also note that the figures in (Gold, Henze and Koch, 2007) were made by
measuring EAPs in a 50 x 50 grid with a spacing of 10 μm. So you may
want to re-caclulate the EAPs and run the measurement at this finer scale.
Note: in order to make the boxplot you must have Matlab Statistics
Toolbox installed Unfortunately, there is no workaround provided for
this.
Read the header of the Matlab code file
eaps/mat/meas_eap/plot_eap_measure.m and
eaps/mat/meas_eap/plot_meas_compare.mfor details on
these function and the parameters.
(top)
If you do any significant amount of work with this EAPS you will
eventually run trials that you did not mean to. Maybe you meant to
set the parameter to some value but you mistyped it or maybe you meant
to change a parameter and forgot to modify the parameter at all! If
you do not want to keep the result from a trial you can "undo" a trial
from matlab as follows:
>> undo_trial('d151')
Really delete d151 trial 26? Y/N [N]: Y
system: rm -rf ../output/d151_0026 got STATUS=0
Decremented trial counter to: 26
As you can guess from the output, the script removes the output
directory created for the trial and decrements the trial counter
by one.
Note: This script is only designed for linux/mac. There is probably
some good Windows equivalent - if you know how to do this and would like
to contribute an improved function please email the author. See the
section Getting Help and Helping with EAPS.
(top)
Analyzing Voltage Gradients
The EAPS package also contains the code to run the simulations
of the simplified neuron and analysis of voltage gradients decribed
in Gold, Henze and Koch (2007), Section 3.7, (The Relationship Between
the Membrane Potential and Extracellular Potential)
Running the Simplified Neuron Simulation
Run the NEURON simulation as usual for the cell named 'line'
- this is the simplifed single cylinder neuron. For mac/linux with an
i686 processor that would be:
mod/i686/special hoc/src/refs.hoc cells/line.hoc hoc/src/file_util.hoc hoc/src/main.hoc
from the root eaps directory.
The default parameter file for the line neuron are the parameters
based on the B simulation. There are also parameter files to run simulations
based on the C and D parameters.
Plotting the Voltage Gradients in Matlab
After running the NEURON simulation for the simplified neuron (line) first
calculate the extracellular action potentials around the cell:
zplane_eap_calc('line', [], [], 0.3, [-500 500 -150 150], 0, 50);
Note: when you run this you will see a lot of error warnings like this:
Warning: Divide by zero.
> In get_phi at 42
In zplane_eap_calc at 119
Error in ==> zplane_eap_calc at 138
The reason for these warnings is that the LSA is attempting to
calculate the EAP's at positions that lie directly on the neuron line
segments (i.e. points along the line Y=0.) This does not cause a
problem: it just generates a bunch of Nan values in the result. But
if you don't want to see these messages just type:
You can plot the eap's, as usual:
plot_eap_grid('line', [], [], 0.3, [-500 500 -150 150], 0, 50);
Note: you will need to change the voltage scaling to get a good picture
of the weaker EAP's around the line. There is code in the top of plot_eap_grid
that you can un-comment for this purpose.
In order to plot the voltage gradient use the following matlab function:
plot_eap_voltage_gradients('line', [],[], 20, [0 50 0], [-500 500 -150 150], 0.3,50);
This should make a figure similar to Figure 8 of Gold, Henze and Koch
(2007). If you re-run the simulation with parameters "C" and "D" you
can recreate figures 9 and 10 from the paper.
You can also make intra-cellular detail plots for the line neuron. Try:
plot_intra_detail('line', [], 'approx', {}, [])
You can make the same plots for different parts of the cell. Try
replacing the parameter 'approx' (for "apical proximal") with
'apdist', 'basprox' or 'badist'. One end
of the cylinder is labeled "apical" ("ap") and the other is labeled
"basal" ("ba"). For the B type simulation the two are identical, but
simulation D you will see the action potential initiate at one end and
then travel to the far end.
(top)
To use another cell morphology in place of D151 we assume that you
start with a .hoc file describing the morphology that includes
3-D point information (i.e. it should include many
pt3dadd(...) functions in the code.) The LSA cannot be run
without 3-D data.
An important issue is the naming convention for the dendrites and
axonal sections of the cell. These names are used for assigning the
appropriate mechanisms and conductances to the different types of
sections. The EAPS Neuron simulation program assumes the following:
- The cell body is named 'soma'
- Every apical dendrite section has the string 'apical' somewhere
in its name
- The axon consists of the following:
- An axon hillock: a single section named 'hill'
- An initial segment: a single section named 'iseg'
- Any number of myelinated sections and nodes. The myelin sections
should have the string 'myelin' somewhere in their name, and
the nodes should have the string 'node' somewhere in their
name.
- Any other sections (not soma, apical, or axon parts) are assumed
to be basal, or default, dendrites.
If your neuron's morphology file does not follow these naming
conventions you can either change it so that it does, or alter the
NEURON program so that it recognizes your own convention. To do this,
modify the procedure make_lists() in the NEURON code file
cell_util.hoc. This procedure is the place where the program
actually searches for the aforementioned strings in the section names.
Throughout the code the different types of sections are referenced by
sections lists (for dendrites, myelin and nodes sections) or by a section
reference (for the soma, initial segment and hillock ). Those sections
lists/references are created in the make_lists() procedure so
that if you use a different naming convention you only need to change
that one procedure.
Next you must do two things to tell the program which parameters
to load for your file, and how to name the output directories
and trial number files:
- Set the values of the strings neuron_name and
cell_type at the top of your morphology file.
neuron_name should be the name of the hoc file you are
loading and cell_type should be "ca1pyr" (to start
with) - these will be used by the neuron program to determine the name
of the parameter files to load. It should like something like:
neuron_name = "myCell1"
cell_type = "ca1pyr"
- Copy the file eaps/hoc/params/d151_params.hoc and
re-name it to neuronname_params.hoc where neuronname
is the name you defined in the previous step.
There are a few additional steps necessary, so that you can make the
intracellular detail plots from your cell (if you do not wish to make
such plots, these steps are unnecessary).
- In the file eaps/hoc/current_util.hoc define a new
procedure neuronname_add_detail_sections()
where neuronname is the same as the string you defined
above. Following the example of d151_add_detail_sections(),
enter which compartments of your cell should have full details saved
from the simulation. These are the compartments for which you will
be able to plot intracellular details.
- In the file eaps/hoc/current_util.hoc add a few lines
to the procedure setup_detail_print():
if (strcmp(neuron_name,"neuroname")==0) {
neuroname_add_detail_sections()
}
where neuroname is the name of your cell. Put this code
right next to the similar code for d151 (either before or after - it
doesn't make a difference.)
- Next you must also add these compartments to the Matlab code, so when
you run the script plot_intra_detail it knows which compartments
correspond to which category. In order to do this, modify the Matlab files
eaps/mat/get_detail_secs.m and eaps/mat/get_detail_xs.m.
Your new code should mirror the code defined for d151 but using
the names of the sections and the compartment x's you defined in
neuronname_add_detail_sections(). Note that classification
of the compartments given by the plot_desc parameter is completely
arbitrary - you can define whatever categories you like, or none at all.
Sometimes it may be hard to decide what compartments you want to save
details for by simply looking at the .hoc file. In these
cases you might want run your first simulation only saving details for
the soma. After you have done this, use the Matlab script
plot_cell_labels described above (in the section Plotting
Intracellular Details) to visualize the cell with the compartment names.
Then decide which compartments to save details for.
If you would like to define simulations based on a different type of
cell (other than CA1 pyramidal) but using the channel model provided,
follow these steps:
- Copy the file eaps/hoc/params/ca1pyr_standard_params.hoc
and re-name it to
eaps/hoc/params/celltype_standard_params.hoc where
celltype is the name of your cell type.
- Make any changes to the file
eaps/hoc/params/celltype_standard_params.hoc necessary
so that it accurately reflects the properties of your cell type. Note
that you should be changing only the numbers in the define_param
procedure calls.
- Change the cell_type parameter at the top of your cell's
.hoc file to the new type.
- Run the simulation as described in the section Running
the NEURON Simulation.
All of the kinetics of the ion channels, passive parameters, linear
changes in conductance density distributions, and spine density
distributions are defined in the standard_params.hoc file.
By changing these you can make simulations for different classes of
cells with relatively minor changes to the code. (Of course,
determining the correct values for these parameters may be a
significant research task...)
Changing the EAPS package to support a different channel model
(different NMODL mechanisms) requires moderately significant changes
to the NEURON code. The same steps apply if you are adding an
additional NMODL mechanism to those that are now in the EAPS package
or if you are replacing some or all of the mechanisms with new ones.
Note: if you only want to remove some mechanisms from the
simulation, it is simplest to define their conductances to be zero
everywhere. That way they won't effect the simulation and you don't
have to change any code!
The code is not currently setup to support multiple channel models so
by setting up your own channel model you will no longer be able to run
the channel model that came with the package. Of course, one could
envision improvements to the code which would allow a program
parameter to inform the code which model is being run and take
appropriate action. This would require additional programming and
a detailed understanding of the NEURON program.
First, you will want to define a standard membrane params file
appropriate to your channel model. This is basically the same as what
was described in the previous section, Running Simulations with
Different Types of Cells. You are not required to follow the same
method as used in the sample (define all parameters of the NMODL
mechanism through the "define_param" function) but it is
strongly advised - especially if you will be experimenting with
different values for the mechanism parameters. If you are only
adding a mechanism you need only add any required params for
the new mechanism.
The second and greater task is that you will have to re-write nearly
the entire file membrane_init.hoc. Most of this file deals
with inserting mechanisms and setting the peak conductances for
different types of sections. The top level function called by the
main program is init_membrane(), so as long as you keep that
consistent it will integrate with the existing main program.
A procedure in membrane_init.hoc that should be kept but
modified is the procedure make_mechanism_list(): this
procedure plays a crucial role in the export of compartment details.
It defines the list of "mechdesc" templates. This list of
templates describes all the mechanisms and their components that
should be exported for the compartments defined for detailed data
export. Naturally you should copy the existing examples, substituting
the names and relevant variables of your own NMODL mechanisms. See
mechdesc.hoc and current_util.hoc for more details.
If you simply leave this procedure empty than no details of the ionic
mechanisms will be saved in the detail data.
Important note: The code that exports the net membrane current
for each compartment (the key data for use in the Line Source
Approximation) only looks for capacitive, Na+,
K+, and passive leak current. If any mechanisms you add
uses other types of current (i.e. Cl-, or non-specific ions
as in mixed-ion channels, shunts, synapses, etc.) then you must
modify the procedure read_compartment_currents() in
current_util.hoc (and also some of the other helper functions
- you'll have to read this code carefully.) Omission of even a
relatively small current can have a surprisingly large impact on the
resulting extracellular potential because if any current is missing
the net membrane current will become unbalanced (not equal to zero.)
This will tend to increase the extracellular potential amplitude
without altering the waveform shape. The EAPS package includes a
useful utility for debugging these types of changes:
eaps/mat/neuron_util/check_current_balance.m. This script
will plot the net current for the entire membrane alongside the
membrane current for the soma. In principal the net membrane current
for the entire cell is zero, but in practice there is some small
deviation due to discretization and rounding errors. After making
changes to current_util.hoc you should run
check_current_balance.m and confirm that the deviations from
zero net current are many orders of magnitude smaller than the peak
soma current. It would be nice if the deviation is on the order of
one millionth (1e-6) of the peak soma current but in practice you may
see deviations up to one ten thousandth (1e-4). If the deviation is
any larger than this it is almost certain that you have introduced a
bug in the current export procedures.
(top)
Note that the EAPS package is provided "as is" and there is no
guarantee of support. The only functionality is that described here
and it is assumed the users will be NEURON/Matlab programmers of
sufficient ability to make any modifications they require for
their own purposes.
That said, we will be starting a discussion thread (or more than one)
in the NEURON
User's Group Forum. All questions should be directed there so
that others can benefit from the answers. The author of the package
will check the User's group and post answers as often as possible.
If you would like to make improvements or extend the functionality of
EAPS you are welcome to contribute! (Bug reports are welcome.)
Contact the author by emailing carl at klab dot caltech dot edu. This
code could become a true open source project if there is anyone out
there who actually wants to contribute anything.
(top)