## Connect multiple cells using connection probabilities

**Moderator:** hines

### Connect multiple cells using connection probabilities

I'm trying to connect multiple neuron cells using the Blue Brain Project neuron models. I need to take into account the connection probabilities between the cells. So I was thinking of multiplying the connection probability by the number of dendrites in the post synaptic cell. Is the number of dendrites present in the expression dend[number_of_dendrites?

### Re: Connect multiple cells using connection probabilities

Let's say you instantiated a model of a neuron into a variable named

*cell*, you can get the total number of dendritic compartments with*len(cell.dend)*.-
- Site Admin
**Posts:**5819**Joined:**Wed May 18, 2005 4:50 pm**Location:**Yale University School of Medicine-
**Contact:**

### Re: Connect multiple cells using connection probabilities

Why would that be useful?ekkya wrote:I'm trying to connect multiple neuron cells . . . I need to take into account the connection probabilities between the cells. So I was thinking of multiplying the connection probability by the number of dendrites in the post synaptic cell.

Try it and see.Is the number of dendrites present in the expression dend[number_of_dendrites?

### Re: Connect multiple cells using connection probabilities

Here's a snippet of one of my scripts where

*preSyn*is the pre-synaptic neuron, and

*postSyn*is the post-synaptic one:

Code: Select all

```
def establishSynapses(preSyn, postSyn, thres=10, w=.04):
# Calculate the number of connections between preSyn and postSyn.
numConnections = int(round((getConnectionProbability(preSyn, postSyn) / 100) * len(postSyn.dend), 0))
for i in range(numConnections):
syn = neuron.h.ExpSyn(0.5, sec = postSyn.dend[i])
syns.append(syn)
nc = neuron.h.NetCon(preSyn.soma[0](0.5)._ref_v, syn, sec=preSyn.soma[0])
nc.weight[0] = w
nc.delay = 0
nc.threshold = thres
nclist.append(nc)
```

*getConnectionProbability*only to get the specific probability value from the file.

Then I divided it by 100 because, in the website, the probability is given in percentage, and I multiple it by the number of dendritic compartments, which I round it to zero decimal places and convert it to integer so I can use it in the

*for*loop, one for the number of connection and other for the number of synapses per connection.

The variable

*numConnections*is the fraction of dendritic compartments based on the connection probability of that specific pair of neurons. Thus, my

*for*loop will run for

*numConnections*times and in each time, it is going to establish one synapse per connection. NMC Portal provides the number of synapses per connection as well, in this case I'd say the best approach would be to code a nested

*for*loop.

The variables for h.ExpSyn and h.NetStim follow the same nomenclature as the ones in the NEURON+Python Tutorial.