add/omit a synapse for different iterations

NMODL and the Channel Builder.
Post Reply
einsinghaf
Posts: 11
Joined: Tue Jun 17, 2014 2:23 pm

add/omit a synapse for different iterations

Post by einsinghaf »

Hi Experts
I have a neuron with lots of sections and segments.
I would like to add a synapse with variable conductance to each segment and save some data,
and then remove the synapse and do this again for the next segment.
Would you please give me some clue about how can I do this?
ramcdougal
Posts: 267
Joined: Fri Nov 28, 2008 3:38 pm
Location: Yale School of Public Health

Re: add/omit a synapse for different iterations

Post by ramcdougal »

The safest way to avoid any risk of cross-contamination from multiple experiments is to run them independently in separate processes. Obviously, doing this manually is not a good use of your time.

You could write a shell script that launches NEURON repeatedly with arguments indicating what simulation to run. This approach will work across all platforms (linux, windows, mac), however: it may make it harder for others (and perhaps yourself) to understand how to run your model, and more importantly it duplicates setup time.

If you are running on linux or mac, I recommend you look into Python's os.fork() function, which clones a running simulation into two identical simulations. Do this inside of your loop over all the segments of interest after having otherwise set up your model. If the function returns 0, you are in the child process: go ahead and add the synapse, run your experiment, and explicitly quit. If, instead, it returns 0, you are in the parent process. Immediately do an os.wait() to wait for the child simulation to quit, and then let the for loop continue to the next possible synapse location; the parent's state is exactly as it was before the child was created (i.e. without any synapse added, and without any effects of running a simulation).
regger
Posts: 21
Joined: Sun Apr 22, 2012 9:49 pm

Re: add/omit a synapse for different iterations

Post by regger »

The usual way to set up and control synapses in NEURON is using the NetCon class.
This offers some very convenient interfaces to what you usually need to set up and control connections:
1. the source - either an analog signal, such as the voltage in an axon terminal, or a "digital" spike source, such as a NetStim or a VecStim.
2. the target - usually a synapse, e.g. an ExpSyn, that you connect to your segment by specifying the segment location along the currently accessed section.
3. synapse parameters - threshold, delay and weight. weight is probably the parameter you want to adjust, it usually refers to the synapse conductance, with the units specified in the .mod file of your synaptic mechanism

Now, if you want to change the location of the synapse between different runs, you need to set up the anatomy of your target cell and the activation time of your presynaptic cell beforehand, and then it's probably best to iterate through all sections and segments before creating a new synapse and NetCon with varying weights before each simulation initialization & run - but this really depends on what you're trying to do exactly. Probably best to try it out with a single synapse first, and only when this is working, go ahead with changing the synapse location and restarting the simulation.

cheers,
Robert
ted
Site Admin
Posts: 6299
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: add/omit a synapse for different iterations

Post by ted »

einsinghaf wrote:I have a neuron with lots of sections and segments.
I would like to add a synapse with variable conductance to each segment and save some data,
and then remove the synapse and do this again for the next segment.
In pseudocode

Code: Select all

for each section of interest {
  for each internal node of this section {
    attach a synaptic mechanism to this location
    run a simulation
    write simulation results to a file
  }
}
Hints for implementation:
1. forall iterates over all sections. If you are only interested in some sections, append them to a SectionList, then iterate over that SectionList, e.g. forsec seclistname
2. Use for (x,0) to iIterate over internal nodes of the currently accessed section.
3. Use an ExpSyn or Exp2Syn. Drive it with events generated by a NetStim. To attach a synaptic mechanism to location x on the currently accessed section syn = new Exp2Syn(x)
ns = new NetCon(pre, syn)
where pre is the objref that points to the NetStim.
4. Use run() to execute each simulation. Use Vector class's record() method to capture the time course of the variable(s) of interest.
5. Whether you write each run's results to a separate output file is up to you; if you do that, you might want to print run parameters as the first line in the file, e.g. secname() and the location to which the synapse was attached.
6. Read the Programmer's Reference to learn more about any of the items I mentioned that may be unfamiliar to you.
Post Reply