// Simulation and analysis of Spatiotemporal Component of Cl- Gradients in a isolated dendrite
// Define spatial properties of dendrite
ANZAHL_NODES = 100
// Determine parameters of pH variation
MIN_PH = 6.8
MAX_PH = 7.8
pH_Steps = 50
pH_Step_Value = (MAX_PH-MIN_PH)/pH_Steps
CO2_Conc = 1.208 // mM - calculated from pCO2 of 38 mmHg (5% of 760 torr) and alpha of 0.0318 (Mitchel et al. 1988, J appl. Physiol)
kS_CA = 0.00074473 // from pKs = 6.128 (Mitchel et al. 1988, J appl. Physiol) renormed to unit mM
// Determining Cl- Properties --------------------------------------
Cl_Steps = 3 // Number of Different [Cl-]i
Min_Cl = 10
Max_Cl = 50
// Write Vektor with Cl- Values
objref Cl_List
Cl_List = new Vector(Cl_Steps)
for i=0, Cl_Steps-1 {
Cl_List.x[i] = Min_Cl + i*((Max_Cl-Min_Cl)/(Cl_Steps-1))
}
// Determination Parameters GABA
ANZAHL_GABA = 1 //Anzahl der synaptischen Pulse
G_GABA = 0.000789 * 100
P_GABA = 0.18
DECAY_GABA = 37
GABA_SYN_LOCATION = 0.5 // Position GABA Synapse for Pulses
ONSET_PULSE = 10
//----- Define run parameters ---------------------
tstop = 3000 // Duration
v_init = -60 // Initial voltage
dt = 0.05 // Step Interval in ms
lenghtoutputvec = 2000 // Number of Lines for output (< 32000 for Excel-Figures)
//----- 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
P_gaba = P_GABA
}
// Definition of synaptic Stimuli
objref stimGABApuls //Pulssequenz GABA
stimGABApuls = new NetStim(GABA_SYN_LOCATION)
stimGABApuls.number = ANZAHL_GABA
stimGABApuls.start = ONSET_PULSE
// Linkage of synaptic Inputs
objref synpulsegaba
dend {
synpulsegaba = new NetCon(stimGABApuls, gabasyn, 0, 0, G_GABA)
}
// ------------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
// ---------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 hco3ivec[ANZAHL_NODES], shorthco3ivec, hco3ivec_aver
objref Outmatrix //0=time, FAKTOR=Cl-, MAX_FAKTOR+FAKTOR = v
strdef OutFileName // Name of File Output
objref OutFile
//--- Assign -------
timevec = new Vector()
shorttimevec = new Vector()
for i = 0, ANZAHL_NODES-1 {
voltvec[i] = new Vector()
clivec[i] = new Vector()
hco3ivec[i] = new Vector()
}
clivec_aver = new Vector()
hco3ivec_aver = new Vector()
voltvec_aver = new Vector()
shortclivec = new Vector()
shorthco3ivec = new Vector()
shortvoltvec = new Vector()
Outmatrix = 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))
hco3ivec[i].record(&dend.hco3i(i/ANZAHL_NODES))
}
// --- Simulation starts here
// outer loop - variation in Cl- concentration
Cl_Step = 0
while (Cl_Step < Cl_Steps){
// assign Cl- concentration ----------------------------------------------
forsec all {
cli0_cldif_CA3_NKCC1_HCO3 = Cl_List.x[Cl_Step]
cli_Start_cldif_CA3_NKCC1_HCO3 = Cl_List.x[Cl_Step]
cli_cldif_CA3_NKCC1_HCO3 = Cl_List.x[Cl_Step]
}
// Inner loop - variation of pH-dependent HCO3- concentration
pH_Step = 0
while (pH_Step < pH_Steps) {
// Calculate [HCO3-] --------------------------------
pH_Value = MIN_PH + (pH_Step) * pH_Step_Value
H_Conc = exp(pH_Value*log(10)*-1) * 1000 // H+ concentration in mM
HCO3_Conc = kS_CA * (CO2_Conc/1000) / (H_Conc/1000)
// Assign HCo3 values
forsec all {
hco3i0_cldif_CA3_NKCC1_HCO3 = HCO3_Conc
hco3i_Start_cldif_CA3_NKCC1_HCO3 = HCO3_Conc
hco3i_cldif_CA3_NKCC1_HCO3 = HCO3_Conc
}
printf("Sequence %g of %g; [Cl-]i = %g, pH = %g, [H+] = %g, [HCO3-] = %g \n", (Cl_Step*pH_Steps+pH_Step), (Cl_Steps*pH_Steps), Cl_List.x[Cl_Step], pH_Value, H_Conc, HCO3_Conc)
// Run Simulation --------------------------------------------------------
run()
// Put Data in Output Matrix --------------------------------------------
// ---- => shrink the parameters to output-size before ---------------------
MakeShort(timevec, shorttimevec, lenghtoutputvec)
Outmatrix.resize(shorttimevec.size()+1, pH_Steps*Cl_Steps*3+1)
Outmatrix.setcol(0, shorttimevec)
// Calculate average [Cli] over all Nodes -------
clivec_aver.resize(clivec[0].size())
hco3ivec_aver.resize(hco3ivec[0].size())
voltvec_aver.resize(voltvec[0].size())
clivec_aver.mul(0) // empty vector
voltvec_aver.mul(0)
for i=0, ANZAHL_NODES-1 {
clivec_aver.add(clivec[i])
hco3ivec_aver.add(hco3ivec[i])
voltvec_aver.add(voltvec[i])
}
clivec_aver.div(ANZAHL_NODES)
hco3ivec_aver.div(ANZAHL_NODES)
voltvec_aver.div(ANZAHL_NODES)
printf(" => [Cl-]i = %g mM, min[HCO3-]i = %g, max[HCO3-]i = %g, Em = %g mV \n", clivec_aver.min(), hco3ivec_aver.min(), hco3ivec_aver.max(), voltvec_aver.max())
// Put Vectors in Outmatrix
MakeShort(clivec_aver, shortclivec, lenghtoutputvec)
MakeShort(hco3ivec_aver, shorthco3ivec, lenghtoutputvec)
MakeShort(voltvec_aver, shortvoltvec, lenghtoutputvec)
shortvoltvec.x[0] = pH_Value
Outmatrix.setcol(Cl_Step*pH_Steps*3+pH_Step*3+1, shortvoltvec)
Outmatrix.setcol(Cl_Step*pH_Steps*3+pH_Step*3+2, shortclivec)
Outmatrix.setcol(Cl_Step*pH_Steps*3+pH_Step*3+3, shorthco3ivec)
// Goto next pH-Value
pH_Step+=1
} // end of pH _ LOOP ----------
// Goto next Cl- Concentration
Cl_Step+=1
} // end of Cl- loop
// Save the Data --------------------------------------------------------------------
OutFile = new File()
sprint(OutFileName, "Result_Isolated_Dendrite_Var_pH.asc")
OutFile.wopen(OutFileName)
Outmatrix.fprint(OutFile, "\t%g")
OutFile.close