Skip to content

Commit 78a17ca

Browse files
committed
initial after curation
0 parents  commit 78a17ca

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+5508
-0
lines changed

AIY_simulation.py

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# "Biophysical modeling of the whole-cell dynamics of C. elegans motor and interneurons families"
2+
# M. Nicoletti et al. PloS ONE, 19(3): e0298105.
3+
# https://doi.org/10.1371/journal.pone.0298105
4+
5+
# AIY neuron H-H MODEL
6+
# current and voltage clamp simulations shown in Figure 3
7+
8+
import os
9+
from neuron import h,gui
10+
import numpy
11+
from matplotlib import pyplot
12+
from AIY_simulation_iclamp import AIY_simulation_iclamp
13+
from AIY_simulation_vclamp import AIY_simulation_vc
14+
from g_to_Scm2 import gScm2
15+
16+
17+
os.mkdir('AIY_SIMULATION')
18+
path='AIY_SIMULATION'
19+
20+
v=numpy.linspace(start=-120, stop=50, num=18)
21+
ic=numpy.linspace(start=-15, stop=35, num=11)
22+
surf=65.89e-8# surface in cm^2 form neuromorpho AIYL
23+
24+
#conductances: leak, slo1iso,kqt1,egl19,slo1egl19,nca,irk,eleak,cm
25+
g0=[0.14,1,0.2,0.1,0.92,0.06,0.5,-89.57,1.6]
26+
27+
28+
gbest=gScm2(g0,surf,6)
29+
30+
31+
best_results=AIY_simulation_vc(gbest,-120,50,18)
32+
best_current=numpy.array(list(best_results[0]))
33+
best_iv=numpy.array(list(best_results[3]))
34+
best_time=numpy.array(list(best_results[1]))
35+
best_iv_WT=numpy.array(list(best_results[2]))
36+
37+
fname4="AIY_simulated_current_WT.txt"
38+
fname5="AIY_simulated_time_WT.txt"
39+
fname6="AIY_simulated_IV_SS_WT.txt"
40+
fname7="AIY_IV_simulated_PEAK_WT.txt"
41+
42+
43+
path4=os.path.join(path, fname4)
44+
path5=os.path.join(path, fname5)
45+
path6=os.path.join(path, fname6)
46+
path7=os.path.join(path, fname7)
47+
48+
numpy.savetxt(path4, best_current, delimiter="," , fmt="%s")
49+
numpy.savetxt(path5, best_time, delimiter="," , fmt="%s")
50+
numpy.savetxt(path6, best_iv, delimiter=", " , fmt="%s")
51+
numpy.savetxt(path7, best_iv_WT, delimiter=", " , fmt="%s")
52+
53+
54+
best_cc=AIY_simulation_iclamp(gbest,-0.015,0.035,11)
55+
best_voltage=best_cc[0]
56+
best_time2=best_cc[1]
57+
best_VIss=best_cc[3]
58+
best_VIpeaks=best_cc[2]
59+
60+
fname8='AIY_CC_simulated_voltage_WT.txt'
61+
fname9='AIY_CC_simulated_time_WT.txt'
62+
path8=os.path.join(path, fname8)
63+
path9=os.path.join(path, fname9)
64+
65+
numpy.savetxt(path8, best_voltage, delimiter="," , fmt="%s")
66+
numpy.savetxt(path9, best_time2, delimiter=", " , fmt="%s")
67+
68+
# plot
69+
70+
fig=pyplot.figure(figsize=(8,4))
71+
iv_plot=pyplot.plot(v,best_iv,color='red',marker='+',markersize=15,label='optimized-ss')
72+
iv_plot=pyplot.plot(v,best_iv_WT,color='red',marker='o',markersize=15,label='optimized-peaks')
73+
pyplot.xlabel('V [mV]')
74+
pyplot.ylabel('I [pA]')
75+
pyplot.xlim(-130,60)
76+
fig.legend(loc=5)
77+
pyplot.title('IV-CURVES')
78+
pyplot.show()
79+
80+
81+
82+
fig3=pyplot.figure(figsize=(8,4))
83+
for i in range(0,18):
84+
curr_plot=pyplot.plot(best_time[i],best_current[i],color='red',linestyle='solid')
85+
pyplot.xlabel('Time [ms]')
86+
pyplot.ylabel('I [pA]')
87+
pyplot.title('Voltage clamp')
88+
pyplot.show()
89+
90+
91+
92+
93+
fig4=pyplot.figure(figsize=(8,4))
94+
for i in range(0,10):
95+
volt_plot=pyplot.plot(best_time2[i],best_voltage[i],color='red',linestyle='solid')
96+
pyplot.xlabel('Time [ms]')
97+
pyplot.ylabel('V [mV]')
98+
#pyplot.xlim(0,0.7)
99+
pyplot.title('Current_Clamp')
100+
pyplot.show()
101+
102+

AIY_simulation_iclamp.py

+130
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
# "Biophysical modeling of the whole-cell dynamics of C. elegans motor and interneurons families"
2+
# M. Nicoletti et al. PloS ONE, 19(3): e0298105.
3+
# https://doi.org/10.1371/journal.pone.0298105
4+
5+
def AIY_simulation_iclamp(gAIY_scaled,s1,s2,ns):
6+
7+
8+
from neuron import h,gui
9+
import numpy
10+
import math
11+
from operator import add
12+
13+
surf=65.89e-8 # surface in cm^2 form neuromorpho AIYL
14+
vol=7.42e-12 # total volume
15+
L=math.sqrt(surf/math.pi)
16+
rsoma=L*1e4
17+
cm_uFcm2=gAIY_scaled[8]
18+
19+
20+
21+
soma=h.Section(name="soma")
22+
soma.L=rsoma
23+
soma.diam=rsoma
24+
soma.cm=cm_uFcm2
25+
soma.Ra=100
26+
h.psection(sec=soma)
27+
28+
soma.insert('egl19')
29+
30+
31+
32+
soma.insert('slo1egl19')
33+
34+
soma.insert('nca')
35+
soma.insert('leak')
36+
soma.insert('slo1iso')
37+
soma.insert('kqt1')
38+
soma.insert('shl1')
39+
40+
41+
42+
43+
for seg in soma:
44+
45+
seg.leak.gbar = gAIY_scaled[0]
46+
seg.slo1iso.gbar = gAIY_scaled[1]
47+
seg.kqt1.gbar=gAIY_scaled[2]
48+
seg.egl19.gbar=gAIY_scaled[3]
49+
seg.slo1egl19.gbar = gAIY_scaled[4]
50+
seg.nca.gbar = gAIY_scaled[5]
51+
seg.shl1.gbar = gAIY_scaled[6]
52+
seg.leak.e=gAIY_scaled[7]
53+
54+
55+
seg.eca=60
56+
seg.ek=-80
57+
58+
59+
stim=h.IClamp(soma(0.5))
60+
dir(stim)
61+
62+
stim.delay=1000
63+
stim.amp=10
64+
stim.dur=5000
65+
66+
v_vec = h.Vector()
67+
t_vec = h.Vector() # Time stamp vector
68+
v_vec.record(soma(0.5)._ref_v)
69+
t_vec.record(h._ref_t)
70+
71+
simdur =11000
72+
73+
ref_v=[]
74+
ref_t=[]
75+
76+
77+
78+
for i in numpy.linspace(start=s1, stop=s2, num=ns):
79+
80+
stim.amp=i
81+
h.tstop=simdur
82+
h.dt=0.4
83+
h.finitialize(-60)
84+
h.run()
85+
86+
ref_t_vec=numpy.zeros_like(t_vec)
87+
t_vec.to_python(ref_t_vec)
88+
ref_t.append(ref_t_vec)
89+
90+
91+
ref_v_vec=numpy.zeros_like(v_vec)
92+
v_vec.to_python(ref_v_vec)
93+
ref_v.append(ref_v_vec)
94+
95+
96+
v=[]
97+
v=numpy.array(list(ref_v))
98+
time1=numpy.array(ref_t)
99+
100+
101+
102+
## SS VOLTAGE-CURRENT RELATION
103+
ind=numpy.where(numpy.logical_and(time1[0]>=5990, time1[0]<=6000))
104+
ind_max=numpy.amax(ind)
105+
ind_min=numpy.amin(ind)
106+
vi=numpy.mean(v[:,ind_min:ind_max],axis=1)
107+
108+
# PEAK VOLTAGE-CURRENT RELATION
109+
ind2=numpy.where(numpy.logical_and(time1[0]>=1000, time1[0]<=1300))
110+
ind2_max=numpy.amax(ind2)
111+
ind2_min=numpy.amin(ind2)
112+
vi_peak=numpy.amax(v[:,ind2_min:ind2_max])
113+
vi_peak=[]
114+
115+
116+
117+
for j in range(ns):
118+
if j<=2:
119+
peak=numpy.amin(v[j,ind2_min:ind2_max])
120+
else:
121+
peak=numpy.amax(v[j,ind2_min:ind2_max])
122+
vi_peak.append(peak)
123+
124+
return v, time1, vi_peak, vi
125+
126+
127+
128+
129+
130+

0 commit comments

Comments
 (0)