Skip to content

Commit 15681a0

Browse files
danieltrpevskijpgsantoskadripajoKadri Pajodkeller9
authored
Development (#30)
*General improvements for code and documentation Co-authored-by: João Pedro Gomes dos Santos <[email protected]> Co-authored-by: João Pedro Gomes dos Santos <[email protected]> Co-authored-by: Kadri Pajo <[email protected]> Co-authored-by: Kadri Pajo <[email protected]> Co-authored-by: dkeller9 <[email protected]>
1 parent 4ff995c commit 15681a0

File tree

385 files changed

+44325
-10681
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

385 files changed

+44325
-10681
lines changed

.gitignore

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
21
**/NEURON/single_sec_cell.py
3-
!**/Matlab/Model/Place models here.txt
4-
**/Matlab/Model/**
52
*.pdf
63
*.tiff
7-
*.png
8-
!**/Docs/Images/**
4+
*.png

Code for paper figures/Reproduce paper figure 3/spike.m renamed to Code for paper figures/Common scripts/spike.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
function thisAmp = spike(timePoint, basalAmp, jumpAmp, risingOffset, k1, k2)
2+
% Script provided by Anu G. Nair to reproduce the calcium spike present in
3+
% his 2016 paper (https://doi.org/10.1371/journal.pcbi.1005080)
24

35
tForMax = log(k1/k2)/(k1-k2);
46
maxAmpForThisRate = (exp(-k1*tForMax) - exp(-k2*tForMax));

Code for paper figures/Reproduce paper figure 6/spiketraindd_Ca.m renamed to Code for paper figures/Common scripts/spiketraindd_Ca.m

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
function thisAmp = spiketraindd_Ca(t, tStart, frequency, maxSpikeNum, ...
2-
basalAmp, maxAmp, k1, k2, spikelengthLowerThresh, spikeAmpMaxThresh, burstFrequency, maxBurstNum, burstMinInter, regorand)
3-
2+
basalAmp, maxAmp, k1, k2, ...
3+
spikelengthLowerThresh, spikeAmpMaxThresh,...
4+
burstFrequency, maxBurstNum, burstMinInter,...
5+
regorand)
6+
% Script provided by Anu G. Nair to reproduce the calcium spike present in
7+
% his 2016 paper (https://doi.org/10.1371/journal.pcbi.1005080)
48

59
t = t * 1000;
610
cv = 0.1;
20.1 MB
Binary file not shown.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
function thisAmp = Ca_input_fig3(times,n)
2+
persistent CaX
3+
persistent CaT
4+
persistent Cah1
5+
persistent Cah2
6+
if isempty(CaX)
7+
Data = coder.load('../Subcellular_workflow/Code for paper figures/Figure 3/Nair_2016_calcium.mat','calcium','time');
8+
CaX = Data.calcium{n};
9+
CaT = Data.time{n};
10+
Cah1 = 1;
11+
end
12+
thisAmp = CaX(end);
13+
if times ~= 30
14+
if times == 0
15+
Cah1 = 1;
16+
thisAmp = CaX(1);
17+
else
18+
while times > CaT(Cah1)
19+
Cah1 = Cah1 + 1;
20+
end
21+
while times < CaT(Cah1 -1)
22+
Cah1 = Cah1 - 1;
23+
end
24+
Cah2 = (CaT(Cah1)-times)*1/(CaT(Cah1)-CaT(Cah1-1));
25+
thisAmp = (CaX(Cah1-1)*Cah2 + CaX(Cah1)*(1-Cah2));
26+
end
27+
end
28+
end
428 KB
Binary file not shown.
54 KB
Binary file not shown.
51.4 KB
Binary file not shown.
2.7 MB
Binary file not shown.
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
function f_Reproduce_data_fig3_CD(folder)
2+
%% Running this script will generate figures 1C and 2C from Nair et al 2016
3+
%% using the updated model with new parameters governing CaMKII autophosphorylation
4+
warning('off','SimBiology:DimAnalysisNotDone_MatlabFcn_Dimensionless')
5+
6+
load(folder + "model_Nair_2016_optimized_fig3.mat",'modelobj');
7+
obj = modelobj;
8+
9+
%% Get steady state values after equilibrating for 50000 s
10+
11+
cnfst = getconfigset(obj);
12+
cnfst.SolverType = 'ode15s';
13+
cnfst.StopTime = 50000;
14+
cnfst.TimeUnits = 'second';
15+
cnfst.SolverOptions.AbsoluteTolerance = 1e-7;
16+
cnfst.SolverOptions.RelativeTolerance = 1e-4;
17+
cnfst.CompileOptions.UnitConversion = 1;
18+
cnfst.SolverOptions.AbsoluteToleranceScaling = 1;
19+
cnfst.RunTimeOptions.StatesToLog = 'all';
20+
21+
[t,species,~] = sbiosimulate(obj);
22+
23+
SteadyState=species(length(t),:);
24+
25+
for i=1:length(SteadyState)
26+
if SteadyState(i)<0
27+
SteadyState(i)=0;
28+
end
29+
end
30+
31+
for i=1:length(SteadyState)
32+
set(obj.species(i), 'InitialAmount', SteadyState(i));
33+
end
34+
35+
%% Add parameters used by the Calcium input
36+
37+
ruleobj=addrule(obj, 'Spine.Ca = Ca_input_fig3(time,Ca_input)');
38+
set(ruleobj,'RuleType','RepeatedAssignment');
39+
addparameter(obj, 'Ca_input', 0);
40+
set(obj.parameters(end), 'ValueUnits', 'dimensionless');
41+
42+
% Assign DA_expression to dopamine
43+
ruleobj=addrule(obj, 'Spine.DA = Spine.DA_expression');
44+
set(ruleobj,'RuleType','RepeatedAssignment');
45+
46+
%% Run simulations
47+
48+
DA = -4:0.2:4;
49+
CaStart = 4;
50+
cnfst.StopTime = 30;
51+
cnfst.SolverOptions.MaxStep = 0.01;
52+
cnfst.SolverOptions.OutputTimes = 0:0.01:30;
53+
cnfst.RuntimeOptions.StatesToLog = {'pSubstrate'};
54+
set(obj.rules(2), 'Active', 1);
55+
set(obj.rules(3), 'Active', 0);
56+
57+
obj.parameters(end).Value = 1;%Ca_input
58+
[t_noDA,x_noDA,~] = sbiosimulate(obj);
59+
activationArea = sum(x_noDA) - x_noDA(1) * length(x_noDA);
60+
61+
set(obj.rules(3), 'Active', 1);
62+
set(obj.parameters(228), 'ValueUnits', 'second'); % par 228 = DA_start
63+
obj.parameters(228).Value = CaStart + 1; % par 228 = DA_start
64+
obj.parameters(end).Value = 2;%Ca_input
65+
66+
[t_DA,x_DA,~] = sbiosimulate(obj);
67+
68+
activationAreaWithMultipleDA = zeros(1,length(DA));
69+
70+
for n = 1:length(DA)
71+
objm{n} = copyobj(obj);
72+
objm{n}.parameters(end).Value = n+2;%Ca_input
73+
objm{n}.parameters(228).Value = CaStart + DA(n); % par 228 = DA_start
74+
objm_cnfst{n} = getconfigset(objm{n});
75+
objm_cnfst{n}.StopTime = 30;
76+
objm_cnfst{n}.SolverOptions.MaxStep = 0.01;
77+
objm_cnfst{n}.SolverOptions.OutputTimes = 0:0.01:30;
78+
objm_cnfst{n}.RuntimeOptions.StatesToLog = {'pSubstrate'};
79+
objm_cnfst{n}.SolverType = 'ode15s';
80+
objm_cnfst{n}.TimeUnits = 'second';
81+
objm_cnfst{n}.SolverOptions.AbsoluteTolerance = 1e-7;
82+
objm_cnfst{n}.SolverOptions.RelativeTolerance = 1e-4;
83+
objm_cnfst{n}.CompileOptions.UnitConversion = 1;
84+
objm_cnfst{n}.SolverOptions.AbsoluteToleranceScaling = 1;
85+
end
86+
87+
parfor n = 1:length(DA)
88+
warning('off','SimBiology:DimAnalysisNotDone_MatlabFcn_Dimensionless')
89+
[~,x,~] = sbiosimulate(objm{n},objm_cnfst{n});
90+
activationAreaWithMultipleDA(n) = sum(x) - x(1) * length(x);
91+
% ME = MException(errID,msgtext)
92+
end
93+
94+
Nair_2016_optimized_Matlab_data_fig3{1}(:,1) = t_noDA;
95+
Nair_2016_optimized_Matlab_data_fig3{1}(:,2) = x_noDA;
96+
Nair_2016_optimized_Matlab_data_fig3{2}(:,1) = t_DA;
97+
Nair_2016_optimized_Matlab_data_fig3{2}(:,2) = x_DA;
98+
Nair_2016_optimized_Matlab_data_fig3{3}(:,1) = DA;
99+
Nair_2016_optimized_Matlab_data_fig3{3}(:,2) = activationAreaWithMultipleDA/activationArea;
100+
101+
save(folder + "Nair_2016_optimized_Matlab_data_fig3.mat",...
102+
'Nair_2016_optimized_Matlab_data_fig3')
103+
end

0 commit comments

Comments
 (0)