function varargout = ProExtract_V2p4(varargin) % PROEXTRACT_V2P4 M-file for ProExtract_V2p4.fig % PROEXTRACT_V2P4, by itself, creates a new PROEXTRACT_V2P4 or raises the existing % singleton*. % % H = PROEXTRACT_V2P4 returns the handle to a new PROEXTRACT_V2P4 or the handle to % the existing singleton*. % % PROEXTRACT_V2P4('CALLBACK',hObject,eventData,handles,...) calls the local % function named CALLBACK in PROEXTRACT_V2P4.M with the given input arguments. % % PROEXTRACT_V2P4('Property','Value',...) creates a new PROEXTRACT_V2P4 or % raises the % existing singleton*. Starting from the left, property value pairs are % applied to the GUI before ProExtract_V2p4_OpeningFcn gets called. An % unrecognized property name or invalid value makes property application % stop. All inputs are passed to ProExtract_V2p4_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 ProExtract_V2p4 % Last Modified by GUIDE v2.5 25-Aug-2011 23:21:05 % Begin initialization code - DO NOT EDIT gui_Singleton = 1; gui_State = struct('gui_Name', mfilename, ... 'gui_Singleton', gui_Singleton, ... 'gui_OpeningFcn', @ProExtract_V2p4_OpeningFcn, ... 'gui_OutputFcn', @ProExtract_V2p4_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 ProExtract_V2p4 is made visible. function ProExtract_V2p4_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 ProExtract_V2p4 (see VARARGIN) % Choose default command line output for ProExtract_V2p4 handles.output = hObject; % Update handles structure guidata(hObject, handles); % UIWAIT makes ProExtract_V2p4 wait for user response (see UIRESUME) % uiwait(handles.figure1); % --- Outputs from this function are returned to the command line. function varargout = ProExtract_V2p4_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 HSSPradio2. function HSSPradio2_Callback(hObject, eventdata, handles) % hObject handle to HSSPradio2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of HSSPradio2 set(handles.HSSPradio1, 'Value',0); set(handles.HSSPradio2, 'Value',1); set(handles.HSSPradio3, 'Value',0); set(handles.HSSPinput2, 'Enable', 'on'); set(handles.HSSPinput3, 'Enable','off'); set(handles.HSSPbrowse2, 'Enable', 'on'); function HSSPinput2_Callback(hObject, eventdata, handles) % hObject handle to HSSPinput2 (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 HSSPinput2 as text % str2double(get(hObject,'String')) returns contents of HSSPinput2 as a double % --- Executes during object creation, after setting all properties. function HSSPinput2_CreateFcn(hObject, eventdata, handles) % hObject handle to HSSPinput2 (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 % --- Executes on button press in HSSPbrowse2. function HSSPbrowse2_Callback(hObject, eventdata, handles) % hObject handle to HSSPbrowse2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) [FileName,PathName,FilterIndex] = uigetfile('*.*','MultiSelect','off'); set(handles.HSSPinput2,'String',[PathName FileName]); % --- Executes on button press in HSSPradio3. function HSSPradio3_Callback(hObject, eventdata, handles) % hObject handle to HSSPradio3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of HSSPradio3 set(handles.HSSPradio1, 'Value',0); set(handles.HSSPradio2, 'Value',0); set(handles.HSSPradio3, 'Value',1); set(handles.HSSPinput2, 'Enable', 'off'); set(handles.HSSPinput3, 'Enable','on'); set(handles.HSSPbrowse2, 'Enable', 'off'); function HSSPinput3_Callback(hObject, eventdata, handles) % hObject handle to HSSPinput3 (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 HSSPinput3 as text % str2double(get(hObject,'String')) returns contents of HSSPinput3 as a double % --- Executes during object creation, after setting all properties. function HSSPinput3_CreateFcn(hObject, eventdata, handles) % hObject handle to HSSPinput3 (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 PDBfileInput_Callback(hObject, eventdata, handles) % hObject handle to PDBfileInput (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 PDBfileInput as text % str2double(get(hObject,'String')) returns contents of PDBfileInput as a double % --- Executes during object creation, after setting all properties. function PDBfileInput_CreateFcn(hObject, eventdata, handles) % hObject handle to PDBfileInput (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 PDBpath = [cd '\PDB\']; set(hObject,'String',PDBpath); % --- Executes on button press in PDBfileBrowse. function PDBfileBrowse_Callback(hObject, eventdata, handles) % hObject handle to PDBfileBrowse (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) [FileName,PathName,FilterIndex] = uigetfile('','MultiSelect','off'); set(handles.PDBfileInput,'String',PathName); function HSSPfileInput_Callback(hObject, eventdata, handles) % hObject handle to HSSPfileInput (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 HSSPfileInput as text % str2double(get(hObject,'String')) returns contents of HSSPfileInput as a double % --- Executes during object creation, after setting all properties. function HSSPfileInput_CreateFcn(hObject, eventdata, handles) % hObject handle to HSSPfileInput (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 HSSPpath = [cd '\hssp\']; set(hObject,'String',HSSPpath); % --- Executes on button press in HSSPfileBrowse. function HSSPfileBrowse_Callback(hObject, eventdata, handles) % hObject handle to HSSPfileBrowse (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) [FileName,PathName,FilterIndex] = uigetfile('','MultiSelect','off'); set(handles.HSSPfileInput,'String',PathName); % --- Executes on button press in ExecuteCreateExProStructButton. function ExecuteCreateExProStructButton_Callback(hObject, eventdata, handles) % hObject handle to ExecuteCreateExProStructButton (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) switch 1 case get(handles.HSSPradio1,'Value') GetMode = 1; FileList = ''; case get(handles.HSSPradio2,'Value') GetMode = 2; FileList = get(handles.HSSPinput2,'String'); case get(handles.HSSPradio3,'Value') GetMode = 3; FileList = get(handles.HSSPinput3,'String'); end PDBpath = get(handles.PDBfileInput,'String'); HSSPpath = get(handles.HSSPfileInput,'String'); ExProStructPath = get(handles.SaveExProStructFolder,'String'); DebugMode = get(handles.DebugMode,'Value'); UnknownHault = get(handles.UnknownHault,'Value'); DoValidate = get(handles.DoValidate,'Value'); ProfileOn = get(handles.DebugOn,'Value'); OnlyMissing = get(handles.OnlyMissing,'Value'); if ProfileOn, profile on end CreateExProStruct(GetMode,FileList,PDBpath,HSSPpath,ExProStructPath,DebugMode,UnknownHault,DoValidate,OnlyMissing); if ProfileOn profile viewer profile clear profile off end % --- Executes on button press in AlignmentsCheck. function AlignmentsCheck_Callback(hObject, eventdata, handles) % hObject handle to AlignmentsCheck (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of AlignmentsCheck if get(hObject,'Value'), set(handles.MinIDcut,'Enable','on'); % set(handles.Distance1, 'Value',0); % set(handles.Distance2, 'Value',0); % set(handles.Distance3, 'Value',1); % set(handles.Distance4, 'Value',0); % set(handles.Distance1, 'Enable', 'off'); % set(handles.Distance2, 'Enable', 'off'); % set(handles.Distance4, 'Enable', 'off'); else set(handles.MinIDcut,'Enable','off'); % set(handles.Distance1, 'Enable', 'on'); % set(handles.Distance2, 'Enable', 'on'); % set(handles.Distance4, 'Enable', 'on'); end % --- Executes on button press in CommulativeCheck. function CommulativeCheck_Callback(hObject, eventdata, handles) % hObject handle to CommulativeCheck (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of CommulativeCheck % --- Executes on button press in pushbutton5. function pushbutton5_Callback(hObject, eventdata, handles) % hObject handle to pushbutton5 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) function ExProStructFolderPath_Callback(hObject, eventdata, handles) % hObject handle to ExProStructFolderPath (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 ExProStructFolderPath as text % str2double(get(hObject,'String')) returns contents of ExProStructFolderPath as a double % --- Executes during object creation, after setting all properties. function ExProStructFolderPath_CreateFcn(hObject, eventdata, handles) % hObject handle to ExProStructFolderPath (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 ExProStructFP = [cd '\ExProStruct\']; set(hObject,'String',ExProStructFP); % --- Executes on button press in ExProStructFolderBrowseButton. function ExProStructFolderBrowseButton_Callback(hObject, eventdata, handles) % hObject handle to ExProStructFolderBrowseButton (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) [FileName,PathName,FilterIndex] = uigetfile('','MultiSelect','off'); set(handles.ExProStructFolderPath,'String',PathName); % --- Executes on button press in UpdateSelection. function UpdateSelection_Callback(hObject, eventdata, handles) % hObject handle to UpdateSelection (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) switch 1 case get(handles.ExProStructRadio1,'Value') GetMode = 1; ChainsSpecified = 0; FileList = ''; case get(handles.ExProStructRadio2,'Value') GetMode = 2; ChainsSpecified = get(handles.ChainsSpecified,'Value'); FileList = get(handles.ExProStructInput2,'String'); case get(handles.ExProStructRadio3,'Value') GetMode = 3; ChainsSpecified = 0; FileList = get(handles.ExProStructInput3,'String'); end ExProStructPath = get(handles.ExProStructFolderPath,'String'); UpdateText = DoUpdateSelection(GetMode,FileList,ExProStructPath); set(handles.CurrentSelection,'String',UpdateText); % --- Executes during object creation, after setting all properties. function edit15_CreateFcn(hObject, eventdata, handles) % hObject handle to edit15 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles empty - handles not created until after all CreateFcns called function AcMin_Callback(hObject, eventdata, handles) % hObject handle to AcMin (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 AcMin as text % str2double(get(hObject,'String')) returns contents of AcMin as a double % --- Executes during object creation, after setting all properties. function AcMin_CreateFcn(hObject, eventdata, handles) % hObject handle to AcMin (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 AcMax_Callback(hObject, eventdata, handles) % hObject handle to AcMax (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 AcMax as text % str2double(get(hObject,'String')) returns contents of AcMax as a double % --- Executes during object creation, after setting all properties. function AcMax_CreateFcn(hObject, eventdata, handles) % hObject handle to AcMax (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 AcRes_Callback(hObject, eventdata, handles) % hObject handle to AcRes (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 AcRes as text % str2double(get(hObject,'String')) returns contents of AcRes as a double % --- Executes during object creation, after setting all properties. function AcRes_CreateFcn(hObject, eventdata, handles) % hObject handle to AcRes (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 DistMin_Callback(hObject, eventdata, handles) % hObject handle to DistMin (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 DistMin as text % str2double(get(hObject,'String')) returns contents of DistMin as a double % --- Executes during object creation, after setting all properties. function DistMin_CreateFcn(hObject, eventdata, handles) % hObject handle to DistMin (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 DistMax_Callback(hObject, eventdata, handles) % hObject handle to DistMax (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 DistMax as text % str2double(get(hObject,'String')) returns contents of DistMax as a double % --- Executes during object creation, after setting all properties. function DistMax_CreateFcn(hObject, eventdata, handles) % hObject handle to DistMax (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 DistRes_Callback(hObject, eventdata, handles) % hObject handle to DistRes (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 DistRes as text % str2double(get(hObject,'String')) returns contents of DistRes as a double % --- Executes during object creation, after setting all properties. function DistRes_CreateFcn(hObject, eventdata, handles) % hObject handle to DistRes (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 % --- Executes on button press in ExecuteCreateDataset. function ExecuteCreateDataset_Callback(hObject, eventdata, handles) % hObject handle to ExecuteCreateDataset (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) switch 1 case get(handles.ExProStructRadio1,'Value') GetMode = 1; ChainsSpecified = 0; FileList = ''; case get(handles.ExProStructRadio2,'Value') GetMode = 2; ChainsSpecified = get(handles.ChainsSpecified,'Value'); FileList = get(handles.ExProStructInput2,'String'); case get(handles.ExProStructRadio3,'Value') GetMode = 3; ChainsSpecified = 0; FileList = get(handles.ExProStructInput3,'String'); end ExProStructPath = get(handles.ExProStructFolderPath,'String'); AcMin = str2num(get(handles.AcMin,'String'))/100; AcMax = str2num(get(handles.AcMax,'String'))/100; AcRes = str2num(get(handles.AcRes,'String'))/100; DistMin = str2num(get(handles.DistMin,'String')); DistMax = str2num(get(handles.DistMax,'String')); DistRes = str2num(get(handles.DistRes,'String')); CLMin = str2num(get(handles.CLmin,'String')); CLMax = str2num(get(handles.CLmax,'String')); CLRes = str2num(get(handles.CLres,'String')); MinIDcut = str2num(get(handles.MinIDcut,'String'))/100; switch 1 case get(handles.Distance1,'Value') DistMode = 1; case get(handles.Distance2,'Value') DistMode = 2; case get(handles.Distance3,'Value') DistMode = 3; case get(handles.Distance4,'Value') DistMode = 4; end MultiChain = get(handles.MultiChainCheck,'Value'); UseAlign = get(handles.AlignmentsCheck,'Value'); UseComulative = get(handles.CommulativeCheck,'Value'); OutputFolder = get(handles.OutputFolder,'String'); OutputName = get(handles.OutputName,'String'); DebugMode = get(handles.DebugMode,'Value'); UnknownHault = get(handles.UnknownHault,'Value'); DoValidate = get(handles.DoValidate,'Value'); ProfileOn = get(handles.DebugOn,'Value'); CreateIndex = get(handles.CreateIndexSet,'Value'); IncludeFromOther = get(handles.IncludeFromOtherCheck,'Value'); ReferencePath = get(handles.ReferencePath,'String'); if ProfileOn, profile on end %if frac(sym((AcMax-AcMin)/AcRes)) ~= 0, % fprintf(1,'Difference between AcMax and AcMin must be divisible by AcRes'); %elseif frac(sym((DistMax-DistMin)/DistRes)) ~= 0, % fprintf(1,'Difference between DistMax and DistMin must be divisible by DistRes'); %else OutputPath = [OutputFolder OutputName '.mat']; fprintf(1,'Creating dataset file and saving preliminary variables.\n'); save(OutputPath,'AcMin','AcMax','AcRes','DistMin','DistMax','DistRes','DistMode','UseAlign','UseComulative','MinIDcut','CLMin','CLMax','CLRes','MultiChain'); fprintf(1,'Datasetfile created.\n'); if get(handles.checkbox10,'Value') ScrambleMode = 'None'; ScrambleNum = 1; CreateDataset(GetMode,FileList,ExProStructPath,AcMin,AcMax,AcRes,DistMin,DistMax,DistRes,DistMode,UseAlign,UseComulative,MinIDcut,CLMin,CLMax,CLRes,MultiChain,OutputPath,DebugMode,UnknownHault,DoValidate,ScrambleMode,ScrambleNum,CreateIndex,ChainsSpecified); end if get(handles.checkbox11,'Value'), if IncludeFromOther, load(ReferencePath,'Naboref'); save(OutputPath,'-append','Naboref'); clear Naboref else if get(handles.checkbox9,'Value'), ScrambleMode = 'SA'; else ScrambleMode = 'All'; end ScrambleNum = str2num(get(handles.edit36,'String')); CreateDataset(GetMode,FileList,ExProStructPath,AcMin,AcMax,AcRes,DistMin,DistMax,DistRes,DistMode,UseAlign,UseComulative,MinIDcut,CLMin,CLMax,CLRes,MultiChain,OutputPath,DebugMode,UnknownHault,DoValidate,ScrambleMode,ScrambleNum,0,ChainsSpecified); end end %end if ProfileOn profile viewer profile clear profile off end % --- Executes on button press in HSSPradio1. function HSSPradio1_Callback(hObject, eventdata, handles) % hObject handle to HSSPradio1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of HSSPradio1 set(handles.HSSPradio1, 'Value',1); set(handles.HSSPradio2, 'Value',0); set(handles.HSSPradio3, 'Value',0); set(handles.HSSPinput2, 'Enable', 'off'); set(handles.HSSPinput3, 'Enable','off'); set(handles.HSSPbrowse2, 'Enable', 'off'); function SaveExProStructFolder_Callback(hObject, eventdata, handles) % hObject handle to SaveExProStructFolder (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 SaveExProStructFolder as text % str2double(get(hObject,'String')) returns contents of SaveExProStructFolder as a double % --- Executes during object creation, after setting all properties. function SaveExProStructFolder_CreateFcn(hObject, eventdata, handles) % hObject handle to SaveExProStructFolder (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 HSSPpath = [cd '\ExProStruct\']; set(hObject,'String',HSSPpath); % --- Executes on button press in ExProStructSaveBrowse. function ExProStructSaveBrowse_Callback(hObject, eventdata, handles) % hObject handle to ExProStructSaveBrowse (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) [FileName,PathName,FilterIndex] = uigetfile('','MultiSelect','off'); set(handles.SaveExProStructFolder,'String',PathName); % --- Executes on button press in Distance1. function Distance1_Callback(hObject, eventdata, handles) % hObject handle to Distance1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of Distance1 set(handles.Distance1, 'Value',1); set(handles.Distance2, 'Value',0); set(handles.Distance3, 'Value',0); set(handles.Distance4, 'Value',0); % --- Executes on button press in Distance2. function Distance2_Callback(hObject, eventdata, handles) % hObject handle to Distance2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of Distance2 set(handles.Distance1, 'Value',0); set(handles.Distance2, 'Value',1); set(handles.Distance3, 'Value',0); set(handles.Distance4, 'Value',0); % --- Executes on button press in Distance3. function Distance3_Callback(hObject, eventdata, handles) % hObject handle to Distance3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of Distance3 set(handles.Distance1, 'Value',0); set(handles.Distance2, 'Value',0); set(handles.Distance3, 'Value',1); set(handles.Distance4, 'Value',0); % --- Executes on button press in Distance4. function Distance4_Callback(hObject, eventdata, handles) % hObject handle to Distance4 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of Distance4 set(handles.Distance1, 'Value',0); set(handles.Distance2, 'Value',0); set(handles.Distance3, 'Value',0); set(handles.Distance4, 'Value',1); % --- Executes on button press in ExProStructRadio2. function ExProStructRadio2_Callback(hObject, eventdata, handles) % hObject handle to ExProStructRadio2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of ExProStructRadio2 set(handles.ExProStructRadio1, 'Value',0); set(handles.ExProStructRadio2, 'Value',1); set(handles.ExProStructRadio3, 'Value',0); set(handles.ExProStructInput2, 'Enable', 'on'); set(handles.ExProStructInput3, 'Enable','off'); set(handles.ExProStructBrowse2, 'Enable', 'on'); set(handles.ChainsSpecified, 'Enable', 'on'); function ExProStructInput2_Callback(hObject, eventdata, handles) % hObject handle to ExProStructInput2 (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 ExProStructInput2 as text % str2double(get(hObject,'String')) returns contents of ExProStructInput2 as a double % --- Executes during object creation, after setting all properties. function ExProStructInput2_CreateFcn(hObject, eventdata, handles) % hObject handle to ExProStructInput2 (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 % --- Executes on button press in ExProStructBrowse2. function ExProStructBrowse2_Callback(hObject, eventdata, handles) % hObject handle to ExProStructBrowse2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) [FileName,PathName,FilterIndex] = uigetfile('*.*','MultiSelect','off'); set(handles.ExProStructInput2,'String',[PathName FileName]); % --- Executes on button press in ExProStructRadio3. function ExProStructRadio3_Callback(hObject, eventdata, handles) % hObject handle to ExProStructRadio3 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of ExProStructRadio3 set(handles.ExProStructRadio1, 'Value',0); set(handles.ExProStructRadio2, 'Value',0); set(handles.ExProStructRadio3, 'Value',1); set(handles.ExProStructInput2, 'Enable', 'off'); set(handles.ExProStructInput3, 'Enable','on'); set(handles.ExProStructBrowse2, 'Enable', 'off'); set(handles.ChainsSpecified, 'Enable', 'off'); function ExProStructInput3_Callback(hObject, eventdata, handles) % hObject handle to ExProStructInput3 (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 ExProStructInput3 as text % str2double(get(hObject,'String')) returns contents of ExProStructInput3 as a double % --- Executes during object creation, after setting all properties. function ExProStructInput3_CreateFcn(hObject, eventdata, handles) % hObject handle to ExProStructInput3 (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 % --- Executes on button press in ExProStructRadio1. function ExProStructRadio1_Callback(hObject, eventdata, handles) % hObject handle to ExProStructRadio1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of ExProStructRadio1 set(handles.ExProStructRadio1, 'Value',1); set(handles.ExProStructRadio2, 'Value',0); set(handles.ExProStructRadio3, 'Value',0); set(handles.ExProStructInput2, 'Enable', 'off'); set(handles.ExProStructInput3, 'Enable','off'); set(handles.ExProStructBrowse2, 'Enable', 'off'); set(handles.ChainsSpecified, 'Enable', 'off'); function MinIDcut_Callback(hObject, eventdata, handles) % hObject handle to MinIDcut (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 MinIDcut as text % str2double(get(hObject,'String')) returns contents of MinIDcut as a double % --- Executes during object creation, after setting all properties. function MinIDcut_CreateFcn(hObject, eventdata, handles) % hObject handle to MinIDcut (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 CLmin_Callback(hObject, eventdata, handles) % hObject handle to CLmin (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 CLmin as text % str2double(get(hObject,'String')) returns contents of CLmin as a double % --- Executes during object creation, after setting all properties. function CLmin_CreateFcn(hObject, eventdata, handles) % hObject handle to CLmin (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 CLmax_Callback(hObject, eventdata, handles) % hObject handle to CLmax (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 CLmax as text % str2double(get(hObject,'String')) returns contents of CLmax as a double % --- Executes during object creation, after setting all properties. function CLmax_CreateFcn(hObject, eventdata, handles) % hObject handle to CLmax (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 CLres_Callback(hObject, eventdata, handles) % hObject handle to CLres (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 CLres as text % str2double(get(hObject,'String')) returns contents of CLres as a double % --- Executes during object creation, after setting all properties. function CLres_CreateFcn(hObject, eventdata, handles) % hObject handle to CLres (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 % --- Executes on button press in MultiChainCheck. function MultiChainCheck_Callback(hObject, eventdata, handles) % hObject handle to MultiChainCheck (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of MultiChainCheck function OutputFolder_Callback(hObject, eventdata, handles) % hObject handle to OutputFolder (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 OutputFolder as text % str2double(get(hObject,'String')) returns contents of OutputFolder as a double % --- Executes during object creation, after setting all properties. function OutputFolder_CreateFcn(hObject, eventdata, handles) % hObject handle to OutputFolder (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 DatasetPath = [cd '\Dataset\']; set(hObject,'String',DatasetPath); % --- Executes on button press in pushbutton13. function pushbutton13_Callback(hObject, eventdata, handles) % hObject handle to pushbutton13 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) [FileName,PathName,FilterIndex] = uigetfile('*.*','MultiSelect','off'); set(handles.OutputFolder,'String',[PathName FileName]); function OutputName_Callback(hObject, eventdata, handles) % hObject handle to OutputName (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 OutputName as text % str2double(get(hObject,'String')) returns contents of OutputName as a double % --- Executes during object creation, after setting all properties. function OutputName_CreateFcn(hObject, eventdata, handles) % hObject handle to OutputName (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 % --- Executes on button press in DebugMode. function DebugMode_Callback(hObject, eventdata, handles) % hObject handle to DebugMode (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of DebugMode % --- Executes on button press in UnknownHault. function UnknownHault_Callback(hObject, eventdata, handles) % hObject handle to UnknownHault (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of UnknownHault % --- Executes on button press in DoValidate. function DoValidate_Callback(hObject, eventdata, handles) % hObject handle to DoValidate (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of DoValidate % --- Executes on button press in DebugOn. function DebugOn_Callback(hObject, eventdata, handles) % hObject handle to DebugOn (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of DebugOn % --- Executes on button press in OnlyMissing. function OnlyMissing_Callback(hObject, eventdata, handles) % hObject handle to OnlyMissing (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of OnlyMissing function ConvertRawDataset_Callback(hObject, eventdata, handles) % hObject handle to ConvertRawDataset (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 ConvertRawDataset as text % str2double(get(hObject,'String')) returns contents of ConvertRawDataset as a double % --- Executes during object creation, after setting all properties. function ConvertRawDataset_CreateFcn(hObject, eventdata, handles) % hObject handle to ConvertRawDataset (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 ExProStructFP = [cd '\Dataset\']; set(hObject,'String',ExProStructFP); % --- Executes on button press in ConvertBrowse1. function ConvertBrowse1_Callback(hObject, eventdata, handles) % hObject handle to ConvertBrowse1 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) [FileName,PathName,FilterIndex] = uigetfile('','MultiSelect','off'); set(handles.ConvertRawDataset,'String',[PathName FileName]); function ConvertOutputFolder_Callback(hObject, eventdata, handles) % hObject handle to ConvertOutputFolder (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 ConvertOutputFolder as text % str2double(get(hObject,'String')) returns contents of ConvertOutputFolder as a double % --- Executes during object creation, after setting all properties. function ConvertOutputFolder_CreateFcn(hObject, eventdata, handles) % hObject handle to ConvertOutputFolder (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 ExProStructFP = [cd '\Dataset\']; set(hObject,'String',ExProStructFP); % --- Executes on button press in ConvertBrowse2. function ConvertBrowse2_Callback(hObject, eventdata, handles) % hObject handle to ConvertBrowse2 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) [FileName,PathName,FilterIndex] = uigetfile('','MultiSelect','off'); set(handles.ConvertOutputFolder,'String',PathName); function ConvertOutputName_Callback(hObject, eventdata, handles) % hObject handle to ConvertOutputName (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 ConvertOutputName as text % str2double(get(hObject,'String')) returns contents of ConvertOutputName as a double % --- Executes during object creation, after setting all properties. function ConvertOutputName_CreateFcn(hObject, eventdata, handles) % hObject handle to ConvertOutputName (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 % --- Executes on button press in ConvertExecute. function ConvertExecute_Callback(hObject, eventdata, handles) % hObject handle to ConvertExecute (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) ConvertRawDataset = get(handles.ConvertRawDataset,'String'); ConvertOutputFolder = get(handles.ConvertOutputFolder,'String'); ConvertOutputName = get(handles.ConvertOutputName,'String'); ConvertOutputPath = [ConvertOutputFolder ConvertOutputName '.mat']; Converter(ConvertRawDataset,ConvertOutputPath); function edit36_Callback(hObject, eventdata, handles) % hObject handle to edit36 (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 edit36 as text % str2double(get(hObject,'String')) returns contents of edit36 as a double % --- Executes during object creation, after setting all properties. function edit36_CreateFcn(hObject, eventdata, handles) % hObject handle to edit36 (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 % --- Executes on button press in checkbox9. function checkbox9_Callback(hObject, eventdata, handles) % hObject handle to checkbox9 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of checkbox9 % --- Executes on button press in checkbox10. function checkbox10_Callback(hObject, eventdata, handles) % hObject handle to checkbox10 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of checkbox10 if ~ get(handles.checkbox11,'Value'), set(handles.checkbox10,'Value',1); end % --- Executes on button press in checkbox11. function checkbox11_Callback(hObject, eventdata, handles) % hObject handle to checkbox11 (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of checkbox11 if ~ get(handles.checkbox10,'Value'), set(handles.checkbox11,'Value',1); end if get(handles.checkbox11,'Value'), set(handles.IncludeFromOtherCheck,'Enable','on'); if get(handles.IncludeFromOtherCheck,'Value'), set(handles.ReferencePath,'Enable','on'); set(handles.edit36,'Enable','off'); set(handles.checkbox9,'Enable','off'); else set(handles.ReferencePath,'Enable','off'); set(handles.edit36,'Enable','on'); set(handles.checkbox9,'Enable','on'); end else set(handles.IncludeFromOtherCheck,'Enable','off'); set(handles.ReferencePath,'Enable','off'); set(handles.edit36,'Enable','off'); set(handles.checkbox9,'Enable','off'); end % --- Executes on button press in CreateIndexSet. function CreateIndexSet_Callback(hObject, eventdata, handles) % hObject handle to CreateIndexSet (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of CreateIndexSet % --- Executes on button press in IncludeFromOtherCheck. function IncludeFromOtherCheck_Callback(hObject, eventdata, handles) % hObject handle to IncludeFromOtherCheck (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of IncludeFromOtherCheck if get(handles.IncludeFromOtherCheck,'Value'), set(handles.ReferencePath,'Enable','on'); set(handles.edit36,'Enable','off'); set(handles.checkbox9,'Enable','off'); else set(handles.ReferencePath,'Enable','off'); set(handles.edit36,'Enable','on'); set(handles.checkbox9,'Enable','on'); end function ReferencePath_Callback(hObject, eventdata, handles) % hObject handle to ReferencePath (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 ReferencePath as text % str2double(get(hObject,'String')) returns contents of ReferencePath as a double % --- Executes during object creation, after setting all properties. function ReferencePath_CreateFcn(hObject, eventdata, handles) % hObject handle to ReferencePath (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 % --- Executes on button press in BrowseReference. function BrowseReference_Callback(hObject, eventdata, handles) % hObject handle to BrowseReference (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) [FileName,PathName,FilterIndex] = uigetfile('*.*','MultiSelect','off'); set(handles.ReferencePath,'String',[PathName FileName]); % --- Executes on button press in ChainsSpecified. function ChainsSpecified_Callback(hObject, eventdata, handles) % hObject handle to ChainsSpecified (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % Hint: get(hObject,'Value') returns toggle state of ChainsSpecified %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%THIS IS WHERE THE MANUAL PROGRAMMING STARTS \SBH%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function CreateExProStruct(GetMode,FileList,PDBpath,HSSPpath,ExProStructPath,DebugMode,UnknownHault,DoValidate,OnlyMissing) %Function loads the HSSPload and PDBload and saves the combined output to %file for every file in argument list HSSPfileList \SBH global ErrorCount %Keeps track of certain types of errors to determine if logfile shold be rewritten or appended ErrorCount(1:2) = 0; %Sets starting values to 0, when error occures, switches value to 1 for certain error type OldFiles = dir(ExProStructPath); %Switching between the three modes for inputs: 1 - All files in folder, 2 - %List of files, 3 - files written in field Statusfile = fopen('Status.txt','w'); IgnoredFiles = 0; SavedFiles = 0; switch GetMode case 1 HSSPdir = dir(HSSPpath); TotalFiles = size(HSSPdir,1)-2; fprintf(1,'-----Creating ExProStruct from %d entries.-----\n',TotalFiles) tic %Do for every file in the directory for i = 3:size(HSSPdir,1); ThisHSSP = HSSPdir(i).name; Exists = 0; for j = 3:size(OldFiles,1); if strcmp(OldFiles(j).name(1:4),upper(ThisHSSP(1:4))) Exists = 1; break end end if ~ (OnlyMissing && Exists) fprintf(1,'Loading %s, file %d of %d. %d percent complete.\n',ThisHSSP,i-2,TotalFiles,round((i-3)/TotalFiles*100)); try fprintf(1,'Loading HSSP data.\n'); [PDBid,ExProStruct] = HSSPload([HSSPpath ThisHSSP]); %Load the HSSP file catch ME idSegLast = char(regexp(ME.identifier, '(?<=:)\w+$', 'match')); switch idSegLast, case 'InvalidFid' Logfile = ErrorLogging(1,['File not found:' ThisHSSP]); fprintf(1, ['Invalid HSSP ID ' ThisHSSP '. Saved to log ' regexprep(Logfile,'\','\\\\') '\n']); case {'nonExistentField', 'alignmentMismatch', 'subsassignnumelmismatch','index_assign_element_count_mismatch','badsubscript','unassignedOutputs'} Logfile = ErrorLogging(1,['Corrupted file :' ThisHSSP]); fprintf(1, ['HSSP file ' ThisHSSP ' is corrupted. Saved to log ' regexprep(Logfile,'\','\\\\') '\n']); otherwise if UnknownHault, for p = 1:length(ME.stack), errmsg = ['Error encountered in line ' num2str(ME.stack(p).line) ' in file ' char(regexp(ME.stack(p).file,'\w+\.\w+$','match')) '\n']; fprintf(1,sprintf(errmsg)); end Logfile = ErrorLogging(1,['Unknown error in file: ' ThisHSSP]); fprintf(1,'Unknown error encountered, haulting for manual debugging mode. Type "ME" for error information. "return" to proceed with next file.\n'); keyboard else Logfile = ErrorLogging(1,['File not found:' ThisHSSP]); fprintf(1, ['Unknown error in HSSP ID ' ThisHSSP '. Saved to log ' regexprep(Logfile,'\','\\\\') '\n']); end end if DebugMode, for p = 1:length(ME.stack), errmsg = ['Error encountered in line ' num2str(ME.stack(p).line) ' in file ' char(regexp(ME.stack(p).file,'\w+\.\w+$','match')) '\n']; fprintf(1,sprintf(errmsg)); end fprintf(1,'Entering manual debugging mode. Type "ME" for error information. "return" to proceed with next file.\n'); keyboard end clear ExProStruct IgnoredFiles = IgnoredFiles + 1; continue end try fprintf(1,'Loading PDB data.\n'); ExProStruct = PDBload([PDBpath 'pdb' PDBid '.ent'],ExProStruct); %Load the PDB file catch ME idSegLast = char(regexp(ME.identifier, '(?<=:)\w+$', 'match')); switch idSegLast, case 'BadPDBFile' Logfile = ErrorLogging(2,['File not found:' PDBid]); fprintf(1, ['Invalid PDB ID ' PDBid '. Saved to log ' regexprep(Logfile,'\','\\\\') '\n']); otherwise if UnknownHault, for p = 1:length(ME.stack), errmsg = ['Error encountered in line ' num2str(ME.stack(p).line) ' in file ' char(regexp(ME.stack(p).file,'\w+\.\w+$','match')) '\n']; fprintf(1,sprintf(errmsg)); end Logfile = ErrorLogging(1,['Unknown error in file: ' ThisHSSP]); fprintf(1,'Unknown error encountered, haulting for manual debugging mode. Type "ME" for error information. "return" to proceed with next file.\n'); keyboard else Logfile = ErrorLogging(1,['File not found:' ThisHSSP]); fprintf(1, ['Unknown error in HSSP ID ' ThisHSSP '. Saved to log ' regexprep(Logfile,'\','\\\\') '\n']); end end if DebugMode, for p = 1:length(ME.stack), errmsg = ['Error encountered in line ' num2str(ME.stack(p).line) ' in file ' char(regexp(ME.stack(p).file,'\w+\.\w+$','match')) '\n']; fprintf(1,sprintf(errmsg)); end fprintf(1,'Entering manual debugging mode. Type "ME" for error information. "return" to proceed with next file.\n'); keyboard end clear ExProStruct IgnoredFiles = IgnoredFiles + 1; continue end if DoValidate, try fprintf(1,'Validating structure.\n'); ExProStruct = ValidateExProStruct(ExProStruct); catch ME idSegLast = char(regexp(ME.identifier, '(?<=:)\w+$', 'match')); switch idSegLast, case {'CAundef','Atom'} Logfile = ErrorLogging(2,['Corrupted file: ' PDBid]); fprintf(1, ['PDB file ' PDBid ' is corrupted. ' ME.message '. Saved to log ' regexprep(Logfile,'\','\\\\') '\n']); case {'ResType','SecStruct','SA','PDBres','Aligns'} Logfile = ErrorLogging(1,['Corrupted file :' ThisHSSP]); fprintf(1, ['HSSP file ' ThisHSSP ' is corrupted. ' ME.message '. Saved to log ' regexprep(Logfile,'\','\\\\') '\n']); otherwise if UnknownHault, for p = 1:length(ME.stack), errmsg = ['Error encountered in line ' num2str(ME.stack(p).line) ' in file ' char(regexp(ME.stack(p).file,'\w+\.\w+$','match')) '\n']; fprintf(1,sprintf(errmsg)); end Logfile = ErrorLogging(1,['Unknown error in file: ' ThisHSSP]); fprintf(1,'Unknown error encountered, haulting for manual debugging mode. Type "ME" for error information. "return" to proceed with next file.\n'); keyboard else Logfile = ErrorLogging(1,['File not found:' ThisHSSP]); fprintf(1, ['Unknown error in HSSP ID ' ThisHSSP '. Saved to log ' regexprep(Logfile,'\','\\\\') '\n']); end end if DebugMode, for p = 1:length(ME.stack), errmsg = ['Error encountered in line ' num2str(ME.stack(p).line) ' in file ' char(regexp(ME.stack(p).file,'\w+\.\w+$','match')) '\n']; fprintf(1,sprintf(errmsg)); end fprintf(1,'Entering manual debugging mode. Type "ME" for error information. "return" to proceed with next file.\n'); keyboard end clear ExProStruct IgnoredFiles = IgnoredFiles + 1; continue end end save([ExProStructPath PDBid '.mat'],'ExProStruct'); SavedFiles = SavedFiles + 1; elapsed = toc; tleft = elapsed*(TotalFiles-(i-2))/(i-2); fprintf(1,'ExProStruct has been successfully created and saved for %s.\nElapsed time: %s.\nEstimated time left: %s.\n%d files successfully saved. %d files ignored due to errors.\n\n', PDBid,sec2time(elapsed),sec2time(tleft),SavedFiles,IgnoredFiles); fprintf(Statusfile,'ExProStruct has been successfully created and saved for %s.\nElapsed time: %s.\nEstimated time left: %s.\n%d files successfully saved. %d files ignored due to errors.\n\n', PDBid,sec2time(elapsed),sec2time(tleft),SavedFiles,IgnoredFiles); else fprintf(1,'ExProStruct for %s already exists\n',ThisHSSP); end clear ExProStruct end case 2 FileOfIDs = fopen(FileList); TotalFiles = 0 while 1 if ~ischar(Line) break end fgetl(FileOfIDs) TotalFiles = TotalFiles + 1; end fclose(FileOfIDs); tic keyboard fprintf(1,'-----Creating ExProStruct from %d entries.-----\n',TotalFiles) FileOfIDs = fopen(FileList); Line = fgetl(FileOfIDs); i = 1; while 1 if ~ischar(Line) break end fprintf(1,'Loading %s, file %d of %d. %d percent complete.\n',ThisHSSP,i,TotalFiles,round((i-1)/TotalFiles*100)); ThisHSSP = Line Exists = 0; for j = 3:size(OldFiles,1); if strcmp(OldFiles(j).name(1:4),upper(ThisHSSP(1:4))) Exists = 1; break end end if ~ (OnlyMissing && Exists) i = i + 1 try fprintf(1,'Loading HSSP data.\n'); [PDBid,ExProStruct] = HSSPload([HSSPpath ThisHSSP '.hssp']); catch ME idSegLast = char(regexp(ME.identifier, '(?<=:)\w+$', 'match')); switch idSegLast, case 'InvalidFid' Logfile = ErrorLogging(1,['File not found:' ThisHSSP]); fprintf(1, ['Invalid HSSP ID ' ThisHSSP '. Saved to log ' regexprep(Logfile,'\','\\\\') '\n']); case {'nonExistentField', 'alignmentMismatch', 'subsassignnumelmismatch','index_assign_element_count_mismatch','badsubscript','unassignedOutputs'} Logfile = ErrorLogging(1,['Corrupted file :' ThisHSSP]); fprintf(1, ['HSSP file ' ThisHSSP ' is corrupted. Saved to log ' regexprep(Logfile,'\','\\\\') '\n']); otherwise if UnknownHault, for p = 1:length(ME.stack), errmsg = ['Error encountered in line ' num2str(ME.stack(p).line) ' in file ' char(regexp(ME.stack(p).file,'\w+\.\w+$','match')) '\n']; fprintf(1,sprintf(errmsg)); end Logfile = ErrorLogging(1,['Unknown error in file: ' ThisHSSP]); fprintf(1,'Unknown error encountered, haulting for manual debugging mode. Type "ME" for error information. "return" to proceed with next file.\n'); keyboard else Logfile = ErrorLogging(1,['File not found:' ThisHSSP]); fprintf(1, ['Unknown error in HSSP ID ' ThisHSSP '. Saved to log ' regexprep(Logfile,'\','\\\\') '\n']); end end if DebugMode, for p = 1:length(ME.stack), errmsg = ['Error encountered in line ' num2str(ME.stack(p).line) ' in file ' char(regexp(ME.stack(p).file,'\w+\.\w+$','match')) '\n']; fprintf(1,sprintf(errmsg)); end fprintf(1,'Entering manual debugging mode. Type "ME" for error information. "return" to proceed with next file.\n'); keyboard end clear ExProStruct IgnoredFiles = IgnoredFiles + 1; continue end try fprintf(1,'Loading PDB data.\n'); ExProStruct = PDBload([PDBpath 'pdb' PDBid '.ent'],ExProStruct); catch ME idSegLast = char(regexp(ME.identifier, '(?<=:)\w+$', 'match')); switch idSegLast, case 'BadPDBFile' Logfile = ErrorLogging(2,['File not found:' PDBid]); fprintf(1, ['Invalid PDB ID ' PDBid '. Saved to log ' regexprep(Logfile,'\','\\\\') '\n']); otherwise if UnknownHault, for p = 1:length(ME.stack), errmsg = ['Error encountered in line ' num2str(ME.stack(p).line) ' in file ' char(regexp(ME.stack(p).file,'\w+\.\w+$','match')) '\n']; fprintf(1,sprintf(errmsg)); end Logfile = ErrorLogging(1,['Unknown error in file: ' ThisHSSP]); fprintf(1,'Unknown error encountered, haulting for manual debugging mode. Type "ME" for error information. "return" to proceed with next file.\n'); keyboard else Logfile = ErrorLogging(1,['File not found:' ThisHSSP]); fprintf(1, ['Unknown error in HSSP ID ' ThisHSSP '. Saved to log ' regexprep(Logfile,'\','\\\\') '\n']); end end if DebugMode, for p = 1:length(ME.stack), errmsg = ['Error encountered in line ' num2str(ME.stack(p).line) ' in file ' char(regexp(ME.stack(p).file,'\w+\.\w+$','match')) '\n']; fprintf(1,sprintf(errmsg)); end fprintf(1,'Entering manual debugging mode. Type "ME" for error information. "return" to proceed with next file.\n'); keyboard end clear ExProStruct IgnoredFiles = IgnoredFiles + 1; continue end if DoValidate, try fprintf(1,'Validating structure.\n'); ExProStruct = ValidateExProStruct(ExProStruct); catch ME idSegLast = char(regexp(ME.identifier, '(?<=:)\w+$', 'match')); switch idSegLast, case {'CAundef','Atom'} Logfile = ErrorLogging(2,['Corrupted file: ' PDBid]); fprintf(1, ['PDB file ' PDBid ' is corrupted. ' ME.message '. Saved to log ' regexprep(Logfile,'\','\\\\') '\n']); case {'ResType','SecStruct','SA','PDBres','Aligns'} Logfile = ErrorLogging(1,['Corrupted file :' ThisHSSP]); fprintf(1, ['HSSP file ' ThisHSSP ' is corrupted. ' ME.message '. Saved to log ' regexprep(Logfile,'\','\\\\') '\n']); otherwise if UnknownHault, for p = 1:length(ME.stack), errmsg = ['Error encountered in line ' num2str(ME.stack(p).line) ' in file ' char(regexp(ME.stack(p).file,'\w+\.\w+$','match')) '\n']; fprintf(1,sprintf(errmsg)); end Logfile = ErrorLogging(1,['Unknown error in file: ' ThisHSSP]); fprintf(1,'Unknown error encountered, haulting for manual debugging mode. Type "ME" for error information. "return" to proceed with next file.\n'); keyboard else Logfile = ErrorLogging(1,['File not found:' ThisHSSP]); fprintf(1, ['Unknown error in HSSP ID ' ThisHSSP '. Saved to log ' regexprep(Logfile,'\','\\\\') '\n']); end end if DebugMode, for p = 1:length(ME.stack), errmsg = ['Error encountered in line ' num2str(ME.stack(p).line) ' in file ' char(regexp(ME.stack(p).file,'\w+\.\w+$','match')) '\n']; fprintf(1,sprintf(errmsg)); end fprintf(1,'Entering manual debugging mode. Type "ME" for error information. "return" to proceed with next file.\n'); keyboard end clear ExProStruct IgnoredFiles = IgnoredFiles + 1; continue end end save([ExProStructPath PDBid '.mat'],'ExProStruct'); SavedFiles = SavedFiles + 1; elapsed = toc; tleft = elapsed*(TotalFiles-i)/i; fprintf(1,'ExProStruct has been successfully created and saved for %s.\nElapsed time: %s.\nEstimated time left: %s.\n%d files successfully saved. %d files ignored due to errors.\n\n', PDBid,sec2time(elapsed),sec2time(tleft),SavedFiles,IgnoredFiles); fprintf(Statusfile,'ExProStruct has been successfully created and saved for %s.\nElapsed time: %s.\nEstimated time left: %s.\n%d files successfully saved. %d files ignored due to errors.\n\n', PDBid,sec2time(elapsed),sec2time(tleft),SavedFiles,IgnoredFiles); else fprintf(1,'ExProStruct for %s already exists\n',ThisHSSP); end clear ExProStruct Line = fgetl(FileOfIDs); end fclose(FileOfIDs); case 3 SeperateIndices = findstr(FileList,';'); TotalFiles = length(SeperateIndices) + 1; tic fprintf(1,'-----Creating ExProStruct from %d entries.-----\n',TotalFiles) for i = 0:length(SeperateIndices), if length(SeperateIndices) == 0, ThisHSSP = FileList; elseif i == 0, ThisHSSP = FileList(1:SeperateIndices(1)-1); elseif i == length(SeperateIndices), ThisHSSP = FileList(SeperateIndices(i)+1:length(FileList)); else ThisHSSP = FileList(SeperateIndices(i)+1:SeperateIndices(i+1)-1); end Exists = 0; for j = 3:size(OldFiles,1); if strcmp(OldFiles(j).name(1:4),upper(ThisHSSP(1:4))) Exists = 1; break end end if ~ (OnlyMissing && Exists) fprintf(1,'Loading %s, file %d of %d. %d percent complete.\n',ThisHSSP,i+1,TotalFiles,round((i)/TotalFiles*100)); try fprintf(1,'Loading HSSP data.\n'); [PDBid,ExProStruct] = HSSPload([HSSPpath ThisHSSP '.hssp']); catch ME idSegLast = char(regexp(ME.identifier, '(?<=:)\w+$', 'match')); switch idSegLast, case 'InvalidFid' Logfile = ErrorLogging(1,['File not found:' ThisHSSP]); fprintf(1, ['Invalid HSSP ID ' ThisHSSP '. Saved to log ' regexprep(Logfile,'\','\\\\') '\n']); case {'nonExistentField', 'alignmentMismatch', 'subsassignnumelmismatch','index_assign_element_count_mismatch','badsubscript','unassignedOutputs'} Logfile = ErrorLogging(1,['Corrupted file :' ThisHSSP]); fprintf(1, ['HSSP file ' ThisHSSP ' is corrupted. Saved to log ' regexprep(Logfile,'\','\\\\') '\n']); otherwise if UnknownHault, for p = 1:length(ME.stack), errmsg = ['Error encountered in line ' num2str(ME.stack(p).line) ' in file ' char(regexp(ME.stack(p).file,'\w+\.\w+$','match')) '\n']; fprintf(1,sprintf(errmsg)); end Logfile = ErrorLogging(1,['Unknown error in file: ' ThisHSSP]); fprintf(1,'Unknown error encountered, haulting for manual debugging mode. Type "ME" for error information. "return" to proceed with next file.\n'); keyboard else Logfile = ErrorLogging(1,['File not found:' ThisHSSP]); fprintf(1, ['Unknown error in HSSP ID ' ThisHSSP '. Saved to log ' regexprep(Logfile,'\','\\\\') '\n']); end end if DebugMode, for p = 1:length(ME.stack), errmsg = ['Error encountered in line ' num2str(ME.stack(p).line) ' in file ' char(regexp(ME.stack(p).file,'\w+\.\w+$','match')) '\n']; fprintf(1,sprintf(errmsg)); end fprintf(1,'Entering manual debugging mode. Type "ME" for error information. "return" to proceed with next file.\n'); keyboard end clear ExProStruct IgnoredFiles = IgnoredFiles + 1; continue end try fprintf(1,'Loading PDB data.\n'); ExProStruct = PDBload([PDBpath 'pdb' PDBid '.ent'],ExProStruct); catch ME idSegLast = char(regexp(ME.identifier, '(?<=:)\w+$', 'match')); switch idSegLast, case 'BadPDBFile' Logfile = ErrorLogging(2,['File not found:' PDBid]); fprintf(1, ['Invalid PDB ID ' PDBid '. Saved to log ' regexprep(Logfile,'\','\\\\') '\n']); otherwise if UnknownHault, for p = 1:length(ME.stack), errmsg = ['Error encountered in line ' num2str(ME.stack(p).line) ' in file ' char(regexp(ME.stack(p).file,'\w+\.\w+$','match')) '\n']; fprintf(1,sprintf(errmsg)); end Logfile = ErrorLogging(2,['Unknown error in file: ' PDBid]); fprintf(1,'Unknown error encountered, haulting for manual debugging mode. Type "ME" for error information. "return" to proceed with next file.\n'); keyboard else Logfile = ErrorLogging(2,['File not found:' PDBid]); fprintf(1, ['Unknown error in PDB ID ' PDBid '. Saved to log ' regexprep(Logfile,'\','\\\\') '\n']); end end if DebugMode, for p = 1:length(ME.stack), errmsg = ['Error encountered in line ' num2str(ME.stack(p).line) ' in file ' char(regexp(ME.stack(p).file,'\w+\.\w+$','match')) '\n']; fprintf(1,sprintf(errmsg)); end fprintf(1,'Entering manual debugging mode. Type "ME" for error information. "return" to proceed with next file.\n'); keyboard end clear ExProStruct IgnoredFiles = IgnoredFiles + 1; continue end if DoValidate, try fprintf(1,'Validating structure.\n'); ExProStruct = ValidateExProStruct(ExProStruct); catch ME idSegLast = char(regexp(ME.identifier, '(?<=:)\w+$', 'match')); switch idSegLast, case {'CAundef','Atom'} Logfile = ErrorLogging(2,['Corrupted file: ' PDBid]); fprintf(1, ['PDB file ' PDBid ' is corrupted. ' ME.message '. Saved to log ' regexprep(Logfile,'\','\\\\') '\n']); case {'ResType','SecStruct','SA','PDBres','Aligns'} Logfile = ErrorLogging(1,['Corrupted file :' ThisHSSP]); fprintf(1, ['HSSP file ' ThisHSSP ' is corrupted. ' ME.message '. Saved to log ' regexprep(Logfile,'\','\\\\') '\n']); otherwise if UnknownHault, for p = 1:length(ME.stack), errmsg = ['Error encountered in line ' num2str(ME.stack(p).line) ' in file ' char(regexp(ME.stack(p).file,'\w+\.\w+$','match')) '\n']; fprintf(1,sprintf(errmsg)); end Logfile = ErrorLogging(1,['Unknown error in file: ' ThisHSSP]); fprintf(1,'Unknown error encountered, haulting for manual debugging mode. Type "ME" for error information. "return" to proceed with next file.\n'); keyboard else Logfile = ErrorLogging(1,['File not found:' ThisHSSP]); fprintf(1, ['Unknown error in HSSP ID ' ThisHSSP '. Saved to log ' regexprep(Logfile,'\','\\\\') '\n']); end end if DebugMode, for p = 1:length(ME.stack), errmsg = ['Error encountered in line ' num2str(ME.stack(p).line) ' in file ' char(regexp(ME.stack(p).file,'\w+\.\w+$','match')) '\n']; fprintf(1,sprintf(errmsg)); end fprintf(1,'Entering manual debugging mode. Type "ME" for error information. "return" to proceed with next file.\n'); keyboard end clear ExProStruct IgnoredFiles = IgnoredFiles + 1; continue end end save([ExProStructPath PDBid '.mat'],'ExProStruct'); SavedFiles = SavedFiles + 1; elapsed = toc; tleft = elapsed*(TotalFiles-(i+1))/(i+1); fprintf(1,'ExProStruct has been successfully created and saved for %s.\nElapsed time: %s.\nEstimated time left: %s.\n%d files successfully saved. %d files ignored due to errors.\n\n', PDBid,sec2time(elapsed),sec2time(tleft),SavedFiles,IgnoredFiles); fprintf(Statusfile,'ExProStruct has been successfully created and saved for %s.\nElapsed time: %s.\nEstimated time left: %s.\n%d files successfully saved. %d files ignored due to errors.\n\n', PDBid,sec2time(elapsed),sec2time(tleft),SavedFiles,IgnoredFiles); else fprintf(1,'ExProStruct for %s already exists\n',ThisHSSP); end clear ExProStruct end end fclose(Statusfile); elapsed = toc; fprintf(1,'-----Finished creating ExProStruct. Total elapsed time: %s-----\n',sec2time(elapsed)); function [PDBid,ExProStruct] = HSSPload(FileName) %Function loading residues from HSSP file. For each residue, defines %residue type, secondary structure, solvent acc., number in pdb, alignment %from hssp. \SBH %Opens the HSSP file, and defines variables HSSPfile = fopen(FileName,'r'); HeaderProtein = '## PROTEINS'; Header = '## ALIGNMENTS'; g = 0; %Number of times residues have been run thrught, that is how many times has "## ALIGNMENTS" been reached %Loop running through every line in file, until EOF has been reached while 1, Line = fgetl(HSSPfile); if ~ischar(Line) %Testing for EOF break; end %Extracts name of matching pdb file, returns as function output if length(Line)>6, if Line(1:5) == 'PDBID' PDBid = upper(Line(12:15)); end end if length(Line)>=length(HeaderProtein), if strcmp(Line(1:length(HeaderProtein)),HeaderProtein), i = 1; Line = fgetl(HSSPfile); Line = fgetl(HSSPfile); while Line(1:2) ~= '##', ExProStruct(1).AlignIde(i) = str2num(Line(29:32)); i = i + 1; Line = fgetl(HSSPfile); end end end %Runs a loop everytime "Header" is reached, that is "## ALIGNMENTS, %ends the loop when file holds no more allignments if length(Line)>=length(Header), while strcmp(Line(1:length(Header)),Header), %Defines some running variables g = g + 1; i = 0; %Current residue position Chain = 0; %Current chain... OldChain = ''; Line = fgetl(HSSPfile); Line = fgetl(HSSPfile); %Runs loop untill no more residues in this ## Alignment tab while Line(1:2) ~= '##', if strcmp('!',Line(15)); Line = fgetl(HSSPfile); end PDBchain = Line(13); %Tests if new chain is reached, and adjusts variables if %that is the case if ~strcmp(OldChain,PDBchain), if Chain > 0, ExProStruct(Chain).ChainLength = PDBres; end Chain = Chain + 1; i = 0; end OldChain = PDBchain; %Identifies number of same residue in pdb file PDBres = str2num(Line(8:11)); if isempty(PDBres) Line = fgetl(HSSPfile); continue end i = i + 1; %Tests if this is the first runthrough of residues, if so, %saves some standard values into ExProStruct if g == 1, HSSPsa = str2num(Line(37:39)); ResType = aa2int(Line(15)); switch Line(18), case 'H' SecStruct = 1; case 'E' SecStruct = 2; case 'T' SecStruct = 3; otherwise SecStruct = 4; end ExProStruct(Chain).Residue(i).ResType = ResType; ExProStruct(Chain).Residue(i).SecStruct = SecStruct; ExProStruct(Chain).Residue(i).SA = HSSPsa; ExProStruct(Chain).Residue(i).PDBres = PDBres; ExProStruct(Chain).Residue(i).PDBchain = PDBchain; end %Tests if current residue pdbnumber matches that of the one %in the ExProStruct, just to make sure. If this is the %case, changes alignment value for this residue to 1. if ExProStruct(Chain).Residue(i).PDBres == PDBres, if length(ExProStruct(1).AlignIde) - (g-1)*70 >= 70 MaxJ = 70; else MaxJ = length(ExProStruct(1).AlignIde) - (g-1)*70; end for j = 1:MaxJ, if length(Line)-51 >= j, Subst = Line(51+j); AAnum = aa2int(Subst); else AAnum = 0; end if AAnum > 20, AAnum = 0; end ExProStruct(Chain).Residue(i).Align(j+70*(g-1)) = AAnum; end else error('HSSPload:alignmentMismatch','Error in matching allignments pdbid %d in block on %d',PDBres,g); end Line = fgetl(HSSPfile); end ExProStruct(Chain).ChainLength = PDBres; end end end fclose(HSSPfile); function ExProStruct = PDBload(FileName,ExProStruct) %Function loads PDB file into array, and transfers coordinates and pdb-id %for residues into ProExtract_V2p4 Structure array. \SBH %Opens the PDB file in pdbread-structure PDBStruct = pdbread(FileName); if isfield(PDBStruct,'Title'), ExProStruct(1).Title = PDBStruct.Title; else ExProStruct(1).Title = 'Undefined'; end if isfield(PDBStruct,'Header'), if isfield(PDBStruct.Header,'classification'), ExProStruct(1).Classification = PDBStruct.Header.classification; else ExProStruct(1).Classification = 'Undefined'; end else ExProStruct(1).Classification = 'Undefined'; end if isfield(PDBStruct,'Keywords'), ExProStruct(1).Keywords = PDBStruct.Keywords; else ExProStruct(1).Keywords = 'Undefined'; end if isfield(PDBStruct,'Source'), ExProStruct(1).Source = PDBStruct.Source; else ExProStruct(1).Source = 'Undefined'; end %Finding number of atoms in model, starting residue position (pdb) and %defining variables Chains = size(ExProStruct,2); NumAtoms = size(PDBStruct.Model(1,1).Atom,2); OldResNr = -1000; %Looping through all atoms, if not hydrogen executes inner code for i = 1:NumAtoms, if ~strcmp(PDBStruct.Model(1,1).Atom(1,i).AtomName,'H'), PDBres = PDBStruct.Model(1,1).Atom(1,i).resSeq; %Residue # in PDB PDBchain = PDBStruct.Model(1,1).Atom(1,i).chainID; if PDBres ~= OldResNr, %Checks if new residue has been reached CurrentAtom = 1; else CurrentAtom = CurrentAtom + 1; end %Loops through all residues in ExProStruct searching for one with %PDBres equal to the one found here, if present in HSSP, should be %present in the structure as well. When found, saves coordinates of %atoms and atom names. for j = 1:size(ExProStruct,2) for k = 1:size(ExProStruct(j).Residue,2) if (ExProStruct(j).Residue(k).PDBres == PDBres) && strcmpi(ExProStruct(j).Residue(k).PDBchain,PDBchain), %Extracting coordinates from PDB X = PDBStruct.Model(1,1).Atom(1,i).X; Y = PDBStruct.Model(1,1).Atom(1,i).Y; Z = PDBStruct.Model(1,1).Atom(1,i).Z; AtomName = PDBStruct.Model(1,1).Atom(1,i).AtomName; %Writing to structure ExProStruct(j).Residue(k).Atom(CurrentAtom).ID = AtomName; ExProStruct(j).Residue(k).Atom(CurrentAtom).X = X; ExProStruct(j).Residue(k).Atom(CurrentAtom).Y = Y; ExProStruct(j).Residue(k).Atom(CurrentAtom).Z = Z; end end end OldResNr = PDBres; end end function ExProStruct = ValidateExProStruct(ExProStruct) %Validates the structure obtained to check that all fields that should %contain data does so. NumAligns = length(ExProStruct(1).AlignIde); RunToChain = size(ExProStruct,2); DeletedChain = 0; for Chain = 1:RunToChain ChainDeleted = 0; Deleted = 0; RunTo = size(ExProStruct(Chain - DeletedChain).Residue,2); for i = 1:RunTo Delete = 0; ResTypeUndefined = 0; ResType = ExProStruct(Chain - DeletedChain).Residue(i - Deleted).ResType; SecStruct = ExProStruct(Chain - DeletedChain).Residue(i - Deleted).SecStruct; SA = ExProStruct(Chain - DeletedChain).Residue(i - Deleted).SA; PDBres = ExProStruct(Chain - DeletedChain).Residue(i - Deleted).PDBres; PDBchain = ExProStruct(Chain - DeletedChain).Residue(i - Deleted).PDBchain; Align = ExProStruct(Chain - DeletedChain).Residue(i - Deleted).Align; ChainLength = ExProStruct(Chain - DeletedChain).ChainLength; try Atom = ExProStruct(Chain - DeletedChain).Residue(i - Deleted).Atom; catch Atom = []; end if isempty(Atom), fprintf(1,'Atom coordinates undefined for residue %d in chain %d. Residue deleted.\n',i,Chain); Delete = 1; end if isempty(ResType) && ~ Delete, fprintf(1,'Residue type undefined for residue %d in chain %d. Residue deleted.\n',i,Chain); Delete = 1; ResTypeUndefined = 1; elseif (ResType == 0 | ResType > 20) && ~ Delete, fprintf(1,'Residue type undefined for residue %d in chain %d. Residue deleted.\n',i,Chain); Delete = 1; ResTypeUndefined = 1; end if isempty(SecStruct) && ~ Delete, fprintf(1,'Secondary structure undefined for residue %d in chain %d. Residue deleted.\n',i,Chain) Delete = 1; end if isempty(SA) && ~ Delete, fprintf(1,'Solvent accessibility undefined for residue %d in chain %d. Residue deleted.\n',i,Chain) Delete = 1; end if isempty(PDBchain) && ~ Delete, fprintf(1,'PDB chain undefined for residue %d in chain %d. Residue deleted.\n',i,Chain) Delete = 1; end if isempty(PDBres) && ~ Delete, fprintf(1,'PDB residue number undefined for residue %d in chain %d. Residue deleted.\n',i,Chain) Delete = 1; end if length(Align) ~= NumAligns && ~ Delete, fprintf(1,'One or more allignments undefined for residue %d in chain %d. Residue deleted.\n',i,Chain) Delete = 1; end if isempty(ChainLength) && ~ Delete, fprintf(1,'Chainlength undefined for chain %d. Residue deleted.\n',Chain) Delete = 1; end CA = 0; FunAtom = 0; if ~ ResTypeUndefined && ~ Delete, Fatom = FunctAtom(ResType); for t=1:length(Fatom), FunAtom(t)=0; for j=1:size(Atom,2) if strcmp(Atom(j).ID,'CA') CA = 1; end if strcmp(Atom(j).ID,Fatom(t)), FunAtom(t) = 1; end end end elseif ~ Delete, for j=1:size(Atom,2) if strcmp(Atom(j).ID,'CA') CA = 1; end end end if ~ CA && ~ Delete, fprintf(1,'Position of CA undefined for residue %d in Chain %d. Residue deleted.\n',i,Chain) Delete = 1; end if ~ min(FunAtom) && ~ Delete, fprintf(1,'Position of functional atom undefined for residue %d in Chain %d. Residue deleted.\n',i,Chain) Delete = 1; end if Delete, k = 1; for j = 1:size(ExProStruct(Chain - DeletedChain).Residue,2) if j ~= i - Deleted, NewResStruct(k) = ExProStruct(Chain - DeletedChain).Residue(j); k = k + 1; end end if k > 1, ExProStruct(Chain - DeletedChain).Residue = NewResStruct; clear NewResStruct; Deleted = Deleted + 1; else fprintf('Chain %d is now empty. Chain deleted.\n',Chain - DeletedChain); if Chain == 1 && size(ExProStruct,2) > 1, ExProStruct(Chain+1).AlignIde = ExProStruct(Chain).AlignIde; ExProStruct(Chain+1).Title = ExProStruct(Chain).Title; ExProStruct(Chain+1).Classification = ExProStruct(Chain).Classification; ExProStruct(Chain+1).Keywords = ExProStruct(Chain).Keywords; ExProStruct(Chain+1).Source = ExProStruct(Chain).Source; end for j = 1:size(ExProStruct,2) if j ~= Chain - DeletedChain, NewStruct(k) = ExProStruct(j); k = k + 1; end end if k <= 1, fprintf('All chains are now deleted. Structure empty.\n'); NewStruct.AlignIde = ExProStruct.AlignIde; NewStruct.Residue = []; NewStruct.ChainLength = ExProStruct.ChainLength; end ExProStruct = NewStruct; clear NewStruct; DeletedChain = DeletedChain + 1; ChainDeleted = 1; end end end end function CreateDataset(GetMode,FileList,ExProStructPath,AcMin,AcMax,AcRes,DistMin,DistMax,DistRes,DistMode,UseAlign,UseComulative,MinIDcut,CLMin,CLMax,CLRes,MultiChain,OutputPath,DebugMode,UnknownHault,DoValidate,ScrambleMode,ScrambleNum,CreateIndex,ChainsSpecified) %Function to create the actual Nabo dataset. The function takes many %inputs, which are defined by the user in the GUI. Returns output tensor to %file specified. %Structure of output tensor is (Residue type 1, Residue type 2, Solvent %shell #, Distance shell #, Secondary structure residue 1, Secondary %structure residue 2, Avg. ChainLength) %Function runs PopulateNabo for each input file global ErrorCount %Keeps track of certain types of errors to determine if logfile shold be rewritten or appended ErrorCount(3) = 0; %Sets starting values to 0, when error occures, switches value to 1 for certain error type global Nabo global c global IndexArray SaSteps = (AcMax-AcMin)/AcRes + 2; CLSteps = (CLMax-CLMin)/CLRes + 2; %DistSteps = (DistMax-DistMin)/DistRes + 2; DistSteps = (DistMax-DistMin)/DistRes + 1; Nabo = zeros(20,20,SaSteps,DistSteps,4,4,CLSteps,6,'single'); if CreateIndex, IndexArray = cell(20,20,SaSteps,DistSteps,4,4,CLSteps,6); end whosindexarray = whos('IndexArray'); thesize = whosindexarray.bytes; fprintf(1,bytestosize(thesize)); c = 0; %Different modes of inputs, much like in the CreateExProStruct function switch GetMode case 1 ExProStructDir = dir(ExProStructPath); TotalFiles = size(ExProStructDir,1) - 2; fprintf(1,'-----Creating dataset from %d entries.-----\n',TotalFiles) tic for i = 3:size(ExProStructDir,1) fprintf(1,'Loading %s, file %d of %d. %d percent complete.\n',ExProStructDir(i).name,i-2,TotalFiles,round((i-3)/TotalFiles*100)); PopulateNabo([ExProStructPath ExProStructDir(i).name],AcMin,AcMax,AcRes,DistMin,DistMax,DistRes,DistMode,UseAlign,UseComulative,MinIDcut,CLMin,CLMax,CLRes,MultiChain,DebugMode,UnknownHault,DoValidate,ScrambleMode,ScrambleNum,ExProStructDir(i).name(1:4),CreateIndex,''); elapsed = toc; tleft = elapsed*(TotalFiles-(i-2))/(i-2); fprintf(1,'Dataset has been successfully created and saved for %s.\nElapsed time: %s.\nEstimated time left: %s.\n\n', ExProStructDir(i).name,sec2time(elapsed),sec2time(tleft)); end case 2 FileOfIDs = fopen(FileList); if ChainsSpecified, Line = fgetl(FileOfIDs); end Line = fgetl(FileOfIDs); TotalFiles = 0; while 1 if ~ischar(Line) break end Line = fgetl(FileOfIDs); TotalFiles = TotalFiles + 1; end fclose(FileOfIDs); fprintf(1,'-----Creating dataset from %d entries.-----\n',TotalFiles) tic FileOfIDs = fopen(FileList); Line = fgetl(FileOfIDs); if ChainsSpecified, Line = fgetl(FileOfIDs); end i=1; while 1 if ~ischar(Line) break end ll = length(Line); if ChainsSpecified, TheChain = Line(5); Line = Line(1:4); else TheChain = ''; Line = Line(ll-3:ll); end fprintf(1,'Loading %s, file %d of %d. %d percent complete.\n',upper(Line),i,TotalFiles,round((i-1)/TotalFiles*100)); if ChainsSpecified, fprintf(1,'Loading chain %s.\n',TheChain); end i = i + 1; PopulateNabo([ExProStructPath upper(Line(1:4)) '.mat'],AcMin,AcMax,AcRes,DistMin,DistMax,DistRes,DistMode,UseAlign,UseComulative,MinIDcut,CLMin,CLMax,CLRes,MultiChain,DebugMode,UnknownHault,DoValidate,ScrambleMode,ScrambleNum,upper(Line),CreateIndex,TheChain); elapsed = toc; tleft = elapsed*(TotalFiles-i)/i; fprintf(1,'Dataset has been successfully created and saved for %s.\nElapsed time: %s.\nEstimated time left: %s.\n\n', upper(Line),sec2time(elapsed),sec2time(tleft)); Line = fgetl(FileOfIDs); end fclose(FileOfIDs); case 3 SeperateIndices = findstr(FileList,';'); TotalFiles = length(SeperateIndices) + 1; tic fprintf(1,'-----Creating ExProStruct from %d entries.-----\n',TotalFiles) for i = 0:length(SeperateIndices), if length(SeperateIndices) == 0, ThisExProStruct = FileList; elseif i == 0, ThisExProStruct = FileList(1:SeperateIndices(1)-1); elseif i == length(SeperateIndices), ThisExProStruct = FileList(SeperateIndices(i)+1:length(FileList)); else ThisExProStruct = FileList(SeperateIndices(i)+1:SeperateIndices(i+1)-1); end fprintf(1,'Loading %s, file %d of %d. %d percent complete.\n',ThisExProStruct,i,TotalFiles,round((i)/TotalFiles*100)); PopulateNabo([ExProStructPath upper(ThisExProStruct) '.mat'],AcMin,AcMax,AcRes,DistMin,DistMax,DistRes,DistMode,UseAlign,UseComulative,MinIDcut,CLMin,CLMax,CLRes,MultiChain,DebugMode,UnknownHault,DoValidate,ScrambleMode,ScrambleNum,upper(ThisExProStruct),CreateIndex,''); elapsed = toc; tleft = elapsed*(TotalFiles-(i+1))/(i+1); fprintf(1,'Dataset has been successfully created and saved for %s.\nElapsed time: %s.\nEstimated time left: %s.\n\n', upper(ThisExProStruct),sec2time(elapsed),sec2time(tleft)); end end if strcmp(ScrambleMode,'None') if CreateIndex, save(OutputPath,'-append','Nabo','IndexArray'); else save(OutputPath,'-append','Nabo'); end else Naboref = Nabo; save(OutputPath,'-append','Naboref'); end fprintf(1,'Nabo has successfully been computed and saved to %s.\nA total of %s pairs were added.\n',OutputPath,num2str(c)); fprintf(1,'-----Finished creating dataset-----\n'); clear global Nabo clear global IndexArray function PopulateNabo(ExProStructPath,AcMin,AcMax,AcRes,DistMin,DistMax,DistRes,DistMode,UseAlign,UseComulative,MinIDcut,CLMin,CLMax,CLRes,MultiChain,DebugMode,UnknownHault,DoValidate,ScrambleMode,ScrambleNum,PDBid,CreateIndex,TheChain) %Function to add data to the output tensor. global Nabo global IndexArray global c try load(ExProStructPath); %Loads the structure file catch ME idSegLast = char(regexp(ME.identifier, '(?<=:)\w+$', 'match')); ExProStructID = char(regexp(ExProStructPath,'\w+\.\w+$','match')); switch idSegLast, case 'couldNotReadFile' Logfile = ErrorLogging(3,['File not found:' ExProStructID]); fprintf(1, ['Invalid ExProStruct ID ' ExProStructID '. Saved to log ' regexprep(Logfile,'\','\\\\') '\n']); otherwise if UnknownHault, for p = 1:length(ME.stack), errmsg = ['Error encountered in line ' num2str(ME.stack(p).line) ' in file ' char(regexp(ME.stack(p).file,'\w+\.\w+$','match')) '\n']; fprintf(1,sprintf(errmsg)); end Logfile = ErrorLogging(1,['Unknown error in file: ' ExProStructID]); fprintf(1,'Unknown error encountered, haulting for manual debugging mode. Type "ME" for error information. "return" to proceed with next file.\n'); keyboard else Logfile = ErrorLogging(1,['File not found:' ExProStructID]); fprintf(1, ['Unknown error in ExProStruct ID ' ExProStructID '. Saved to log ' regexprep(Logfile,'\','\\\\') '\n']); end end if DebugMode, for p = 1:length(ME.stack), errmsg = ['Error encountered in line ' num2str(ME.stack(p).line) ' in file ' char(regexp(ME.stack(p).file,'\w+\.\w+$','match')) '\n']; fprintf(1,sprintf(errmsg)); end fprintf(1,'Entering manual debugging mode. Type "ME" for error information. "return" to proceed with next file.\n'); keyboard end clear ExProStruct return end if DoValidate, %Runs validate, if selected try fprintf(1,'Validating structure.\n'); ExProStruct = ValidateExProStruct(ExProStruct); fprintf(1, 'Structure validation successfull.\n'); catch ME idSegLast = char(regexp(ME.identifier, '(?<=:)\w+$', 'match')); ExProStructID = char(regexp(ExProStructPath,'\w+\.\w+$','match')); switch idSegLast, case {'ResType','SecStruct','SA','PDBres','Aligns','CAundef','Atom'} Logfile = ErrorLogging(3,['Corrupted file: ' ExProStructID]); fprintf(1, ['ExProStruct file ' ExProStructID ' is corrupted. Saved to log ' regexprep(Logfile,'\','\\\\') '\n']); otherwise if UnknownHault, for p = 1:length(ME.stack), errmsg = ['Error encountered in line ' num2str(ME.stack(p).line) ' in file ' char(regexp(ME.stack(p).file,'\w+\.\w+$','match')) '\n']; fprintf(1,sprintf(errmsg)); end Logfile = ErrorLogging(3,['Unknown error in file: ' ExProStructID]); fprintf(1,'Unknown error encountered, haulting for manual debugging mode. Type "ME" for error information. "return" to proceed with next file.\n'); keyboard else Logfile = ErrorLogging(3,['File not found:' ExProStructID]); fprintf(1, ['Unknown error in HSSP ID ' ExProStructID '. Saved to log ' regexprep(Logfile,'\','\\\\') '\n']); end end if DebugMode, for p = 1:length(ME.stack), errmsg = ['Error encountered in line ' num2str(ME.stack(p).line) ' in file ' char(regexp(ME.stack(p).file,'\w+\.\w+$','match')) '\n']; fprintf(1,sprintf(errmsg)); end fprintf(1,'Entering manual debugging mode. Type "ME" for error information. "return" to proceed with next file.\n'); keyboard end clear ExProStruct return end end for l = 1:ScrambleNum, ValAligns = IdentifyValidAligns(ExProStruct(1).AlignIde,MinIDcut); j = 1; if MultiChain, %If multichain is selected, puts the chains together to form one long chain CombiChain = [ExProStruct.Residue]; for Chain = 1:size(ExProStruct,2), for i = 1:size(ExProStruct(Chain).Residue,2), CombiChain(j).ChainLength = ExProStruct(Chain).ChainLength; j = j + 1; end end else if strcmp(TheChain,''), CombiChain = ExProStruct(1).Residue; for i = 1:size(ExProStruct(1).Residue,2), CombiChain(i).ChainLength = ExProStruct(1).ChainLength; end else for Chain = 1:size(ExProStruct,2), if size(ExProStruct(Chain).Residue,2) > 0, if strcmp(ExProStruct(Chain).Residue(1).PDBchain,TheChain), CombiChain = ExProStruct(Chain).Residue; for i = 1:size(ExProStruct(Chain).Residue,2), CombiChain(i).ChainLength = ExProStruct(Chain).ChainLength; end end end end end end a = 0; b = 0; if ~exist('CombiChain'), fprintf(1,'No residues in chain, continuing...\n'); continue end SA = SaBin(CombiChain,AcMin,AcMax,AcRes,UseComulative); if ~ strcmp(ScrambleMode,'None'), TheChain = Scramble(CombiChain,ScrambleMode,AcMin,AcMax,AcRes); else TheChain = CombiChain; end fprintf(1,'Calculating data.\n'); for k = 1:length(SA) for i = 1:length(SA(k).Residue) for j = (i+1):length(SA(k).Residue) Res1 = TheChain(SA(k).Residue(i)); Res2 = TheChain(SA(k).Residue(j)); Dist = CalcDist(Res1,Res2,DistMin,DistMax,DistRes,DistMode); if Dist > DistMax continue, end CL = mean(Res1.ChainLength,Res2.ChainLength);%HVAD MED DET HER??????? ChainLength = CLBin(CL,CLMin,CLMax,CLRes); if ~ strcmp(ScrambleMode,'None'), Res1Type = Res1.ScrambledResType; Res2Type = Res2.ScrambledResType; else Res1Type = Res1.ResType; Res2Type = Res2.ResType; end SolvAc = k; Distance = DistBin(Dist,DistMin,DistMax,DistRes); Res1SS = Res1.SecStruct; Res2SS = Res2.SecStruct; PrimarySeqDiff = abs(Res1.PDBres-Res2.PDBres) + 1; if PrimarySeqDiff > 6 || ~ strcmp(Res1.PDBchain,Res2.PDBchain), PrimarySeqDiff = 6; end %Adds 1 to the field in Nabo if Res1Type <= size(Nabo,1) && Res2Type <= size(Nabo,2), NaboOld1 = Nabo(Res1Type,Res2Type,SolvAc,Distance,Res1SS,Res2SS,ChainLength,PrimarySeqDiff); Nabo(Res1Type,Res2Type,SolvAc,Distance,Res1SS,Res2SS,ChainLength,PrimarySeqDiff) = NaboOld1 + 1/ScrambleNum; NaboOld2 = Nabo(Res2Type,Res1Type,SolvAc,Distance,Res2SS,Res1SS,ChainLength,PrimarySeqDiff); Nabo(Res2Type,Res1Type,SolvAc,Distance,Res2SS,Res1SS,ChainLength,PrimarySeqDiff) = NaboOld2 + 1/ScrambleNum; a = a + 1; if CreateIndex, Res1Chain = Res1.PDBchain; Res2Chain = Res2.PDBchain; Res1PDBres = num2str(Res1.PDBres,'%04.0f'); Res2PDBres = num2str(Res2.PDBres,'%04.0f'); IndexString = [PDBid Res1PDBres Res1Chain Res2PDBres Res2Chain]; OldIndex = IndexArray{Res1Type,Res2Type,SolvAc,Distance,Res1SS,Res2SS,ChainLength,PrimarySeqDiff}; IndexArray{Res1Type,Res2Type,SolvAc,Distance,Res1SS,Res2SS,ChainLength,PrimarySeqDiff} = [OldIndex;IndexString]; IndexString = [PDBid Res2PDBres Res2Chain Res1PDBres Res1Chain]; OldIndex = IndexArray{Res2Type,Res1Type,SolvAc,Distance,Res2SS,Res1SS,ChainLength,PrimarySeqDiff}; IndexArray{Res2Type,Res1Type,SolvAc,Distance,Res2SS,Res1SS,ChainLength,PrimarySeqDiff} = [OldIndex;IndexString]; end end %If using aligns, does the same thing for these if UseAlign, for z = 1:length(ValAligns), Res1Type = Res1.Align(ValAligns(z)); Res2Type = Res2.Align(ValAligns(z)); if (Res1Type ~= 0) && (Res2Type ~=0), Nabo(Res1Type,Res2Type,SolvAc,Distance,Res1SS,Res2SS,ChainLength,PrimarySeqDiff) = Nabo(Res1Type,Res2Type,SolvAc,Distance,Res1SS,Res2SS,ChainLength,PrimarySeqDiff) + 1/ScrambleNum; Nabo(Res2Type,Res1Type,SolvAc,Distance,Res2SS,Res1SS,ChainLength,PrimarySeqDiff) = Nabo(Res2Type,Res1Type,SolvAc,Distance,Res2SS,Res1SS,ChainLength,PrimarySeqDiff) + 1/ScrambleNum; b = b + 1; end end end end end end c = c + (a + b) / ScrambleNum; end fprintf(1,'%s pairs of residues used. %s pairs used from alignments. %s hits added to Nabo.\n',num2str(a),num2str(b),num2str(a+b)); whosindexarray = whos('IndexArray'); thesize = whosindexarray.bytes; fprintf(1,bytestosize(thesize)); function thesize = bytestosize(numbytes) kb = floor(numbytes/1024); mb = floor(kb/1024); gb = floor(mb/1024); thesize = ['IndexArray: ' num2str(gb) ' Gb, ' num2str(mb-1024*gb) ' Mb, ' num2str(kb-1024*mb) ' kb, ' num2str(round(numbytes-1024*kb)) ' bytes.\n']; function ExProStruct = Scramble(Residues,ScrambleMode,AcMin,AcMax,AcRes) ScrambledStruct = Residues; if strcmp(ScrambleMode,'All'), SA = SaBin(Residues,-1000,1000,2000,0); elseif strcmp(ScrambleMode,'SA'), SA = SaBin(Residues,AcMin,AcMax,AcRes,0); end for i = 1:size(SA,2), if SA(i).Residue(1) == 0 ScrambledSA(i).Residue = 0; continue end numRes = size(SA(i).Residue,2); ResCount = 1:numRes; for j=1:numRes, randNum = rand; thisResPos = ceil(randNum*(numRes-j+1)); thisRes = ResCount(thisResPos); oldRes = SA(i).Residue(j); newRes = SA(i).Residue(thisRes); ScrambledSA(i).Residue(j) = newRes; ResSA = Residues(oldRes).SA/AAsurf(Residues(oldRes).ResType); newResSArea = round(ResSA*AAsurf(Residues(newRes).ResType)); ScrambledStruct(oldRes).ScrambledResType = Residues(newRes).ResType; ScrambledStruct(oldRes).ResType = Residues(oldRes).ResType; ScrambledStruct(oldRes).Align = Residues(newRes).Align; ScrambledStruct(oldRes).SA = newResSArea; ResCount = [ResCount(1:thisResPos-1) ResCount(thisResPos+1:length(ResCount))]; end end ExProStruct = ScrambledStruct; function ValAligns = IdentifyValidAligns(AlignID,MinIDcut) %Function to find out which aligns fullfills the threshold ValAligns = []; j = 1; for i = 1:length(AlignID), if AlignID(i) >= MinIDcut, ValAligns(j) = i; j = j + 1; end end function SA = SaBin(CombiChain,AcMin,AcMax,AcRes,UseComulative) %Function to grup residues into shells from their SA SaSteps = (AcMax-AcMin)/AcRes; for i = 1:(SaSteps+2), SA(i).Residue(1) = 0; end for i = 1:size(CombiChain,2), ResSa = CombiChain(i).SA/AAsurf(CombiChain(i).ResType); ThisSa = ResSa - AcMin; if ResSa <= AcMin, ThisSaStep = 1; elseif ResSa >= AcMax, ThisSaStep = SaSteps + 2; else ThisSaStep = ceil(ThisSa/AcRes) + 1; end if UseComulative, for j = 1:ThisSaStep, if SA(j).Residue(1) == 0, ThisResidue = 1; else ThisResidue = size(SA(j).Residue,2)+1; end SA(j).Residue(ThisResidue) = i; end else if SA(ThisSaStep).Residue(1) == 0, ThisResidue = 1; else ThisResidue = size(SA(ThisSaStep).Residue,2)+1; end SA(ThisSaStep).Residue(ThisResidue) = i; end end function ThisCLStep = CLBin(ChainLength,CLMin,CLMax,CLRes) %Function to find the shell number of the current chainlength CLSteps = (CLMax-CLMin)/CLRes; ThisCL = ChainLength - CLMin; if ChainLength <= CLMin, ThisCLStep = 1; elseif ChainLength >= CLMax, ThisCLStep = CLSteps + 2; else ThisCLStep = ceil(ThisCL/CLRes) + 1; end function Dist = CalcDist(Res1,Res2,DistMin,DistMax,DistRes,DistMode) %Function to calculate distance between residues. Mode 1 - closest distance, %mode 2 - geometrical midpoints, mode 3 - CAs, mode 4 - functional groups Res1Type = Res1.ResType; Res2Type = Res2.ResType; Atom1 = Res1.Atom; Atom2 = Res2.Atom; switch DistMode, case 1 %Shortest distance Dist = 1000000; for i = 1:size(Atom1,2), for j = 1:size(Atom2,2), x = (Atom1(i).X - Atom2(j).X)^2; y = (Atom1(i).Y - Atom2(j).Y)^2; z = (Atom1(i).Z - Atom2(j).Z)^2; ThisDist = sqrt(x+y+z); if ThisDist < Dist, Dist = ThisDist; end end end case 2%Geometrical midpoints %GM of first residue (x1,y1,z1) xr1 = 0; yr1 = 0; zr1 = 0; for i = 1:size(Atom1,2), xr1 = xr1 + Atom1(i).X; yr1 = yr1 + Atom1(i).Y; zr1 = zr1 + Atom1(i).Z; end x1 = xr1 / size(Atom1,2); y1 = xr1 / size(Atom1,2); z1 = xr1 / size(Atom1,2); %GM of second residue (x2,y2,z2) xr2 = 0; yr2 = 0; zr2 = 0; for i = 1:size(Atom2,2), xr2 = xr2 + Atom2(i).X; yr2 = yr2 + Atom2(i).Y; zr2 = zr2 + Atom2(i).Z; end x2 = xr2 / size(Atom2,2); y2 = xr2 / size(Atom2,2); z2 = xr2 / size(Atom2,2); %Find Dist x = (x1-x2)^2; y = (y1-y2)^2; z = (z1-z2)^2; Dist = sqrt(x+y+z); case 3 %CA of first residue (x1,y1,z1) for i = 1:size(Atom1,2), if strcmp(Atom1(i).ID,'CA') x1 = Atom1(i).X; y1 = Atom1(i).Y; z1 = Atom1(i).Z; end end %CA of second residue (x2,y2,z2) for i = 1:size(Atom2,2), if strcmp(Atom2(i).ID,'CA'), x2 = Atom2(i).X; y2 = Atom2(i).Y; z2 = Atom2(i).Z; end end %Find Dist x = (x1-x2)^2; y = (y1-y2)^2; z = (z1-z2)^2; Dist = sqrt(x+y+z); case 4 FAtom1 = FunctAtom(Res1Type); FAtom2 = FunctAtom(Res2Type); Dist = 1000000; %FR of first residue (x1,y1,z1) for r = 1:length(FAtom1), for t = 1:length(FAtom2), for i = 1:size(Atom1,2), if strcmp(Atom1(i).ID,FAtom1(r)), x1 = Atom1(i).X; y1 = Atom1(i).Y; z1 = Atom1(i).Z; end end %FR of second residue (x2,y2,z2) for i = 1:size(Atom2,2), if strcmp(Atom2(i).ID,FAtom2(t)), x2 = Atom2(i).X; y2 = Atom2(i).Y; z2 = Atom2(i).Z; end end %Find Dist x = (x1-x2)^2; y = (y1-y2)^2; z = (z1-z2)^2; ThisDist = sqrt(x+y+z); if ThisDist < Dist, Dist = ThisDist; end end end end function ThisDistStep = DistBin(Dist,DistMin,DistMax,DistRes) %Function to find distance shell number of current shell DistSteps = (DistMax-DistMin)/DistRes; ThisDist = Dist - DistMin; if Dist <= DistMin, ThisDistStep = 1; elseif Dist == DistMax, ThisDistStep = DistSteps + 1; else ThisDistStep = ceil(ThisDist/DistRes) + 1; end function LogPath = ErrorLogging(ErrorType,ErrorMsg) %Function to log errors to logfiles global ErrorCount switch ErrorType case 1 LogPath = 'HSSPlog.txt'; case 2 LogPath = 'PDBlog.txt'; case 3 LogPath = 'ExProStructlog.txt'; end if ErrorCount(ErrorType) == 0, mode = 'w'; ErrorCount(ErrorType) = 1; ErrorMsg = ['Errors encountered during executing at : ' datestr(now) '\n' ErrorMsg '\n']; else mode = 'a'; ErrorMsg = [ErrorMsg '\n']; end ErrorLog = fopen(LogPath,mode); fprintf(ErrorLog,ErrorMsg); fclose(ErrorLog); function thetime = sec2time(sec) %Function to concert seconds into h:m:s min = floor(sec/60); hr = floor(min/60); thetime = [num2str(hr) ' hours, ' num2str(min-60*hr) ' minutes and ' num2str(round(sec-60*min)) ' seconds']; function FAtom = FunctAtom(ResType) %Function that defines functional groups of residues switch ResType case 1 FAtom{1} = 'CB'; case 2 %ARG FAtom{1} = 'NH1'; FAtom{2} = 'NH2'; FAtom{3} = 'NE'; case 3 %ASN FAtom{1} = 'ND2'; FAtom{2} = 'OD1'; case 4 %ASP FAtom{1} = 'OD1'; FAtom{2} = 'OD2'; case 5 %CYS FAtom{1} = 'SG'; case 6 %GLN FAtom{1} = 'NE2'; FAtom{2} = 'OE1'; case 7 %GLU FAtom{1} = 'OE1'; FAtom{2} = 'OE2'; case 8 FAtom{1} = 'CA'; case 9 %HIS FAtom{1} = 'ND1'; FAtom{2} = 'NE2'; case 10 %ILE FAtom{1} = 'CG2'; FAtom{2} = 'CD1'; case 11 %LEU FAtom{1} = 'CD1'; FAtom{2} = 'CD2'; case 12 %LYS FAtom{1} = 'NZ'; case 13 %MET FAtom{1} = 'SD'; FAtom{2} = 'CE'; case 14 %PHE FAtom{1} = 'CZ'; FAtom{2} = 'CD1'; FAtom{3} = 'CD2'; FAtom{4} = 'CE1'; FAtom{5} = 'CE2'; case 15 %PRO FAtom{1} = 'CG'; FAtom{2} = 'CD'; FAtom{3} = 'CB'; case 16 %SER FAtom{1} = 'OG'; case 17 %THR FAtom{1} = 'OG1'; case 18 %TRP FAtom{1} = 'NE1'; %?? case 19 %TYR FAtom{1} = 'OH'; case 20 %VAL FAtom{1} = 'CG1'; FAtom{2} = 'CG2'; end %%%%%%%%%%%%%USED WITH PROPACK PAPER%%%%%%%%%%%%%%%%% % % % function FAtom = FunctAtom(ResType) % %Function that defines functional groups of residues % switch ResType % case 1 % FAtom{1} = 'CB'; % case 2 % FAtom{1} = 'NH1'; % FAtom{2} = 'NH2'; % case 3 % FAtom{1} = 'ND2'; % FAtom{2} = 'OD1'; % case 4 % FAtom{1} = 'OD1'; % FAtom{2} = 'OD2'; % case 5 % FAtom{1} = 'SG'; % case 6 % FAtom{1} = 'NE2'; % FAtom{2} = 'OE1'; % case 7 % FAtom{1} = 'OE1'; % FAtom{2} = 'OE2'; % case 8 % FAtom{1} = 'CA'; % case 9 % FAtom{1} = 'ND1'; % case 10 % FAtom{1} = 'CG1'; % FAtom{2} = 'CG2'; % case 11 % FAtom{1} = 'CG'; % case 12 % FAtom{1} = 'NZ'; % case 13 % FAtom{1} = 'SD'; % case 14 % FAtom{1} = 'CZ'; % case 15 % FAtom{1} = 'CG'; % case 16 % FAtom{1} = 'OG'; % case 17 % FAtom{1} = 'OG1'; % case 18 % FAtom{1} = 'CE2'; % case 19 % FAtom{1} = 'OH'; % case 20 % FAtom{1} = 'CG1'; % FAtom{2} = 'CG2'; % end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function AAint = AAsurf(AA) %Function that defines surface area (Å^2) of residues switch AA case {'v','V',20} AAint = 160; case {'l','L',11} AAint = 180; case {'i','I',10} AAint = 182; case {'m','M',13} AAint = 204; case {'f','F',14} AAint = 218; case {'w','W',18} AAint = 259; case {'y','Y',19} AAint = 229; case {'g','G',8} AAint = 85; case {'a','A',1} AAint = 113; case {'p','P',15} AAint = 143; case {'s','S',16} AAint = 122; case {'t','T',17} AAint = 146; case {'c','C',5} AAint = 140; case {'h','H',9} AAint = 194; case {'r','R',2} AAint = 241; case {'k','K',12} AAint = 211; case {'q','Q',6} AAint = 189; case {'e','E',7} AAint = 183; case {'n','N',3} AAint = 158; case {'d','D',4} AAint = 151; otherwise AAint = 100000; end function myint = aa2int(Subst) switch Subst case 'A' myint = 1; case 'R' myint = 2; case 'N' myint = 3; case 'D' myint = 4; case 'C' myint = 5; case 'Q' myint = 6; case 'E' myint = 7; case 'G' myint = 8; case 'H' myint = 9; case 'I' myint = 10; case 'L' myint = 11; case 'K' myint = 12; case 'M' myint = 13; case 'F' myint = 14; case 'P' myint = 15; case 'S' myint = 16; case 'T' myint = 17; case 'W' myint = 18; case 'Y' myint = 19; case 'V' myint = 20; otherwise myint = 0; end