-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 78a17ca
Showing
47 changed files
with
5,508 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
# "Biophysical modeling of the whole-cell dynamics of C. elegans motor and interneurons families" | ||
# M. Nicoletti et al. PloS ONE, 19(3): e0298105. | ||
# https://doi.org/10.1371/journal.pone.0298105 | ||
|
||
# AIY neuron H-H MODEL | ||
# current and voltage clamp simulations shown in Figure 3 | ||
|
||
import os | ||
from neuron import h,gui | ||
import numpy | ||
from matplotlib import pyplot | ||
from AIY_simulation_iclamp import AIY_simulation_iclamp | ||
from AIY_simulation_vclamp import AIY_simulation_vc | ||
from g_to_Scm2 import gScm2 | ||
|
||
|
||
os.mkdir('AIY_SIMULATION') | ||
path='AIY_SIMULATION' | ||
|
||
v=numpy.linspace(start=-120, stop=50, num=18) | ||
ic=numpy.linspace(start=-15, stop=35, num=11) | ||
surf=65.89e-8# surface in cm^2 form neuromorpho AIYL | ||
|
||
#conductances: leak, slo1iso,kqt1,egl19,slo1egl19,nca,irk,eleak,cm | ||
g0=[0.14,1,0.2,0.1,0.92,0.06,0.5,-89.57,1.6] | ||
|
||
|
||
gbest=gScm2(g0,surf,6) | ||
|
||
|
||
best_results=AIY_simulation_vc(gbest,-120,50,18) | ||
best_current=numpy.array(list(best_results[0])) | ||
best_iv=numpy.array(list(best_results[3])) | ||
best_time=numpy.array(list(best_results[1])) | ||
best_iv_WT=numpy.array(list(best_results[2])) | ||
|
||
fname4="AIY_simulated_current_WT.txt" | ||
fname5="AIY_simulated_time_WT.txt" | ||
fname6="AIY_simulated_IV_SS_WT.txt" | ||
fname7="AIY_IV_simulated_PEAK_WT.txt" | ||
|
||
|
||
path4=os.path.join(path, fname4) | ||
path5=os.path.join(path, fname5) | ||
path6=os.path.join(path, fname6) | ||
path7=os.path.join(path, fname7) | ||
|
||
numpy.savetxt(path4, best_current, delimiter="," , fmt="%s") | ||
numpy.savetxt(path5, best_time, delimiter="," , fmt="%s") | ||
numpy.savetxt(path6, best_iv, delimiter=", " , fmt="%s") | ||
numpy.savetxt(path7, best_iv_WT, delimiter=", " , fmt="%s") | ||
|
||
|
||
best_cc=AIY_simulation_iclamp(gbest,-0.015,0.035,11) | ||
best_voltage=best_cc[0] | ||
best_time2=best_cc[1] | ||
best_VIss=best_cc[3] | ||
best_VIpeaks=best_cc[2] | ||
|
||
fname8='AIY_CC_simulated_voltage_WT.txt' | ||
fname9='AIY_CC_simulated_time_WT.txt' | ||
path8=os.path.join(path, fname8) | ||
path9=os.path.join(path, fname9) | ||
|
||
numpy.savetxt(path8, best_voltage, delimiter="," , fmt="%s") | ||
numpy.savetxt(path9, best_time2, delimiter=", " , fmt="%s") | ||
|
||
# plot | ||
|
||
fig=pyplot.figure(figsize=(8,4)) | ||
iv_plot=pyplot.plot(v,best_iv,color='red',marker='+',markersize=15,label='optimized-ss') | ||
iv_plot=pyplot.plot(v,best_iv_WT,color='red',marker='o',markersize=15,label='optimized-peaks') | ||
pyplot.xlabel('V [mV]') | ||
pyplot.ylabel('I [pA]') | ||
pyplot.xlim(-130,60) | ||
fig.legend(loc=5) | ||
pyplot.title('IV-CURVES') | ||
pyplot.show() | ||
|
||
|
||
|
||
fig3=pyplot.figure(figsize=(8,4)) | ||
for i in range(0,18): | ||
curr_plot=pyplot.plot(best_time[i],best_current[i],color='red',linestyle='solid') | ||
pyplot.xlabel('Time [ms]') | ||
pyplot.ylabel('I [pA]') | ||
pyplot.title('Voltage clamp') | ||
pyplot.show() | ||
|
||
|
||
|
||
|
||
fig4=pyplot.figure(figsize=(8,4)) | ||
for i in range(0,10): | ||
volt_plot=pyplot.plot(best_time2[i],best_voltage[i],color='red',linestyle='solid') | ||
pyplot.xlabel('Time [ms]') | ||
pyplot.ylabel('V [mV]') | ||
#pyplot.xlim(0,0.7) | ||
pyplot.title('Current_Clamp') | ||
pyplot.show() | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
# "Biophysical modeling of the whole-cell dynamics of C. elegans motor and interneurons families" | ||
# M. Nicoletti et al. PloS ONE, 19(3): e0298105. | ||
# https://doi.org/10.1371/journal.pone.0298105 | ||
|
||
def AIY_simulation_iclamp(gAIY_scaled,s1,s2,ns): | ||
|
||
|
||
from neuron import h,gui | ||
import numpy | ||
import math | ||
from operator import add | ||
|
||
surf=65.89e-8 # surface in cm^2 form neuromorpho AIYL | ||
vol=7.42e-12 # total volume | ||
L=math.sqrt(surf/math.pi) | ||
rsoma=L*1e4 | ||
cm_uFcm2=gAIY_scaled[8] | ||
|
||
|
||
|
||
soma=h.Section(name="soma") | ||
soma.L=rsoma | ||
soma.diam=rsoma | ||
soma.cm=cm_uFcm2 | ||
soma.Ra=100 | ||
h.psection(sec=soma) | ||
|
||
soma.insert('egl19') | ||
|
||
|
||
|
||
soma.insert('slo1egl19') | ||
|
||
soma.insert('nca') | ||
soma.insert('leak') | ||
soma.insert('slo1iso') | ||
soma.insert('kqt1') | ||
soma.insert('shl1') | ||
|
||
|
||
|
||
|
||
for seg in soma: | ||
|
||
seg.leak.gbar = gAIY_scaled[0] | ||
seg.slo1iso.gbar = gAIY_scaled[1] | ||
seg.kqt1.gbar=gAIY_scaled[2] | ||
seg.egl19.gbar=gAIY_scaled[3] | ||
seg.slo1egl19.gbar = gAIY_scaled[4] | ||
seg.nca.gbar = gAIY_scaled[5] | ||
seg.shl1.gbar = gAIY_scaled[6] | ||
seg.leak.e=gAIY_scaled[7] | ||
|
||
|
||
seg.eca=60 | ||
seg.ek=-80 | ||
|
||
|
||
stim=h.IClamp(soma(0.5)) | ||
dir(stim) | ||
|
||
stim.delay=1000 | ||
stim.amp=10 | ||
stim.dur=5000 | ||
|
||
v_vec = h.Vector() | ||
t_vec = h.Vector() # Time stamp vector | ||
v_vec.record(soma(0.5)._ref_v) | ||
t_vec.record(h._ref_t) | ||
|
||
simdur =11000 | ||
|
||
ref_v=[] | ||
ref_t=[] | ||
|
||
|
||
|
||
for i in numpy.linspace(start=s1, stop=s2, num=ns): | ||
|
||
stim.amp=i | ||
h.tstop=simdur | ||
h.dt=0.4 | ||
h.finitialize(-60) | ||
h.run() | ||
|
||
ref_t_vec=numpy.zeros_like(t_vec) | ||
t_vec.to_python(ref_t_vec) | ||
ref_t.append(ref_t_vec) | ||
|
||
|
||
ref_v_vec=numpy.zeros_like(v_vec) | ||
v_vec.to_python(ref_v_vec) | ||
ref_v.append(ref_v_vec) | ||
|
||
|
||
v=[] | ||
v=numpy.array(list(ref_v)) | ||
time1=numpy.array(ref_t) | ||
|
||
|
||
|
||
## SS VOLTAGE-CURRENT RELATION | ||
ind=numpy.where(numpy.logical_and(time1[0]>=5990, time1[0]<=6000)) | ||
ind_max=numpy.amax(ind) | ||
ind_min=numpy.amin(ind) | ||
vi=numpy.mean(v[:,ind_min:ind_max],axis=1) | ||
|
||
# PEAK VOLTAGE-CURRENT RELATION | ||
ind2=numpy.where(numpy.logical_and(time1[0]>=1000, time1[0]<=1300)) | ||
ind2_max=numpy.amax(ind2) | ||
ind2_min=numpy.amin(ind2) | ||
vi_peak=numpy.amax(v[:,ind2_min:ind2_max]) | ||
vi_peak=[] | ||
|
||
|
||
|
||
for j in range(ns): | ||
if j<=2: | ||
peak=numpy.amin(v[j,ind2_min:ind2_max]) | ||
else: | ||
peak=numpy.amax(v[j,ind2_min:ind2_max]) | ||
vi_peak.append(peak) | ||
|
||
return v, time1, vi_peak, vi | ||
|
||
|
||
|
||
|
||
|
||
|
Oops, something went wrong.