Connecting 2 neurons

The basics of how to develop, test, and use models.
Post Reply
ehb
Posts: 6
Joined: Tue Jun 10, 2014 9:02 pm

Connecting 2 neurons

Post by ehb »

Hello,

I am new to programming on Neuron. I am trying to create 2 neurons (each with 1 soma, 1 dendrite and 1 axon). I connected axon1 with dend2 and then I connected axon2 with dend1. I also put an IClamp to stimulate soma1. I am expecting that initial stimulation to produce a continuous closed-loop excitatory state. However, I am getting an error with my NexCon source value: &axon1. I still receive an error if include .v(0.5). Do you know what I am doing incorrectly?

Here is my code:

Code: Select all

load_file("nrngui.hoc")

create soma1

soma1 {
nseg = 1
diam = 30
L = 30
Ra = 100.0
insert hh
insert pas	
}

create dend1

dend1 {
nseg = 23
diam = 1
L = 600
Ra = 100
insert hh
insert pas
}

create axon1

axon1 {
nseg = 3
diam = 1
L = 1000
Ra = 100
insert hh
insert pas
}


// Connect parts together

connect dend1(0), soma1(0)
connect axon1(0), soma1(1)


// create an electrode in the soma

objectvar stim 
soma1 {
stim = new IClamp(0.5)
stim.del = 100
stim.dur = 5
stim.amp = .45
}
tstop = 500


// SECOND IDENTICAL NEURON


create soma2

soma2 {
nseg = 1
diam = 30
L = 30
Ra = 100.0
insert hh
insert pas	
}

create dend2

dend2 {
nseg = 23
diam = 1
L = 600
Ra = 100
insert hh
insert pas
}

create axon2

axon2 {
nseg = 3
diam = 1
L = 1000
Ra = 100
insert hh
insert pas
}


// Connect parts together

connect dend2(0), soma2(0)
connect axon2(0), soma2(1)


// Placing synapse on dend2

objectvar syn1 
dend2 {
syn1 = new Exp2Syn(0.5)
syn1.tau1 = 0.5
syn1.tau2 = 1.0
syn1.e = 0
}

// Connecting axon1 to dend2
objectvar connection1 
connection1 = new NetCon(&axon1, syn1, -20, 1, 1 ))

// Placing synapse on dend1

objectvar syn2 
dend1 {
syn2 = new Exp2Syn(0.5)
syn2.tau1 = 0.5
syn2.tau2 = 1.0
syn2.e = 0
}

// Connecting axon2 to axon1
objectvar connection2
connection2 = new NetCon(&axon2, syn2, -20, 1, 1 ))

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

Re: Connecting 2 neurons

Post by ted »

Do you know what I am doing incorrectly?
Yes, but wouldn't you rather read how to do things correctly? Here's a list that will help you get going in the right direction.
1. Apply the principle of incremental revision and testing. Failure to do this is a very common mistake. It is not a good idea to try to use a specialized feature of a programming language for the first time in a complicated setting, e.g. using a NetCon in a model that is far too complex. Start out by making a network model whose cells are single compartments, then use a NetCon to connect them. When it comes time to make a network of cells that are more complex, first make sure that you have properly evaluated and revised the model cells before trying to use them in a network. The values used for nseg in the dendrite and axon are way off from what they should be for reasonable spatial accuracy, given the values of cm and Ra. You would have discovered this if you created your model cell with the CellBuilder, and used its d_lambda rule to discretize it.
2. Read relevant documentation in the Programmer's Reference. For example, don't use ion channel models without understanding them. Why combine hh and pas? hh includes three channel models--sodium, potassium, and a leak channel. gl_hh is huge, so if you really must have a separate pas channel, you'll probably want to set gl_hh to 0. Better would be to omit the pas channel.
3. Read relevant articles for their tutorial value. Chapter 10 of the NEURON Book, and any of the articles here
http://www.neuron.yale.edu/neuron/nrnpubs
that discuss modeling networks with NEURON (but especially the article mentioned below), contain lots of useful information about modeling networks with NEURON. Do you have to read them all, or be an expert on everything, before you can do anything useful? No, but you would have soon discovered that the strategy for constructing a network model is
--specify the cell classes that will be used in the network
--use the cell classes to create the cell instances that will be in the network
--connect the cell instances
4. Take advantage of the GUI to avoid writing code as much as possible. If you create your model cell with the CellBuilder, you can use its Management / Cell Type feature to generate a file that contains working hoc code that defines a cell class. Also, reading the contents of such a file is a great way to learn more about programming with NEURON and effective ways for specifying the properties of model cells.
5. Look at exercises from previous NEURON courses. A link at
http://www.neuron.yale.edu/neuron/courses
will take you to a list of hands-on exercises that include two that are relevant to network models.
6. It often helps to examine published working code produced by others who have more experience. For example, there are certain common practices used to specify the topology (branched architecture) of a cell. One is to attach the 0 end of a child section to its parent, and I see that you have done that. Another is to attach the axon to the 0 end of the soma, and if there is only one dendrite to attach the dendrite to the 1 end of the soma. You might find this particular article useful
Hines, M.L. and Carnevale, N.T.
Translating network models to parallel hardware in NEURON.
J. Neurosci. Methods 169:425-455, 2008
(available from http://www.neuron.yale.edu/neuron/nrnpubs)
because it provides examples of working code for network models that you're clearly ready to read. And all the source code is available from ModelDB https://senselab.med.yale.edu/modeldb/
ehb
Posts: 6
Joined: Tue Jun 10, 2014 9:02 pm

Re: Connecting 2 neurons

Post by ehb »

Thank you, Ted.
Post Reply