forked from gjeschke/MMM
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMMM_prototype.m
More file actions
6324 lines (5136 loc) · 204 KB
/
MMM_prototype.m
File metadata and controls
6324 lines (5136 loc) · 204 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 = MMM_prototype(varargin)
% MMM_PROTOTYPE M-file for MMM_prototype.fig
% MMM_PROTOTYPE, by itself, creates a new MMM_PROTOTYPE or raises the existing
% singleton*.
%
% H = MMM_PROTOTYPE returns the handle to a new MMM_PROTOTYPE or the handle to
% the existing singleton*.
%
% MMM_PROTOTYPE('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in MMM_PROTOTYPE.M with the given input arguments.
%
% MMM_PROTOTYPE('Property','Value',...) creates a new MMM_PROTOTYPE or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before MMM_prototype_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to MMM_prototype_OpeningFcn via varargin.
%
% *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 MMM_prototype
% Last Modified by GUIDE v2.5 16-Jul-2020 09:27:43
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @MMM_prototype_OpeningFcn, ...
'gui_OutputFcn', @MMM_prototype_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 MMM_prototype is made visible.
function MMM_prototype_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 command line arguments to MMM_prototype (see VARARGIN)
% Choose default command line output for MMM_prototype
handles.output = hObject;
handles.zoom_step=1.05; % scaling factor for camera angle on zoom out
handles.view_step=5;
% declare global structure variables for all figures
global hMain
global MMM_info
% global MMM_icon
global rootdir
global third_party
global general
initialize_MMM
set(handles.MMM,'Name',MMM_info.title);
set(handles.MMM,'WindowStyle','normal');
hMain=handles;
hMain.large = general.large_windows;
hMain.figure=handles.MMM;
hMain.detached=0;
hMain.edit_command_line=handles.edit_command_line;
hMain.text_message_board=handles.text_message_board;
hMain.uitoggletool_rotate=handles.uitoggletool_rotate;
hMain.uitoggletool_zoom=handles.uitoggletool_zoom;
hMain.uitoggletool_select=handles.uitoggletool_select;
hMain.uitoggletool_pan=handles.uitoggletool_pan;
hMain.color='black';
hMain.store_undo=1;
hMain.history_num=20;
hMain.depth_cue=0;
for k=1:hMain.history_num, hMain.history{k}=''; end
for k=1:hMain.history_num, hMain.undo{k}=''; end
for k=1:hMain.history_num, hMain.redo{k}=''; end
hMain.history_poi=1;
hMain.edit_poi=1;
hMain.undo_poi=1;
hMain.redo_poi=1;
hMain.selected=[];
hMain.axes_model=handles.axes_model;
hMain.axes_frame=handles.axes_frame;
hMain.hierarchy_display=0;
hMain.current_reference=0;
hMain.alpha=1;
hMain.color_selection=[0,0,1];
hMain.z_analysis=0;
hMain.statistics=0;
hMain.rotamer_PDB=0;
hMain.graph_update=0;
hMain.current_tag='';
hMain.virgin=1;
hMain.site_scan_residue=0;
hMain.annotation_open=[];
hMain.reference_open=[];
hMain.auxiliary=[];
hMain.atom_graphics_mode=1;
hMain.atom_graphics_auto=false;
hMain.atom_graphics_requested=1;
hMain.keyword_request=''; % for keyword request to annotation window
hMain.report_file='';
hMain.ANM_plot=false;
hMain.dynamic_rotamers=false;
hMain.residue_pattern = '';
axes(handles.axes_model);
cla reset
[img,map]=imread('MMM_title.jpg');
colormap(map);
h2=image(img);
set(h2,'ButtonDownFcn',@webcall_download);
axis off
axis equal
hMain.view_memory_camup=get(hMain.axes_model,'CameraUpVector');
hMain.view_memory_campos=get(hMain.axes_model,'CameraPosition');
hMain.view_memory_camtar=get(hMain.axes_model,'CameraTarget');
hMain.view_memory_camview=get(hMain.axes_model,'CameraViewAngle');
hMain.view_memory_camproj=get(hMain.axes_model,'Projection');
session_start=datestr(now,'yyyy-mm-dd_HH-MM-SS');
defname=sprintf('MMM_%s.log',session_start);
pathname=strcat(rootdir,'tmp/');
if ~isdir(pathname)
mkdir(pathname)
end
hMain.logfile=strcat(pathname,defname);
if get(handles.checkbox_log,'Value')
fid=fopen(hMain.logfile,'w');
fprintf(fid,'--- MMM logfile %s ---\n\nver> %s, %s\n',defname,MMM_info.title,MMM_info.date);
[comp,maxsize]=computer;
fprintf(fid,'env> running on Matlab version %s on %s\nenv> with %g MByte maximum array size.\n',version,comp,maxsize/1e6);
fclose(fid);
diary(hMain.logfile);
end
add_msg_board('MMM initalized');
command=sprintf('bckg grey');
exe(handles,command,hObject);
load helpicon
set(handles.pushbutton_main_help,'CData',cdata);
tmp_check;
if ~third_party.msms
set(handles.menu_EPR_access,'Enable','off');
set(handles.menu_analysis_accessibility,'Enable','off');
set(handles.menu_build_SAS,'Enable','off');
set(handles.menu_build_bilayer,'Enable','off');
end
if ~third_party.scwrl4
set(handles.menu_build_repair,'Enable','off');
set(handles.menu_build_sidechains,'Enable','off');
set(handles.menu_biochem_mutate,'Enable','off');
set(handles.menu_analysis_crystal,'Enable','off');
end
if ~third_party.dssp
set(handles.menu_build_secondary,'Enable','off');
end
if ~third_party.modeller
set(handles.menu_build_repair_gaps,'Enable','off');
set(handles.menu_build_fit_Modeller,'Enable','off');
end
% Old version with MMM figure icon, blocked because of warning
% j = get(handles.MMM,'javaframe');
% j.setFigureIcon(javax.swing.ImageIcon(im2java(MMM_icon))); %create a java image and set the figure icon
job_check
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes MMM_prototype wait for user response (see UIRESUME)
% uiwait(handles.MMM);
% --- Outputs from this function are returned to the command line.
function varargout = MMM_prototype_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;
function edit_command_line_Callback(hObject, eventdata, handles)
% hObject handle to edit_command_line (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 edit_command_line as text
% str2double(get(hObject,'String')) returns contents of edit_command_line as a double
command_line=get(hObject,'String');
[command,args]=strtok(command_line); % check for commands that are not treated by the interpreter
switch command
case 'undo'
handles=undo_last(handles);
case 'redo'
handles=redo(handles);
otherwise
handles=cmd(handles,command_line);
end
set(hObject,'String','');
guidata(hObject, handles);
% --- Executes during object creation, after setting all properties.
function edit_command_line_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit_command_line (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
% --- If Enable == 'on', executes on mouse press in 5 pixel border.
% --- Otherwise, executes on mouse press in 5 pixel border or over edit_command_line.
function edit_command_line_ButtonDownFcn(hObject, eventdata, handles)
% hObject handle to edit_command_line (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
set(hObject,'String','');
set(hObject,'ForegroundColor','k');
set(hObject,'Enable','on');
guidata(hObject, handles);
% --- Executes on key press with focus on edit_command_line and none of its controls.
function edit_command_line_KeyPressFcn(hObject, eventdata, handles)
% hObject handle to edit_command_line (see GCBO)
% eventdata structure with the following fields (see UICONTROL)
% Key: name of the key that was pressed, in lower case
% Character: character interpretation of the key(s) that was pressed
% Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed
% handles structure with handles and user data (see GUIDATA)
global hMain
switch eventdata.Key
case 'uparrow'
command=hMain.history{hMain.edit_poi};
hMain.edit_poi=hMain.edit_poi-1;
if hMain.edit_poi<1
hMain.edit_poi=hMain.history_num;
end
set(hObject,'String',command);
case 'downarrow'
if ~isempty(eventdata.Modifier)
command='';
else
command=hMain.history{hMain.edit_poi};
hMain.edit_poi=hMain.edit_poi+1;
if hMain.edit_poi>hMain.history_num
hMain.edit_poi=1;
end
end
set(hObject,'String',command);
end
% --- Executes on button press in button_cam_zoom_out.
function button_cam_zoom_out_Callback(hObject, eventdata, handles)
% hObject handle to button_cam_zoom_out (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
command=sprintf('zoom out');
exe(handles,command,hObject);
% --- Executes on button press in button_cam_zoom_in.
function button_cam_zoom_in_Callback(hObject, eventdata, handles)
% hObject handle to button_cam_zoom_in (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
command=sprintf('zoom in');
exe(handles,command,hObject);
% --------------------------------------------------------------------
function context_model_rotate_Callback(hObject, eventdata, handles)
% hObject handle to context_model_rotate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global hMain
global hModel
if hMain.detached
fig=hModel.figure;
else
fig=hMain.figure;
end
set(handles.uitoggletool_rotate,'State','on');
set(handles.uitoggletool_zoom,'State','off');
set(handles.uitoggletool_select,'State','off');
set(handles.uitoggletool_pan,'State','off');
set(handles.context_model_rotate,'Checked','on');
set(handles.context_model_zoom,'Checked','off');
set(handles.context_model_select,'Checked','off');
set(handles.context_model_pan,'Checked','off');
view3D(fig,'rot');
guidata(hObject,handles);
% --------------------------------------------------------------------
function context_model_zoom_Callback(hObject, eventdata, handles)
% hObject handle to context_model_zoom (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global hMain
global hModel
if hMain.detached
fig=hModel.figure;
else
fig=hMain.figure;
end
set(handles.uitoggletool_rotate,'State','off');
set(handles.uitoggletool_zoom,'State','on');
set(handles.uitoggletool_select,'State','off');
set(handles.uitoggletool_pan,'State','off');
set(handles.context_model_rotate,'Checked','off');
set(handles.context_model_zoom,'Checked','on');
set(handles.context_model_select,'Checked','off');
set(handles.context_model_pan,'Checked','off');
view3D(fig,'zoom');
guidata(hObject,handles);
% --------------------------------------------------------------------
function context_model_bckg_Callback(hObject, eventdata, handles)
% hObject handle to context_model_bckg (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function context_model_detach_Callback(hObject, eventdata, handles)
% hObject handle to context_model_detach (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% global hMain
% global hModel
command=sprintf('detach');
exe(handles,command,hObject);
% --------------------------------------------------------------------
function context_model_attach_Callback(hObject, eventdata, handles)
% hObject handle to context_model_attach (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% global hMain
% global hModel
command=sprintf('attach');
exe(handles,command,hObject);
% --------------------------------------------------------------------
function context_model_bckg_black_Callback(hObject, ~, handles)
% hObject handle to context_model_bckg_black (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
command=sprintf('bckg black');
exe(handles,command,hObject);
% --------------------------------------------------------------------
function context_model_bckg_grey_Callback(hObject, eventdata, handles)
% hObject handle to context_model_bckg_grey (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
command=sprintf('bckg grey');
exe(handles,command,hObject);
% --------------------------------------------------------------------
function context_model_bckg_white_Callback(hObject, eventdata, handles)
% hObject handle to context_model_bckg_white (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
command=sprintf('bckg white');
exe(handles,command,hObject);
% --------------------------------------------------------------------
function context_model_Callback(hObject, eventdata, handles)
% hObject handle to context_model (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function menu_file_Callback(hObject, eventdata, handles)
% hObject handle to menu_file (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function menu_edit_Callback(hObject, eventdata, handles)
% hObject handle to menu_edit (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function menu_display_Callback(hObject, eventdata, handles)
% hObject handle to menu_display (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function menu_display_fly_Callback(hObject, eventdata, handles)
% hObject handle to menu_display_fly (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
command=sprintf('zoom in');
exe(handles,command,hObject);
% --------------------------------------------------------------------
function menu_display_mode_Callback(hObject, eventdata, handles)
% hObject handle to menu_display_mode (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function menu_edit_center_Callback(hObject, eventdata, handles)
% hObject handle to menu_edit_center (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 hMain
set(gcf,'Pointer','watch');
drawnow;
snum=model.current_structure;
[msg,coor]=get_object(snum,'xyz');
if iscell(coor)
coor=coor{1};
end
center=mean(coor,1);
% center = center - [20,20,20]; % hack for shifting
transmat=affine('translation',-center);
transform_structure(snum,transmat);
model.info{snum}.center=[0,0,0];
camera.pos = get(hMain.axes_model,'cameraposition' );
camera.targ = get(hMain.axes_model,'cameratarget' );
camera.dar = get(hMain.axes_model,'dataaspectratio');
camera.up = get(hMain.axes_model,'cameraupvector' );
display_model(handles, hObject,camera);
guidata(handles.axes_model,hMain);
set(gcf,'Pointer','arrow');
drawnow;
% --------------------------------------------------------------------
function menu_edit_symmetry_Callback(hObject, eventdata, handles)
% hObject handle to menu_edit_symmetry (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 hMain
set(gcf,'Pointer','watch');
drawnow;
snum=model.current_structure;
[p0,v,msg]=symmetry_axis;
if ~isempty(p0) && ~isempty(v)
if msg.error
add_msg_board(msg.text);
end
v=v/norm(v);
th=acos(v(3));
if norm(v(1:2))>1e-6
v=v(1:2)/norm(v(1:2));
else
v=[0,0];
end
phi=atan2(v(2),v(1));
transmat1=affine('translation',-p0);
transmat2=affine('Euler',[-phi,-th,0]);
transform_structure(snum,{transmat1,transmat2});
[msg,coor]=get_object(snum,'xyz');
if iscell(coor)
coor=coor{1};
end
center=mean(coor,1);
transmat=affine('translation',-center);
transform_structure(snum,transmat);
display_model(handles, hObject);
else
add_msg_board('Selected objects do not define a symmetry axis or nothing selected.');
end
guidata(handles.axes_model,hMain);
set(gcf,'Pointer','arrow');
drawnow;
% --------------------------------------------------------------------
function menu_edit_domain_Callback(hObject, eventdata, handles)
% hObject handle to menu_edit_domain (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[indices,msg]=resolve_address('*');
if msg.error>0
add_msg_board('Domain definition requires selection of residues');
add_msg_board(sprintf('ERROR: %s',msg.text));
return;
end
if isempty(indices)
add_msg_board('Domain definition requires selection of residues');
add_msg_board('ERROR: No object selected.');
return;
end
[m,n]=size(indices);
fail=0;
for k=1:m
cindices=indices(k,:);
cindices=cindices(cindices>0);
if length(cindices)~=4
fail=1; break;
end
end
if fail
add_msg_board('Domain definition requires selection of residues');
add_msg_board('ERROR: Objects other than residues are selected.');
return;
end
name=inputdlg('Domain name','Domain definition from selected objects');
exe(handles,sprintf('domain * %s',char(name{1})),hObject);
% --------------------------------------------------------------------
function menu_file_new_Callback(hObject, eventdata, handles)
% hObject handle to menu_file_new (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function menu_file_save_Callback(hObject, eventdata, handles)
% hObject handle to menu_file_save (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
save_model(hObject, eventdata, handles);
% --------------------------------------------------------------------
function menu_file_load_Callback(hObject, eventdata, handles)
% hObject handle to menu_file_load (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global model
doit=0;
if ~exist('model','var') || isempty(model)
doit=1;
else
button = questdlg('Do you want to delete old model?','New model will overwrite existing model','No');
if strcmpi(button,'Yes')
doit=1;
end
end
if doit
open_model(hObject, eventdata, handles);
else
add_msg_board('Opening new model cancelled by user');
end
add_msg_board('Model loaded.');
drawnow
% --------------------------------------------------------------------
function menu_file_add_Callback(hObject, eventdata, handles)
% hObject handle to menu_file_add (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function menu_file_close_Callback(hObject, eventdata, handles)
% hObject handle to menu_file_close (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
MMM_CloseRequestFcn(handles.MMM, eventdata, handles);
% --------------------------------------------------------------------
function pushtool_fly_ClickedCallback(hObject, eventdata, handles)
% hObject handle to pushtool_fly (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
command=sprintf('zoom in');
exe(handles,command,hObject);
% [msg,all_graphics]=get_object('*','graphics'); % get graphics information for all objects
% m=length(all_graphics);
% if m<1,
% return;
% end;
% ghandles=zeros(1,10000);
% poi=0;
% if m==1,
% ghandles=all_graphics.objects;
% poi2=length(ghandles);
% else
% for k=1:m,
% poi2=poi+length(all_graphics{k}.objects);
% ghandles(poi+1:poi2)=all_graphics{k}.objects;
% poi=poi2;
% end;
% end;
% ghandles=ghandles(1:poi2);
% camlookat(ghandles);
% --------------------------------------------------------------------
function menu_EPR_Callback(hObject, eventdata, handles)
% hObject handle to menu_EPR (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function menu_biochem_Callback(hObject, eventdata, handles)
% hObject handle to menu_biochem (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function menu_biochem_crosslink_Callback(hObject, eventdata, handles)
% hObject handle to menu_biochem_crosslink (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function menu_biochem_mutate_Callback(hObject, eventdata, handles)
% hObject handle to menu_biochem_mutate (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global exchange_container
select_type;
mutate('*',exchange_container);
guidata(hObject,handles);
% --------------------------------------------------------------------
function menu_biochem_substitute_Callback(hObject, eventdata, handles)
% hObject handle to menu_biochem_substitute (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function menu_EPR_DEER_Callback(hObject, eventdata, handles)
% hObject handle to menu_EPR_DEER (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
deer_window;
guidata(hObject,handles);
% --------------------------------------------------------------------
function menu_EPR_access_Callback(hObject, ~, handles)
% hObject handle to menu_EPR_access (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function menu_EPR_dynamics_Callback(hObject, eventdata, handles)
% hObject handle to menu_EPR_dynamics (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
command=sprintf('EPRdyn');
exe(handles,command,hObject);
% --------------------------------------------------------------------
function menu_EPR_P31_Callback(hObject, eventdata, handles)
% hObject handle to menu_EPR_P31 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
ENDOR_window;
% --------------------------------------------------------------------
function menu_file_save_PDB_Callback(hObject, eventdata, handles)
% hObject handle to menu_file_save_PDB (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
my_path=pwd;
cd(general.pdb_files);
set(gcf,'Pointer','watch');
if isempty(model.current_structure) || (model.current_structure<1)
add_msg_board('### ERROR ### No structure available');
guidata(hObject,handles);
return;
else
idCode=model.info{model.current_structure}.idCode;
if isempty(idCode), idCode='AMMM'; end
% idCode(1)=char(idCode(1)+16);
end
default_name=sprintf('%s.pdb',idCode);
[filename, pathname] = uiputfile(default_name, 'Save current structure as PDB');
if isequal(filename,0) || isequal(pathname,0)
message.text='Save as PDB cancelled by user';
message.error=1;
else
reset_user_paths(pathname);
general.pdb_files=pathname;
fname=fullfile(pathname, filename);
msg=sprintf('Current structure saved as PDB file: %s',fname);
add_msg_board(msg);
message=wr_pdb(fname,idCode);
end
set(gcf,'Pointer','arrow');
if message.error
add_msg_board(message.text);
end
cd(my_path);
guidata(hObject,handles);
% --------------------------------------------------------------------
function menu_display_copy_Callback(hObject, eventdata, handles)
% hObject handle to menu_display_copy (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
print(handles.MMM,'-dbitmap');
% --------------------------------------------------------------------
function pushtool_detach_ClickedCallback(hObject, eventdata, handles)
% hObject handle to pushtool_detach (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
command=sprintf('detach');
exe(handles,command,hObject);
% --------------------------------------------------------------------
function pushtool_attach_ClickedCallback(hObject, eventdata, handles)
% hObject handle to pushtool_attach (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
command=sprintf('attach');
exe(handles,command,hObject);
% --- Executes during object creation, after setting all properties.
function button_cam_down_CreateFcn(hObject, eventdata, handles)
% hObject handle to button_cam_down (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
load down_button
set(hObject,'CData',icon_data);
% --- Executes during object creation, after setting all properties.
function button_cam_up_CreateFcn(hObject, eventdata, handles)
% hObject handle to button_cam_up (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
load up_button
set(hObject,'CData',icon_data);
% --- Executes during object creation, after setting all properties.
function button_cam_right_CreateFcn(hObject, eventdata, handles)
% hObject handle to button_cam_right (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
load right_button
set(hObject,'CData',icon_data);
% --- Executes during object creation, after setting all properties.
function button_cam_left_CreateFcn(hObject, eventdata, handles)
% hObject handle to button_cam_left (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
load left_button
set(hObject,'CData',icon_data);
% --------------------------------------------------------------------
function menu_edit_undo_Callback(hObject, eventdata, handles)
% hObject handle to menu_edit_undo (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles=undo_last(handles);
guidata(hObject,handles);
% --------------------------------------------------------------------
function menu_edit_redo_Callback(hObject, ~, handles)
% hObject handle to menu_edit_redo (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles=redo(handles);
guidata(hObject,handles);
% --- Executes on button press in button_script.
function button_script_Callback(hObject, eventdata, handles)
% hObject handle to button_script (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global general
currdir=pwd;
cd(general.scripts);
[fname,pname,findex]=uigetfile('*.mmm','Run script file');
if isequal(fname,0) || isequal(pname,0)
add_msg_board('Script loading cancelled by user');
else
general.scripts=pname;
cd(currdir);
handles=run_script(handles,fullfile(pname,fname));
end
cd(currdir);
guidata(hObject,handles);
% --- Executes during object creation, after setting all properties.
function button_cam_zoom_out_CreateFcn(hObject, eventdata, handles)
% hObject handle to button_cam_zoom_out (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
load view_zoom_out_button
set(hObject,'CData',icon_data);
% --- Executes during object creation, after setting all properties.
function button_cam_zoom_in_CreateFcn(hObject, eventdata, handles)
% hObject handle to button_cam_zoom_in (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
load view_zoom_in_button
set(hObject,'CData',icon_data);
% --- Executes during object creation, after setting all properties.
function button_script_CreateFcn(hObject, eventdata, handles)
% hObject handle to button_script (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
load script_button
set(hObject,'CData',icon_data);
% --------------------------------------------------------------------
function menu_Build_Callback(hObject, eventdata, handles)
% hObject handle to menu_Build (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function menu_predict_Callback(hObject, eventdata, handles)
% hObject handle to menu_predict (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function menu_predict_sec_Callback(hObject, eventdata, handles)
% hObject handle to menu_predict_sec (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function menu_predict_tert_Callback(hObject, eventdata, handles)
% hObject handle to menu_predict_tert (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function menu_predict_quater_Callback(hObject, eventdata, handles)
% hObject handle to menu_predict_quater (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function menu_predict_top_Callback(hObject, eventdata, handles)
% hObject handle to menu_predict_top (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function menu_predict_disorder_Callback(hObject, eventdata, handles)
% hObject handle to menu_predict_disorder (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function menu_predict_domain_Callback(hObject, eventdata, handles)
% hObject handle to menu_predict_domain (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function menu_predict_hinge_Callback(hObject, eventdata, handles)
% hObject handle to menu_predict_hinge (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function menu_build_sidechains_Callback(hObject, eventdata, handles)
% hObject handle to menu_build_sidechains (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global model
snum=model.current_structure;
models=length(model.structures{snum}(1).residues);
for modnum=1:models % repack all models of current structure
repack(snum,modnum);
end
guidata(hObject,handles);
% --------------------------------------------------------------------
function menu_edit_sec_DSSP_Callback(hObject, eventdata, handles)
% hObject handle to menu_edit_sec_DSSP (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --------------------------------------------------------------------
function menu_edit_sec_manual_Callback(hObject, eventdata, handles)
% hObject handle to menu_edit_sec_manual (see GCBO)