Setpointer when defining a synapse

A Python package that facilitates development and use of models of biological neural networks

Moderator: tom_morse

Post Reply
Noémie
Posts: 1
Joined: Fri Jun 15, 2018 4:54 am

Setpointer when defining a synapse

Post by Noémie » Fri Jun 22, 2018 4:30 am

Hi,

I am trying to translate the Gentiletti et al. model (https://senselab.med.yale.edu/modeldb/S ... hoc#tabs-2) to netpyne and I have some problems with the inhibitory synapse.
In this model, the mod file is not Exp2Syn.mod but is.mod and it require a pointer with the interneuron ecl.
Below is the is mod file :

Code: Select all

TITLE is :Inhibitory synapse in the pyramidal cell

NEURON {	
	POINT_PROCESS is
        RANGE tau1, tau2, i, g
	USEION cl READ ecl WRITE icl VALENCE -1	
        		   
	POINTER e
}

PARAMETER {
	tau1 = 2   (ms)
	tau2 = 6   (ms)
}

ASSIGNED {
	v    (mV)
	e    (mV)
	ecl  (mV)
	icl  (nanoamp)
  g (microsiemens)
  factor
}

STATE {
   A (microsiemens)
   B (microsiemens)
}

INITIAL {
 LOCAL tp
 if (tau1/tau2 > .9999) {
     tau1 = .9999*tau2
 }
 A = 0
 B = 0
 tp = (tau1*tau2)/(tau2 - tau1) * log(tau2/tau1)
 factor = -exp(-tp/tau1) + exp(-tp/tau2)
 factor = 1/factor
}

BREAKPOINT {
 SOLVE state METHOD cnexp
 g = B - A
 icl = g*(v - e)
}

DERIVATIVE state {
 A' = -A/tau1
 B' = -B/tau2
}

 NET_RECEIVE(weight (microsiemens)) {
 A = A + weight*factor
 B = B + weight*factor
} 
and the hoc code that I am trying to translate :

Code: Select all

//Inhibitory synapse (GABA_A)
objref ncl
ncl = new List()
objref syn
psoma syn = new is(0.5)
setpointer syn.e, psoma.ecl(0.5)
syn.tau2 = 6
syn.tau1 = 2
soma ncl.append(new NetCon(&v(1),syn,-10,0,0.003))
I tried to import the synapse mechanism like that :

Code: Select all

netParams.synMechParams['inhE'] = {'mod': 'is', 'tau1': 0.25, 'tau2': 5.0} 
But I don't know how to set the pointer with psoma.ecl

I also tried to import the mechanism directly with the cell :

Code: Select all

netParams.importCellParams(label='PyrCell_rule', conds={'cellType': 'PYR', 'cellModel': 'PyrCell'},
    			fileName='PyrCell2.py', cellName='PyrCellClass', importSynMechs=True, cellArgs={'Complex_PyrCell':True})
print netParams.synMechParams
where Pyrcell2.py is :

Code: Select all

class Cell(object):
    def __init__(self, Complex_PyrCell):
        self.synlist = []
        self.createSections()
        self.buildTopology()
        self.defineGeometry()
        self.defineBiophysics(Complex_PyrCell)
        self.createSynapses(Complex_PyrCell)
        self.nclist = []

    def createSections(self):
        pass

    def buildTopology(self):
        pass

    def defineGeometry(self):
        pass

    def defineBiophysics(self):
        pass

    def createSynapses(self,Complex_PyrCell):
        if Complex_PyrCell :
            self.synE = h.Exp2Syn(self.soma(0.5))
            self.synE.e = 0
            self.synE.tau1 = 0.4
            self.synE.tau2 = 2

            self.synI=h.isyn(0.5, sec=self.soma)
            self.synI.tau1 = 0.25
            self.synI.tau2 = 5
            h.setpointer(self.soma(.5)._ref_ecl,'e',self.synI)
        else :
            self.synE = h.Exp2Syn(self.soma(0.5))
            self.synE.e = 0
            self.synE.tau1 = 0.2
            self.synE.tau2 = 1

            self.synI = h.Exp2Syn(self.soma(0.5))
            self.synI.e = -80
            self.synI.tau1 = 0.25
            self.synI.tau2 = 5


    def createNetcon(self, thresh=10):
        """ created netcon to record spikes """
        nc = h.NetCon(self.soma(0.5)._ref_v, None, sec = self.soma)
        nc.threshold = thresh
        return nc


class PyrCellClass(Cell):
    def createSections(self):
        """Create the sections of the cell."""
        self.soma=h.Section(name='soma')
        self.dend1=h.Section(name='dend1')
        self.dend2=h.Section(name='dend2')
        self.sections=[self.soma, self.dend1, self.dend2]

    def defineGeometry(self):
        """Set the 3D geometry of the cell."""
        self.soma.nseg=1
        self.soma.L=20
        self.soma.diam=15

        self.dend1.nseg=1
        self.dend1.L=300
        self.dend1.diam=1.9

        self.dend2.nseg=1
        self.dend2.L=150
        self.dend2.diam=6.2

    def defineBiophysics(self,Complex_PyrCell):
        """Assign the membrane properties across the cell."""
        # Insert active Hodgkin-Huxley current in the soma

        for ss in self.sections:
            #these settings are the same for all sections of interneuron and pyramidal cell
            ss.insert('leak')
            ss.Ra=100
            ss.cm=1
        # insert mechanisms only for soma
        self.soma.insert('pnas')
        self.soma.gna_pnas=0.025
        self.soma.insert('pkdrs')
        self.soma.gkdr_pkdrs=0.05
        # insert mechanisms only for dend1
        self.dend1.insert('pnad')
        self.dend1.gna_pnad=0.0045
        self.dend1.insert('pkdrd')
        self.dend1.gkdr_pkdrd=0.00185
        # insert mechanisms only for dend2
        self.dend2.insert('pnad')
        self.dend2.gna_pnad=0.0045
        self.dend2.insert('pkdrd')
        self.dend2.gkdr_pkdrd=0.00185
        if Complex_PyrCell :
            for ss in self.sections:
                #these settings are the same for all sections of interneuron and pyramidal cell
                ss.insert('nakpump')
                ss.km_k_nakpump=2
                ss.km_na_nakpump=10
                #these settings are the same for all sections of the pyramidal cell
                ss.insert('kcc2')
                ss.insert('singleaccum') # modified accum for a single cell
                ss.insert('cal')
                ss.gcal_cal=0.00015
                ss.insert('kahp')
                ss.gkahp_kahp=0.0001
                ss.insert('kc')
                ss.gkc_kc=0.196
            # insert mechanisms only for soma
            self.soma.insert('nap')
            self.soma.gna_nap=0.0002
            self.soma.insert('km')
            self.soma.gkm_km=0.0035


    def buildTopology(self):
        self.dend1.connect(self.soma(0),1)
        self.soma.connect(self.dend2(0),1)
When I print the netParam.synMechParams I have :

Code: Select all

{PyrCellClass_isyn_0: {tau2: 5.0, tau1: 0.25, mod: 'isyn'}, PyrCellClass_Exp2Syn_1: {tau2: 2.0, tau1: 0.4, e: 0.0, mod: 'Exp2Syn'}}
But when I want to use PyrCellClass_isyn_0, the simulation doesn't start, I don't have any error but it does nothing at all.

Code: Select all

Creating network of 20 cell populations on 1 hosts...
  Number of cells on node 0: 20
  Done; cell creation time = 0.01 s.
Making connections...
  Number of connections on node 0: 25
  Done; cell connection time = 0.01 s.
Recording 8 traces of 4 types on node 0
Thanks for your help,
Noémie

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

Re: Setpointer when defining a synapse

Post by ted » Fri Jun 22, 2018 11:05 am

All those POINTERs are going to be a real problem in a parallelized model. Would it be better to use RxD to deal with extracellular ion accumulation?

salvadord
Posts: 76
Joined: Tue Aug 18, 2015 3:49 pm

Re: Setpointer when defining a synapse

Post by salvadord » Wed Jul 04, 2018 4:36 pm

Hi Noemie,

Currently, netpyne does not support synapses with pointers. I added a Github issue to add this feature in the future: https://github.com/Neurosim-lab/netpyne/issues/332

You could try creating the pointer "manually" after the network has been instantiated -- but it is not an elegant solution, and can easily lead to issues -- it would look something like this:

Code: Select all

sim.create()

# repeat below 2 lines in for loop for all syns
sec=sim.net.cells[0].secs['soma']
h.setpointer(sec['hSec'](.5)._ref_ecl, 'e', sec['synMechs'][0]['hSyn'])

sim.simulate()
sim.analyze()
You could also try following Ted's suggestion of using RxD. NetPyNE currently works well with RxD plus we are integrating it within our declarative language and GUI. You can see some examples is this repo used for our CNS Tutorial on multiscale modeling: https://github.com/Neurosim-lab/netpyne_workspace.

Also, could you please complete the details of your info and the model you are working on in this gdoc? https://docs.google.com/spreadsheets/d/ ... edit#gid=0 -- thanks!

Post Reply