-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdublBasicPlots.m
753 lines (689 loc) · 30.3 KB
/
dublBasicPlots.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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
function dublBasicPlots(intraStructures,varargin)
% DUBLBASICPLOTS Produces plots of a given statistic of intra-kinetochore
% measurements.
%
% DUBLBASICPLOTS(INTRASTRUCTURE,...) Outputs a figure representing the
% distribution of various measurements of intra-kinetochore distances
% and/or angles, collated in each cell element of INTRASTRUCTURES,
% across multiple experiments. INTRASTRUCTURES are produced by
% dublIntraMeasurements.
%
% Options, defaults in {}:-
%
% coordSystem: {'plate'} or 'microscope'. Which coordinate system within
% which to represent measurements. Note that some measurements are
% only available using 'plate' (e.g. twist), and some measurements
% are independent of coordinate system (e.g. 3D delta).
%
% depthFilter: 0 or {1}. Whether or not to give depth-filtered
% measurements of intra-measurements.
%
% legend: {'Expt 1', ...} or similar. Names for each experiment.
%
% stat: {'delta3D'} or one of the following:
% - 'delta3D'
% - 'delta2D'
% - 'delta1D'
% - 'deltaXYZ'
% - 'delta3D-church'
% - 'delta2D-church'
% - 'sisSep3D'
% - 'sisSep2D'
% - 'sisSepXYZ'
% - 'twist3D'
% - 'twistYZ'
% - 'swivel3D'
% - 'swivelYZ'
% - 'swivelKMT'
% - 'rawInts'
% - 'normInts'
% The statistic to be printed to screen. If no statistic is provided,
% the user will be prompted.
%
% Copyright (c) 2017 C. A. Smith
% default options
opts.coordSystem = 'microscope';
opts.depthFilter = 1;
opts.legend = {'Expt 1','Expt 2','Expt 3','Expt 4', 'Expt 5'};
opts.stat = '';
% get user options
opts = processOptions(opts,varargin{:});
% process input
if ~iscell(intraStructures)
nExpts = 1;
intraStructures = {intraStructures};
else
nExpts = length(intraStructures);
end
% ask the user which stat they would like
statsList = {'delta3D' ,'delta2D' ,'delta1D' ,'deltaXYZ',...
'delta3D-church','delta2D-church',...
'sisSep3D','sisSep2D','sisSepXYZ',...
'twist3D' ,'twistYZ' ,...
'swivel3D','swivelYZ','swivelKMT',...
'rawInts','normInts'};
if ~strcmp(opts.coordSystem,'plate')
statsList(10:11) = [];
end
if ~ismember(opts.stat,statsList)
fprintf('Output statistics options:\n')
for iStat=1:length(statsList)
fprintf(' %i) %s\n',iStat,statsList{iStat});
end
prompt = sprintf('Please type the number statistic you would like: ');
result = input(prompt);
opts.stat = statsList{result};
end
for iExpt = 1:nExpts
isall{iExpt} = isfield(intraStructures{iExpt}.microscope.raw.delta.threeD,'all');
if strcmp(opts.coordSystem,'plate')
if (isall{iExpt} && isempty(intraStructures{iExpt}.plate.raw.delta.threeD.all)) || (~isall{iExpt} && isempty(intraStructures{iExpt}.plate.raw.delta.threeD))
kitLog('No plane fit in movies in intraMeasurements. Converting coordinate system to ''microscope''');
opts.coordSystem = 'microscope';
end
end
end
switch opts.stat
case 'delta3D'
switch opts.coordSystem
case 'plate'
if opts.depthFilter
for iExpt = 1:nExpts
if isall{iExpt}
delta3D{iExpt} = intraStructures{iExpt}.plate.depthFilter.delta.threeD.all(:)*1000;
else
delta3D{iExpt} = intraStructures{iExpt}.plate.depthFilter.delta.threeD(:)*1000;
end
end
else
for iExpt = 1:nExpts
if isall{iExpt}
delta3D{iExpt} = intraStructures{iExpt}.plate.raw.delta.threeD.all(:)*1000;
else
delta3D{iExpt} = intraStructures{iExpt}.plate.raw.delta.threeD(:)*1000;
end
end
end
case 'microscope'
if opts.depthFilter
for iExpt = 1:nExpts
if isall{iExpt}
delta3D{iExpt} = intraStructures{iExpt}.microscope.depthFilter.delta.threeD.all(:)*1000;
else
delta3D{iExpt} = intraStructures{iExpt}.microscope.depthFilter.delta.threeD(:)*1000;
end
end
else
for iExpt = 1:nExpts
if isall{iExpt}
delta3D{iExpt} = intraStructures{iExpt}.microscope.raw.delta.threeD.all(:)*1000;
else
delta3D{iExpt} = intraStructures{iExpt}.microscope.raw.delta.threeD(:)*1000;
end
end
end
end
title = sprintf('\\Delta_{3D}: %s',opts.legend{1});
for iExpt = 2:nExpts
title = [title ' vs. ' opts.legend{iExpt}];
end
compareHistograms(delta3D,'axisLimits',[0 300],'title',title,'xLabel','\Delta_{3D} (nm)');
case 'delta2D'
switch opts.coordSystem
case 'plate'
if opts.depthFilter
for iExpt = 1:nExpts
if isall{iExpt}
delta2D{iExpt} = intraStructures{iExpt}.plate.depthFilter.delta.twoD.all(:)*1000;
else
delta2D{iExpt} = intraStructures{iExpt}.plate.depthFilter.delta.twoD(:)*1000;
end
end
else
for iExpt = 1:nExpts
if isall{iExpt}
delta2D{iExpt} = intraStructures{iExpt}.plate.raw.delta.twoD.all(:)*1000;
else
delta2D{iExpt} = intraStructures{iExpt}.plate.raw.delta.twoD(:)*1000;
end
end
end
case 'microscope'
if opts.depthFilter
for iExpt = 1:nExpts
if isall{iExpt}
delta2D{iExpt} = intraStructures{iExpt}.microscope.depthFilter.delta.twoD.all(:)*1000;
else
delta2D{iExpt} = intraStructures{iExpt}.microscope.depthFilter.delta.twoD(:)*1000;
end
end
else
for iExpt = 1:nExpts
if isall{iExpt}
delta2D{iExpt} = intraStructures{iExpt}.microscope.raw.delta.twoD.all(:)*1000;
else
delta2D{iExpt} = intraStructures{iExpt}.microscope.raw.delta.twoD(:)*1000;
end
end
end
end
title = sprintf('\\Delta_{2D}: %s',opts.legend{1});
for iExpt = 2:nExpts
title = [title ' vs. ' opts.legend{iExpt}];
end
compareHistograms(delta2D,'axisLimits',[0 300],'title',title,'xLabel','\Delta_{2D} (nm)');
case 'delta1D'
switch opts.coordSystem
case 'plate'
if opts.depthFilter
for iExpt = 1:nExpts
delta1D{iExpt} = intraStructures{iExpt}.plate.depthFilter.delta.oneD(:)*1000;
end
else
for iExpt = 1:nExpts
delta1D{iExpt} = intraStructures{iExpt}.plate.raw.delta.oneD(:)*1000;
end
end
case 'microscope'
if opts.depthFilter
for iExpt = 1:nExpts
delta1D{iExpt} = intraStructures{iExpt}.microscope.depthFilter.delta.oneD(:)*1000;
end
else
for iExpt = 1:nExpts
delta1D{iExpt} = intraStructures{iExpt}.microscope.raw.delta.oneD(:)*1000;
end
end
end
title = sprintf('\\Delta_{1D}: %s',opts.legend{1});
for iExpt = 2:nExpts
title = [title ' vs. ' opts.legend{iExpt}];
end
compareHistograms(delta1D,'axisLimits',[-100 200],'title',title,'xLabel','\Delta_{1D} (nm)');
case 'deltaXYZ'
switch opts.coordSystem
case 'plate'
if opts.depthFilter
for iExpt = 1:nExpts
if isall{iExpt}
deltaX{iExpt} = intraStructures{iExpt}.plate.depthFilter.delta.x.all(:)*1000;
deltaY{iExpt} = intraStructures{iExpt}.plate.depthFilter.delta.y.all(:)*1000;
deltaZ{iExpt} = intraStructures{iExpt}.plate.depthFilter.delta.z.all(:)*1000;
else
deltaX{iExpt} = intraStructures{iExpt}.plate.depthFilter.delta.x(:)*1000;
deltaY{iExpt} = intraStructures{iExpt}.plate.depthFilter.delta.y(:)*1000;
deltaZ{iExpt} = intraStructures{iExpt}.plate.depthFilter.delta.z(:)*1000;
end
end
else
for iExpt = 1:nExpts
if isall{iExpt}
deltaX{iExpt} = intraStructures{iExpt}.plate.raw.delta.x.all(:)*1000;
deltaY{iExpt} = intraStructures{iExpt}.plate.raw.delta.y.all(:)*1000;
deltaZ{iExpt} = intraStructures{iExpt}.plate.raw.delta.z.all(:)*1000;
else
deltaX{iExpt} = intraStructures{iExpt}.plate.raw.delta.x(:)*1000;
deltaY{iExpt} = intraStructures{iExpt}.plate.raw.delta.y(:)*1000;
deltaZ{iExpt} = intraStructures{iExpt}.plate.raw.delta.z(:)*1000;
end
end
end
case 'microscope'
if opts.depthFilter
for iExpt = 1:nExpts
if isall{iExpt}
deltaX{iExpt} = intraStructures{iExpt}.microscope.depthFilter.delta.x.all(:)*1000;
deltaY{iExpt} = intraStructures{iExpt}.microscope.depthFilter.delta.y.all(:)*1000;
deltaZ{iExpt} = intraStructures{iExpt}.microscope.depthFilter.delta.z.all(:)*1000;
else
deltaX{iExpt} = intraStructures{iExpt}.microscope.depthFilter.delta.x(:)*1000;
deltaY{iExpt} = intraStructures{iExpt}.microscope.depthFilter.delta.y(:)*1000;
deltaZ{iExpt} = intraStructures{iExpt}.microscope.depthFilter.delta.z(:)*1000;
end
end
else
for iExpt = 1:nExpts
if isall{iExpt}
deltaX{iExpt} = intraStructures{iExpt}.microscope.raw.delta.x.all(:)*1000;
deltaY{iExpt} = intraStructures{iExpt}.microscope.raw.delta.y.all(:)*1000;
deltaZ{iExpt} = intraStructures{iExpt}.microscope.raw.delta.z.all(:)*1000;
else
deltaX{iExpt} = intraStructures{iExpt}.microscope.raw.delta.x(:)*1000;
deltaY{iExpt} = intraStructures{iExpt}.microscope.raw.delta.y(:)*1000;
deltaZ{iExpt} = intraStructures{iExpt}.microscope.raw.delta.z(:)*1000;
end
end
end
end
figure; clf
title = sprintf('\\Delta_{x}: %s',opts.legend{1});
for iExpt = 2:nExpts
title = [title ' vs. ' opts.legend{iExpt}];
end
subplot(1,3,1)
compareHistograms(deltaX,'nBins',10,'axisLimits',[-200 200],...
'title',title,'xLabel','\Delta_{x} (nm)','withinFig',1);
subplot(1,3,2)
title(9) = 'y';
compareHistograms(deltaY,'nBins',10,'axisLimits',[-200 200],...
'title',title,'xLabel','\Delta_{y} (nm)','yLabel','','withinFig',1);
subplot(1,3,3)
title(9) = 'z';
compareHistograms(deltaZ,'nBins',10,'axisLimits',[-200 200],...
'title',title,'xLabel','\Delta_{z} (nm)','yLabel','','withinFig',1);
case 'delta3D-church'
if nExpts > 1
error('Plotting Churchman-derived inflation-corrected delta only currently works for single conditions.');
else
isall = isall{1};
intraStructure = intraStructures{1};
end
switch opts.coordSystem
case 'plate'
if opts.depthFilter
if isall
delta3D = intraStructure.plate.depthFilter.delta.threeD.all(:);
else
delta3D = intraStructure.plate.depthFilter.delta.threeD(:);
end
else
if isall
delta3D = intraStructure.plate.raw.delta.threeD.all(:);
else
delta3D = intraStructure.plate.raw.delta.threeD(:);
end
end
case 'microscope'
if opts.depthFilter
if isall
delta3D = intraStructure.microscope.depthFilter.delta.threeD.all(:);
else
delta3D = intraStructure.microscope.depthFilter.delta.threeD(:);
end
else
if isall
delta3D = intraStructure.microscope.raw.delta.threeD.all(:);
else
delta3D = intraStructure.microscope.raw.delta.threeD(:);
end
end
end
% Churchman falls over with outliers - remove them.
outs = findoutliers(delta3D);
delta3D = delta3D(~outs);
mean = nanmean(delta3D)*1000;
stdDev = nanstd(delta3D)*1000;
MLp3D(delta3D*1000,[mean stdDev],1,25);
case 'delta2D-church'
if nExpts > 1
error('Plotting Churchman-derived inflation-corrected delta only currently works for single conditions.');
else
isall = isall{1};
intraStructure = intraStructures{1};
end
switch opts.coordSystem
case 'plate'
if opts.depthFilter
if isall
delta2D = intraStructure.plate.depthFilter.delta.twoD.all(:);
else
delta2D = intraStructure.plate.depthFilter.delta.twoD(:);
end
else
if isall
delta2D = intraStructure.plate.raw.delta.twoD.all(:);
else
delta2D = intraStructure.plate.raw.delta.twoD(:);
end
end
case 'microscope'
if opts.depthFilter
if isall
delta2D = intraStructure.microscope.depthFilter.delta.twoD.all(:);
else
delta2D = intraStructure.microscope.depthFilter.delta.twoD(:);
end
else
if isall
delta2D = intraStructure.microscope.raw.delta.twoD.all(:);
else
delta2D = intraStructure.microscope.raw.delta.twoD(:);
end
end
end
% Churchman falls over with outliers - remove them.
outs = findoutliers(delta2D);
delta2D = delta2D(~outs);
mean = nanmean(delta2D)*1000;
stdDev = nanstd(delta2D)*1000;
MLp2D(delta2D*1000,[mean stdDev],1,25);
case 'sisSep3D'
switch opts.coordSystem
case 'plate'
for iExpt = 1:nExpts
sisSep3D{iExpt} = intraStructures{iExpt}.plate.sisSep.threeD(:);
end
case 'microscope'
for iExpt = 1:nExpts
sisSep3D{iExpt} = intraStructures{iExpt}.microscope.sisSep.threeD(:);
end
end
title = sprintf('d_{3D}: %s',opts.legend{1});
for iExpt = 2:nExpts
title = [title ' vs. ' opts.legend{iExpt}];
end
compareHistograms(sisSep3D,'axisLimits',[0.25 2],'title',title,'xLabel','d_{3D} (\mum)');
case 'sisSep2D'
switch opts.coordSystem
case 'plate'
for iExpt = 1:nExpts
sisSep2D{iExpt} = intraStructures{iExpt}.plate.sisSep.twoD(:);
end
case 'microscope'
for iExpt = 1:nExpts
sisSep2D{iExpt} = intraStructures{iExpt}.microscope.sisSep.twoD(:);
end
end
title = sprintf('d_{2D}: %s',opts.legend{1});
for iExpt = 2:nExpts
title = [title ' vs. ' opts.legend{iExpt}];
end
compareHistograms(sisSep2D,'axisLimits',[0.25 1.75],'title',title,'xLabel','d_{2D} (\mum)');
case 'sisSepXYZ'
switch opts.coordSystem
case 'plate'
for iExpt = 1:nExpts
sisSepX{iExpt} = intraStructures{iExpt}.plate.sisSep.x(:);
sisSepY{iExpt} = intraStructures{iExpt}.plate.sisSep.y(:);
sisSepZ{iExpt} = intraStructures{iExpt}.plate.sisSep.z(:);
xAxisLims = [-3 3];
end
case 'microscope'
for iExpt = 1:nExpts
sisSepX{iExpt} = intraStructures{iExpt}.microscope.sisSep.x(:);
sisSepY{iExpt} = intraStructures{iExpt}.microscope.sisSep.y(:);
sisSepZ{iExpt} = intraStructures{iExpt}.microscope.sisSep.z(:);
xAxisLims = [-1.5 1.5];
end
end
figure; clf
title = sprintf('d_{x}: %s',opts.legend{1});
for iExpt = 2:nExpts
title = [title ' vs. ' opts.legend{iExpt}];
end
subplot(1,3,1)
compareHistograms(sisSepX,'nBins',10,'axisLimits',xAxisLims,...
'title',title,'xLabel','d_{x} (nm)','withinFig',1);
subplot(1,3,2)
title(4) = 'y';
compareHistograms(sisSepY,'nBins',10,'axisLimits',[-1.5 1.5],...
'title',title,'xLabel','d_{y} (nm)','yLabel','','withinFig',1);
subplot(1,3,3)
title(4) = 'z';
compareHistograms(sisSepZ,'nBins',10,'axisLimits',[-1.5 1.5],...
'title',title,'xLabel','d_{z} (nm)','yLabel','','withinFig',1);
case 'twist3D'
for iExpt = 1:nExpts
twist3D{iExpt} = intraStructures{iExpt}.plate.raw.twist.threeD(:);
end
figure; clf
title = sprintf('twist_{3D}: %s',opts.legend{1});
for iExpt = 2:nExpts
title = [title ' vs. ' opts.legend{iExpt}];
end
compareHistograms(twist3D,'nBins',10,'axisLimits',[0 90],...
'title',title,'xLabel','twist_{3D} (deg)','yLabel','','withinFig',1);
case 'twistYZ'
for iExpt = 1:nExpts
twistY{iExpt} = intraStructures{iExpt}.plate.raw.twist.y(:);
twistZ{iExpt} = intraStructures{iExpt}.plate.raw.twist.z(:);
end
figure; clf
title = sprintf('twist_{y}: %s',opts.legend{1});
for iExpt = 2:nExpts
title = [title ' vs. ' opts.legend{iExpt}];
end
subplot(1,2,1)
compareRoses(twistY,'nBins',18,...
'title',title,'xLabel','twist_{y} (deg)','withinFig',1);
subplot(1,2,2)
title(8) = 'z';
compareRoses(twistZ,'nBins',18,...
'title',title,'xLabel','twist_{z} (deg)','withinFig',1);
case 'swivel3D'
switch opts.coordSystem
case 'plate'
if opts.depthFilter
for iExpt = 1:nExpts
if isall{iExpt}
swivel3D{iExpt} = intraStructures{iExpt}.plate.depthFilter.swivel.threeD.all(:);
else
swivel3D{iExpt} = intraStructures{iExpt}.plate.depthFilter.swivel.threeD(:);
end
end
else
for iExpt = 1:nExpts
if isall{iExpt}
swivel3D{iExpt} = intraStructures{iExpt}.plate.raw.swivel.threeD.all(:);
else
swivel3D{iExpt} = intraStructures{iExpt}.plate.raw.swivel.threeD(:);
end
end
end
case 'microscope'
if opts.depthFilter
for iExpt = 1:nExpts
if isall{iExpt}
swivel3D{iExpt} = intraStructures{iExpt}.microscope.depthFilter.swivel.threeD.all(:);
else
swivel3D{iExpt} = intraStructures{iExpt}.microscope.depthFilter.swivel.threeD(:);
end
end
else
for iExpt = 1:nExpts
if isall{iExpt}
swivel3D{iExpt} = intraStructures{iExpt}.microscope.raw.swivel.threeD.all(:);
else
swivel3D{iExpt} = intraStructures{iExpt}.microscope.raw.swivel.threeD(:);
end
end
end
end
figure; clf
title = sprintf('swivel_{3D}: %s',opts.legend{1});
for iExpt = 2:nExpts
title = [title ' vs. ' opts.legend{iExpt}];
end
compareHistograms(swivel3D,'nBins',10,'axisLimits',[0 180],...
'title',title,'xLabel','swivel_{3D} (deg)','yLabel','','withinFig',1);
case 'swivelYZ'
switch opts.coordSystem
case 'plate'
if opts.depthFilter
for iExpt = 1:nExpts
if isall{iExpt}
swivelY{iExpt} = intraStructures{iExpt}.plate.depthFilter.swivel.y.all(:);
swivelZ{iExpt} = intraStructures{iExpt}.plate.depthFilter.swivel.z.all(:);
else
swivelY{iExpt} = intraStructures{iExpt}.plate.depthFilter.swivel.y(:);
swivelZ{iExpt} = intraStructures{iExpt}.plate.depthFilter.swivel.z(:);
end
end
else
for iExpt = 1:nExpts
if isall{iExpt}
swivelY{iExpt} = intraStructures{iExpt}.plate.raw.swivel.y.all(:);
swivelZ{iExpt} = intraStructures{iExpt}.plate.raw.swivel.z.all(:);
else
swivelY{iExpt} = intraStructures{iExpt}.plate.raw.swivel.y(:);
swivelZ{iExpt} = intraStructures{iExpt}.plate.raw.swivel.z(:);
end
end
end
case 'microscope'
if opts.depthFilter
for iExpt = 1:nExpts
if isall{iExpt}
swivelY{iExpt} = intraStructures{iExpt}.microscope.depthFilter.swivel.y.all(:);
swivelZ{iExpt} = intraStructures{iExpt}.microscope.depthFilter.swivel.z.all(:);
else
swivelY{iExpt} = intraStructures{iExpt}.microscope.depthFilter.swivel.y(:);
swivelZ{iExpt} = intraStructures{iExpt}.microscope.depthFilter.swivel.z(:);
end
end
else
for iExpt = 1:nExpts
if isall{iExpt}
swivelY{iExpt} = intraStructures{iExpt}.microscope.raw.swivel.y.all(:);
swivelZ{iExpt} = intraStructures{iExpt}.microscope.raw.swivel.z.all(:);
else
swivelY{iExpt} = intraStructures{iExpt}.microscope.raw.swivel.y(:);
swivelZ{iExpt} = intraStructures{iExpt}.microscope.raw.swivel.z(:);
end
end
end
end
figure; clf
title = sprintf('swivel_{y}: %s',opts.legend{1});
for iExpt = 2:nExpts
title = [title ' vs. ' opts.legend{iExpt}];
end
subplot(1,2,1)
compareRoses(swivelY,'nBins',18,...
'title',title,'xLabel','swivel_{y} (deg)','withinFig',1);
subplot(1,2,2)
title(9) = 'z';
compareRoses(swivelZ,'nBins',18,...
'title',title,'xLabel','swivel_{z} (deg)','withinFig',1);
case 'swivelKMT'
switch opts.coordSystem
case 'plate'
if opts.depthFilter
for iExpt = 1:nExpts
if isall{iExpt}
swivelKMT{iExpt} = intraStructures{iExpt}.plate.depthFilter.swivel.kMT.all(:);
else
swivelKMT{iExpt} = intraStructures{iExpt}.plate.depthFilter.swivel.kMT(:);
end
end
else
for iExpt = 1:nExpts
if isall{iExpt}
swivelKMT{iExpt} = intraStructures{iExpt}.plate.raw.swivel.kMT.all(:);
else
swivelKMT{iExpt} = intraStructures{iExpt}.plate.raw.swivel.kMT(:);
end
end
end
case 'microscope'
if opts.depthFilter
for iExpt = 1:nExpts
if isall{iExpt}
swivelKMT{iExpt} = intraStructures{iExpt}.microscope.depthFilter.swivel.kMT.all(:);
else
swivelKMT{iExpt} = intraStructures{iExpt}.microscope.depthFilter.swivel.kMT(:);
end
end
else
for iExpt = 1:nExpts
if isall{iExpt}
swivelKMT{iExpt} = intraStructures{iExpt}.microscope.raw.swivel.kMT.all(:);
else
swivelKMT{iExpt} = intraStructures{iExpt}.microscope.raw.swivel.kMT(:);
end
end
end
end
figure; clf
title = sprintf('swivel_{kMT}: %s',opts.legend{1});
for iExpt = 2:nExpts
title = [title ' vs. ' opts.legend{iExpt}];
end
compareRoses(swivelY,'nBins',18,...
'title',title,'xLabel','swivel_{kMT} (deg)','withinFig',1);
case 'rawInts'
for iExpt = 1:nExpts
intsInner{iExpt} = intraStructures{iExpt}.intensity.mean.inner(:);
intsOuter{iExpt} = intraStructures{iExpt}.intensity.mean.outer(:);
if opts.depthFilter
if isall{iExpt}
filt = ~isnan(intraStructures{iExpt}.plate.depthFilter.delta.threeD.all(:));
else
filt = ~isnan(intraStructures{iExpt}.plate.depthFilter.delta.threeD(:));
end
intsInner{iExpt}(filt) = NaN;
intsOuter{iExpt}(filt) = NaN;
end
end
figure; clf
subplot(1,2,1);
title = sprintf('raw intensity_{inner}: %s',opts.legend{1});
for iExpt = 2:nExpts
title = [title ' vs. ' opts.legend{iExpt}];
end
compareBoxWhiskers(intsInner,'showOutliers',0,'outlierP',0.05,...
'title',title,'yLabel','raw intensity',...
'withinFig',1,'legend',opts.legend);
subplot(1,2,2);
title = sprintf('raw intensity_{outer}: %s',opts.legend{1});
for iExpt = 2:nExpts
title = [title ' vs. ' opts.legend{iExpt}];
end
compareBoxWhiskers(intsOuter,'showOutliers',0,'outlierP',0.05,...
'title',title,'yLabel','raw intensity',...
'withinFig',1,'legend',opts.legend);
case 'normInts'
for iExpt = 1:nExpts
intsInner{iExpt} = intraStructures{iExpt}.intensity.mean.inner(:);
intsOuter{iExpt} = intraStructures{iExpt}.intensity.mean.outer(:);
if opts.depthFilter
if isall{iExpt}
filt = ~isnan(intraStructures{iExpt}.plate.depthFilter.delta.threeD.all(:));
else
filt = ~isnan(intraStructures{iExpt}.plate.depthFilter.delta.threeD(:));
end
intsInner{iExpt}(filt) = NaN;
intsOuter{iExpt}(filt) = NaN;
end
normIntsInner{iExpt} = intsInner{iExpt};
normIntsOuter{iExpt} = intsOuter{iExpt};
normIntsInner{iExpt} = normIntsInner{iExpt}./intsOuter{iExpt};
normIntsOuter{iExpt} = normIntsOuter{iExpt}./intsInner{iExpt};
end
figure; clf
subplot(1,2,1);
title = sprintf('inner-normalised intensity_{outer}: %s',opts.legend{1});
for iExpt = 2:nExpts
title = [title ' vs. ' opts.legend{iExpt}];
end
compareBoxWhiskers(normIntsOuter,'showOutliers',0,'outlierP',0.05,...
'title',title,'yLabel','normalised intensity',...
'withinFig',1,'legend',opts.legend);
subplot(1,2,2);
title = sprintf('outer-normalised intensity_{inner}: %s',opts.legend{1});
for iExpt = 2:nExpts
title = [title ' vs. ' opts.legend{iExpt}];
end
compareBoxWhiskers(normIntsInner,'showOutliers',0,'outlierP',0.05,...
'title',title,'yLabel','normalised intensity',...
'withinFig',1,'legend',opts.legend);
otherwise
error('Statistic requested is not yet built into this version of dublBasicStats. See later release.')
end
fprintf('\n')
end
%% Sub-functions
function outs = findoutliers(data)
if nargin<1 || isempty(data)
return
end
if verLessThan('matlab','9.2')
nTests = length(data);
outs = zeros(nTests,1);
for iTest = 1:nTests
outs(iTest) = ttest2(data,data(iTest),'alpha',0.0455);
end
else
outs = isoutlier(data,'mean');
end
end