how to make a simple Random network?

Moderator: wwlytton

Post Reply
GTR

how to make a simple Random network?

Post by GTR »

I have a simple network of 4 subthalamic neurons with a deterministic way the number of neurons that participate in the network are defined , number of synapses each one makes with the others,and a deterministic combination of connection (with which one makes synapse).

I just want to make each neuron connect randomly with the others in a small network with their synapses in the soma of the postsynaptic cell and of my great concern that the produced combinations from hoc to be automatically launched in the object instances Sthcells.soma SthCells[i+1].soma SthCells[i+2].soma inside my code so as to have the random network and run it directly. It is desired but not necessary to be able to choose the number of participating neurons and each one to make synapses with the 1/4 of nSThcells.For example in an 8 neurons net each one to make 2 synapses.

If it is not feasible to be compatible with the current code,
suppose I have a network of 8 subthalamic neurons how can I use random() to generate for me the random connections each one makes.Can you help me icorporate it inside the code ?



Code: Select all

SThcells[1].soma syn[0] = new ExpSyn(0)                                            
SThcells[0].soma SThcells[1].nclist.append(new NetCon(&v(0), syn[0], -20, 1, 0.5))

Code: Select all

load_file("nrngui.hoc")

objref cvode

cvode = new CVode(0)

begintemplate SThcell
public soma, treeA, treeB, nclist

create soma, treeA[1], treeB[1]
objectvar f, nclist

proc init() {local i, me, child1, child2

    create soma

    nclist = new List()

    soma {
      nseg = 1
      diam = 18.8
      L = 18.8
      Ra = 150.224
      
      // channels
......................................................................................
......................................................................................

     // Connect trees to the soma
    connect treeA[0](0), soma(1)
    connect treeB[0](0), soma(0)
}

endtemplate SThcell

tstop = 800
ndend = 2
nSThcells = 4                             

objectvar SThcells[nSThcells]              

for i = 0, nSThcells-1 {
    SThcells[i] = new SThcell()
}

objectvar stim[nSThcells]                
                                              
i=0
SThcells[i].soma {
    stim[i] = new IClamp(0.5)
    stim[i].del = 0
    stim[i].dur = 0
    stim[i].amp = 0
}
i=1
SThcells[i].soma {
    stim[i] = new IClamp(0.5)
    stim[i].del = 0
    stim[i].dur = 0
    stim[i].amp = 0
}  
i=2
SThcells[i].soma {
    stim[i] = new IClamp(0.5)
    stim[i].del = 0
    stim[i].dur = 0
    stim[i].amp = 0
}  
i=3
SThcells[i].soma {
    stim[i] = new IClamp(0.5)
    stim[i].del = 0
    stim[i].dur = 0
    stim[i].amp = 0
}
 

//synapse1 attach source:SThcells[0] -> target: SThcells[1] at point treeA[1]        

maxsyn = 10                                  
objectvar syn[maxsyn]                

SThcells[1].soma syn[0] = new ExpSyn(0)                                            
SThcells[0].treeB[1] SThcells[1].nclist.append(new NetCon(&v(0), syn[0], -20, 1, 0.5))

access SThcells[0].soma

//synapse2 attach source: SThcells[1] -> target:SThcells[2]at point treea[7]
 
SThcells[2].soma syn[1] = new ExpSyn(0)                                                                                  
SThcells[1].treeA[7] SThcells[2].nclist.append(new NetCon(&v(0), syn[1], -18, 1, 0.5)) 

access SThcells[1].soma

// synapse3 attach source: SThcells[2] -> target: SThcells[3] at soma

SThcells[3].soma syn[2] = new ExpSyn(0)                                           
SThcells[2].soma SThcells[3].nclist.append(new NetCon(&v(0), syn[2], -18, 1, 0.5))

access SThcells[2].soma
...................................................................
xopen("sthE2.ses")
run()
I used Random in a matlab code to produce me the random synapses but my problem is that then I have to change the postsynaptic instance subscripts

Code: Select all

SThcells[i].soma syn[2] = new ExpSyn(0)
one by one inside hoc code.

Can I modify the following?

Code: Select all

makeRandomSynapses(nSThcells)
nSynapses=countSynapses()
print nSynapses
objectvar synapsesCells[nSynapses]
proc attachCells() {
    synapsesCells[$1]=new ExpSyn(0)
    synapsesCells[$1].tau1=0.05
    synapsesCells[$1].tau2=0.1
    synapsesCells[$1].e=-30
    SThcells[$2].soma SThcells[$3].nclist.append(new NetCon(&v(0),synapsesCells[$1],30,1,0.01))
I want a code as simple as possible for beggining even with a predetermined number of paricipating neurons.
Thank you in advance,
George.
ted
Site Admin
Posts: 6300
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: how to make a simple Random network?

Post by ted »

The best strategy for setting up a network model is
1. define the cell classes
2. create the specific instances of each cell class
3. set up the connections between the cells

The best way to manage collections of objects--whether they be point processes,
Graphs, NetCons, or biophysical or artificial model cells (as instances of cell classes)--
is with Lists.

Hybrid hoc/pseudocode for a program that sets up a network of bc cells that project to
pyr cells:

Code: Select all

load_file("nrngui.hoc")
// DEFINE CELL CLASSES
// do this by load_file statements that read files that contain definitions of cell classes
load_file("pyrclass.hoc")
load_file("bcclass.hoc")
// next read file that defines constants that specify how many cells of each class,
// and network parameters--i.e. connection probabilities, and statistics of 
// strengths, delays etc.
load_file("netspecs.hoc")

// CREATE SPECIFIC INSTANCES OF EACH CELL CLASS
// these will become Lists that contain instances of pyramidal cells, basket cells etc.
objref pyrlist, bclist
pyrlist = new List()
bclist = new List()

for ii=0,NPYR-1 pyrlist.append(new PyrCell)
for ii=0,NBC-1 bclist.append(new BCell)

// SET UP CONNECTIONS
objref nclist, nctemp

// if it is necessary to set up more than one kind of projection, 
// the following nested for loops can be generalized
// and put inside a proc that expects two objref arguments
// (the lists of source and target cells)
// plus as many scalar arguments as needed to specify connection parameters
for ii=0,pyrlist.size()-1 { // outer loop should iterate over target cells
  for jj=0,bclist.size()-1 { // inner loop iterates over source cells
    use the network statistics for bc to pyr connections to decide whether 
      there should be a connection from this target to this source
    if yes {
      calculate the weight and delay
      nctemp = new NetCon with this weight and delay
        that watches this source and delivers events to this target
      nclist.append(nctemp)
    }
  }
  objref nctemp  // so we can't mess up the last NetCon in nclist
}
Post Reply