Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
orena1 authored Jul 4, 2022
0 parents commit 2e8175c
Show file tree
Hide file tree
Showing 36 changed files with 236,802 additions and 0 deletions.
480 changes: 480 additions & 0 deletions Construct_rho_alpha_extraction_all_morphs.ipynb

Large diffs are not rendered by default.

476 changes: 476 additions & 0 deletions models/Hay_2011_full/Cell.hoc

Large diffs are not rendered by default.

90 changes: 90 additions & 0 deletions models/Hay_2011_full/L5PCbiophys3.hoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
// Author: Etay Hay, 2011
// Models of Neocortical Layer 5b Pyramidal Cells Capturing a Wide Range of
// Dendritic and Perisomatic Active Properties
// (Hay et al., PLoS Computational Biology, 2011)
//
// Model of L5 Pyramidal Cell, constrained both for BAC firing and Current Step Firing


begintemplate L5PCbiophys
public biophys

proc biophys() {
celsius = 37
forsec $o1.all {
insert pas
cm = 1
Ra = 100
e_pas = -90

}

forsec $o1.somatic {
insert Ca_LVAst
insert Ca_HVA
insert SKv3_1
insert SK_E2
insert K_Tst
insert K_Pst
insert Nap_Et2
insert NaTa_t
insert CaDynamics_E2
insert Ih
ek = -85
ena = 50
gIhbar_Ih = 0.0002
g_pas = 0.0000338
decay_CaDynamics_E2 = 460.0
gamma_CaDynamics_E2 = 0.000501
gCa_LVAstbar_Ca_LVAst = 0.00343
gCa_HVAbar_Ca_HVA = 0.000992
gSKv3_1bar_SKv3_1 = 0.693
gSK_E2bar_SK_E2 = 0.0441
gK_Tstbar_K_Tst = 0.0812
gK_Pstbar_K_Pst = 0.00223
gNap_Et2bar_Nap_Et2 = 0.00172
gNaTa_tbar_NaTa_t = 2.04
}

forsec $o1.apical {
cm = 2
insert Ih
insert SK_E2
insert Ca_LVAst
insert Ca_HVA
insert SKv3_1
insert NaTa_t
insert Im
insert CaDynamics_E2
ek = -85
ena = 50
decay_CaDynamics_E2 = 122
gamma_CaDynamics_E2 = 0.000509
gSK_E2bar_SK_E2 = 0.0012
gSKv3_1bar_SKv3_1 = 0.000261
gNaTa_tbar_NaTa_t = 0.0213
gImbar_Im = 0.0000675
g_pas = 0.0000589
}
$o1.distribute_channels("apic","gIhbar_Ih",2,-0.8696,3.6161,0.0,2.0870,0.00020000000)
$o1.distribute_channels("apic","gCa_LVAstbar_Ca_LVAst",3,1.000000,0.010000,685.000000,885.000000,0.0187000000)
$o1.distribute_channels("apic","gCa_HVAbar_Ca_HVA",3,1.000000,0.100000,685.000000,885.000000,0.0005550000)

forsec $o1.basal {
cm = 2
insert Ih
gIhbar_Ih = 0.0002
g_pas = 0.0000467
}

forsec $o1.axonal {
g_pas = 0.0000325
}
}

endtemplate L5PCbiophys





251 changes: 251 additions & 0 deletions models/Hay_2011_full/L5PCtemplate.hoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,251 @@
// Author: Etay Hay, 2011
// Models of Neocortical Layer 5b Pyramidal Cells Capturing a Wide Range of
// Dendritic and Perisomatic Active Properties
// (Hay et al., PLoS Computational Biology, 2011)
//
// Template for models of L5 Pyramidal Cell

begintemplate L5PCtemplate
public init
public locateSites, getLongestBranch
public soma, dend, apic, axon, getAbsSecIndex
public all, somatic, apical, axonal, basal, nSecSoma, nSecApical, nSecBasal, nSecAxonal, nSecAll, nSecAxonalOrig, SecSyn, distribute_channels
objref SecSyn, this
objref all, somatic, apical, axonal, basal
strdef tstr

//$s1 - morphology file name
proc init() {localobj nl,import
all = new SectionList()
somatic = new SectionList()
basal = new SectionList()
apical = new SectionList()
axonal = new SectionList()
forall delete_section()

nl = new Import3d_Neurolucida3()
nl.quiet = 1
nl.input($s1)
import = new Import3d_GUI(nl, 0)
import.instantiate(this)
geom_nseg()
biophys()
forsec this.all {
if(diam == 0){
diam = 1
printf("Error : Morphology problem with section [%s] 0 diam \n", secname())
}
}
}

create soma[1], dend[1], apic[1], axon[1]

proc geom() {
}

proc geom_nseg() {local nSec, L1, L2, D1, D2, nSeg1, nSeg2
soma area(.5) // make sure diam reflects 3d points
nSec = 0
forsec all {
nseg = 1 + 2*int(L/40)
nSec = nSec + 1
}

nSecAll = nSec
nSec = 0
forsec somatic { nSec = nSec + 1}
nSecSoma = nSec
nSec = 0
forsec apical { nSec = nSec + 1}
nSecApical= nSec
nSec = 0
forsec basal { nSec = nSec + 1}
nSecBasal = nSec
nSec = 0
forsec axonal { nSec = nSec + 1}
nSecAxonalOrig = nSecAxonal = nSec
}

proc biophys() {localobj bp
delete_axon()
area(0.5)
distance()
access soma

bp = new L5PCbiophys()
bp.biophys(this)
}

// deleting axon, keeping only first 60 micrometers
proc delete_axon(){
forsec axonal{delete_section()}
create axon[2]
access axon[0]{
L= 30
diam = 1
nseg = 1+2*int(L/40)
all.append()
axonal.append()
}
access axon[1]{
L= 30
diam = 1
nseg = 1+2*int(L/40)
all.append()
axonal.append()
}

nSecAxonal = 2
connect axon(0), soma(0.5)
connect axon[1](0), axon[0](1)
access soma
}

proc distribute_channels() {local dist,val,base,maxLength
base = $8
soma distance()
maxLength = getLongestBranch($s1)

forsec $s1 {
if(0==strcmp($s2,"Ra")){
Ra = $8
} else {
for(x) {
if ($3==3) {
dist = distance(x)
} else {
dist = distance(x)/maxLength
}
val = calculate_distribution($3,dist,$4,$5,$6,$7,$8)
sprint(tstr,"%s(%-5.10f) = %-5.10f",$s2,x,val)
execute(tstr)
}
}
}
}

// $1 is the distribution type:
// 0 linear, 1 sigmoid, 2 exponential
// 3 step for absolute distance (in microns)
func calculate_distribution() {local value
if ($1==0) {value = $3 + $2*$4}
if ($1==1) {value = $3 + ($4/(1+exp(($2-$5)/$6)))}
if ($1==2) {value = $3 + $6*exp($4*($2-$5))}
if ($1==3) {
if (($2 > $5) && ($2 < $6)) {
value = $3
} else {
value = $4
}
}
value = value*$7
return value
}

// $s1 section
func getLongestBranch(){local maxL,d localobj distallist,sref
sprint(tstr,"%s distance()",$s1)
execute(tstr,this)

if(0==strcmp($s1,"axon")){
sprint(tstr,"%s[0] distance(1)",$s1)
execute(tstr,this)
}

maxL = 0
d = 0
distallist = new SectionList()
forsec $s1 {
sref = new SectionRef()
if (sref.nchild==0) distallist.append()
}
forsec distallist{
d = distance(1)
if(maxL<d) maxL = d
}
// for the soma case
if (maxL == 0) {
$s1 {
maxL = L
}
}
return maxL
}

// $s1 section
// $2 distance x in micrometers
// return list of [1,2] vectors - of the appropriate section and the location in each vector
obfunc locateSites() {local maxL,site,d0,d1,siteX,i localobj vv,ll
ll = new List()

sprint(tstr,"%s distance()",$s1)
execute(tstr,this)

if(0==strcmp($s1,"axon")){
sprint(tstr,"%s[0] distance(1)",$s1)
execute(tstr,this)
}

maxL = getLongestBranch($s1)
site = $2
i = 0
forsec $s1 {
if (distance(0) < distance(1)) {
d0 = distance(0)
d1 = distance(1)
} else {
d1 = distance(0)
d0 = distance(1)
}

if (site <= d1 && site >= d0) {
siteX = (site-d0)/(d1-d0)
secNum = i
vv = new Vector()
ll.append(vv.append(secNum,siteX))
}
i = i+1
}
return ll
}

func getAbsSecIndex(){ local nAbsInd, index localobj str,strObj
strObj = new StringFunctions()
str = new String()
nAbsInd = 0
index = 0
if(strObj.substr($s1, "soma") > 0) {
strObj.tail($s1, "soma", str.s)
if(sscanf(str.s, "%*c%d", &index) < 0) {
index = 0
}
nAbsInd = index
}else if (strObj.substr($s1, "axon") >0) {
strObj.tail($s1, "axon", str.s)
if(sscanf(str.s, "%*c%d", &index) < 0) {
index = 0
}
nAbsInd = nSecSoma + index
}else if (strObj.substr($s1, "dend") >0) {
strObj.tail($s1, "dend", str.s)
if(sscanf(str.s, "%*c%d", &index) < 0) {
index = 0
}
nAbsInd = nSecSoma + nSecAxonalOrig + index
}else if (strObj.substr($s1, "apic") > 0) {
strObj.tail($s1, "apic", str.s)
if(sscanf(str.s, "%*c%d", &index) < 0) {
index = 0
}
nAbsInd = nSecSoma + nSecAxonalOrig + nSecBasal + index
}
return nAbsInd
}


endtemplate L5PCtemplate





Loading

0 comments on commit 2e8175c

Please sign in to comment.