How to add synapses to an Adex model

When Python is the interpreter, what is a good
design for the interface to the basic NEURON
concepts.

Moderator: hines

Post Reply
anandhupresannan
Posts: 9
Joined: Tue Feb 26, 2019 10:13 am

How to add synapses to an Adex model

Post by anandhupresannan » Fri Oct 25, 2019 12:55 am

Hi,

I am working on an Adex model. I want to add inhibitory and excitatory synapses into my model. How can I add that ?. Adding any kind of equation to the mod file help to obtain these properties or is there any reference for the Adex model development like for the multicompartmental model we use Neuron Book, any alternative like that?. My model is developed with Neuron-Python.

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

Re: How to add synapses to an Adex model

Post by ted » Mon Oct 28, 2019 12:10 pm

You want help implementing synaptic inputs to a model cell but say nothing about how you implemented the model cell--yet that is the very information required to give you a useful answer. Did you implement the model cell as an ARTIFICIAL_CELL, a POINT_PROCESS, or as a section to which NMODL-implemented mechanisms are inserted?

anandhupresannan
Posts: 9
Joined: Tue Feb 26, 2019 10:13 am

Re: How to add synapses to an Adex model

Post by anandhupresannan » Tue Nov 05, 2019 1:30 am

The mod which I am using is a POINT_PROCESS

Code: Select all

NEURON {
	POINT_PROCESS ADEXTWO
	RANGE C,s,i,gl,el,delT,Vt,I,Ex,In,cou_gnmda,mod_cou_gnmda
	RANGE Vr,vrest,a,b,tw,fflag,thresh,thresh1,Gmax,Onset
	RANGE weighti,nspike,gmax,gnmda,Isyn,ISYN,Talp,talp,onset
	RANGE gampa,gampa1,gampa2,gampa3
	RANGE ggaba,ggaba1,ggaba2,ggaba3,i_membrane
}

INITIAL {
	vv=-70
	w=0
	gampa=0
	gampa1=0
	gampa2=0
	gampa3=0
	:gnmda=0
	net_send(0,1)
}

PARAMETER {
	Ex=0
	In=0
	C=150:77
	nspike=0
	weighti=0
	onset=20
	Onset=24
	gl=10
	el=-70
	delT=4
	thresh=15
	thresh1=11
	Vt=-50
	I=0
	Vr=-64
	vrest=-70
	a=9:81
	b=250:175
	i_membrane = 0
	tw=13:385                                                                     	
	fflag=1
	gmax=7.78
	talp=6.6:5.169
	Gmax=10
	Talp=3.5
}

STATE { w vv }

ASSIGNED {
	s
	gampa 
	ggaba
	ggaba1
	ggaba2
	ggaba3
	cou_gnmda
	mod_cou_gnmda
	gampa1
	gampa2
	gampa3
	gnmda
	Isyn
	ISYN
}

BREAKPOINT {
	SOLVE states METHOD derivimplicit
}

DERIVATIVE states {
	if (gnmda==1 && In==0) {
			if (t>=onset) {
			:net_send(0,4)
			gampa=gmax*(t/talp)*exp(1-t/talp)
			ggaba=0
			}
	}
	if (gnmda==2 && In==0) {
			if (t>=onset) {
				gampa=gmax*(t/talp)*exp(1-t/talp)
				gampa1=gmax*(t/talp)*exp(1-t/talp)
				gampa=gampa+gampa1
				ggaba=0
			}
	}
	if (gnmda==3 && In==0) {
			if (t>=onset) {
		        	gampa=gmax*(t/talp)*exp(1-t/talp)
                        	gampa1=gmax*(t/talp)*exp(1-t/talp)
				gampa2=gmax*(t/talp)*exp(1-t/talp)
                        	gampa=gampa+gampa1+gampa2
					ggaba=0	
			}
	}
	if (gnmda==4 && In==0) {
			if (t>=onset) {
				gampa=0
				gampa1=0
				gampa2=0
				gampa3=0
                        	gampa=gmax*(t/talp)*exp(1-t/talp)
                        	gampa1=gmax*(t/talp)*exp(1-t/talp)
                        	gampa2=gmax*(t/talp)*exp(1-t/talp)
				gampa3=gmax*(t/talp)*exp(1-t/talp)
                        	gampa=gampa+gampa1+gampa2+gampa3  
			:		ggaba=0
                	}
	}
	if (gnmda==1 && In==1) {
		Talp=3
		if (t>=onset) {
                        	gampa=gmax*(t/talp)*exp(1-t/talp)
			if (t>=Onset) {
				ggaba=Gmax*(t/Talp)*exp(1-t/Talp)
			}
		}
	}
	if (gnmda==1 && In==2) {
		Talp=3
		if (t>=onset) {
				gampa=gmax*(t/talp)*exp(1-t/talp)
			if (t>=Onset) {
				ggaba=Gmax*(t/Talp)*exp(1-t/Talp)
				ggaba1=Gmax*(t/Talp)*exp(1-t/Talp)
				ggaba=ggaba+ggaba1
			}
		}
	}
	if (gnmda==1 && In==3) {	
		Talp=3
		if (t>=onset) {
				gampa=gmax*(t/talp)*exp(1-t/talp)
			if (t>=Onset) {
				ggaba=Gmax*(t/Talp)*exp(1-t/Talp)
				ggaba1=Gmax*(t/Talp)*exp(1-t/Talp)
				ggaba2=Gmax*(t/Talp)*exp(1-t/Talp)
				ggaba=ggaba+ggaba1+ggaba2
			}
		}
	}
	if (gnmda==1 && In==4) {
		Talp=3
		if (t>=onset) {
				gampa=gmax*(t/talp)*exp(1-t/talp)
			if (t>=Onset) {
				ggaba=Gmax*(t/Talp)*exp(1-t/Talp)
                                ggaba1=Gmax*(t/Talp)*exp(1-t/Talp)
                                ggaba2=Gmax*(t/Talp)*exp(1-t/Talp)
				ggaba3=Gmax*(t/Talp)*exp(1-t/Talp)
                                ggaba=ggaba+ggaba1+ggaba2+ggaba3
			}
		}
	}
	if (gnmda==2 && In==1) {	
		Talp=3.2
                if (t>=onset) {
                                gampa=gmax*(t/talp)*exp(1-t/talp)
                                gampa1=gmax*(t/talp)*exp(1-t/talp)
                                gampa=gampa+gampa1
			if (t>=Onset) {
				ggaba=Gmax*(t/Talp)*exp(1-t/Talp)
			}
                }
	}
	if (gnmda==2 && In==2) {
		Talp=3.2
		if (t>=onset) {
				gampa=gmax*(t/talp)*exp(1-t/talp)
                                gampa1=gmax*(t/talp)*exp(1-t/talp)
                                gampa=gampa+gampa1
			if (t>=Onset) {
				ggaba=Gmax*(t/Talp)*exp(1-t/Talp)
				ggaba1=Gmax*(t/Talp)*exp(1-t/Talp)
				ggaba=ggaba+ggaba1
			}
		}
	}
	if (gnmda==2 && In==3) {
		Talp=3.2
		if (t>=onset) {
				gampa=gmax*(t/talp)*exp(1-t/talp)
                                gampa1=gmax*(t/talp)*exp(1-t/talp)
                                gampa=gampa+gampa1
			if (t>=Onset) {
                                ggaba=Gmax*(t/Talp)*exp(1-t/Talp)
                                ggaba1=Gmax*(t/Talp)*exp(1-t/Talp)
				ggaba2=Gmax*(t/Talp)*exp(1-t/Talp)
                                ggaba=ggaba+ggaba1+ggaba2
                        }
		}
	}
	if (gnmda==2 && In==4) {
		Talp=3.2
		if (t>=onset) {
                                gampa=gmax*(t/talp)*exp(1-t/talp)
                                gampa1=gmax*(t/talp)*exp(1-t/talp)
                                gampa=gampa+gampa1
			if (t>=Onset) {
                                ggaba=Gmax*(t/Talp)*exp(1-t/Talp)
                                ggaba1=Gmax*(t/Talp)*exp(1-t/Talp)
                                ggaba2=Gmax*(t/Talp)*exp(1-t/Talp)
				ggaba3=Gmax*(t/Talp)*exp(1-t/Talp)
                                ggaba=ggaba+ggaba1+ggaba2+ggaba3
                        }
		}
	}
	if (gnmda==3 && In==1) {
		thresh=11.4
		Talp=3.4
                if (t>=onset) {
                                gampa=gmax*(t/talp)*exp(1-t/talp)
				gampa1=gmax*(t/talp)*exp(1-t/talp)
				gampa2=gmax*(t/talp)*exp(1-t/talp)
				gampa=gampa+gampa1+gampa2
                        if (t>=Onset) {
                                ggaba=Gmax*(t/Talp)*exp(1-t/Talp)
                        }
                }
	}
	if (gnmda==3 && In==2) {
		Talp=3.4
		thresh=8.6
                if (t>=onset) {
                                gampa=gmax*(t/talp)*exp(1-t/talp)
				gampa1=gmax*(t/talp)*exp(1-t/talp)
                                gampa2=gmax*(t/talp)*exp(1-t/talp)
                                gampa=gampa+gampa1+gampa2
                        if (t>=Onset) {
                                ggaba=Gmax*(t/Talp)*exp(1-t/Talp)
                                ggaba1=Gmax*(t/Talp)*exp(1-t/Talp)
                                ggaba=ggaba+ggaba1
                        }
                }
	}
	if (gnmda==3 && In==3) {
		Talp=3.4
		thresh=6
                if (t>=onset) {
                                gampa=gmax*(t/talp)*exp(1-t/talp)
				gampa1=gmax*(t/talp)*exp(1-t/talp)
                                gampa2=gmax*(t/talp)*exp(1-t/talp)
                                gampa=gampa+gampa1+gampa2
                        if (t>=Onset) {
                                ggaba=Gmax*(t/Talp)*exp(1-t/Talp)
                                ggaba1=Gmax*(t/Talp)*exp(1-t/Talp)
				ggaba2=Gmax*(t/Talp)*exp(1-t/Talp)
				ggaba=ggaba+ggaba1+ggaba2
			}
		}
	}
	if (gnmda==3 && In==4) {
		Talp=3.4
		thresh=3.27
                if (t>=onset) {
                                gampa=gmax*(t/talp)*exp(1-t/talp)
                                gampa1=gmax*(t/talp)*exp(1-t/talp)
                                gampa2=gmax*(t/talp)*exp(1-t/talp)
                                gampa=gampa+gampa1+gampa2
                        if (t>=Onset) {
                                ggaba=Gmax*(t/Talp)*exp(1-t/Talp)
                                ggaba1=Gmax*(t/Talp)*exp(1-t/Talp)
                                ggaba2=Gmax*(t/Talp)*exp(1-t/Talp)
				ggaba3=Gmax*(t/Talp)*exp(1-t/Talp)
                                ggaba=ggaba+ggaba1+ggaba2+ggaba3
                        }
                }
	}
	if (gnmda==4 && In==1) {
		C=1000
		talp=2.66
		Talp=3.5
                if (t>=onset) {
                                gampa=gmax*(t/talp)*exp(1-t/talp)
                                gampa1=gmax*(t/talp)*exp(1-t/talp)
                                gampa2=gmax*(t/talp)*exp(1-t/talp)
				gampa3=gmax*(t/talp)*exp(1-t/talp)
                                gampa=gampa+gampa1+gampa2+gampa3
                        if (t>=Onset) {
                                ggaba=Gmax*(t/Talp)*exp(1-t/Talp)
                        }
                }
	}
	if (gnmda==4 && In==2) {
		C=1000
                talp=2.61
                Talp=3.5
                if (t>=onset) {
                                gampa=gmax*(t/talp)*exp(1-t/talp)
                                gampa1=gmax*(t/talp)*exp(1-t/talp)
                                gampa2=gmax*(t/talp)*exp(1-t/talp)
				gampa3=gmax*(t/talp)*exp(1-t/talp)
                                gampa=gampa+gampa1+gampa2+gampa3
                        if (t>=Onset) {
                                ggaba=Gmax*(t/Talp)*exp(1-t/Talp)
                                ggaba1=Gmax*(t/Talp)*exp(1-t/Talp)
                                ggaba=ggaba+ggaba1
                        }
		}
	}
	if (gnmda==4 && In==3) {
		C=1000
                talp=2.61
                Talp=3.5
		if (t>=onset) {
                                gampa=gmax*(t/talp)*exp(1-t/talp)
                                gampa1=gmax*(t/talp)*exp(1-t/talp)
                                gampa2=gmax*(t/talp)*exp(1-t/talp)
                                gampa3=gmax*(t/talp)*exp(1-t/talp)
                                gampa=gampa+gampa1+gampa2+gampa3
                        if (t>=Onset) {
                                ggaba=Gmax*(t/Talp)*exp(1-t/Talp)
                                ggaba1=Gmax*(t/Talp)*exp(1-t/Talp)
				ggaba2=Gmax*(t/Talp)*exp(1-t/Talp)
                                ggaba=ggaba+ggaba1+ggaba2
                        }
                }
	}
	if (gnmda==4 && In==4) {
		C=1000
                talp=2.61
                Talp=3.5
		if (t>=onset) {
                                gampa=gmax*(t/talp)*exp(1-t/talp)
                                gampa1=gmax*(t/talp)*exp(1-t/talp)
                                gampa2=gmax*(t/talp)*exp(1-t/talp)
                                gampa3=gmax*(t/talp)*exp(1-t/talp)
                                gampa=gampa+gampa1+gampa2+gampa3
                        if (t>=Onset) {
                                ggaba=Gmax*(t/Talp)*exp(1-t/Talp)
                                ggaba1=Gmax*(t/Talp)*exp(1-t/Talp)
                                ggaba2=Gmax*(t/Talp)*exp(1-t/Talp)
				ggaba3=Gmax*(t/Talp)*exp(1-t/Talp)
                                ggaba=ggaba+ggaba1+ggaba2+ggaba3
                        }
                }
	}
		Isyn=gampa*(vv-0)
		ISYN=ggaba*(vv+80)
                :vv'=(gl*(el-vv)+gl*delT*exp((vv-Vt)/delT)-I-w)/C-(Isyn+ISYN):gampa*(vrest-0)
		i_membrane=(gl*(el-vv)+gl*delT*exp((vv-Vt)/delT)-I-w)
		vv' = i_membrane/C-(Isyn+ISYN):gampa*(vrest-0)
   	        w'=(a*(vv-el)-w)/tw
}

NET_RECEIVE (u) {
	INITIAL {
		gnmda=0
	}
	if (flag == 1) {
			WATCH (vv>thresh) 2
	} else if (flag == 2) {
		net_event(t)
		vv=Vr
		w=w+b
		nspike=nspike+1
			if (nspike > 0) {
				WATCH (vv>thresh1) 3
			}
	printf("The number of spikes is %f\n",nspike)
	} else if (flag == 3) {
		net_event(t)
		vv=Vr
		w=w+b
	}else {	:synaptic activation
		gnmda=gnmda+1
		printf("The gnmda value is %f\n",gnmda)

		COMMENT
		s=0
		if (gnmda <= 4) {
			s=s+1
			printf("the s value is %f\n",s)
			:cou_gnmda=gnmda
		}else if (gnmda > 4) {
			:printf("i m here\n")
			:mod_cou_gnmda=gnmda-cou_gnmda
			:cou_gnmda=mod_cou_gnmda
			:gnmda=cou_gnmda
		}
		printf("the value of s is %f\n",s)
		:if (Ex==4) {
		:	gnmda=4
		:}else if (Ex==3) {
		:	gnmda=3
		:}else if (Ex==2) {
		:	gnmda=2
		:}else if (Ex==1) {
		:	gnmda=1
		:}
		ENDCOMMENT
	}
}
This is the file I am using. I need to both inhibitory and excitatory behaviour.

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

Re: How to add synapses to an Adex model

Post by ted » Tue Nov 05, 2019 10:10 am

It's an artificial spiking cell. It ignores the membrane potential and membrane currents of whatever section to which it is attached, and makes no contribution to that section's membrane currents. It also ignores the weight associated with whatever NetCons deliver events to it. Although it contains a lot of code (controlled by a lot of conditional statements that exist for purposes that are not entirely clear) that is used to represent the effects of AMPA, NMDA, and GABA, it offers no way to influence these effects from outside the mechanism.
I need to both inhibitory and excitatory behaviour.
If you want something other than what this code provides, it will need a huge rewrite. But before that can even be attemted, you'll have to come up with a mathematical statement of how you want excitatory and inhibitory inputs to affect the artificial spiking cell. And in the process of revising the code, care must be taken not to break anything that should be preserved. The end result will be a model cell class that has to be tested extensively to make sure that it does what you want it to do, and that no bugs have been introduced.

Suggest you contact whoever developed this in the first place and explain what you want. Maybe that person will just go ahead and do it, or tell you how to proceed.

anandhupresannan
Posts: 9
Joined: Tue Feb 26, 2019 10:13 am

Re: How to add synapses to an Adex model

Post by anandhupresannan » Wed Nov 06, 2019 1:16 am

Thank you

Post Reply