Skip to content

Commit 003da6b

Browse files
committed
Few bug fixes for v0.1.3 release
1 parent 22a81a5 commit 003da6b

File tree

16 files changed

+96
-61
lines changed

16 files changed

+96
-61
lines changed

@Chromatography/baseline.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@
9696

9797
% Check input
9898
if nargin < 1
99-
error('Not enough input arguments');
99+
error('Not enough input arguments.');
100100
elseif isstruct(varargin{1})
101101
data = DataStructure('validate', varargin{1});
102102
else
103-
error('Undefined input arguments of type ''data''');
103+
error('Undefined input arguments of type ''data''.');
104104
end
105105

106106
% Check user input

@Chromatography/import.m

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@
3030
% Check input
3131
[data, options] = parse(obj, varargin);
3232

33+
% Check for errors
34+
if isempty(data) && isempty(options)
35+
disp('Unrecognized file format.');
36+
return
37+
end
38+
3339
% Supress warnings
3440
warning off all
3541

@@ -94,7 +100,7 @@
94100

95101
% Check data
96102
if isempty(import_data{i})
97-
disp(['Unrecognized file format (', num2str(i), '/', num2str(length(files(:,1))), ')']);
103+
disp(['Unrecognized file format (', num2str(i), '/', num2str(length(files(:,1))), ').']);
98104
continue
99105
end
100106

@@ -125,7 +131,7 @@
125131

126132
% Check data
127133
if isempty(import_data{i})
128-
disp(['Unrecognized file format (', num2str(i), '/', num2str(length(files(:,1))), ')']);
134+
disp(['Unrecognized file format (', num2str(i), '/', num2str(length(files(:,1))), ').']);
129135
continue
130136
end
131137

@@ -150,7 +156,7 @@
150156

151157
% Check data
152158
if isempty(import_data{i})
153-
disp(['Unrecognized file format (', num2str(i), '/', num2str(length(files(:,1))), ')']);
159+
disp(['Unrecognized file format (', num2str(i), '/', num2str(length(files(:,1))), ').']);
154160
continue
155161
end
156162

@@ -307,14 +313,16 @@ function update(varargin)
307313

308314
% Check number of inputs
309315
if nargin < 1
310-
error('Not enough input arguments');
316+
error('Not enough input arguments.');
311317
elseif ~ischar(varargin{1})
312-
error('Undefined input arguments of type ''filetype''');
318+
error('Undefined input arguments of type ''filetype''.');
313319
end
314320

315321
% Check for supported file extension
316322
if ~any(find(strcmp(varargin{1}, obj.options.import)))
317-
error('Unrecognized file format');
323+
varargout{1} = [];
324+
varargout{2} = [];
325+
return
318326
else
319327
options.filetype = varargin{1};
320328
end

@Chromatography/integrate.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,11 @@
207207

208208
% Check input
209209
if nargin < 1
210-
error('Not enough input arguments');
210+
error('Not enough input arguments.');
211211
elseif isstruct(varargin{1})
212212
data = DataStructure('validate', varargin{1});
213213
else
214-
error('Undefined input arguments of type ''data''');
214+
error('Undefined input arguments of type ''data''.');
215215
end
216216

217217
% Check user input

@Chromatography/smooth.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@
8484

8585
% Check input
8686
if nargin < 1
87-
error('Not enough input arguments');
87+
error('Not enough input arguments.');
8888
elseif isstruct(varargin{1})
8989
data = DataStructure('validate', varargin{1});
9090
else
91-
error('Undefined input arguments of type ''data''');
91+
error('Undefined input arguments of type ''data''.');
9292
end
9393

9494
% Check user input

@Chromatography/visualize.m

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
% 'xlim' : 'auto', [xmin, xmax]
2020
% 'ylim' : 'auto', [ymin, ymax]
2121
% 'legend' : 'on', 'off'
22-
% 'export' : see MATLAB documentation on print functions
22+
% 'export' : see MATLAB documentation on print functions (ex. {'myfig', '-dtiff', '-r300'})
23+
% 'color' : RGB array
2324
% 'colormap' : 'parula', 'jet', 'hsv', 'hot', 'cool', 'spring', 'summer',
2425
% 'autumn', 'winter', 'gray', 'bone', 'copper', 'pink'
2526
%
@@ -39,6 +40,7 @@
3940
% 'ylim' : y-axis limits (default = 'auto')
4041
% 'legend' : display legend (default = 'on')
4142
% 'export' : options passed to the MATLAB print function (default = 'off')
43+
% 'color' : manually set the RGB values used for line colors (default = 'off')
4244
% 'colormap' : select colormap to use for plotting (default = 'parula')
4345
%
4446
% Examples
@@ -86,7 +88,12 @@
8688

8789
% Input values
8890
y = data(samples(i)).tic.values;
89-
91+
92+
% Check for sparse matrix
93+
if issparse(y)
94+
y = full(y);
95+
end
96+
9097
% Check baseline
9198
if any(strcmpi(options.baseline, {'on', 'corrected'}))
9299
baseline = data(samples(i)).tic.baseline;
@@ -105,14 +112,19 @@
105112
if strcmpi(options.legend, 'on')
106113
names = options.name(i);
107114
else
108-
names = '';
115+
names = {''};
109116
end
110117

111118
case 'all'
112119

113120
% Input values
114121
y = data(samples(i)).xic.values;
115122

123+
% Check for sparse matrix
124+
if issparse(y)
125+
y = full(y);
126+
end
127+
116128
% Check baseline
117129
if any(strcmpi(options.baseline, {'on', 'corrected'}))
118130
baseline = data(samples(i)).xic.baseline;
@@ -140,6 +152,11 @@
140152
% Input values
141153
y = data(samples(i)).xic.values(:, options.ions);
142154

155+
% Check for sparse matrix
156+
if issparse(y)
157+
y = full(y);
158+
end
159+
143160
% Check baseline
144161
if any(strcmpi(options.baseline, {'on', 'corrected'}))
145162
baseline = data(samples(i)).xic.baseline;
@@ -195,13 +212,13 @@
195212
switch version('-release')
196213

197214
case '2014b'
198-
line(x, y,...
215+
plot(x, y,...
199216
'parent', options.axes, ...
200217
'linewidth', options.linewidth, ...
201218
'displayname', [names{:}]);
202219

203220
otherwise
204-
line(x, y,...
221+
plot(x, y,...
205222
'parent', options.axes,...
206223
'linewidth', options.linewidth,...
207224
'linesmoothing', 'on',...
@@ -473,7 +490,11 @@ function plot_update(options)
473490

474491
% Check color options
475492
if isempty(options.colormap) && ~isempty(options.color)
476-
options.colormap = options.color;
493+
if iscell(options.color)
494+
options.colormap = options.color{1};
495+
else
496+
options.colormap = options.color;
497+
end
477498
end
478499

479500
% Determine color order
@@ -533,8 +554,9 @@ function plot_update(options)
533554
'color', 'none',...
534555
'linewidth', options.line.width,...
535556
'tickdir', 'out',...
536-
'ticklength', options.ticks.size,...
537-
'nextplot', 'add');
557+
'ticklength', options.ticks.size);
558+
559+
hold all
538560

539561
% Set x-axis label
540562
options.xlabel = xlabel(...
@@ -620,11 +642,11 @@ function plot_update(options)
620642

621643
% Check input
622644
if nargin < 1
623-
error('Not enough input arguments');
645+
error('Not enough input arguments.');
624646
elseif isstruct(varargin{1})
625647
data = DataStructure('validate', varargin{1});
626648
else
627-
error('Undefined input arguments of type ''data''');
649+
error('Undefined input arguments of type ''data''.');
628650
end
629651

630652
% Check user input
@@ -1096,11 +1118,13 @@ function plot_update(options)
10961118
% Set default options
10971119
options.export = {'chromatography_export', '-dpng', '-r300'};
10981120

1121+
elseif iscell(export)
1122+
options.export = export;
1123+
10991124
elseif any(strcmpi(export, {'default', 'off'}))
11001125
options.export = [];
1101-
1102-
% Check input type
1103-
elseif ~iscell(export)
1126+
1127+
else
11041128
options.export = [];
11051129
end
11061130

Development/Parallel Computing/ParallelBaseline.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535

3636
% Check input
3737
if nargin < 1
38-
error('Not enough input arguments');
38+
error('Not enough input arguments.');
3939
elseif ~isnumeric(y)
40-
error('Undefined input arguments of type ''y''');
40+
error('Undefined input arguments of type ''y''.');
4141
end
4242

4343
% Default options

Development/Parallel Computing/ParallelSmooth.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535

3636
% Check input
3737
if nargin < 1
38-
error('Not enough input arguments');
38+
error('Not enough input arguments.');
3939
elseif ~isnumeric(y)
40-
error('Undefined input arguments of type ''y''');
40+
error('Undefined input arguments of type ''y''.');
4141
end
4242

4343
% Default options

Methods/Export/ExportCSV.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function ExportCSV(varargin)
4242

4343
% Check input
4444
if nargin < 1
45-
error('Not enough input arguments');
45+
error('Not enough input arguments.');
4646
elseif nargin <= 3
4747
values = sum(cellfun(@isnumeric, varargin));
4848
elseif nargin > 3
@@ -51,7 +51,7 @@ function ExportCSV(varargin)
5151

5252
% Check for any data
5353
if values == 0
54-
error('Incorrect input arguments of type ''y''');
54+
error('Incorrect input arguments of type ''y''.');
5555
end
5656

5757
% Check input data
@@ -156,7 +156,7 @@ function ExportCSV(varargin)
156156
% Add '.CSV' extension
157157
options.file = strcat(options.file, '.CSV');
158158
else
159-
options.filename = 'data.CSV';
159+
options.file = 'data.CSV';
160160
end
161161

162162

Methods/Integration/ExponentialGaussian.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,15 @@
154154

155155
% Check input
156156
if nargin < 1
157-
error('Not enough input arguments');
157+
error('Not enough input arguments.');
158158
elseif nargin >= 1 && isnumeric(varargin{1}) && ~isnumeric(varargin{2})
159159
y = varargin{1};
160160
x = 1:length(y(:,1));
161161
elseif nargin >1 && isnumeric(varargin{1}) && isnumeric(varargin{2})
162162
x = varargin{1};
163163
y = varargin{2};
164164
else
165-
error('Undefined input arguments of type ''xy''');
165+
error('Undefined input arguments of type ''xy''.');
166166
end
167167

168168
% Check data precision
@@ -181,7 +181,7 @@
181181
y = y';
182182
end
183183
if length(x(:,1)) ~= length(y(:,1))
184-
error('Input dimensions must aggree');
184+
error('Input dimensions must aggree.');
185185
end
186186

187187
% Check data length
@@ -207,7 +207,7 @@
207207
[~,index] = max(y);
208208
options.center = x(index);
209209
elseif ~isnumeric(options.center)
210-
error('Undefined input arguments of type ''center''');
210+
error('Undefined input arguments of type ''center''.');
211211
end
212212

213213
% Check width options
@@ -223,7 +223,7 @@
223223
if isempty(options.width) || min(options.width) <= 0
224224
options.width(1:length(options.center),1) = max(x) * 0.05;
225225
elseif ~isnumeric(options.width)
226-
error('Undefined input arguments of type ''width''');
226+
error('Undefined input arguments of type ''width''.');
227227
end
228228

229229
% Find out of range center values (maximum)

Methods/Integration/PeakDetection.m

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -258,15 +258,15 @@
258258

259259
% Check input
260260
if nargin < 1
261-
error('Not enough input arguments');
261+
error('Not enough input arguments.');
262262
elseif nargin >= 1 && isnumeric(varargin{1}) && ~isnumeric(varargin{2})
263263
y = varargin{1};
264264
x = 1:length(y(:,1));
265265
elseif nargin >1 && isnumeric(varargin{1}) && isnumeric(varargin{2})
266266
x = varargin{1};
267267
y = varargin{2};
268268
else
269-
error('Undefined input arguments of type ''xy''');
269+
error('Undefined input arguments of type ''xy''.');
270270
end
271271

272272
% Check data precision
@@ -285,7 +285,7 @@
285285
y = y';
286286
end
287287
if length(x(:,1)) ~= length(y(:,1))
288-
error('Input dimensions must aggree');
288+
error('Input dimensions must aggree.');
289289
end
290290

291291
% Check user input
@@ -306,7 +306,7 @@
306306
[~,index] = max(y);
307307
options.center = x(index);
308308
elseif ~isnumeric(options.center)
309-
error('Undefined input arguments of type ''center''');
309+
error('Undefined input arguments of type ''center''.');
310310
elseif max(options.center) > max(x) || min(options.center) < min(x)
311311
[~,index] = max(y);
312312
options.center = x(index);
@@ -325,7 +325,7 @@
325325
if isempty(options.width) || min(options.width) <= 0
326326
options.width(1:length(options.center),1) = max(x) * 0.05;
327327
elseif ~isnumeric(options.width)
328-
error('Undefined input arguments of type ''width''');
328+
error('Undefined input arguments of type ''width''.');
329329
end
330330

331331
% Find out of range values (maximum)

0 commit comments

Comments
 (0)