- calculate overlap dialog copyright 2009-2012 Blair Armstrong, Christine Watson, David Plaut This file is part of SOS SOS is free software: you can redistribute it and/or modify it for academic and non-commercial purposes under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. For commercial or for-profit uses, please contact the authors (sos@cnbc.cmu.edu). SOS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
0001 % - calculate overlap dialog 0002 % 0003 % copyright 2009-2012 Blair Armstrong, Christine Watson, David Plaut 0004 % 0005 % This file is part of SOS 0006 % 0007 % SOS is free software: you can redistribute it and/or modify 0008 % it for academic and non-commercial purposes 0009 % under the terms of the GNU General Public License as published by 0010 % the Free Software Foundation, either version 3 of the License, or 0011 % (at your option) any later version. For commercial or for-profit 0012 % uses, please contact the authors (sos@cnbc.cmu.edu). 0013 % 0014 % SOS is distributed in the hope that it will be useful, 0015 % but WITHOUT ANY WARRANTY; without even the implied warranty of 0016 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0017 % GNU General Public License for more details. 0018 0019 % You should have received a copy of the GNU General Public License 0020 % along with SOS (see COPYING.txt). 0021 % If not, see <http://www.gnu.org/licenses/>. 0022 0023 0024 0025 function varargout = calculateOverlap_Dialog(varargin) 0026 % CALCULATEOVERLAP_DIALOG M-file for calculateOverlap_Dialog.fig 0027 % CALCULATEOVERLAP_DIALOG, by itself, creates a new CALCULATEOVERLAP_DIALOG or raises the existing 0028 % singleton*. 0029 % 0030 % H = CALCULATEOVERLAP_DIALOG returns the handle to a new CALCULATEOVERLAP_DIALOG or the handle to 0031 % the existing singleton*. 0032 % 0033 % CALCULATEOVERLAP_DIALOG('CALLBACK',hObject,eventData,handles,...) calls the local 0034 % function named CALLBACK in CALCULATEOVERLAP_DIALOG.M with the given input arguments. 0035 % 0036 % CALCULATEOVERLAP_DIALOG('Property','Value',...) creates a new CALCULATEOVERLAP_DIALOG or raises the 0037 % existing singleton*. Starting from the left, property value pairs are 0038 % applied to the GUI before calculateOverlap_Dialog_OpeningFcn gets called. An 0039 % unrecognized property name or invalid value makes property application 0040 % stop. All inputs are passed to calculateOverlap_Dialog_OpeningFcn via varargin. 0041 % 0042 % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one 0043 % instance to run (singleton)". 0044 % 0045 % See also: GUIDE, GUIDATA, GUIHANDLES 0046 0047 % Edit the above text to modify the response to help calculateOverlap_Dialog 0048 0049 % Last Modified by GUIDE v2.5 19-Sep-2010 12:19:38 0050 0051 % Begin initialization code - DO NOT EDIT 0052 gui_Singleton = 1; 0053 gui_State = struct('gui_Name', mfilename, ... 0054 'gui_Singleton', gui_Singleton, ... 0055 'gui_OpeningFcn', @calculateOverlap_Dialog_OpeningFcn, ... 0056 'gui_OutputFcn', @calculateOverlap_Dialog_OutputFcn, ... 0057 'gui_LayoutFcn', [] , ... 0058 'gui_Callback', []); 0059 if nargin && ischar(varargin{1}) 0060 gui_State.gui_Callback = str2func(varargin{1}); 0061 end 0062 0063 if nargout 0064 [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); 0065 else 0066 gui_mainfcn(gui_State, varargin{:}); 0067 end 0068 % End initialization code - DO NOT EDIT 0069 0070 0071 % --- Executes just before calculateOverlap_Dialog is made visible. 0072 function calculateOverlap_Dialog_OpeningFcn(hObject, eventdata, handles, varargin) 0073 % This function has no output args, see OutputFcn. 0074 % hObject handle to figure 0075 % eventdata reserved - to be defined in a future version of MATLAB 0076 % handles structure with handles and user data (see GUIDATA) 0077 % varargin command line arguments to calculateOverlap_Dialog (see VARARGIN) 0078 0079 % Choose default command line output for calculateOverlap_Dialog 0080 handles.output = hObject; 0081 0082 % Update handles structure 0083 guidata(hObject, handles); 0084 0085 % UIWAIT makes calculateOverlap_Dialog wait for user response (see UIRESUME) 0086 % uiwait(handles.figure_calculateOverlap_Dialog); 0087 0088 0089 % --- Outputs from this function are returned to the command line. 0090 function varargout = calculateOverlap_Dialog_OutputFcn(hObject, eventdata, handles) 0091 % varargout cell array for returning output args (see VARARGOUT); 0092 % hObject handle to figure 0093 % eventdata reserved - to be defined in a future version of MATLAB 0094 % handles structure with handles and user data (see GUIDATA) 0095 0096 % Get default command line output from handles structure 0097 varargout{1} = handles.output; 0098 0099 0100 % --- Executes on selection change in popupmenu_sample1Selector. 0101 function popupmenu_sample1Selector_Callback(hObject, eventdata, handles) 0102 % hObject handle to popupmenu_sample1Selector (see GCBO) 0103 % eventdata reserved - to be defined in a future version of MATLAB 0104 % handles structure with handles and user data (see GUIDATA) 0105 0106 % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu_sample1Selector contents as cell array 0107 % contents{get(hObject,'Value')} returns selected item from popupmenu_sample1Selector 0108 populateSampleList(hObject); 0109 0110 0111 function populateSampleList(hObject) 0112 % get a list of all populations in the base workspace: 0113 vars = evalin('base','whos()'); 0114 0115 samples = []; 0116 for i=1:length(vars) 0117 if strcmp(vars(i).class,'sample') 0118 samples = [samples; {vars(i).name}]; %#ok<AGROW> 0119 end 0120 end 0121 0122 % assign that list to the options in the pop up menu 0123 warning('off','MATLAB:hg:uicontrol:ParameterValuesMustBeValid'); 0124 set(hObject,'String',samples); 0125 0126 0127 0128 % --- Executes during object creation, after setting all properties. 0129 function popupmenu_sample1Selector_CreateFcn(hObject, eventdata, handles) 0130 % hObject handle to popupmenu_sample1Selector (see GCBO) 0131 % eventdata reserved - to be defined in a future version of MATLAB 0132 % handles empty - handles not created until after all CreateFcns called 0133 0134 % Hint: popupmenu controls usually have a white background on Windows. 0135 % See ISPC and COMPUTER. 0136 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 0137 set(hObject,'BackgroundColor','white'); 0138 end 0139 0140 0141 % --- Executes on button press in pushbutton_refreshSample1List. 0142 function pushbutton_refreshSample1List_Callback(hObject, eventdata, handles) 0143 % hObject handle to pushbutton_refreshSample1List (see GCBO) 0144 % eventdata reserved - to be defined in a future version of MATLAB 0145 % handles structure with handles and user data (see GUIDATA) 0146 populateSampleList(handles.popupmenu_sample1Selector); 0147 0148 0149 % --- If Enable == 'on', executes on mouse press in 5 pixel border. 0150 % --- Otherwise, executes on mouse press in 5 pixel border or over popupmenu_sample1Selector. 0151 function popupmenu_sample1Selector_ButtonDownFcn(hObject, eventdata, handles) 0152 % hObject handle to popupmenu_sample1Selector (see GCBO) 0153 % eventdata reserved - to be defined in a future version of MATLAB 0154 % handles structure with handles and user data (see GUIDATA) 0155 populateSampleList(hObject); 0156 0157 0158 % --- Executes on selection change in popupmenu_sample2Selector. 0159 function popupmenu_sample2Selector_Callback(hObject, eventdata, handles) 0160 % hObject handle to popupmenu_sample2Selector (see GCBO) 0161 % eventdata reserved - to be defined in a future version of MATLAB 0162 % handles structure with handles and user data (see GUIDATA) 0163 0164 % Hints: contents = cellstr(get(hObject,'String')) returns popupmenu_sample2Selector contents as cell array 0165 % contents{get(hObject,'Value')} returns selected item from popupmenu_sample2Selector 0166 populateSampleList(hObject); 0167 0168 % --- Executes during object creation, after setting all properties. 0169 function popupmenu_sample2Selector_CreateFcn(hObject, eventdata, handles) 0170 % hObject handle to popupmenu_sample2Selector (see GCBO) 0171 % eventdata reserved - to be defined in a future version of MATLAB 0172 % handles empty - handles not created until after all CreateFcns called 0173 0174 % Hint: popupmenu controls usually have a white background on Windows. 0175 % See ISPC and COMPUTER. 0176 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) 0177 set(hObject,'BackgroundColor','white'); 0178 end 0179 0180 0181 % --- Executes on button press in pushbutton_refreshSample2List. 0182 function pushbutton_refreshSample2List_Callback(hObject, eventdata, handles) 0183 % hObject handle to pushbutton_refreshSample2List (see GCBO) 0184 % eventdata reserved - to be defined in a future version of MATLAB 0185 % handles structure with handles and user data (see GUIDATA) 0186 populateSampleList(handles.popupmenu_sample2Selector); 0187 0188 % --- If Enable == 'on', executes on mouse press in 5 pixel border. 0189 % --- Otherwise, executes on mouse press in 5 pixel border or over popupmenu_sample2Selector. 0190 function popupmenu_sample2Selector_ButtonDownFcn(hObject, eventdata, handles) 0191 % hObject handle to popupmenu_sample2Selector (see GCBO) 0192 % eventdata reserved - to be defined in a future version of MATLAB 0193 % handles structure with handles and user data (see GUIDATA) 0194 populateSampleList(hObject); 0195 0196 0197 % --- Executes on button press in pushbutton_overlap. 0198 function pushbutton_overlap_Callback(hObject, eventdata, handles) 0199 % hObject handle to pushbutton_overlap (see GCBO) 0200 % eventdata reserved - to be defined in a future version of MATLAB 0201 % handles structure with handles and user data (see GUIDATA) 0202 sample1MenuHandle = handles.popupmenu_sample1Selector; 0203 sample1Name = getdfName(sample1MenuHandle,'sample'); 0204 0205 sample2MenuHandle = handles.popupmenu_sample2Selector; 0206 sample2Name = getdfName(sample2MenuHandle,'sample'); 0207 0208 if isempty(sample1Name) == 0 && isempty(sample2Name) == 0 0209 % run the command 0210 0211 command = ['dataFrame.overlap(',sample1Name,',',sample2Name,');']; 0212 0213 verbosePrint(['Executing command: ','''',command,''''],'calculateOverlapDialog_calculateOverlap'); 0214 evalin('base',command); 0215 end