GUM*2002

San Antonio, November 9-10, 2002

Genesis tutorial on the synaptic control of spike timing with a variety of synaptic input patterns controlled by timetable objects.

by Dieter Jaeger

This tutorial is found in the GUM02_JAEGER directory (which you may have to install first). Start with your own copy of these files, because you will edit them as you go. Overall this simulation has several small modules coded into Genesis script (*.g) files. The simulation that is set up is a single compartment model with a flexible number and density of voltage-gated channels and synaptic inputs. The pattern of activations for each synapse is controlled by a timetable element, which substitutes for the inputs ususally originating from a network. Thus, timetable elements let you examine the synaptic decoding properties of single cells with complex input patterns without simulating a whole network. Timetable and event_tofile objects used in this tutorial are standard in Genesis2.2, but were not present in Genesis2.1.

The modular concept of this tutorial lets you simulate single compartment processing from very simple to very complex. We can start with one synapse in a passive compartment and can finish with hundreds of inhibitory and excitatory plastic synapses in a compartment with spike currents and other active currents. In addition we can examine currents in voltage clamp, and we can inject current pulses or noise currents. To examine the wealth of information these simulations can generate, scripts are prepared that show you how to save streams of input and output spike event times, or analog voltage and conductance traces. Data analysis is most conveniently performed with Matlab.

Overview of scripts used in tutorial:

This will look like a lot of scripts at first, but you don't need to know them all to get started. After the overview of scripts, a roadmap for getting into the `grove' is provided.

A: Core scripts setting up the simulation.

master.g: This is the master script, which includes several subscripts to set up the base simulation.

cell.g: This script sets up the cell, that resides in /cell/soma after the simulation is started.

cinject.g This script sets up a curren injection element

vclamp.g Function: makevclamp (). This script sets up a voltage-clamp mechanism. The makevlcamp function has to be executed by the user to activate the voltage clamp. The voltage clamp can be toggled with disable (enable) /PID commands. A reset is necessary before these commands take effect.

edschan.g: This script sets up the Hodgkin-Huxley channels made by Erik De Schutter for a Purkinje cell simulation in the channel library.

addspikechan.g. Functions: addspikecurrent () simply copies the Na and K spike channels from the channel library into the soma. addothercurrent () adds more `modulatory' currents. These functions have to be executed by the user to add channels to the simulation. Thereafter the activity of each channel type can be toggled with disable (enable) /cell/soma/{channame}. Again a reset is required after disable/enable commands.

B: Scripts setting up the graphical interface and connecting it to the simulation. These scripts are modified from Sharon Crook's CPG tutorial and need not to be modified while using this tutorial. Note that the graphical interface of this tutorial is rudimentary. The goal is to verify on-line that the simulation is working, but to save real data in files for later analysis.

tools.g

xtools.g

viewform.g

toggles.g

settings.g

setcolors.g

help.g

graphs.g

C: Scripts setting up current inputs or synaptic inputs using timetables. These scripts need to be modified to gain maximum flexibility when using the tutorial.

randomi1.g This script modifies the current injection pulse that is accessible with the graphical interface to include a noise term.

randomi2.g This script adds a noise current to the simulation that is active at all times. This script also provides a nice example of the use of extended objects in Genesis.

syn_timed.g Function: addsyn (name, tau1, tau2, gmax, isi). A synchan with name [name] is added to /input, and given properties tau1, tau2, and gmax. It is activated with a timetable. The mean activation rate is set to {isi}. Other properties of this timetable should be modified by editing the script. The synchan can be later disabled with `disable /input/[name]'

ampastp_timed.g Function: addfacsyn (name, tauf, taud, fac, dep, isi). Similar to syn_timed.g, but the synapse created has properties of short term plasticity with parameters tauf, taud, fac, and dep. See facsynchan documentation for details. Use setfield commands to change synaptic properties. Edit script to change the temporal activation properties.

nmda_timed.g Function: addnmda (name, isi). Similar to syn_timed.g, but the synapse created has a Mg block element and is voltage dependent. See Mg_block documentation for further details. In addition, this script shows how a timetable element can be set up to include bursts of activity with different isi properties. This synapse can be turned off or on with disable (enable) /cell/[name]/Mg. Note that the Magnesium block element actually provides the synaptic conductance to the soma in this case.

nmdahebb_timed.g Function: addnmdahebb (name, isi). Same as nmda_timed.g but a hebbsynchan is created. The long term plasticity properties are disabled by default but can be set by the user with setfield commands. See hebbsynchan documentation for details.

autapse.g A fun way to create feedback in your simulation. This needs no timetable, as the soma spike is used to generate the next activation.

lotsexandin.g This script creates an excitatory and an inhibitory synapse, which are activated randomly at high rates with 10 convergent timetables each. Note that a single synchan really corresponds to a population of synapses, so there is no need to create a new synapse for each timetable. Edit the script to change the timetable activation times.

lotsexandin2.g A variant of the above. Now we have 100 convergent timetables, and are using a gamma distribution for each input.

D: Scripts used for output control or running the simulation. Use these as templates to make your own variations thereof.

tt_tofile.g Function: tt_save(ttel, filename). This function saves the values in a time table element (of name ttel) to an asci file (of name {filename}). You need not run the simulation to get the times at which the timetable will activate. The output format is compatible with reading the same file as input into another timetable element, or to use the `load' command in Matlab to generate a vector of input times.

spike_tofile.g Function: spike_save(filename). This script saves the times of spike output from the soma to an asci file. The format is compatible with reading the same file as input into a timetable element.

runpar1.g This is an example of automated simulation control. A synaptic input situation is generated. Files to save results in are set up. A parameter is stepped through multiple values and the results are saved. Variants of this script can include any of the above functions for maximal flexibility.

shuntdemo.g Another example of controlling the simulation in batch mode. This script generates the data that lets you analyze the process of synaptic shunting, by looking at conductances, currents, and spike times.

A roadmap to get started

1) Run `genesis master'. You get an image of your compartment, and a graph window, which will show membrane voltage and injected current. You can change passive cell parameters and the current injection pulse with the graphical interface. Step the simulation for 0.1 s. You will see a stable resting membrane potential at -70 mV

2) Set the current pulse to 0.5 nA, and 0.2 s duration. Run for 0.5 s. Issue the `addspikecurrent' command, and run the simulation again. Then set the current pulse back to 0 ms duration.

3) Add an ampa-type synapse with the command `addsyn ampa1 0.5e-3 2e-3 1e-8'. Examine the new elements generated (/input/ampa1spike; /input/ampa1tt; /cell/ampa1) with showfield and showmsg commands. The default timetable /input/ampa1tt that is generated contains a 10s sequence of activation times with a 2nd order gamma distribution with a mean interval of 10 ms, and a 2 ms refractory period. Verify that this really is the case. Use `tt_save /input/ampa1tt1 ampa1.asc' to generate an asci file of your activation times. Use Matlab to make a histogram of the intervals. (in Matlab: `load ampa1.asc'. `intvl = diff(ampa1(:,2))', `hist(intvl,100)' ).

4) Run the simulation for 0.5 s. What do you see? Turn on the voltage-clamp with `makevclamp'. Rerun the simulation. Explain the time course of the voltage-clamp current. Turn off the voltage clamp with `disable /PID'.

5) Add an NMDA synapse to your input situation with `addnmda nmda1 0.05'. This adds an NMDA channel with a mean isi of 50 ms, and two bursts of 5 ms isi's at 0.5 and 1.0 s (one regular, one with exponential distribution). Examine the nmda_timed script as to how this timetable is set up. Save the activation times to file and verify it works as advertised. Disable your ampa synapse, the NaF and the Kdr channels and run the simulation with the nmda synapse alone. Then add a 0.5 nA current injection on top of the nmda synapse. You should be able to see the voltage dependence of synaptic current through this synapse.

6) Easy task: Make a copy of the syn_timed.g script and edit the timetable fields to get a different input sequence. For instance you can make a set of activation times with a regular interval of 20 ms, and then you use the TUPDATE function to jitter your activation times by +-2 ms. Make a synapse with this changed script and verify its function.

7) Ready for running a paradigm. Exit the simulation and get a clean start. Examine the runpar1.g script. What does it do? Execute it. Examine the data files with Matlab. What happens with spiking as you increase synaptic gain?

After you get the gist of how to run and manipulate these simulations, you can complete many interesting tasks regarding the function of synaptic input in active cells. Some possible directions to go are given below.

Example: The effects of synaptic shunting when many inputs are active.

The simulations can be run in a batch with the shuntdemo.g script. This script adds the spike currents to the cell and performs 3 simulations: 1) A noise current injection is used to elicit spiking. 2) A mixed baseline of inhibitory and excitatory inputs is used to elicit spiking. 3) Both the noise current and the synaptic input are turned on to compete in the control of spiking.

Here are some suggestions as to what you should look for in understanding this system. What does the Vm trace look like in each condition? What does the spike pattern look like when noise current and synaptic current compete for spike control? To understand the findings we need to look at the current and conductance traces that were saved. Use Matlab to plot the random current, and the total synaptic current in the presence or absence of random current injection. Use Matlab to subtract the total synaptic current in the presence of random current from the total synaptic current in the absence of random current. Why is there a difference between the two synaptic currents, though the synaptic conductance is identical? What does the difference look like? Another interesting analysis is to generate a trace of the combined synaptic reversal potential for these simulations with Matlab: Esyn = (Gin * -0.07) / Gex + Gin) and compare this trace to the membrane potential trace during the simulation. Gin and Gex are saved as column 3 and 5 in the asci output files, Vm is saved as column 2. If you don't know how to add, subtract, and multiply vectors in Matlab, ask your friendly support staff.

Possible Directions to Explore:

1) Explore the effects of various forms of short-term facilitation and short term depression with different types of input patterns using variants of the ampastp_timed script. Try to form a hypothesis first. Then create the patterns of input and plasticity parameters. Get your results. Examine your hypothesis. For example. Hypothesis 1: Strong short-term potentiation will enhance the response to small bursts in the input pattern of excitatory input.

2) Explore the effect of synaptic activity on spiking when `addothercurrent' has been used. (You should first look at the spike patterns caused by these voltage-gated conductances with just a current injection pulse). Then generate patterns of synaptic input you want to study.

3) Explore the development of plasticity over time after making different patterns of input with variants of the nmdahebb_timed script.

4) For the intrepid: Combine the effect of short-term plasticity and long-term potentiation, and see what forms the interaction may take. You will need a script that saves the weight of each synapse over time.

5) Definitely out of control: Combine short-term plasticity, long term plasticity, and modulatory voltage-gated conductances.

Copy of Genesis 2.2 on-line Documentation:

26.68 timetable

Object Type:	timetable

Description:	A table of time values at which an activation variable 
		is set to different value for one timestep.
		Designed to allow timestep independent synaptic activation
		with controlled sequences of input.

Author:		D. Jaeger, Caltech (3/95)
	        revised and extended for GENESIS 2.2 4/00

------------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:	timetable_type [in genesis/src/device/spike_struct.h]

Size:		176 bytes

Fields:		method		1 = exponential inter-time interval
				2 = gamma iti
				3 = regular iti
                                4 = read times from ascii file
		meth_desc1	method parameter
		meth_desc2	method parameter
		meth_dexc3	method parameter
		seed		random number generator seed
		act_val		value of activation when set to on
		maxtime		max. time up to which table is filled
		maxpos		table size
		tabpos		current table index
		fname		name of file if times are read from file
		
		------- fields below should not be touched by user ----

		*timetable	floating point array
		allocated	allocation flag

------------------------------------------------------------------------

SIMULATION PARAMETERS

Function:	TimetableFunc [in genesis/src/device/timetable.c]

Classes:	device

Actions:	SET
		RESET
		PROCESS
		TABCREATE
		TABFILL
		TUPDATE

Messages:	[none]

-------------------------------------------------------------------------

Notes:	The timetable consists of a floating point array of values
	at which an activation variable is set to on.

	The table can be filled with various distributions of inter-
	time intervals. This procedure is controlled by the
	TABCREATE, TABFILL, and TUPDATE actions. The fields
	method, meth_desc1, meth_desc2, and meth_desc3 control
	the process. Here is how it works:

	TABCREATE: a table of size maxpos is allocated and filled with zeros.
	TABFILL: a table is created and filled according to the following
		rules: 
		method=1: exponential iti distribution.
			-> meth_desc1 = mean iti.
		method=2: gamma iti distribution with added refractory period
			-> meth_desc1 = mean iti.
			-> meth_desc2 = absolute refractory period.
			-> meth_desc3 = order of gamma distribution
				(integer between 1 and 6)
		method=3: regular iti distribution
			-> meth_desc1 = iti
		method=4: read times from ascii file
			-> filename = filename

		maxtime: table is filled up to maximal value of maxtime
			and appropriate table is allocated and maxpos is
			set automatically.
		seed:	if seed != 0 then random number generator is
			seeded before filling table with methods 1 or 2.

	TUPDATE: the table is changed in the following way.
	example: call timetable TUPDATE mode mintime maxtime new_iti [new_iti2]
		i.e. the TUPDATE is done with a call statement and
			4 variables need to be supplied.
		mode=1: The time values are randomly jitterd for
			+- 0.5 new_iti
		mode=2: A new distribution following the current
			method field is inserted between mintime and
			maxtime. The old values in this time range
			are thrown out, but surrounding values stay
			intact.	 The new_iti field determines the new
			mean iti. If a new_iti2 is given, the new iti is
			changed linearly from new_iti to new_iti2 during
			the period between mintime and maxtime.
                mode=3: A specified number of spikes can be inserted
                        into a given time window. Usage:
                        call  TUPDATE 3 starttime endtime n jitval
                        The first spike is inserted at starttime. If more
                        than one spike is to be inserted, subsequent spikes
                        are inserted at regular intervals until the nth
                        spike is inserted at endtime. If jitval <> 0 then
                        each inserted spike is randomly jittered by a value
                        of max. +-jitval.

Example:

create timetable tt
setfield tt maxtime 1 act_val 1.0 method 1 meth_desc1 0.02
/* create table with exponential distribution of mean 0.02 */
call tt TABFILL
/* connect table to synaptic events */
create synchan c3
addmsg tt c3 ACTIVATION activation

/* put burst with faster itis  (iti 0.001)  at time 0.1 to 0.2 */
call tt TUPDATE 2 0.1 0.2 0.001

/* put burst of diminishing itis (iti 0.001 to 0.01)  at time 0.5 to 0.7 */
call tt TUPDATE 2 0.5 0.7 0.001 0.01

See also:	event_tofile, Scripts/examples/spike/spikes.g

26.24 event_tofile

Object Type:	event_tofile

Description:	A gizmo that collects an INPUT message. When value
		in message exceeds threshold, current simulation
		time is written to asci file.
		
		Designed to allow ascii output from a range of
		objects, like channelC3, synchan, timetable.

Author:		D. Jaeger, Caltech (3/95)

---------------------------------------------------------------------

ELEMENT PARAMETERS

DataStructure:	event_tofile_type [in genesis/src/device/spike_struct.h]

Size:		64 bytes

Fields:		fname		File name of asci output
		fp		file pointer
		open		flag
		threshold	threshold above which time is written to file

-----------------------------------------------------------------------

SIMULATION PARAMETERS

Function:	Event_tofileFunc  [in genesis/src/device/event_tofile.c]

Classes:	device

Actions:	PROCESS
		SET
		OPEN
		CLOSE
		FLUSH

Messages:	INPUT compared against threshold

-----------------------------------------------------------------------

Notes:	An ascii file containing simulation times at which an event
	occurred is generated. The event arrives via an INPUT
	message, and is generated when the input value exceeds
	threshold. Only positive thresholds are implemented.

	Before activation the file needs to be opened with a reset or call
        OPEN statement.  The generic openfile, writefile, and closfile
        commands can NOT be used with the same file.

	
Example: 

create synchan syn
create event_tofile etf
set etf fname test.asc
sendmsg syn etf INPUT activation
reset
... // run simulation
call etf CLOSE

See also: openfile, writefile, closefile (for general asci file control)
          timetable, spikegen, randomspike (for good source elements
          to feed into event_tofile), Scripts/examples/spike/spikes.g.