// Simulation and analysis of Spatiotemporal Component of Cl- Gradients in a isolated dendrite
// ------------Procedures and Functions -------------------------------
// --------------------------------------------------------------------
// Function MakeShort ---------------------------------------//
// Inputs: $1 Objref to Inputvector //
// $2 Objref to Outoutvector //
// lenoutvec desired lendth of Outputvector //
// //
// Reduce Inputvec to Outputvev by averaging n elements //
// n (reducing factor) = floor(Inputvec.size() / lenoutvec) //
// ----------------------------------------------------------//
obfunc MakeShort() {local i, n
n = int($o1.size()/$3)
$o2.resize($3)
for i=0, $3-1 {
$o2.x[i] = $o1.mean(i*n, (i+1)*n-1)
}
return $o2
} // End of function
// Define spatial properties of dendrite
ANZAHL_NODES = 100
// Determination Parameters GABA
ANZAHL_GABA = 1 //Anzahl der synaptischen Pulse
G_GABA = 0.000789
DECAY_GABA = 37
GABA_SYN_LOCATION = 0.5 // Position GABA Synapse for Pulses
ONSET_PULSE = 50
// Determining Cl- Properties -----------------------------------
Cl_conc = 30
forsec all {
cli0_cldif_CA3 = Cl_conc
cli_Start_cldif_CA3 = Cl_conc
cli_cldif_CA3 = Cl_conc
}
//----- Define run parameters ---------------------
tstop = 3000 // Duration
v_init = -60 // Initial voltage
dt = 0.02 // Step Interval in ms
steps_per_ms = 50
lenghtoutputvec = 2000 // Number of Lines for output (< 32000 for Excel-Figures)
// Determining GABA receptor conductivity ---------------------------
gGABA_Steps = 100
Min_gGABA = 0.1
Max_gGABA = 1000
// Write Vektor with gGABA-Values
objref gGABA_List
gGABA_List = new Vector(gGABA_Steps)
for i=0, gGABA_Steps-1 {
gGABA_List.x[i] = (Min_gGABA + i*((Max_gGABA-Min_gGABA)/(gGABA_Steps-1))) *G_GABA
}
// Determining relative GABA receptor HCO3 conductivity ---------------------------
pGABA_Steps = 3 // 3 different decay constants
objref pGABA_List
pGABA_List = new Vector(pGABA_Steps)
// manually put desired tau_Values in List
pGABA_List.x[0] = 0 // synaptic weight according to miniature events
pGABA_List.x[1] = 0.18
pGABA_List.x[2] = 0.44
//----- Insert synapses -------------------------
// Determination of Synapses
objref gabasyn
dend {
// insert GABA synapse
gabasyn = new gaba(GABA_SYN_LOCATION)
tau1_gaba = 0.1
tau2_gaba = DECAY_GABA
HCO3e_gaba = 22.4
HCO3i_gaba = 14.1
}
// Definition of synaptic Stimuli
objref stimGABApuls //Pulssequenz GABA
stimGABApuls = new NetStim(GABA_SYN_LOCATION)
stimGABApuls.number = ANZAHL_GABA
stimGABApuls.start = ONSET_PULSE
objref synpulsegaba
// ---------Definition of Output Vectors and File Output --------------
// --------------------------------------------------------------------
//-- Define ------
objref timevec, shorttimevec
objref voltvec[ANZAHL_NODES], shortvoltvec, voltvec_aver
objref clivec[ANZAHL_NODES], shortclivec, clivec_aver
objref voltOutmatrix //0=time
objref cliOutmatrix //0=time
strdef voltOutFileName, cliOutFileName // Name of File Output
objref voltOutFile, cliOutFile
//--- Assign -------
timevec = new Vector()
shorttimevec = new Vector()
for i = 0, ANZAHL_NODES-1 {
voltvec[i] = new Vector()
clivec[i] = new Vector()
}
clivec_aver = new Vector()
voltvec_aver = new Vector()
shortclivec = new Vector()
shortvoltvec = new Vector()
voltOutmatrix = new Matrix()
cliOutmatrix = new Matrix()
//-- Link Output Vectors ----------------
timevec.record(&t) // Time vector
for i = 0, ANZAHL_NODES-1 { // Generate Vektor for each node
voltvec[i].record(&dend.v(i/ANZAHL_NODES))
clivec[i].record(&dend.cli(i/ANZAHL_NODES))
}
// --- Simulation starts here
//-- Outer Loop Variation of gGABA -------------------
gGABA_Step = 0
while (gGABA_Step < gGABA_Steps){
G_GABA = gGABA_List.x[gGABA_Step]
// Inner Loop Variation of P_GABA --------------------------------------------------
pGABA_Step = 0
while (pGABA_Step < pGABA_Steps){
p_GABA = pGABA_List.x[pGABA_Step]
// 1. assign P_GABA and gGABA to synapse ----------------------------------------------
gabasyn.P = p_GABA
G_GABA = gGABA_List.x[gGABA_Step]
synpulsegaba = new NetCon(stimGABApuls, gabasyn, 0, 0, G_GABA)
printf("Sequence %g of %g; gGABA = %g, p(GABA) = %g, ", (pGABA_Step*gGABA_Steps+gGABA_Step+1), (gGABA_Steps*pGABA_Steps), gGABA_List.x[gGABA_Step], pGABA_List.x[pGABA_Step])
// Run Simulation --------------------------------------------------------
run()
// Put Data in Output Matrix --------------------------------------------
// ---- => shrink the parameters to output-size before ---------------------
MakeShort(timevec, shorttimevec, lenghtoutputvec)
voltOutmatrix.resize(shorttimevec.size(), 1 + pGABA_Steps*gGABA_Steps)
voltOutmatrix.setcol(0, shorttimevec)
cliOutmatrix.resize(shorttimevec.size(), 1 + pGABA_Steps*gGABA_Steps)
cliOutmatrix.setcol(0, shorttimevec)
// Calculate average [Cl]i and [HCO3]i over all Nodes -------
clivec_aver.resize(clivec[0].size())
clivec_aver.mul(0) // empty vector
for i=0, ANZAHL_NODES-1 {
clivec_aver.add(clivec[i])
}
clivec_aver.div(ANZAHL_NODES)
printf(" => [Cl-]i = %g - %g mM, Em = %g - %g mV \n", clivec_aver.min(), clivec_aver.max(), voltvec[50].min(), voltvec[50].max())
// Put Vectors in Outmatrix
MakeShort(clivec_aver, shortclivec, lenghtoutputvec)
MakeShort(voltvec[50], shortvoltvec, lenghtoutputvec)
shortvoltvec.x[0] = gGABA_List.x[gGABA_Step]
shortvoltvec.x[1] = pGABA_List.x[pGABA_Step]
shortvoltvec.x[2] = 7777
shortclivec.x[0] = gGABA_List.x[gGABA_Step]
shortclivec.x[1] = pGABA_List.x[pGABA_Step]
shortclivec.x[2] = 7777
cliOutmatrix.setcol(pGABA_Step*gGABA_Steps+gGABA_Step+1, shortclivec)
voltOutmatrix.setcol(pGABA_Step*gGABA_Steps+gGABA_Step+1, shortvoltvec)
// Goto next p_GABA
pGABA_Step+=1
}
// End inner loop ---------------------------------
// Goto next gGABA_value
gGABA_Step+=1
} // End of outer loop
// Save the Data --------------------------------------------------------------------
voltOutFile = new File()
sprint(voltOutFileName, "Result_Isolated_Dendrite_woHCO3_Var-gGABA_Var-Cl_Volt.asc")
voltOutFile.wopen(voltOutFileName)
voltOutmatrix.fprint(voltOutFile, "\t%g")
voltOutFile.close
cliOutFile = new File()
sprint(cliOutFileName, "Result_Isolated_Dendrite_woHCO3_Var-gGABA_Var-Cl_cli.asc")
cliOutFile.wopen(cliOutFileName)
cliOutmatrix.fprint(cliOutFile, "\t%g")
cliOutFile.close