-
Notifications
You must be signed in to change notification settings - Fork 0
/
neuropharmacology_wrapper.m
238 lines (167 loc) · 6.59 KB
/
neuropharmacology_wrapper.m
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
% #! MATLAB script
% This script processes the neuropharmocological results documented in an excel sheet
% The excel sheet contain 1 sheet per experiment trial for all trials of a given drug
%
% Inputs:
% paths to input and output folders, excel file name to process
% list of drugs to process
%
% Author :- Pradeep Dheerendra, School of Neurology, Institute of Neuroscience,
% Newcastle University, Newcastle-upon-Tyne, UK
% (C) Copyright 2014 - All rights reserved with Newcastle University
% Version History:-
% ver - DD MMMM YYYY - Feature added
% 0.1 - 01 July 2014 - basic implementation
% 0.2 - 04 July 2014 - upgraded for automation on multiple flags
% 0.3 - 24 July 2014 - added washout feature in flags
% 0.4 - 06 Oct 2014 - added writing output file feature
% 0.5 - 02 Jan 2015 - cleanup
% start afresh
clear; close; clc; % clear all data, figures, and console
%% specify inputs - configuration
% flag to enable plotting of single trial
single_trial = 1;
% flag to enable plotting of population results
population_stats = 0;
% whether to perform normalization on the parameters
enable_normalization_flags = [ 0 1 ];
% washout plots
washout_flags = [0 1];
% flag to convey whether to plot figures
draw_plots = 0;
% flag to convey whether to save population values as excel
write_xl_file = 1;
% name of the output excel file
output_xl_file = 'Population';
% flag to specify whether to overwrite on the output excel file
overwite = 0;
% list of drugs to process the data
drug_list = ...
{
'Kainate';
'Pirenzepine';
'Physostigmine';
'Scopolamine';
'DAP5';
'Atropine';
'NBQX';
'Gabazine';
'Carbachol';
};
% path to the folder where data is present
data_path = 'data/';
% path to output folder
out_path_base = 'statistics';
% set the plot file extension type
file_extension = 'png';
% color for: Peak power, peak freq, AUC
col = [ 1 0 0; % red
0 0.75 0; % dark green
0 0 1]; % blue
% width of line in the plots
line_width = 1;
% set font size for the figure legends
font_size = 8;
%% initializations
% Range within excel sheet - currently unused
% xlRange = 'B1:D26';
% flag to enable wrapper integration
enable_wrapper = 1;
% name of the sheet within the excel file to process
only_sheet = ''; % empty processes all files
% call the script for each drug on the list
for num = 1:length(drug_list)
% select the drug from the list of drugs
drug = drug_list{num};
switch drug
case 'Carbachol'
% name of the input excel file
input_xl_file_name = 'Carbachol';
% name of the sheet within the excel file to process
only_sheet = '';
case 'Carbachol-peak_10'
% name of the input excel file
input_xl_file_name = 'Carbachol-peak_10';
% name of the sheet within the excel file to process
only_sheet = '';
case 'Gabazine'
% name of the input excel file
input_xl_file_name = 'Gabazine';
% name of the sheet within the excel file to process
only_sheet = '';
case 'NBQX'
% name of the input excel file
input_xl_file_name = 'NBQX';
% name of the sheet within the excel file to process
only_sheet = '';
case 'Atropine'
% name of the input excel file
input_xl_file_name = 'Atropine';
% name of the sheet within the excel file to process
only_sheet = '';
case 'DAP5'
% name of the input excel file
input_xl_file_name = 'DAP5';
% name of the sheet within the excel file to process
only_sheet = '';
case 'Scopolamine'
% name of the input excel file
input_xl_file_name = 'Scopolamine';
% name of the sheet within the excel file to process
only_sheet = '';
case 'Kainate'
% name of the input excel file
input_xl_file_name = 'Kainate';
% name of the sheet within the excel file to process
only_sheet = '';
case 'Physostigmine'
% name of the input excel file
input_xl_file_name = 'Physostigmine';
% name of the sheet within the excel file to process
only_sheet = '';
case 'Pirenzepine'
% name of the input excel file
input_xl_file_name = 'Pirenzepine';
% name of the sheet within the excel file to process
only_sheet = '';
otherwise
% unsupported drug
disp(['Drug: ' drug ' not on list']);
continue;
end
for washout = washout_flags
if washout
input_xl_file_name = [input_xl_file_name ' - washout'];
% concatenate input file name
input_file_name = [data_path '\' input_xl_file_name '.xlsx'];
% verify input file integrity
if exist(input_file_name,'file') == 0
% If File not found then ignore (WO is not always done)
continue;
end
drug = [drug '_washout'];
end
for enable_normalization = enable_normalization_flags
if single_trial
% path to output folder
out_path = [out_path_base '/trials'];
if enable_normalization
out_path = [out_path '_norm'];
end
% call the script to plot each experiment of this drug
neuropharmacology_trials;
end
if population_stats
% path to output folder
out_path = [ out_path_base '/population'];
output_xl_file_name = output_xl_file;
if enable_normalization
out_path = [out_path '_norm'];
output_xl_file_name = [output_xl_file '_norm'];
end
% call the script to plot each experiment of this drug
neuropharmacology_population;
end
end
end
end