0001 function varargout = Precons(varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010 gui_Singleton = 1;
0011 gui_State = struct('gui_Name', mfilename, ...
0012 'gui_Singleton', gui_Singleton, ...
0013 'gui_OpeningFcn', @Precons_OpeningFcn, ...
0014 'gui_OutputFcn', @Precons_OutputFcn, ...
0015 'gui_LayoutFcn', [] , ...
0016 'gui_Callback', []);
0017 if nargin && ischar(varargin{1})
0018 gui_State.gui_Callback = str2func(varargin{1});
0019 end
0020
0021 if nargout
0022 [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
0023 else
0024 gui_mainfcn(gui_State, varargin{:});
0025 end
0026
0027
0028
0029
0030 function Precons_OpeningFcn(hObject, eventdata, handles, varargin)
0031
0032
0033
0034
0035
0036 Fileid = fopen('orgs.txt','r');
0037 orgcell = textscan(Fileid,'%s %s %[^\n]');
0038 fclose(Fileid);
0039 Tcode = orgcell{1}; Scode = orgcell{2};
0040 for ct = 1:numel(Tcode)
0041 tscode{ct} = [Scode{ct},' ',Tcode{ct}];
0042 end
0043 set(handles.OrganPopup,'String',tscode)
0044
0045
0046 handles.output = hObject;
0047
0048
0049 guidata(hObject, handles);
0050
0051
0052
0053
0054
0055
0056 function varargout = Precons_OutputFcn(hObject, eventdata, handles)
0057
0058
0059
0060
0061
0062
0063 varargout{1} = handles.output;
0064
0065
0066
0067 function OrganPopup_Callback(hObject, eventdata, handles)
0068
0069
0070
0071 Fileid = fopen('orgs.txt','r');
0072 orgcell = textscan(Fileid,'%s %s %[^\n]');
0073 fclose(Fileid);
0074 Ncode = orgcell{3}; Scode = orgcell{2};
0075 Cursel = get(hObject,'Value');
0076 if ~isempty(Cursel)
0077 set(handles.Orgtext,'String',Ncode{Cursel})
0078 set(handles.OrganEdit,'String',Scode{Cursel})
0079 end
0080
0081 stat = get(handles.Biographcheck,'Value');
0082 if stat
0083 Org = get(handles.OrganEdit,'String');
0084 if ~strcmp(Org,'Organism code')
0085 Txt1 = 'Downloding pathway data...';
0086 fprintf(Txt1)
0087 [getpathways,stat] = urlread(['http://rest.kegg.jp/list/pathway/',Org]);
0088 if ~stat
0089 msgbox('There is a problem with the internet connection!');
0090 for i =1:numel(Txt1)
0091 fprintf('\b')
0092 end
0093 return
0094 end
0095 for i =1:numel(Txt1)
0096 fprintf('\b')
0097 end
0098 pths = textscan(getpathways,'%s %[^\n]');
0099 pathnames = pths{1}; pathnames = strrep(pathnames,'path:','');
0100 pathdescription = pths{2};
0101 set(handles.Pathwaylistbox,'String',strcat(pathnames,'_',pathdescription))
0102 end
0103 end
0104
0105
0106 function OrganPopup_CreateFcn(hObject, eventdata, handles)
0107
0108
0109
0110
0111
0112
0113 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0114 set(hObject,'BackgroundColor','white');
0115 end
0116
0117
0118
0119 function OrganEdit_Callback(hObject, eventdata, handles)
0120
0121
0122
0123 Fileid = fopen('orgs.txt','r');
0124 orgcell = textscan(Fileid,'%s %s %[^\n]');
0125 fclose(Fileid);
0126 Tcode = orgcell{1}; Scode = orgcell{2}; Ncode = orgcell{3};
0127 OrgEditSelect = get(hObject,'String');
0128 WhereOrgPop1 = find(ismember(Tcode,OrgEditSelect));
0129 WhereOrgPop2 = find(ismember(Scode,OrgEditSelect));
0130 if ~isempty(WhereOrgPop1)
0131 set(handles.OrganPopup,'Value',WhereOrgPop1)
0132 set(handles.Orgtext,'String',Ncode{WhereOrgPop1})
0133 elseif ~isempty(WhereOrgPop2)
0134 set(handles.OrganPopup,'Value',WhereOrgPop2)
0135 set(handles.Orgtext,'String',Ncode{WhereOrgPop2})
0136 else
0137 set(handles.Orgtext,'String','Wrong organism code')
0138 end
0139 stat = get(handles.Biographcheck,'Value');
0140 if stat
0141 Org = get(handles.OrganEdit,'String');
0142 if ~strcmp(Org,'Organism code')
0143 Txt1 = 'Downloding pathway data...';
0144 fprintf(Txt1)
0145 [getpathways,stat] = urlread(['http://rest.kegg.jp/list/pathway/',Org]);
0146 if ~stat
0147 msgbox('There is a problem with the internet connection!');
0148 for i =1:numel(Txt1)
0149 fprintf('\b')
0150 end
0151 return
0152 end
0153 for i =1:numel(Txt1)
0154 fprintf('\b')
0155 end
0156 pths = textscan(getpathways,'%s %[^\n]');
0157 pathnames = pths{1}; pathnames = strrep(pathnames,'path:','');
0158 pathdescription = pths{2};
0159 set(handles.Pathwaylistbox,'String',strcat(pathnames,'_',pathdescription))
0160 end
0161 end
0162
0163
0164 function OrganEdit_CreateFcn(hObject, eventdata, handles)
0165
0166
0167
0168
0169
0170
0171 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0172 set(hObject,'BackgroundColor','white');
0173 end
0174
0175
0176
0177 function DonePush_Callback(hObject, eventdata, handles)
0178
0179
0180
0181 PreconsMethod(handles)
0182
0183
0184
0185 function Pathwaylistbox_Callback(hObject, eventdata, handles)
0186
0187
0188
0189
0190
0191
0192
0193
0194
0195 function Pathwaylistbox_CreateFcn(hObject, eventdata, handles)
0196
0197
0198
0199
0200
0201
0202 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
0203 set(hObject,'BackgroundColor','white');
0204 end
0205
0206
0207
0208 function Biographcheck_Callback(hObject, eventdata, handles)
0209
0210
0211
0212
0213
0214 stat = get(hObject,'Value');
0215 if stat
0216 set(handles.Pathwaylistbox,'Enable','on')
0217 set(handles.G2Bradiobutton,'Enable','on')
0218 set(handles.G2Kradiobutton,'Enable','on')
0219 set(handles.G2K2Bradiobutton,'Enable','on')
0220 Org = get(handles.OrganEdit,'String');
0221 if ~strcmp(Org,'Organism code')
0222 Txt1 = 'Downloding pathway data...';
0223 fprintf(Txt1)
0224 [getpathways,stat] = urlread(['http://rest.kegg.jp/list/pathway/',Org]);
0225 if ~stat
0226 msgbox('There is a problem with the internet connection!');
0227 for i =1:numel(Txt1)
0228 fprintf('\b')
0229 end
0230 return
0231 end
0232 for i =1:numel(Txt1)
0233 fprintf('\b')
0234 end
0235 pths = textscan(getpathways,'%s %[^\n]');
0236 pathnames = pths{1}; pathnames = strrep(pathnames,'path:','');
0237 pathdescription = pths{2};
0238 set(handles.Pathwaylistbox,'String',strcat(pathnames,'_',pathdescription))
0239 end
0240 else
0241 set(handles.Pathwaylistbox,'Enable','off')
0242 set(handles.G2Bradiobutton,'Enable','off')
0243 set(handles.G2Kradiobutton,'Enable','off')
0244 set(handles.G2K2Bradiobutton,'Enable','off')
0245 end