forked from gjeschke/MMM
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocking_window.m
More file actions
2745 lines (2332 loc) · 110 KB
/
docking_window.m
File metadata and controls
2745 lines (2332 loc) · 110 KB
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
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
function varargout = docking_window(varargin)
%DOCKING_WINDOW M-file for docking_window.fig
% DOCKING_WINDOW, by itself, creates a new DOCKING_WINDOW or raises the existing
% singleton*.
%
% H = DOCKING_WINDOW returns the handle to a new DOCKING_WINDOW or the handle to
% the existing singleton*.
%
% DOCKING_WINDOW('Property','Value',...) creates a new DOCKING_WINDOW using the
% given property value pairs. Unrecognized properties are passed via
% varargin to docking_window_OpeningFcn. This calling syntax produces a
% warning when there is an existing singleton*.
%
% DOCKING_WINDOW('CALLBACK') and DOCKING_WINDOW('CALLBACK',hObject,...) call the
% local function named CALLBACK in DOCKING_WINDOW.M with the given input
% arguments.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help docking_window
% Last Modified by GUIDE v2.5 09-Sep-2013 16:07:18
% Y.Polyhach 09/2013
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @docking_window_OpeningFcn, ...
'gui_OutputFcn', @docking_window_OutputFcn, ...
'gui_LayoutFcn', [], ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT
% --- Executes just before docking_window is made visible.
function docking_window_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin unrecognized PropertyName/PropertyValue pairs from the
% command line (see VARARGIN)
global hMain
% global MMM_icon
% Old version with MMM figure icon, blocked because of warning
% j = get(hObject,'javaframe');
% j.setFigureIcon(javax.swing.ImageIcon(im2java(MMM_icon))); %create a java image and set the figure icon
load helpicon
set(handles.pushbutton_help_docking,'CData',cdata);
% global MMM_icon % check if needed!!!!!!!
% j = get(hObject,'javaframe');
% j.setFigureIcon(javax.swing.ImageIcon(im2java(MMM_icon))); % create a java image and set the figure icon
% Choose default command line output for docking_window
% handles.output = hObject;
hMain.docking=[];
set(handles.save_stats,'Value',1.0);
set(handles.save_pdb,'Value',1.0);
set(handles.gridMethod,'Enable','off');
set(handles.fitMethod,'Enable','off');
set(handles.checkhomooligomer,'Value',0.0); % default behaviour: het dimer is more general
set(handles.checkhomooligomer,'Enable','off');
set(handles.valMultiplicity,'String',num2str(2));
set(handles.valMultiplicity,'String',' ');
set(handles.valMultiplicity,'Enable','off');
set(handles.LargeGridcheckbox,'Value',0.0); % default behaviour: a grid is assumed to be not too large at start
set(handles.finishexit,'Enable','off');
set(handles.rundocking,'Enable','off');
% set(handles.fitOnlyPanel,'Visible','off');
% set(handles.GridSearchPanel,'Visible','off');
% default values for the hetero grid search
def.al_grid_st=0;
def.al_grid_end=360;
def.al_grid_elem=9;
def.be_grid_st=0;
def.be_grid_end=180;
def.be_grid_end_homo=90;
def.be_grid_elem=8;
def.ga_grid_st=0;
def.ga_grid_end=360;
def.ga_grid_elem=9;
def.x_grid_st=-75;
def.x_grid_end=75;
def.x_grid_elem=9;
def.y_grid_st=-75;
def.y_grid_end=75;
def.y_grid_elem=9;
def.z_grid_st=-75;
def.z_grid_end=75;
def.z_grid_elem=9;
pstr=sprintf('%d',def.al_grid_st);
set(handles.get_Alpha_grid_st,'String',pstr);
pstr=sprintf('%d',def.al_grid_end);
set(handles.get_Alpha_grid_end,'String',pstr);
pstr=sprintf('%d',def.al_grid_elem);
set(handles.get_Alpha_grid_elem,'String',pstr);
pstr=sprintf('%d',def.be_grid_st);
set(handles.get_Beta_grid_st,'String',pstr);
pstr=sprintf('%d',def.be_grid_end);
set(handles.get_Beta_grid_end,'String',pstr);
pstr=sprintf('%d',def.be_grid_elem);
set(handles.get_Beta_grid_elem,'String',pstr);
pstr=sprintf('%d',def.ga_grid_st);
set(handles.get_Gama_grid_st,'String',pstr);
pstr=sprintf('%d',def.ga_grid_end);
set(handles.get_Gama_grid_end,'String',pstr);
pstr=sprintf('%d',def.ga_grid_elem);
set(handles.get_Gama_grid_elem,'String',pstr);
pstr=sprintf('%d',def.x_grid_st);
set(handles.get_x_grid_st,'String',pstr);
pstr=sprintf('%d',def.x_grid_end);
set(handles.get_x_grid_end,'String',pstr);
pstr=sprintf('%d',def.x_grid_elem);
set(handles.get_x_grid_elem,'String',pstr);
pstr=sprintf('%d',def.y_grid_st);
set(handles.get_y_grid_st,'String',pstr);
pstr=sprintf('%d',def.y_grid_end);
set(handles.get_y_grid_end,'String',pstr);
pstr=sprintf('%d',def.y_grid_elem);
set(handles.get_y_grid_elem,'String',pstr);
pstr=sprintf('%d',def.z_grid_st);
set(handles.get_z_grid_st,'String',pstr);
pstr=sprintf('%d',def.z_grid_end);
set(handles.get_z_grid_end,'String',pstr);
pstr=sprintf('%d',def.z_grid_elem);
set(handles.get_z_grid_elem,'String',pstr);
handles.grid.grSize=def.al_grid_elem*def.be_grid_elem*def.ga_grid_elem*def.x_grid_elem*def.y_grid_elem*def.z_grid_elem;
pstr=sprintf('%g',handles.grid.grSize);
set(handles.show_gridSize,'String',pstr);
if handles.grid.grSize<1000000
set(handles.LargeGridcheckbox,'Value',0.0);
% set(handles.LargeGridcheckbox,'Enable','off');
else
set(handles.LargeGridcheckbox,'Value',1.0);
% set(handles.LargeGridcheckbox,'Enable','on');
end
% stack value for large grids (same for homo and hetero cases)
def.stackSize=100000;
pstr=sprintf('%d',def.stackSize);
set(handles.get_stackSize,'String',pstr);
set(handles.get_stackSize,'Enable','off');
% default starting values for fitting when the window is initilized
% (after grid search is completed, the best grid point has to be taken as a starting point for fitting)
def.al_fit=0;
pstr=sprintf('%d',def.al_fit);
set(handles.get_Alpha_fitSt,'String',pstr);
def.be_fit=0;
pstr=sprintf('%d',def.be_fit);
set(handles.get_Beta_fitSt,'String',pstr);
def.ga_fit=0;
pstr=sprintf('%d',def.ga_fit);
set(handles.get_Gama_fitSt,'String',pstr);
def.x_fit=0;
pstr=sprintf('%d',def.x_fit);
set(handles.get_x_fitSt,'String',pstr);
def.y_fit=0;
pstr=sprintf('%d',def.y_fit);
set(handles.get_y_fitSt,'String',pstr);
def.z_fit=0;
pstr=sprintf('%d',def.z_fit);
set(handles.get_z_fitSt,'String',pstr);
% handles.dockFit=dockFit;
handles=appendFields(handles,def,1);
handles.def=def;
set(handles.bestfit_alpha,'Enable','off');
set(handles.bestfit_beta,'Enable','off');
set(handles.bestfit_gama,'Enable','off');
set(handles.bestfit_x,'Enable','off');
set(handles.bestfit_y,'Enable','off');
set(handles.bestfit_z,'Enable','off');
% Update handles structure
guidata(hObject, handles);
% guidata(hObject)
% uiwait(handles.docking_window);
% UIWAIT makes docking_window wait for user response (see UIRESUME)
% uiwait(handles.docking_window);
% --- Outputs from this function are returned to the command line.
function varargout = docking_window_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
% varargout{1} = handles.output;
% --- Executes on button press in load_pushbotton.
function load_pushbotton_Callback(hObject, eventdata, handles)
% hObject handle to load_pushbotton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% global model
global general % needed to enabling current path resetting (check if really needed!!!!!)
mypath=pwd;
cd(general.restraint_files);
% snum=model.current_structure;
% axes(handles.axes_model);
[fname,pname,findex]=uigetfile('*.dat','Load constraints from file');
% if isequal(fname,0) || isequal(pname,0) % to be used when no findex is returned
if isequal(findex,0)
add_msg_board('Constraint loading cancelled by user');
else
% reset_user_paths(pname); % !!!!!! check if convenient!!!!!
general.restraint_files=pname; % check how this would work!!!!!
restraints=rd_restraints_docking(fullfile(pname,fname));
handles.ensemble=restraints.ensemble;
handles.uncertainty=restraints.uncertainty;
handles.exclude=restraints.exclude;
handles.target=restraints.target;
if isfield(restraints,'basis'),
handles.basis=restraints.basis;
end;
% if isfield(restraints,'tif'), % auxilary functionality - think how to have it as well!!!!!!
% handles.tif=restraints.tif;
% else
% handles.tif=ENM_param.tif;
% end;
% if isfield(restraints,'mmax'),
% handles.mmax=restraints.mmax;
% else
% handles.mmax=ENM_param.mmax;
% end;
hfig=gcf;
set(hfig,'Pointer','watch');
drawnow;
[DEER,cancelled]=process_DEER_restraints(restraints);
set(hfig,'Pointer','arrow');
if cancelled,
add_msg_board('Processing of DEER constraints cancelled.');
return
end;
% keyboard
handles.dockBasis=DEER(1).dockBasis;
handles.dockBasis.constrFile=fullfile(pname,fname);
handles.dockBasis.PDB=restraints.PDB;
handles.dockBasis.restraintsFile=fullfile(pname,fname);
DEER=rmfield(DEER,'dockBasis');
handles.DEER=DEER;
set(handles.gridMethod,'Value',0.0);
set(handles.fitMethod,'Value',1.0);
set(handles.gridMethod,'Enable','on');
set(handles.fitMethod,'Enable','on');
set(handles.fitStartValues,'Visible','on');
set(handles.fitBestValues,'Visible','on');
set(handles.save_stats,'Visible','on');
set(handles.save_pdb,'Visible','on');
set(handles.rundocking,'Enable','on');
% set(handles.append2model,'Visible','on');
% set(handles.save_mat_file,'Visible','on');
switch handles.dockBasis.oligomer
case 1
% % !!!!
if isfield(handles.dockBasis,'multiplicity')
multiplicity=handles.dockBasis.multiplicity;
else
multiplicity=2;
end
Gama_oligomer=360/multiplicity;
set(handles.checkhomooligomer,'Value',1.0);
set(handles.checkhomooligomer,'Enable','on');
set(handles.get_Beta_grid_end,'String',num2str(90));
set(handles.valMultiplicity,'Enable','on');
set(handles.valMultiplicity,'String',num2str(multiplicity));
set(handles.get_z_grid_st,'Enable','off');
set(handles.get_z_grid_st,'String',num2str(0));
set(handles.get_z_grid_end,'Enable','off');
set(handles.get_z_grid_end,'String',num2str(0));
set(handles.get_z_grid_elem,'Enable','off');
set(handles.get_z_grid_elem,'String',num2str(1));
set(handles.get_Gama_grid_st,'Enable','off');
set(handles.get_Gama_grid_st,'String',num2str(0));
set(handles.get_Gama_grid_end,'Enable','off');
set(handles.get_Gama_grid_end,'String',num2str(Gama_oligomer));
set(handles.get_Gama_grid_elem,'Enable','off');
set(handles.get_Gama_grid_elem,'String',num2str(1));
set(handles.get_Gama_fitSt,'Enable','off');
set(handles.get_Gama_fitSt,'String',num2str(Gama_oligomer));
set(handles.get_z_fitSt,'Enable','off');
% display here may be a warning that by default a homodimer
% case is treated!!!
case 2
set(handles.checkhomooligomer,'Value',0.0);
set(handles.checkhomooligomer,'Enable','off');
% set(handles.valMultiplicity,'String',num2str(1));
set(handles.valMultiplicity,'String',' ');
set(handles.valMultiplicity,'Enable','off');
end
% [direct,cancelled]=process_direct_restraints(restraints);
% if cancelled,
% add_msg_board('Processing of direct constraints cancelled.');
% return
% end;
% handles.direct=direct;
% [displacements,cancelled]=process_displacement_restraints(restraints); % check if needed!!!!
% if cancelled,
% add_msg_board('Processing of displacement constraints cancelled.');
% return
% end;
% handles.displacements=displacements;
% set(handles.checkbox_restraints,'Enable','on'); % flag indicating that restraints have been loaded - to be implemented!!!!!
% set(handles.checkbox_restraints,'Value',1);
%
% if ~isempty(DEER),
% dvec=zeros(length(handles.DEER),3);
% for k=1:length(handles.DEER),
% % handles.DEER(k).l1=line(handles.DEER(k).xyz1(1),handles.DEER(k).xyz1(2),handles.DEER(k).xyz1(3),...
% % 'Parent',handles.restraint_graphics,'Marker','.','Color','b');
% % handles.DEER(k).l2=line(handles.DEER(k).xyz2(1),handles.DEER(k).xyz2(2),handles.DEER(k).xyz2(3),...
% % 'Parent',handles.restraint_graphics,'Marker','.','Color','b');
% x=[handles.DEER(k).xyz1(1) handles.DEER(k).xyz2(1)];
% y=[handles.DEER(k).xyz1(2) handles.DEER(k).xyz2(2)];
% z=[handles.DEER(k).xyz1(3) handles.DEER(k).xyz2(3)];
% r0=norm(handles.DEER(k).xyz1-handles.DEER(k).xyz2)/10;
% dvec(k,:)=(handles.DEER(k).r-r0)*(handles.DEER(k).xyz1-handles.DEER(k).xyz2)/(10*r0);
% det=abs(r0-handles.DEER(k).r)/handles.DEER(k).sigr;
% if det>2,
% col='r';
% elseif det>1,
% col=[255,190,0]/255; % yellow-orange
% else
% col='g';
% end;
% handles.DEER(k).ll=line(x,y,z,'Parent',handles.restraint_graphics,'Color',col,'LineWidth',1.5,'LineStyle',':');
% cindices=handles.DEER(k).indices;
% f1=false;
% f2=false;
% for l=1:length(model.coarse(snum).indices),
% diff=cindices(1,:)-model.coarse(snum).indices(l,:);
% if sum(abs(diff))==0,
% handles.DEER(k).res1=l;
% f1=true;
% x=[handles.DEER(k).xyz1(1) model.coarse(snum).Ca_coor(l,1)];
% y=[handles.DEER(k).xyz1(2) model.coarse(snum).Ca_coor(l,2)];
% z=[handles.DEER(k).xyz1(3) model.coarse(snum).Ca_coor(l,3)];
% handles.DEER(k).rl1=line(x,y,z,'Parent',handles.restraint_graphics,'Color','b','LineWidth',1);
% end;
% diff=cindices(2,:)-model.coarse(snum).indices(l,:);
% if sum(abs(diff))==0,
% handles.DEER(k).res2=l;
% f2=true;
% x=[handles.DEER(k).xyz2(1) model.coarse(snum).Ca_coor(l,1)];
% y=[handles.DEER(k).xyz2(2) model.coarse(snum).Ca_coor(l,2)];
% z=[handles.DEER(k).xyz2(3) model.coarse(snum).Ca_coor(l,3)];
% handles.DEER(k).rl2=line(x,y,z,'Parent',handles.restraint_graphics,'Color','b','LineWidth',1);
% end;
% end;
% if ~f1,
% add_msg_board(sprintf('Warning: Residue for first label of restraint %i not in network model.',k));
% end;
% if ~f2,
% add_msg_board(sprintf('Warning: Residue for second label of restraint %i not in network model.',k));
% end;
% end;
% dvec=dvec/sqrt(sum(sum(dvec.^2)));
% elseif ~isempty(handles.direct),
% dvec=zeros(length(handles.direct),3);
% network0=model.coarse(snum).Ca_coor;
% for k=1:length(handles.direct),
% xyz1=network0(handles.direct(k,1),:);
% xyz2=network0(handles.direct(k,2),:);
% line(xyz1(1),xyz1(2),xyz1(3),...
% 'Parent',handles.restraint_graphics,'Marker','.','Color','b');
% line(xyz2(1),xyz2(2),xyz2(3),...
% 'Parent',handles.restraint_graphics,'Marker','.','Color','b');
% x=[xyz1(1) xyz2(1)];
% y=[xyz1(2) xyz2(2)];
% z=[xyz1(3) xyz2(3)];
% r0=norm(xyz1-xyz2)/10;
% dvec(k,:)=(handles.direct(k,4)-r0)*(xyz1-xyz2)/(10*r0);
% det=abs(r0-handles.direct(k,4))/handles.direct(k,5);
% if det>2,
% col='r';
% elseif det>1,
% col=[255,190,0]/255; % yellow-orange
% else
% col='g';
% end;
% line(x,y,z,'Parent',handles.restraint_graphics,'Color',col,'LineWidth',1.5,'LineStyle',':');
% end;
% end;
end;
% if ~isempty(DEER),
% overlaps=zeros(1,100);
% for k=1:100,
% evec=model.ANM(model.current_structure).u(:,k+6);
% m=length(evec)/3;
% mode=reshape(evec,3,m);
% mdvec=zeros(length(handles.DEER),3);
% for kk=1:length(handles.DEER),
% dchange=mode(:,handles.DEER(kk).res1)-mode(:,handles.DEER(kk).res2);
% mdvec(kk,:)=dchange';
% end;
% mdvec=mdvec/sqrt(sum(sum(mdvec.^2)));
% overlaps(k)=abs(sum(sum(dvec.*mdvec)));
% end;
% % figure(1); clf;
% % plot(overlaps,'k.');
% % figure(2); clf;
% % plot(cumsum(overlaps),'k');
% axes(handles.axes_plot);
% cla;
% set(handles.text_auxiliary,'String','Constraint matching');
% ma=0;
% rmsd=0;
% fom=0; % figure of merit
% for k=1:length(handles.DEER),
% r0=norm(handles.DEER(k).xyz1-handles.DEER(k).xyz2)/10;
% rmsd=rmsd+(r0-handles.DEER(k).r)^2;
% det=abs(r0-handles.DEER(k).r)/handles.DEER(k).sigr;
% fom=fom+det^2;
% if det>2,
% col='r';
% elseif det>1,
% col=[255,190,0]/255; % yellow-orange
% else
% col='g';
% end;
% errorbar(k,handles.DEER(k).r,handles.DEER(k).sigr,'k');
% if handles.DEER(k).r+handles.DEER(k).sigr>ma,
% ma=handles.DEER(k).r+handles.DEER(k).sigr;
% end;
% if r0>ma,
% ma=r0;
% end;
% hold on;
% plot(k,r0,'.','Color',col);
% end;
% handles.rmsd=sqrt(rmsd/length(handles.DEER));
% handles.fom=sqrt(fom/length(handles.DEER));
% axis([0,length(handles.DEER)+1,0,1.05*ma]);
% xlabel('Constraint number');
% ylabel('Distance (nm)');
% set(handles.text_info,'String',sprintf('Loaded %i DEER restraints with rmsd of %5.2f nm to template',length(handles.DEER),handles.rmsd));
% set(handles.text_auxiliary_msg,'String',sprintf('Figure of merit: %6.4f',handles.fom));
% end;
% set(handles.pushbutton_fit,'Enable','on');
% set(handles.pushbutton_parametrize,'Enable','on');
% cd(my_path);
% keyboard
cd(mypath);
guidata(hObject,handles);
function [direct,cancelled]=process_direct_restraints(restraints)
global model
cancelled=false;
if ~isfield(restraints,'direct'),
direct=[];
return;
end;
snum=model.current_structure;
md=length(restraints.direct);
direct=zeros(md,5);
cindices=model.coarse(snum).indices;
[mn,nn]=size(cindices);
for k=1:md,
adr1=restraints.direct(k).adr1;
ind1=resolve_address(adr1);
if isempty(ind1),
add_msg_board(sprintf('ERROR: Specified residue %s does not exist in template structure.',adr1));
cancelled=true;
direct=[];
return;
end;
net1=0;
for kk=1:mn,
match=sum(abs(ind1-cindices(kk,:)));
if match==0,
net1=kk;
break;
end;
end;
direct(k,1)=net1;
adr2=restraints.direct(k).adr2;
ind2=resolve_address(adr2);
net2=0;
for kk=1:mn,
match=sum(abs(ind2-cindices(kk,:)));
if match==0,
net2=kk;
break;
end;
end;
direct(k,2)=net2;
direct(k,4)=restraints.direct(k).r;
direct(k,5)=restraints.direct(k).sigr;
if net1==0 || net2==0,
add_msg_board('ERROR: Constrained C_alpha-C_alpha distance does not exist in network model.');
cancelled=true;
direct=[];
return;
end;
end;
function get_Alpha_fit_Callback(hObject, eventdata, handles)
% hObject handle to get_Alpha_fit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of get_Alpha_fit as text
% str2double(get(hObject,'String')) returns contents of get_Alpha_fit as a double
[v,handles]=edit_update_MMM(handles,hObject,0,360,0,'%0.2f',0);
handles.dockFit.al_fit=v;
guidata(hObject,handles);
% --- Executes during object creation, after setting all properties.
function get_Alpha_fit_CreateFcn(hObject, eventdata, handles)
% hObject handle to get_Alpha_fit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function get_Beta_fit_Callback(hObject, eventdata, handles)
% hObject handle to get_Beta_fit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of get_Beta_fit as text
% str2double(get(hObject,'String')) returns contents of get_Beta_fit as a double
[v,handles]=edit_update_MMM(handles,hObject,0,360,0,'%0.2f',0);
handles.dockFit.be_fit=v;
guidata(hObject,handles);
% --- Executes during object creation, after setting all properties.
function get_Beta_fit_CreateFcn(hObject, eventdata, handles)
% hObject handle to get_Beta_fit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function get_Gama_fit_Callback(hObject, eventdata, handles)
% hObject handle to get_Gama_fit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of get_Gama_fit as text
% str2double(get(hObject,'String')) returns contents of get_Gama_fit as a double
[v,handles]=edit_update_MMM(handles,hObject,0,360,0,'%0.2f',0);
handles.dockFit.ga_fit=v;
guidata(hObject,handles);
% --- Executes during object creation, after setting all properties.
function get_Gama_fit_CreateFcn(hObject, eventdata, handles)
% hObject handle to get_Gama_fit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function get_x_fit_Callback(hObject, eventdata, handles)
% hObject handle to get_x_fit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of get_x_fit as text
% str2double(get(hObject,'String')) returns contents of get_x_fit as a double
[v,handles]=edit_update_MMM(handles,hObject,-75,75,0,'%0.2f',0);
handles.x_fit=v;
guidata(hObject,handles);
% --- Executes during object creation, after setting all properties.
function get_x_fit_CreateFcn(hObject, eventdata, handles)
% hObject handle to get_x_fit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function get_y_fit_Callback(hObject, eventdata, handles)
% hObject handle to get_y_fit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of get_y_fit as text
% str2double(get(hObject,'String')) returns contents of get_y_fit as a double
[v,handles]=edit_update_MMM(handles,hObject,-75,75,0,'%0.2f',0);
handles.y_fit=v;
guidata(hObject,handles);
% --- Executes during object creation, after setting all properties.
function get_y_fit_CreateFcn(hObject, eventdata, handles)
% hObject handle to get_y_fit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function get_z_fit_Callback(hObject, eventdata, handles)
% hObject handle to get_z_fit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of get_z_fit as text
% str2double(get(hObject,'String')) returns contents of get_z_fit as a double
[v,handles]=edit_update_MMM(handles,hObject,-75,75,0,'%0.2f',0);
handles.z_fit=v;
guidata(hObject,handles);
% --- Executes during object creation, after setting all properties.
function get_z_fit_CreateFcn(hObject, eventdata, handles)
% hObject handle to get_z_fit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function show_gridSize_Callback(hObject, eventdata, handles)
% hObject handle to show_gridSize (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of show_gridSize as text
% str2double(get(hObject,'String')) returns contents of show_gridSize as a double
% --- Executes during object creation, after setting all properties.
function show_gridSize_CreateFcn(hObject, eventdata, handles)
% hObject handle to show_gridSize (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function get_stackSize_Callback(hObject, eventdata, handles)
% hObject handle to get_stackSize (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of get_stackSize as text
% str2double(get(hObject,'String')) returns contents of get_stackSize as a double
[v,handles]=edit_update_MMM(handles,hObject,100000,1000000,100000,'%d',1);
handles.stackSize=v;
guidata(hObject,handles);
% --- Executes during object creation, after setting all properties.
function get_stackSize_CreateFcn(hObject, eventdata, handles)
% hObject handle to get_stackSize (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function get_z_grid_elem_Callback(hObject, eventdata, handles)
% hObject handle to get_z_grid_elem (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of get_z_grid_elem as text
% str2double(get(hObject,'String')) returns contents of get_z_grid_elem as a double
[v,handles]=edit_update_MMM(handles,hObject,1,1e7,9,'%d',1);
handles.z_grid_elem=v;
if get(handles.checkhomooligomer,'Value')
handles.grid.grSize=handles.al_grid_elem*handles.be_grid_elem*handles.x_grid_elem*handles.y_grid_elem;
else
handles.grid.grSize=handles.al_grid_elem*handles.be_grid_elem*handles.ga_grid_elem*handles.x_grid_elem*handles.y_grid_elem*handles.z_grid_elem;
end
pstr=sprintf('%g',handles.grid.grSize);
set(handles.show_gridSize,'String',pstr);
if handles.grid.grSize<1000000
set(handles.LargeGridcheckbox,'Value',0.0);
set(handles.LargeGridcheckbox,'Enable','off');
set(handles.get_stackSize,'Enable','off');
else
set(handles.LargeGridcheckbox,'Value',1.0);
set(handles.LargeGridcheckbox,'Enable','on');
set(handles.get_stackSize,'Enable','on');
end
guidata(hObject,handles);
% --- Executes during object creation, after setting all properties.
function get_z_grid_elem_CreateFcn(hObject, eventdata, handles)
% hObject handle to get_z_grid_elem (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function get_z_grid_end_Callback(hObject, eventdata, handles)
% hObject handle to get_z_grid_end (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of get_z_grid_end as text
% str2double(get(hObject,'String')) returns contents of get_z_grid_end as a double
[v,handles]=edit_update_MMM(handles,hObject,-75,75,0,'%0.2f',0);
handles.z_grid_end=v;
guidata(hObject,handles);
% --- Executes during object creation, after setting all properties.
function get_z_grid_end_CreateFcn(hObject, eventdata, handles)
% hObject handle to get_z_grid_end (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function get_z_grid_st_Callback(hObject, eventdata, handles)
% hObject handle to get_z_grid_st (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of get_z_grid_st as text
% str2double(get(hObject,'String')) returns contents of get_z_grid_st as a double
[v,handles]=edit_update_MMM(handles,hObject,-75,75,0,'%0.2f',0);
handles.z_grid_st=v;
guidata(hObject,handles);
% --- Executes during object creation, after setting all properties.
function get_z_grid_st_CreateFcn(hObject, eventdata, handles)
% hObject handle to get_z_grid_st (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function get_y_grid_end_Callback(hObject, eventdata, handles)
% hObject handle to get_y_grid_end (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of get_y_grid_end as text
% str2double(get(hObject,'String')) returns contents of get_y_grid_end as a double
[v,handles]=edit_update_MMM(handles,hObject,-75,75,0,'%0.2f',0);
handles.y_grid_end=v;
guidata(hObject,handles);
% --- Executes during object creation, after setting all properties.
function get_y_grid_end_CreateFcn(hObject, eventdata, handles)
% hObject handle to get_y_grid_end (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function get_y_grid_elem_Callback(hObject, eventdata, handles)
% hObject handle to get_y_grid_elem (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of get_y_grid_elem as text
% str2double(get(hObject,'String')) returns contents of get_y_grid_elem as a double
[v,handles]=edit_update_MMM(handles,hObject,1,1e7,9,'%d',1);
handles.y_grid_elem=v;
if get(handles.checkhomooligomer,'Value')
handles.grid.grSize=handles.al_grid_elem*handles.be_grid_elem*handles.x_grid_elem*handles.y_grid_elem;
else
handles.grid.grSize=handles.al_grid_elem*handles.be_grid_elem*handles.ga_grid_elem*handles.x_grid_elem*handles.y_grid_elem*handles.z_grid_elem;
end
pstr=sprintf('%g',handles.grid.grSize);
set(handles.show_gridSize,'String',pstr);
if handles.grid.grSize<1000000
set(handles.LargeGridcheckbox,'Value',0.0);
set(handles.LargeGridcheckbox,'Enable','off');
set(handles.get_stackSize,'Enable','off');
else
set(handles.LargeGridcheckbox,'Value',1.0);
set(handles.LargeGridcheckbox,'Enable','on');
set(handles.get_stackSize,'Enable','on');
end
guidata(hObject,handles);
% --- Executes during object creation, after setting all properties.
function get_y_grid_elem_CreateFcn(hObject, eventdata, handles)
% hObject handle to get_y_grid_elem (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function get_y_grid_st_Callback(hObject, eventdata, handles)
% hObject handle to get_y_grid_st (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of get_y_grid_st as text
% str2double(get(hObject,'String')) returns contents of get_y_grid_st as a double
[v,handles]=edit_update_MMM(handles,hObject,-75,75,0,'%0.2f',0);
handles.y_grid_st=v;
guidata(hObject,handles);
% --- Executes during object creation, after setting all properties.
function get_y_grid_st_CreateFcn(hObject, eventdata, handles)
% hObject handle to get_y_grid_st (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function get_x_grid_elem_Callback(hObject, eventdata, handles)
% hObject handle to get_x_grid_elem (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of get_x_grid_elem as text
% str2double(get(hObject,'String')) returns contents of get_x_grid_elem as a double
[v,handles]=edit_update_MMM(handles,hObject,1,1e7,9,'%d',1);
handles.x_grid_elem=v;
if get(handles.checkhomooligomer,'Value')
handles.grid.grSize=handles.al_grid_elem*handles.be_grid_elem*handles.x_grid_elem*handles.y_grid_elem;
else
handles.grid.grSize=handles.al_grid_elem*handles.be_grid_elem*handles.ga_grid_elem*handles.x_grid_elem*handles.y_grid_elem*handles.z_grid_elem;
end
pstr=sprintf('%g',handles.grid.grSize);
set(handles.show_gridSize,'String',pstr);
if handles.grid.grSize<1000000
set(handles.LargeGridcheckbox,'Value',0.0);
set(handles.LargeGridcheckbox,'Enable','off');
set(handles.get_stackSize,'Enable','off');
else
set(handles.LargeGridcheckbox,'Value',1.0);
set(handles.LargeGridcheckbox,'Enable','on');
set(handles.get_stackSize,'Enable','on');
end
guidata(hObject,handles);
% --- Executes during object creation, after setting all properties.
function get_x_grid_elem_CreateFcn(hObject, eventdata, handles)
% hObject handle to get_x_grid_elem (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
function get_x_grid_st_Callback(hObject, eventdata, handles)
% hObject handle to get_x_grid_st (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of get_x_grid_st as text
% str2double(get(hObject,'String')) returns contents of get_x_grid_st as a double
[v,handles]=edit_update_MMM(handles,hObject,-75,75,0,'%0.2f',0);
handles.x_grid_st=v;
guidata(hObject,handles);
% --- Executes during object creation, after setting all properties.
function get_x_grid_st_CreateFcn(hObject, eventdata, handles)
% hObject handle to get_x_grid_st (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))