-
Notifications
You must be signed in to change notification settings - Fork 0
/
getCells.py
180 lines (162 loc) · 5.9 KB
/
getCells.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
import os
import sys
active_model_ids = [497229117, 491766131, 497232312, 485591806,
497232419, 497232429, 496930324, 497232564, 497232839, 497232946,
497233049, 497233139, 497233307, 497229124]
class allenCell:
def __init__(self):
self.basal = []
self.apical = []
self.soma = []
self.axon = []
def generate_cell(self, h):
for sec in h.soma:
self.soma.append(sec)
for sec in h.apic:
self.apical.append(sec)
for sec in h.dend:
self.basal.append(sec)
for sec in h.axon:
self.axon.append(sec)
def GetAllenCells(neuronal_model_ids):
from allensdk.api.queries.biophysical_api import BiophysicalApi
bp = BiophysicalApi()
bp.cache_stimulus = False # change to True to download the large stimulus NWB file
for neuronal_model_id in neuronal_model_ids:
os.system('mkdir models/' + str(neuronal_model_id))
bp.cache_data(neuronal_model_id, working_directory=str(neuronal_model_id))
os.system('cd ' + str(neuronal_model_id) + '; nrnivmodl ./modfiles; cd ../../')
def AllenCell(path = None):
owd = os.getcwd()
os.chdir(path)
# sys.path.append('/home/craig_kelley_downstate_edu/allensdk/lib/python3.6/site-packages/')
from allensdk.model.biophys_sim.config import Config
from allensdk.model.biophysical import utils as Utils # this is basically "implied" in the tutorial
description = Config().load('manifest.json')
manifest = description.manifest
morphology_path = description.manifest.get_path('MORPHOLOGY')
utils = Utils.create_utils(description, model_type='Biophysical - all active') # this is insane - help doc says ALL_ACTIVE_TYPE or PERISOMATIC_TYPE for model_type
h = utils.h
utils.generate_morphology(morphology_path) # in tutorial, they instead use mophology_path.encode('ascii','ignore')
utils.load_cell_parameters()
cell = allenCell()
cell.generate_cell(h)
os.chdir(owd)
return cell
def KoleCell():
owd = os.getcwd()
os.chdir('./models/Kole')
from neuron import h, init
# h.load_file("/usr/local/nrn//share/nrn/lib/hoc/stdrun.hoc")
h.load_file('stdrun.hoc')
h.load_file('cellTemplate.hoc')
cell = h.KoleCell()
apical_maintrunk = [0, 8, 10, 18, 30, 32, 34, 36, 42, 44]
# apical_maintrunk = [cell.apic[0], cell.apic[8], cell.apic[10], cell.apic[18],cell.apic[30],
# cell.apic[32], cell.apic[34], cell.apic[36], cell.apic[42], cell.apic[44]]
os.chdir(owd)
return cell, apical_maintrunk
def AckerAnticCell():
owd = os.getcwd()
os.chdir('./models/AckerAntic')
import sys
sys.path.insert(1, './cells/')
from eeeD import MakeCell
cell = MakeCell()
cell.apical_maintrunk = [i for i in range(2,9)]
# for i in range(2,9):
# cell.apical_maintrunk.append(cell.apical[i])
os.chdir(owd)
return cell
def NeymotinHarnettCell(slope=14*2):
owd = os.getcwd()
os.chdir('./models/Neymotin')
from neuron import h, init
h.load_file("./cells/PTcell.hoc")
ihMod2str = {'harnett': 1, 'kole': 2, 'migliore': 3}
cell = h.PTcell(ihMod2str['harnett'], slope)
os.chdir(owd)
return cell
def NeymotinKoleCell(slope=14*2):
owd = os.getcwd()
os.chdir('./models/Neymotin')
from neuron import h, init
h.load_file("./cells/PTcell.hoc")
ihMod2str = {'harnett': 1, 'kole': 2, 'migliore': 3}
cell = h.PTcell(ihMod2str['kole'], slope)
os.chdir(owd)
return cell
def NeymotinMiglioreCell(slope=14*2):
owd = os.getcwd()
os.chdir('./models/Neymotin')
from neuron import h, init
h.load_file("./cells/PTcell.hoc")
ihMod2str = {'harnett': 1, 'kole': 2, 'migliore': 3}
cell = h.PTcell(ihMod2str['migliore'], slope)
os.chdir(owd)
return cell
def HayCell(morphology_file = './morphologies/cell1.asc'):
owd = os.getcwd()
os.chdir('./models/Hay')
from neuron import h#, init
h.load_file('stdrun.hoc')
h.load_file('import3d.hoc')
h.load_file('./models/L5PCbiophys3.hoc') # BAP version
h.load_file('./models/L5PCtemplate.hoc')
cell = h.L5PCtemplate(morphology_file)
apical_maintrunk = [0,1,2,3,14,20,26,34,36]
# apical_maintrunk = [cell.apic[0], cell.apic[1], cell.apic[2], cell.apic[3],
# cell.apic[14], cell.apic[20], cell.apic[26], cell.apic[34], cell.apic[36]]
os.chdir(owd)
return cell, apical_maintrunk
def RichHuman():
owd = os.getcwd()
os.chdir('models/HumanCellOrganized_v2/')
from neuron import h
h.load_file('stdrun.hoc')
h.load_file('import3d.hoc')
h.load_file('SimulationParameters_PlusSomeDefinitions.hoc')
h.load_file('ModelSetup.hoc')
trunk_secs = [1,3,7,15,24,37,59,85,109,123,131,137,143,145,149,155]
os.chdir(owd)
return h, trunk_secs
def HayCellMig(morphology_file = './morphologies/cell1.asc'):
owd = os.getcwd()
os.chdir('./models/Hay')
from neuron import h#, init
h.load_file('stdrun.hoc')
h.load_file('import3d.hoc')
h.load_file('./models/L5PCbiophysMig.hoc') # BAP version
h.load_file('./models/L5PCtemplate.hoc')
cell = h.L5PCtemplate(morphology_file)
apical_maintrunk = [0,1,2,3,14,20,26,34,36]
# apical_maintrunk = [cell.apic[0], cell.apic[1], cell.apic[2], cell.apic[3],
# cell.apic[14], cell.apic[20], cell.apic[26], cell.apic[34], cell.apic[36]]
os.chdir(owd)
return cell, apical_maintrunk
def HayCellSWC(morphology_file = '../suter_shepherd/BS0284.CNG.swc'):
owd = os.getcwd()
os.chdir('./models/Hay')
from neuron import h#, init
# h.load_file("/usr/local/nrn//share/nrn/lib/hoc/stdrun.hoc")
# h.load_file('/usr/local/nrn//share/nrn/lib/hoc/import3d.hoc')
h.load_file('stdrun.hoc')
h.load_file('import3d.hoc')
# h.load_file('./models/L5PCbiophys3.hoc') # BAP version
h.load_file('./models/L5PCbiophysMig.hoc')
h.load_file('./models/templateSWC.hoc')
cell = h.templateSWC(morphology_file)
os.chdir(owd)
return cell
def M1Cell():
# sys.path.insert(0, '../../my_netpyne/')
sys.path.insert(0, 'models/DuraBernal/')
# owd = os.getcwd()
# os.chdir('./models/DuraBernal')
print(os.getcwd())
from netParams_unified import netParams
from cfg_unified import cfg
from netpyne import sim
sim.create(netParams, cfg)
# os.chdir(owd)
return sim