0001
0002
0003
0004
0005
0006 function FR3D(varargin)
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050 gui_Singleton = 1;
0051 gui_State = struct('gui_Name', mfilename, ...
0052 'gui_Singleton', gui_Singleton, ...
0053 'gui_OpeningFcn', @FR3D_OpeningFcn, ...
0054 'gui_OutputFcn', @FR3D_OutputFcn, ...
0055 'gui_LayoutFcn', [] , ...
0056 'gui_Callback', []);
0057 if nargin && ischar(varargin{1})
0058 gui_State.gui_Callback = str2func(varargin{1});
0059 end
0060
0061 if nargout
0062 [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
0063 else
0064 gui_mainfcn(gui_State, varargin{:});
0065 end
0066
0067
0068
0069
0070 function FR3D_OpeningFcn(hObject, eventdata, handles, varargin)
0071
0072 if ~(exist('FR3DSource') == 7),
0073 mkdir('FR3DSource');
0074 end
0075 path(path,[pwd filesep 'FR3DSource']);
0076
0077 if ~(exist('PDBFiles') == 7),
0078 mkdir('PDBFiles');
0079 end
0080 path(path,[pwd filesep 'PDBFiles']);
0081
0082 if ~(exist('PrecomputedData') == 7),
0083 mkdir('PrecomputedData');
0084 end
0085 path(path,[pwd filesep 'PrecomputedData']);
0086
0087 if ~(exist('SearchSaveFiles') == 7),
0088 mkdir('SearchSaveFiles');
0089 end
0090 path(path,[pwd filesep 'SearchSaveFiles']);
0091
0092 savedf=dir(['SearchSaveFiles' filesep '*.mat']);
0093 if length(savedf) == 0,
0094 savedff=' ';
0095 else
0096 for i = 1:length(savedf),
0097 savedff{i,1} = savedf(i).name;
0098 end
0099 end
0100 set(handles.LOAD,'String',savedff);
0101
0102 [s,snolist] = mGetPDBFilenames;
0103
0104 if length(s) == 0,
0105 set(handles.Status,'String','ALERT: there are no PDB files or saved PDB data in the folders "PDBFiles" and "PrecomputedData". Please put some PDB files in these locations and try again!');
0106 set(handles.ReadQuery,'Visible','Off');
0107 else
0108 set(handles.SearchPDBs,'String',s);
0109 set(handles.SearchPDBs,'Min',1);
0110 set(handles.SearchPDBs,'Max',length(s)+1);
0111
0112 set(handles.SearchPDBs,'Value',1);
0113
0114 set(handles.QueryPDB,'String',snolist);
0115
0116 p = find(ismember(snolist,'1s72'));
0117 if ~isempty(p),
0118 set(handles.QueryNTs,'String','2692:2694, 2701:2702');
0119 set(handles.QueryPDB,'Value',p);
0120 else
0121 set(handles.QueryNTs,'String','List query nucleotides and chains here');
0122 end
0123
0124 end
0125
0126
0127 handles.output = hObject;
0128 guidata(hObject, handles);
0129
0130
0131 function FR3D_OutputFcn(hObject, eventdata, handles)
0132
0133
0134
0135
0136
0137
0138 function LOAD_Callback(hObject, eventdata, handles)
0139
0140 savedf = dir(['SearchSaveFiles' filesep '*.mat']);
0141 if length(savedf) == 0,
0142 savedff=' ';
0143 else
0144 for i = 1:length(savedf),
0145 savedff{i,1} = savedf(i).name;
0146 end
0147 end
0148
0149 set(handles.LOAD,'String',savedff);
0150
0151 v=get(handles.LOAD,'Value');
0152 f=savedff{v,1};
0153 l= ['SearchSaveFiles' filesep f];
0154 load(l)
0155
0156 if (~isfield(Search,'File')) && (length(Search.Candidates(:,1)) > 0),
0157 Search = xAddFiletoSearch([],Search);
0158
0159 if isfield(handles,'File')
0160 File = handles.File;
0161 [File,FIndex] = zAddNTData(Search.CandidateFilenames,2,File);
0162 else
0163 [File,FIndex] = zAddNTData(Search.CandidateFilenames,2);
0164 end
0165 Search = xAddFiletoSearch(File(FIndex),Search);
0166 save(['SearchSaveFiles' filesep Search.SaveName], 'Search');
0167 fprintf('Saved updated version of this search\n');
0168
0169 handles.File = File;
0170 end
0171
0172 if isfield(Search,'File'),
0173 if ~isfield(Search.File,'Backbone'),
0174 if isfield(handles,'File'),
0175 File = handles.File;
0176 [File,FIndex] = zAddNTData(Search.CandidateFilenames,2,File);
0177 else
0178 [File,FIndex] = zAddNTData(Search.CandidateFilenames,2);
0179 end
0180 Search = xAddFiletoSearch(File(FIndex),Search);
0181 save(['SearchSaveFiles' filesep Search.SaveName], 'Search');
0182 save(l, 'Search');
0183
0184 fprintf('Saved updated version of this search\n');
0185
0186 handles.File = File;
0187 end
0188 end
0189
0190 Search.ActualFilename = strrep(f,'.mat','');
0191
0192 mSetLoadedParameters
0193
0194 handles.Search=Search;
0195 guidata(hObject, handles);
0196
0197
0198
0199 function QueryPDBedit_Callback(hObject, eventdata, handles)
0200 function QueryPDBedit_CreateFcn(hObject, eventdata, handles)
0201 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0202 set(hObject,'BackgroundColor','white');
0203 end
0204
0205
0206
0207 function QueryNTs_CreateFcn(hObject, eventdata, handles)
0208 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0209 set(hObject,'BackgroundColor','white');
0210 end
0211 function QueryNTs_Callback(hObject, eventdata, handles)
0212
0213
0214
0215
0216 function ReadQuery_Callback(hObject, eventdata, handles)
0217
0218
0219 x=get(handles.QueryPDB,'Value');
0220 s=get(handles.QueryPDB,'String');
0221 Query.Filename = s{x};
0222 set(handles.Status,'String','Reading query PDB, please wait ...');
0223 drawnow
0224
0225
0226 if isfield(handles,'File')
0227 File = handles.File;
0228 [File,QIndex]=zAddNTData(Query.Filename,2,File);
0229 else
0230 [File,QIndex]=zAddNTData(Query.Filename,2);
0231 end
0232
0233
0234
0235 [Indices,Ch] = zIndexLookup(File(QIndex),get(handles.QueryNTs,'String'));
0236
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248
0249
0250
0251
0252
0253 h = findobj('-regexp','Tag','ChainPopup[0-9]');
0254 delete(h);
0255
0256
0257 if length(Indices)<13
0258 x=.054;
0259 y=.04;
0260 else
0261 x=.684/min(25,length(Indices));
0262 y=.54 /min(25,length(Indices));
0263 end
0264
0265 for i=1:min(25,length(Indices)),
0266 Query.NTList{i} = File(QIndex).NT(Indices(i)).Number;
0267 handles.ChainPopup(i) = uicontrol('Tag',strcat('ChainPopup',num2str(i)),'Style','popupmenu','Units','normalized','Position',[(0.305+x*(i-1)) (0.795) x-.003 .04],'String',Ch{i},'Background',[1 1 1]);
0268 end
0269
0270 set(handles.QueryChains,'Visible','on')
0271
0272
0273
0274 handles.Indices = Indices;
0275 handles.NT=Query.NTList;
0276 handles.Filename = Query.Filename;
0277 handles.File = File;
0278 handles.QIndex=QIndex;
0279 handles.NTList=Query.NTList;
0280 guidata(hObject, handles);
0281
0282 if get(handles.ViewQuery,'Value')==1
0283 figure(3)
0284 clf
0285 VP.Sugar = 1;
0286 zDisplayNT(File(QIndex),Indices,VP);
0287 grid off
0288 rotate3d on
0289 zShowInteractionTable(File(QIndex),Indices)
0290 end
0291 set(handles.Status,'String','Choose "Query Chains" and click "Generate Interaction Matrix"');
0292 set(handles.GenerateMatrix,'Visible','on');
0293
0294 set(handles.RunSearch,'Visible','off');
0295 set(handles.ListCandidates,'Visible','off');
0296 set(handles.DisplayCandidates,'Visible','off');
0297
0298
0299
0300 function GenerateMatrix_Callback(hObject, eventdata, handles)
0301
0302 if get(handles.Geometric,'Value') == 1
0303 NT=handles.NT;
0304 File=handles.File;
0305 QIndex=handles.QIndex;
0306
0307
0308 for i=1:length(NT)
0309 h=findobj('Tag',strcat('ChainPopup',num2str(i)));
0310 s=get(h,'String');
0311 v=get(h,'Value');
0312 Query.ChainList{i}=s(v);
0313 end
0314
0315 ChainList=Query.ChainList;
0316 handles.ChainList=ChainList;
0317 handles.NTlen=length(NT);
0318 set(handles.Status,'String','Ready to Search');
0319 else
0320 NTlen=str2num(get(handles.NumberOfNTs,'String'));
0321 if NTlen>25
0322 set(handles.Status,'String','25 is the maximum number of nucleotides that can be addressed in this GUI. Ready to "Search"');
0323 else
0324 set(handles.Status,'String','Ready to "Search"');
0325 end
0326 NTlen=min(25,NTlen);
0327 for i=1:NTlen
0328 NT{i}=num2str(i);
0329 end
0330 handles.NTlen=NTlen;
0331 end
0332
0333 mCreateMatrix
0334
0335 set(handles.GuarCutoffText,'visible','on');
0336 set(handles.GuarCutoff,'visible','on');
0337 set(handles.RelCutoffText,'visible','on');
0338 set(handles.RelCutoff,'visible','on');
0339 set(handles.Overlap,'visible','on');
0340 set(handles.RunSearch,'visible','on');
0341 set(handles.SearchNameText,'visible','on');
0342 set(handles.SearchName,'visible','on');
0343 set(handles.SearchDescriptionText,'visible','on');
0344 set(handles.SearchDescription,'visible','on');
0345
0346
0347 guidata(hObject, handles);
0348
0349
0350
0351 function RunSearch_Callback(hObject, eventdata, handles)
0352
0353
0354
0355
0356 if isfield(handles,'File')
0357 File=handles.File;
0358 end
0359 if get(handles.Geometric,'Value') == 1
0360 Query.Filename=handles.Filename;
0361 Query.ChainList=handles.ChainList;
0362 Query.NTList=handles.NTList;
0363 end
0364 NTlen=handles.NTlen;
0365 mSpecifyQueryforGUI;
0366
0367
0368 x=get(handles.SearchPDBs,'Value');
0369 s=get(handles.SearchPDBs,'String');
0370 for i=1:length(x)
0371 Filenames{i,1}=s{x(i)};
0372 end
0373
0374
0375 GUIactive = 1;
0376
0377 set(handles.Status,'String','Searching ... Please wait (press Ctrl+C to interrupt)');
0378 drawnow
0379
0380 Verbose = 1;
0381 xFR3DSearch
0382
0383 handles.File=File;
0384
0385
0386 if ~isempty(Candidates),
0387 set(handles.ListCandidates,'Visible','on');
0388 set(handles.DisplayCandidates,'Visible','on');
0389 if length(Discrepancy)>1
0390 s='s';
0391 else s='';
0392 end
0393 str=strcat(num2str(length(Discrepancy)),' candidate',s,' found');
0394 set(handles.Status,'String',str);
0395
0396 handles.Search=Search;
0397
0398 else
0399 set(handles.Status,'String','No candidates found');
0400 set(handles.ListCandidates,'Visible','off');
0401 set(handles.DisplayCandidates,'Visible','off');
0402 end
0403 guidata(hObject, handles);
0404
0405
0406 function SearchName_Callback(hObject, eventdata, handles)
0407 function SearchName_CreateFcn(hObject, eventdata, handles)
0408 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0409 set(hObject,'BackgroundColor','white');
0410 end
0411
0412
0413 function SearchPDBs_Callback(hObject, eventdata, handles)
0414 function SearchPDBs_CreateFcn(hObject, eventdata, handles)
0415 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0416 set(hObject,'BackgroundColor','white');
0417 end
0418
0419
0420 function QueryPDB_Callback(hObject, eventdata, handles)
0421 function QueryPDB_CreateFcn(hObject, eventdata, handles)
0422 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0423 set(hObject,'BackgroundColor','white');
0424 end
0425
0426 function ViewQuery_Callback(hObject, eventdata, handles)
0427
0428
0429 function NumberOfNTs_Callback(hObject, eventdata, handles)
0430 function NumberOfNTs_CreateFcn(hObject, eventdata, handles)
0431 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0432 set(hObject,'BackgroundColor','white');
0433 end
0434
0435
0436
0437
0438
0439
0440
0441 function Geometric_Callback(hObject, eventdata, handles)
0442 set(handles.Geometric,'Value',1);
0443 set(handles.NonGeometric,'Value',0);
0444
0445 set(handles.NumberOfNTsTitle,'Visible','off');
0446 set(handles.NumberOfNTs,'Visible','off');
0447 set(handles.GenerateMatrix,'Visible','off');
0448
0449 set(handles.QueryPDBTitle,'Visible','on');
0450 set(handles.QueryPDB,'Visible','on');
0451 set(handles.ViewQuery,'Visible','on');
0452 set(handles.QueryNTsTitle,'Visible','on');
0453 set(handles.QueryNTs,'Visible','on');
0454 set(handles.ReadQuery,'Visible','on');
0455
0456 set(handles.Status,'String','Hint: Choose "Query PDB" and "Query NTs", then click "Read Query" - Repeat anytime to restart');
0457 Query.Geometric = 1;
0458
0459
0460
0461 function NonGeometric_Callback(hObject, eventdata, handles)
0462 set(handles.NonGeometric,'Value',1);
0463 set(handles.Geometric,'Value',0)
0464
0465 set(handles.QueryPDBTitle,'Visible','off');
0466 set(handles.ViewQuery,'Visible','off');
0467 set(handles.QueryNTsTitle,'Visible','off');
0468 set(handles.ReadQuery,'Visible','off');
0469
0470 set(handles.QueryPDB,'Visible','off');
0471 set(handles.QueryNTs,'Visible','off');
0472
0473
0474
0475
0476
0477
0478 h = findobj('-regexp','Tag','ChainPopup[0-9]');
0479 delete(h);
0480
0481 set(handles.QueryChains,'Visible','off')
0482
0483 set(handles.NumberOfNTsTitle,'Visible','on');
0484 set(handles.NumberOfNTs,'Visible','on');
0485 set(handles.GenerateMatrix,'Visible','on');
0486
0487 set(handles.Status,'String','Hint: Input "Number of NTs" (positive integer) and click "Generate Interaction Matrix" - Repeat anytime to restart');
0488 Query.Geometric = 0;
0489
0490
0491
0492 function SearchDescription_Callback(hObject, eventdata, handles)
0493 function SearchDescription_CreateFcn(hObject, eventdata, handles)
0494 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0495 set(hObject,'BackgroundColor','white');
0496 end
0497
0498
0499 function DisplayCandidates_Callback(hObject, eventdata, handles)
0500
0501 Search=handles.Search;
0502
0503 if isfield(handles,'File')
0504 File = handles.File;
0505 [Search,File] = xDisplayCandidates(File,Search);
0506 else
0507 [Search,File] = xDisplayCandidates([],Search);
0508 end
0509
0510 handles.File=File;
0511 handles.Search = Search;
0512 save(['SearchSaveFiles' filesep Search.SaveName], 'Search');
0513 guidata(hObject, handles);
0514
0515
0516 function ListCandidates_Callback(hObject, eventdata, handles)
0517
0518 Search=handles.Search;
0519 xListCandidates(Search,Inf);
0520
0521
0522 function Overlap_Callback(hObject, eventdata, handles)
0523
0524
0525
0526
0527
0528
0529
0530
0531
0532 function Overlap_CreateFcn(hObject, eventdata, handles)
0533
0534
0535
0536
0537
0538
0539 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0540 set(hObject,'BackgroundColor','white');
0541 end
0542
0543
0544
0545 function GuarCutoff_Callback(hObject, eventdata, handles)
0546
0547
0548
0549
0550
0551
0552
0553
0554
0555 function GuarCutoff_CreateFcn(hObject, eventdata, handles)
0556
0557
0558
0559
0560
0561
0562 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0563 set(hObject,'BackgroundColor','white');
0564 end
0565
0566
0567
0568
0569
0570
0571 function RelCutoff_Callback(hObject, eventdata, handles)
0572
0573
0574
0575
0576
0577
0578
0579
0580
0581 function RelCutoff_CreateFcn(hObject, eventdata, handles)
0582
0583
0584
0585
0586
0587
0588 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0589 set(hObject,'BackgroundColor','white');
0590 end
0591
0592
0593
0594
0595 function InteractionText_Callback(hObject, eventdata, handles)
0596 xDescribeInteraction
0597
0598
0599 function MaxDistText_Callback(hObject, eventdata, handles)
0600 xDescribeDistance
0601
0602
0603 function NTmaskText_Callback(hObject, eventdata, handles)
0604 xDescribeMask
0605