This repository has been archived by the owner on May 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
drg.py
103 lines (79 loc) · 3.31 KB
/
drg.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
'''
c fiber peripheral nerve fiber
contains only the peripheral nerve fiber for simulation of NaV channel effects on peripheral axon
'''
from neuron import h
class cfiber():
secs = {
'drgperi': {'nseg':100, 'L':100, 'diam': 0.8 },
'drgcntr': {'nseg':100, 'L':100, 'diam': 0.4 },
'drgstem': {'nseg':50 , 'L':75, 'diam': 1.4 },
'drgsoma': {'nseg':1 , 'L':25, 'diam': 25 }}
# 100 segments, 0.5 mm x 0.8 um
def __init__(self,x=0,y=0,z=0,ID=0,
navs = {'na17a': 0.04/6, 'na18a': 0.12/6, 'na19a': 0.08/6 },
kvs = {'kv4' : 0.01 , 'kv2' : 0.002 },#, 'kv1' : 0.00006 },
ena = 70,
ek = -70,
vrest= -57,
gm = 1/10000,
rmut = 0.5):
self.regions = {'all': [], 'axn': [], 'drg': [], 'soma': []}
self.vrest = vrest
self.navs = navs # sodium channel dictionary
self.ena = ena # Nernst of sodium
self.kvs = kvs # potassium channel dictionary
self.ek = ek # Nernst of potassium
self.emut = (ena + ek) / 2 # mutated reversal in between sodium and potassium channel
self.rmut = rmut # percent mutation RNA
self.gm = gm
self.set_morphology()
self.insert_conductances()
self.connect_secs()
self.initialize_values()
def add_comp(self, sec, *regions):
self.__dict__[sec] = h.Section(name=sec)
for region in regions:
self.regions[region].append(self.__dict__[sec])
def set_morphology(self):
for sec in ['drgperi', 'drgcntr', 'drgstem']:
self.add_comp(sec, sec[0:3], 'all')
self.set_geom(sec)
for sec in ['drgsoma']:
self.add_comp(sec, 'drg', 'soma', 'all')
self.set_geom(sec)
def set_geom(self, sec):
self.__dict__[sec].nseg = cfiber.secs[sec]['nseg']
self.__dict__[sec].L = cfiber.secs[sec]['L']
self.__dict__[sec].diam = cfiber.secs[sec]['diam']
def insert_conductances (self):
for sec in self.regions['all']:
sec.Ra = 1000
for nav in self.navs:
sec.insert(nav)
exestr = "sec.gnabar_%s = self.navs[nav]" %(nav)
exec(exestr)
sec.ena = self.ena
for kv in self.kvs:
sec.insert(kv)
exestr = "sec.gkbar_%s = self.kvs[kv]" %(kv)
exec(exestr)
sec.ek = self.ek
sec.insert('pas')
sec.g_pas = self.gm
##sec.e_pas = -60
def connect_secs(self):
#self.drgperi.connect(self.axnperi)
self.drgstem.connect(self.drgperi)
self.drgsoma.connect(self.drgstem)
self.drgcntr.connect(self.drgperi)
#self.axncntr.connect(self.drgcntr)
def initialize_values(self):
#sets passive current to allow for steady state voltage.
for i, sec in enumerate(self.regions['all']):
h.finitialize(self.vrest)
h.fcurrent()
##sec.g_pas = sec.v + (sec.ina + sec.ik) / sec.e_pas
sec.e_pas = sec.v + (sec.ina + sec.ik) / sec.g_pas
##print( "e_pas: %f" %(sec.e_pas) )
print( "e_pas: %f" %(sec.e_pas) )