1 7 Selecting an optimal parameter set The program zzzdar.m is usd to select an optimal set from the results of AR for closer inspection of spectra and elution curves. This program is very similar to the program z z zdar2 . m that calculates the confidence ranges as well. The reason for keeping a similar function in these two programs is that the zzzdar.m can operate faster when the full confidence ranges are not needed. %ZZZDAR.M selects AR solution for display. % Date: 30 Sep 1995 % ======================================= % Data analysis for hyphenated techniques % (c) Erkki & Ulla Karjalainen 1995 % ======================================= function zzzdar(page,gui,action); global C global elpchoice global gcuriter global gcurrpt global gcurspec global gelpcur global gelpmax global gelpmin global gelpsteps global gmaxiter global gmaxspec
Obs.mat params.txt kombi.mat
"EJ
---II". --..... ~
DAR
-......... ---.... ----I.~
current.txt C.mat S.mat
Figure 17.1 Program z z zdar . m reads the data matrix Obs . rna t, the parameters from params. txt and the starting situation (kombi . mat) for producing the spectra (8 • mat) and the elution curves (C . mat). The selected parameters are stored in current. txt.
341
342
global global global global global global global global global global global global global global global global global global global global global global global global global global global global global global global global global global global global global global global global global global global global global global global global global global global global global
gminspec grptct gspectcur gspectmax gspectmin gspectsteps gtotalsteps kombi nofile Obs S SavedFile spectchoice stepcount unichoice ed_SELErun_Stepct ed_SELEset_Curiter ed_SELEset_Currpt ed_SELEset_CUrspec ed_SELEset_Elpcurl ed_SELEset_Elpcur2 ed_SELEset_Elplinlog ed_SELEset_Elpmax ed_SELEset_Elpmin ed_SELEset_Elpsteps ed_SELEset_Maxspec ed_SELEset~spec
ed_SELEset_spectcul ed_SELEset_spectcu2 ed_SELEset_spectlinlog ed_SELEset_spectmax ed_SELEset_spectmin ed_SELEset_spectsteps ed_SELEset_Unimod fg_SELErun fg_SELEset fr_SELEset_CUrrentframe fr_SELEset_Paramframe rni_SELErun_Back mi_SELErun_Help mi_SELErun_Quit rni_SELErun_Save_curves rni_SELErun_Save_spectra rni_SELEset~elp
rni_SELEset_Quit rni_SELEset_Run InIl_SELErun_Files InIl_SELErun_GOTO InIl_SELEset_Files InIl_SELEset_GOTO pb_SELErun_Back pb_SELErun~elp
pb_SELEset_Help
343
global pb_SELEset_Load_Default global pb_SELEset_Run global tx_SELEset_Curitertx global tx_SELEset_Currpttx global tx_SELEset_Curspectx global tx_SELEset_Elpcurtxl global tx_SELEset_Elpcurtx2 global tx_SELEset_Elpmaxtx global tx_SELEset_Elpmintx global tx_SELEset_Elprof global tx_SELEset_Elpstepstx global tx_SELEset_Maxspectx global tx_SELEset_Minspectx global tx_SELEset_Paramheader global tx_SELEset_Species global tx_SELEset_Spectconst global tx_SELEset_Spectcurtxl global tx_SELEset_Spectcurtx2 global tx_SELEset_Spectmaxtx global tx_SELEset_Spectmintx global t~SELEset_Spectstepstx global t~SELEset_SUbsetheader if nargin == 0 page = 'initpage'; gui = 'initgui'; action = 0; end if strcmp(page, 'initpage') fg_SELEset = figure; fg_SELErun = figure; zzzdar('SELErun', 'initgui',O); zzzdar('SELEset', 'initgui',O); page = "; end if strcmp(page, 'SELEset') figure (fg_SELEset) set (gcf, 'NtimberTitle', 'off', 'Name', 'SELEset', .. , 'backingstore', 'off'); if strcmp(gui, 'initgui') zzzdar('SELEset', 'SELEset~enul',O); zzzdar('SELEset', 'SELEset_Menu2',0); zzzdar('SELEset', 'SELEset_Paramframe',O); zzzdar('SELEset', 'SELEset_Currentframe',O); zzzdar('SELEset', 'SELEset_Paramheader',O); zzzdar('SELEset', 'SELEset_Subsetheader',O); zzzdar('SELEset', 'SELEset_Elprof',O); zzzdar('SELEset', 'SELEset_Unimod',O); zzzdar('SELEset', 'SELEset_Elpmin',O); zzzdar('SELEset', 'SELEset_Elpmintx',O); zzzdar('SELEset', 'SELEset_Elpcurtxl',O); zzzdar('SELEset', 'SELEset_Elpcurl',O); zzzdar('SELEset', 'SELEset_Elpmax',O);
344
zzzdar('SELEset', 'SELEset_Elpmaxtx',O); zzzdar('SELEset', 'SELEset_Elpcur2',0); zzzdar('SELEset', 'SELEset_Elpcurtx2',O); zzzdar('SELEset', 'SELEset_Elplinlog',O); zzzdar('SELEset', 'SELEset_Elpsteps',O); zzzdar('SELEset', 'SELEset_Elpstepstx',O); zzzdar('SELEset', 'SELEset_Spectcurtx1',0); zzzdar('SELEset', 'SELEset_Spectcu1',0); zzzdar('SELEset', 'SELEset_Spectconst',O); zzzdar('SELEset', 'SELEset_Spectcu2',0); zzzdar('SELEset', 'SELEset_Spectcurtx2',0); zzzdar('SELEset', 'SELEset_Spectmin',O); zzzdar('SELEset', 'SELEset_Spectmintx',O); zzzdar('SELEset', 'SELEset_Spectmax',O); zzzdar('SELEset', 'SELEset_Spectmaxtx',O); zzzdar('SELEset', 'SELEset_Curspectx',O); zzzdar('SELEset', 'SELEset_Curspec',O); zzzdar('SELEset', 'SELEset_Spectlinlog',O); zzzdar('SELEset', 'SELEset_Spectsteps',O); zzzdar('SELEset', 'SELEset_Spectstepstx',O); zzzdar('SELEset', 'SELEset_Currpttx',O); zzzdar ( , SELEset' , 'SELEset_Currpt' , 0) ; zzzdar('SELEset', 'SELEset_Species',O); zzzdar('SELEset', 'SELEset_Minspec',O); zzzdar('SELEset', 'SELEset_Minspectx',O); zzzdar('SELEset', 'SELEset_Curitertx',O); zzzdar('SELEset', 'SELEset_Curiter',O); zzzdar('SELEset', 'SELEset_Maxspec',O); zzzdar('SELEset', 'SELEset_Maxspectx',O); zzzdar('SELEset', 'SELEset_Run',O); zzzdar('SELEset', 'SELEset_Load_Default',O); zzzdar('SELEset', 'SELEset_Help',O); zzzdar('SELEset', 'SELEset_Boot',l); end if strcmp(gui, 'SELEset_Paramframe') if action == 0 fr_SELEset_Paramframe = uicontrol(fg_SELEset, ... 'Style', 'frame', 'BackgroundColor',[0.50 0.50 0.50], ... 'Units', 'normalized', 'Position', [0.071 0.058 0.443 0.904]); end end if strcmp(gui, 'SELEset_Currentframe') if action == 0 fr_SELEset_Currentframe = uicontrol(fg_SELEset, ... 'Style', 'frame', 'BackgroundColor', [0.50 0.50 0.50], ... 'Units', 'normalized', 'Position', [0.529 0.058 0.414 0.904]); end end if strcmp (gui, 'SELEset_Menu1' ) if action == 0 uimenu(fg_SELEset, ... mn_SELEset_Files 'Label', 'Files'); mi_SELEset_Quit = uimenu(mn_SELEset_Files, ...
=
345 'Label', 'Quit', ... 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_bye' ',l)i')i end end if strcmp(gui, 'SELEset_Menu2') if action == 0 ~SELEset_GOTO = uimenu(fg_SELEset, ... 'Label', 'GOTO') i mi_SELEset_Run = uimenu (mn_SELEset_GOTO, ... 'Label', 'Run', ... 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_runthem' ',l)i ')i mi_SELEset_Help = u~enu{mn_SELEset_GOTO, ... 'Label', 'Help', ... 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Help' ',l)i ')i end end i f strcmp(gui, 'SELEset_setthem') if action == 1 figure (fg_SELEset) page = 1i end end i f strcmp (gui, 'SELEset_runthem' ) if action == 1 figure(fg~SELErun)
page = 2i end end if strcmp(gui, 'SELEset_Save_s') if action == 1 [filename, path]=uiputfile('S.mat', 'save spectra file:')i pit=length(filename)i if filename -= 0 vari=filename(1:pit-4)i zapu=[vari, ' = Si']i eval(zapu) rapu= [' save " vari,' , vari] i eval(rapu) end end end i f strcmp(gui, 'SELEset_Save_c') if action == 1 [filename, pathl=uiputfile('C.mat', 'Save elution curves file:')i vari=filenamei pit=length(filename)i if filename -= 0 i f pit> 4 vari=filename(l:pit-4)i end zapu=[vari, ' = Ci']i eval(zapu)
346
rapu= [ 'save' vari,' , vari] ; eval(rapu) end end end if strcmp(gui, 'SELEset_Boot') if action == 1 %global gmaxiter %global grptct %global gminspec %global gmaxspec %global gspectsteps %global gspectmin %global gspectmax %global gelpsteps %global gelpmax %global gelpmin %global gtotalsteps %global elpchoice %global spectchoice %global unichoice %global kombi %global Obs fid = fopen('PARAMS.TXT', 'r'); gmaxiter = fscanf(fid, '%f', [1,1]); grptct = fscanf(fid, '%f', [1,1]); gmaxspec = fscanf(fid, '%f', [1,1]); gminspec = fscanf(fid, '%f', [1,1]); gspectsteps = fscanf(fid, '%f', [1,1]); gspectmax = fscanf(fid, '%f', [1,1]); gspectmin = fscanf(fid, '%f', [1,1]); gelpsteps = fscanf(fid, '%f', [1,1]); gelpmax = fscanf(fid, '%f', [1,1]); gelpmin = fscanf(fid, '%f', [1,1]); gtotalsteps = fscanf(fid, '%f', [1,1]); spectchoice = fscanf(fid, '%f', [1,1]); elpchoice = fscanf(fid, '%f', [1,1]); unichoice = fscanf(fid, '%f', [1,1]); status = fclose(fid); load KOMBI kombi=KOMBI; load OBS TObs=OBS; Obs=TObs' ; total steps = gspectsteps*gelpsteps*(gmaxspec-gminspec+1); set (ed_SELEset_Elpmin, 'String',nunQstr(gelpmin»; set (ed_SELEset_Elpmax, 'String',nunQstr(gelpmax»; set (ed_SELEset_Elpsteps, 'String',num2str(gelpsteps»; set(ed_SELEset_spectmin, 'String',num2str(gspectmin»; set(ed_SELEset_spectmax, 'String',num2str(gspectmax»; set (ed_SELEset_spectsteps, 'String',num2str(gspectsteps»; set (ed_SELEset_Minspec, 'String',num2str(gminspec»; set (ed_SELEset_Maxspec, 'String',num2str(gmaxspec»;
347
if elpchoice == 1 teksti=' Lin' i else teksti= 'Log' i end set (ed_SELEset_Elplinlog, 'String' , teks ti) ; if spectchoice == 1 teksti= 'Lin' i else teksti= 'Log' ; end set (ed_SELEset_Spectlinlog, 'String',teksti); if unichoice == 1 teksti= ' Unimod' ; else teksti='Polymod'i end set (ed_SELEset_Unimod, 'String',teksti)i end end i f strcmp (gui, 'SELEset_loadthern' ) if action == 1 %global SavedFile %global nofile [filename,pathname] = uigetfile('*.mat', ... 'Choose a MATLAB Data file',SO,SO)i nofile=l; if filename -= 0 SavedFile = [pathname filename); clear filename pathname; eval(['load ' savedFile '; '); nofile=Oi end end end if strcmp (gui, 'SELEset_savethern' ) if action == 1 %global savedFile [filename,pathname) = uiputfile('*.mat', ... 'Data Filename',SO,SO)i if filename -= 0 SavedFile = [pathname filename]i clear filename pathnamei eval(['save ' SavedFile 'i'])i end end end i f strcmp(gui, 'SELEset_saveasthern') if action == 1 %global SavedFile if (strcmp(SavedFile,' '» [filename,pathname] = uiputfile('*.mat', ... 'Data Filename',SO,SO)i
348
else [filename,pathname] = uiputfile(SavedFile, ..• 'Data Filename',50,50)i end if filename 0 savedFile = [pathname filename] i clear filename patlmame; eval(['save ' SavedFile 'i'])i end
-=
end end if strcmp(gui, 'SELEset_bye') if action 1 close (fg_SELEset) close (fg_SELErun) end end if strcmp(gui, 'SELEset_Run') if action == 0 pb_SELEset_Run uicontrol(fg_SELEset, ... 'Style', 'pushbutton', ... 'Units', 'normalized', 'position', [0.057 0.000 0.171 0.058], ... 'String', 'Run', 'BackgroundColor', [0.8 0.8 0.8], ... 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Run' ',l)i')i end if action == 1 %global gelpcur %global gspectcur %global gcurspec %global gcurrpt %global gcuriter gelpcur = str2num(get(ed_SELEset_Elpcur1, 'String'»; i f gelpcur gelpcur = 1; end if gelpcur < 1 gelpcur = 1; set (ed_SELEset_Elpcur1, 'String',num2str(gelpcur»; end if gelpcur > gelpsteps gelpcur = gelpsteps; set(ed_SELEset_Elpcur1, 'String',num2str(gelpcur»; end if elpchoice == 1 elpvector = linspace(gelpmin/100,gelpmax/100,gelpsteps); else elpmi = log10(gelpmin/100)i elpma = log10(gelpmax/100); elpvector = logspace(elpmi,elpma,gelpsteps); end
==
=
== []
set (ed_SELEset_Elpcur2, 'String',num2str(100*elpvector(gelpcur»); gspectcur = str2num(get(ed_SELEset_Spectcu1, 'String'»;
349 if gspectcur == [] gspectcur = 1; end if gspectcur < 1 gspectcur = 1; set (ed_SELEset_Spectcul, 'String',num2str(gspectcur»; end if gspectcur > gspectsteps gspectcur = gspectsteps; set (ed_SELEset_Spectcu1, 'String',num2str(gspectcur»; end if spectchoice == 1 spectvector = linspace(gspectmin/100, .•. gspectmax/100,gspectsteps); else spectmi = log10(gspectmin/100); spectma = log10(gspectmax/100); spectvector = logspace(spectmi,spectma,gspectsteps); end set (ed_SELEset_Spectcu2, 'String',num2str(100*spectvector(gspectcur»); gcurspec = str2num(get(ed_SELEset_CUrspec, 'String'»; i f gcurspec == [] gcurspec gminspec; end i f gcurspec < gminspec gcurspec gminspec; end if gcurspec > gmaxspec gcurspec gmaxspec; end gcurrpt = str2num(get(ed_SELEset_CUrrpt, 'String'»; i£ gcurrpt == [] gcurrpt = 1; end i f gcurrpt <= 0 gcurrpt = 1; end set (ed_SELEset_CUrrpt, 'String',num2str(gcurrpt»; gcuriter = str2num(get(ed_SELEset_CUriter, 'String'»; i f gcuri ter == [) gcuriter = 20; end if gcuriter < 2 gcuriter = 2; end set (ed_SELEset_CUriter, 'String',num2str(gcuriter»; tid = fopen('CURRENT.TXT', 'w'); ~rintf(fid, '%8.5£ \n',gelpcur); ~rintf(£id, '%8.5£ \n',gspectcur); fprintf(fid, '%8.5f \n',gcurspec); fprintf(fid, '%8.5f \n',gcurrpt); fprintf(£id, '%8.5£ \n' ,gcuriter);
= = =
350
status = fclose(fid); figure (fg",-SELErun) page = 2; zzzdar('SELErun', 'SELErun_Execute',l); end end if strcup (gui, 'SELEset_Save_s' ) if action == 1 [filename, path]=uiputfile('S.mat', 'Save spectra file: '); vari=filename; pit=length(filename); if filename -= 0 if pit> 4 vari=filename(1:pit-4); end zapu=[vari, , = S;']; eval(zapu) rapu= [ 'save " vari,' , vari]; eval(rapu) end end end if strcup(gui, 'SELEset_Load_Default') if action == 0 pb_SELEset_Load_Default = uicontrol(fg_SELEset, ... 'Style', 'pushbutton', .•. 'Units', 'normalized', 'Position', [0.529 0.000 0.171 0.058], .. . 'String', 'Load_Default', 'BackgroundColor', [0.8 0.8 0.8], .. . 'CallBack', 'zzzdar(' 'SELESet' ',' 'SELEset_Load_Default' ',1); '); end if action == 1 gelpcur = 1; set (ed_SELEset_Elpcur1, 'String',nunastr(gelpcur»; set (ed_SELESet_Elpcur2, 'String',nunastr(100*kombi(gelpcur,2»); gspectcur = 1; set (ed_SELEset_Spectcu1, 'String',nunastr(gspectcur»; set (ed_SELEset_Spectcu2, 'String',nunastr(100*kombi(gspectcur,3»); gcurspec = gminspec; set (ed_SELEset_Curspec, 'String',nunastr(gcurspec»; gcurrpt = 1; set (ed_SELEset_Currpt, 'String',numQstr(gcurrpt»; gcuriter = 20; set (ed_SELEset_Curiter, 'String',numQstr(gcuriter»; end end if strcup(gui, 'SELEset_Help') if action == 0 pb_SELEset_Help = uicontrol(fg_SELEset, ... 'Style', 'pushbutton', ... 'Units', 'normalized', 'Position', [0.771 0.000 0.171 0.058], ... 'String', 'Help', 'BackgroundColor', [0.8 0.8 0.8], ... 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Help' ',1); ');
351
end if action == 1 help helpdar; end end if strcmp (gui, 'SELEset_Paramheader' ) if action == 0 t~SELEset_Paramheader = uicontrol(fg_SELEset, ... 'Style', 'text', 'BackgroundC', [0.5 0.5 0.5], ... 'ForegroundC', [1 1 1], ... 'Units', 'normalized', 'Position', [0.143 0.904 0.286 0.038], ... 'String', 'Parameters for Analysis', ... 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Paramheader' ',1);'); end end i f strcmp (gui, 'SELEset_Subsetheader' ) if action == 0 tx_SELEset_Subsetheader = uicontrol(fg_SELEset, ... 'Style', 'text', 'BackgroundC', [0.5 0.5 0.5], ... 'ForegroundC', [1 1 1], ... 'Units', 'normalized', 'Position', [0.629 0.904 0.200 0.038], ... 'String', 'Selected Subset', ... 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Subsetheader' ',1); '); end end if strcmp(gui, 'SELEset_Elprof') if action == 0 tx_SELEset_Elprof = uicontrol(fg_SELEset, .. . 'Style', 'text', 'BackgroundC', [0.5 0.5 0.5], .. . 'ForegroundC', [1 1 1], ... 'Units', 'normalized', 'Position', [0.071 0.846 0.271 0.038], ... 'String', 'Elution Curve Baseline', ... 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Elprof' ',1); '); end end if strcmp(gui, 'SELEset_Unimod') if action == 0 ed_SELEset_unimod = uicontrol(fg_SELEset, ... 'Style', 'edit', 'BackgroundColor', [0.50 0.50 0.50], ... 'Units', 'normalized', 'Position', [0.100 0.769 0.100 0.058], ... , String' , , , , ..• 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Unimod' ',1); '); end end if strcmp (gui, 'SELEset_Elpmin' ) if action == 0 ed_SELEset_Elpmin uicontrol(fg_SELEset, ... 'Style', 'edit', 'BackgroundColor', [0.50 0.50 0.50], ... 'Units', 'normalized', 'Position', [0.214 0.769 0.086 0.058], ... 'String', ", ... 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Elpmin' ',1); '); end end
=
352 if strcmp(gui, 'SELEset_Elpmintx') if action == 0 tx_SELEset_Elpmintx = uicontrol(fg_SELEset, .. . 'Style', 'text', 'BackgroundC', [0.5 0.5 0.5], .. . 'ForegroundC', [1 1 1], ..• 'Units', 'normalized', 'Position', [0.314 0.769 0.157 0.058], ... 'String', 'Minimum %', ... 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Elpmintx' ',1); '); end end if strcmp (gui, 'SELEset_Elpcurtxl' ) if action == 0 tx_SELEset_Elpcurtx1 = uicontrol(fg_SELEset, .. . 'Style', 'text', 'BackgroundC', [0.5 0.5 0.5], .. . 'ForegroundC', [1 1 1], ... 'Units', 'normalized', 'Position', [0.557 0.673 0.171 0.154], ... 'String', 'Selected step for elution curve baseline', ... 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Elpcurtx1' ',1); '); end end if strcmp(gui, 'SELEset_Elpcur1') if action == 0 ed_SELEset_Elpcur1 = uicontrol(fg_SELEset, ... 'Style', 'edit', 'BackgroundColor', [0.50 0.50 0.50], ... 'Units', 'normalized', 'Position', [0.743 0.769 0.100 0.058], ... 'String',' ', ... 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Elpcur1' ',1); ,); end end if strcmp(gui, 'SELEset_Elpmax') if action == 0 ed_SELEset_Elpmax = uicontrol(fg_SELEset, ... 'Style', 'edit', 'BackgroundColor', [0.50 0.50 0.50], ... 'Units', 'normalized', 'position', [0.214 0.692 0.086 0.058], .,. 'String', ", ... 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Elpmax' ',1); '); end end if strcmp(gui, 'SELEset_Elpmaxtx') if action == 0 tx_SELEset_Elpmaxtx = uicontrol(fg_SELEset, .. . 'Style', 'text', 'BackgroundC', [0.5 0.5 0.5], .. . 'ForegroundC', [1 1 1], ... 'Units', 'normalized', 'position', [0.314 0.692 0.157 0.058], ... 'String', 'Maximum %', ... 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Elpmaxtx' ',1); '); end end i f strcmp (gui, 'SELEset_Elpcur2 ' )
if action == 0 ed_SELEset_Elpcur2 = uicontrol(fg_SELEset, ... 'Style', 'edit', 'BackgroundColor', [0.50 0.50 0.50], ... 'Units', 'normalized', 'position', [0.743 0.692 0.100 0.058], ...
353 'String', ", ... 'CallBack', 'zzzdar(' 'SELEset",' 'SELEset_Elpcur2' ',I); '); end end i f strCIrq:> (gui, 'SELEset_Elpcurtx2' ) if action == 0 tx_SELEset_Elpcurtx2 = uicontrol(fg_SELEset, .. . 'Style', 'text', 'BackgroundC', [0.5 0.5 0.5], .. . 'ForegroundC', [1 1 I], ... 'Units', 'normalized', 'Position', [0.857 0.692 0.057 0.058], ... , String' , , (%) , , ••• 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Elpcurtx2' ',I);'); end end if strCIrq:> (gui, 'SELEset~lplinlog') if action == 0 ed_SELEset_Elplinlog = uicontrol(fg_SELEset, ..• 'Style', 'edit', 'BackgroundColor', [0.50 0.50 0.50], ... 'Units', 'normalized', 'Position', [0.100 0.615 0.100 0.058], ... 'String',", ... 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Elplinlog' ',I);'); end end if strCIrq:> (gui, 'SELEset_Elpsteps') if action == 0 ed_SELEset_Elpsteps = uicontrol(fg_SELEset, ... 'Style', 'edit', 'BackgroundColor', [0.50 0.50 0.50], ..• 'Units', 'normalized', 'Position', [0.214 0.615 0.086 0.058], ... 'String', ", ... 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Elpsteps' ',I);'); end end i f strCIrq:> (gui, 'SELEset_Elpstepstx' ) if action == 0 tx_SELEset_Elpstepstx = uicontrol(fg_SELEset, .. . 'Style', 'text', 'BackgroundC', [0.5 0.5 0.5], .. . 'ForegroundC', [1 1 1], ... 'Units', 'normalized', 'Position', [0.314 0.615 0.157 0.058], ... 'String', 'No. of steps', ... 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Elpstepstx' ',I);'); end end if strCIrq:>(gui, 'SELEset_Spectcurtx1') if action == 0 tx_SELEset_Spectcurtx1 = uicontrol(fg_SELEset, ... 'Style', 'text', 'BackgroundC', [0.5 0.5 0.5], ... 'ForegroundC', [1 1 1], •.. 'Units', 'normalized', 'position', [0.557 0.481 0.171 0.154], ... 'String', 'Selected step for spectral baseline', ... 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Spectcurtx1' ',I);'); end end if strCIrq:> (gui, 'SELEset_Spectcu1')
354
if action == 0 ed_SELEset_Spectcu1 = uicontrol(fg_SELEset, ... 'Style', 'edit', 'BackgroundColor', [0.50 0.50 0.50], ... 'Units', 'normalized', 'Position', [0.743 0.577 0.100 0.058], ... 'String',", ... 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Spectcu1' ',1);'); end end i f strcmp (gui, 'SELEset_Spectconst') if action == 0 tx_SELEset_Spectconst = uicontrol(fg_SELEset, .. . 'Style', 'text', 'BackgroundC', [0.5 0.5 0.5], .. . 'ForegroundC', [1 1 1], ... 'Units', 'normalized', 'Position', [0.100 0.538" 0.243 0.038], ... 'String', 'Spectral Baseline', ... 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Spectconst' ',1);'); end end if strcmp (gui, 'SELEset_Spectcu2' ) if action == 0 ed_SELEset_Spectcu2 = uicontrol(fg_SELEset, ... 'Style', 'edit', 'BackgroundColor', [0.50 0.50 0.50], ... 'Units', 'normalized', 'Position', [0.743 0.500 0.100 0.058], ... , String' , , , , ... 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Spectcu2' ',1);'); end end i f strcmp (gui, 'SELEset_Spectcurtx2 ' ) if action == 0 tx_SELEset_Spectcurtx2 = uicontrol(fg_SELEset, ... 'Style', 'text', 'BackgroundC', [0.5 0.5 0.5], ... 'ForegroundC', [1 1 1], ... 'Units', 'normalized', 'Position', [0.857 0.500 0.057 0.058], ... 'String',' (%)', ••• 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Spectcurtx2' ',1);'); end end if strcmp(gui, 'SELEset_Spectmin') if action == 0 ed_SELEset_Spectmin = uicontrol(fg_SELEset, .•. 'Style', 'edit', 'BackgroundColor', [0.50 0.50 0.50], •.. 'Units', 'normalized', 'Position', [0.214 0.462 0.086 0.058], ... 'String',", ... 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Spectmin' ',1);'); end end if strcmp(gui, 'SELEset_Spectmintx') if action == 0 tx_SELEset_Spectmintx = uicontrol(fg_SELEset, .. . 'Style', 'text', 'BackgroundC', [0.5 0.5 0.5], .. . 'ForegroundC', [1 1 1], ... 'Units', 'normalized', 'position', [0.314 0.462 0.157 0.058], ... 'String', 'Minimum %', ...
355
'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Spectmintx' ',1);'); end end i f strc:rrp(gui, 'SELEset_Spectmax')
if action == 0 ed_SELEset_Spectmax = uicontrol(fg_SELEset, ... 'Style', 'edit', 'BackgroundColor', [0.50 0.50 0.50], •.. 'Units', 'normalized', 'Position', [0.214 0.385 0.086 0.058], .•. 'String',", ... 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Spectmax' ',1);'); end end i f strcmp (gui, 'SELEset_Spectmaxtx' ) if action == 0 tx_SELEset_Spectmaxtx = uicontrol(fg_SELEset, .. . 'Style', 'text', 'BackgroundC', [0.5 0.5 0.5], .. . 'ForegroundC', [1 1 1], ... 'Units', 'normalized', 'Position', [0.314 0.385 0.157 0.058], ... 'String', 'Maximum t', ... 'CallBack', 'zzzdar(' 'SELEset' I,' 'SELEset_Spectmaxtx",l);'); end end i f strcmp(gui, 'SELEset_Curspectx') if action == 0 tx_SELEset_Curspectx = uicontrol(fg_SELEset, .. . 'Style', 'text', 'BackgroundC', [0.5 0.5 0.5], .. . 'ForegroundC', [1 1 1], ... 'Units', 'normalized', 'Position', [0.557 0.308 0.171 0.096], ... 'String', 'Number of species', ... 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Curspectx' ',1); I); end end i f strcmp (gui, 'SELEset_Curspec' ) if action == 0 ed_SELEset_Curspec = uicontrol(fg_SELEset, ... 'Style', 'edit', 'BackgroundColor', [0.50 0.50 0.50], .•. 'Units', 'normalized', 'position', [0.743 0.346 0.100 0.058], ... 'String', ", .•. 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Curspec' ',1); I); end end if strcmp(gui, 'SELEset_Spectlinlog') if action == 0 e~SELEset_Spectlinlog = uicontrol(fg_SELEset, ... 'Style', 'edit', 'BackgroundColor', [0.50 0.50 0.50], ... 'Units', 'normalized', 'Position', [0.100 0.308 0.1000.058], ... 'String', ", .•• 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Spectlinlog' ',1);'); end end if strcmp (gui, 'SELEset_Spectsteps' ) if action == 0 ed_SELEset_Spectsteps = uicontrol(fg_SELEset, ...
356 'Style', 'edit', 'BackgroundColor', [0.50 0.50 0.50], ... 'Units', 'normalized', 'Position', [0.214 0.308 0.086 0.058], ... , String' , , , , ..• 'CallBack', 'zzzdar(' 'SELEset",' 'SELEset_Spectsteps",l);'); end end i f strcmp(gui, 'SELEset_Spectstepstx') if action == 0 tx_SELEset_Spectstepstx = uicontrol(fg_SELEset, ... 'Style", 'text', 'BackgroundC', [0.5 0.5 0.5], ... 'ForegroundC' , [1 1 1], ... 'units', 'normalized', 'Position', [0.314 0.308 0.157 0.058], ... 'String', 'No. of steps', ... 'CallBack', 'zzzdar(' 'SELEset",' 'SELEset_Spectstepstx' ',1); '); end end i f strcmp (gui, 'SELEset_Currpttx' ) if action == 0 tx_SELEset_Currpttx = uicontrol(fg_SELEset, .. . 'Style', 'text', 'BackgroundC',[0.5 0.5 0.5], .. . 'ForegroundC', [1 1 1], ... 'units', 'normalized', 'position', [0.557 0.192 0.171 0.096], ... 'String', 'Number of repeats', ... 'CallBack', 'zzzdar("SELEset' ',' 'SELEset_Currpttx' ',1);'); end end i f strcmp (gui, 'SELEset_Currpt' ) if action == 0 ed_SELEset_CUrrpt = uicontrol(fg_SELEset, ... 'Style', 'edit', 'BackgroundColor', [0.50 0.50 0.50], ... 'units', 'normalized', 'position', [0.743 0.231 0.100 0.058], ... 'String',", ... 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_CUrrpt' ',1);'); end end if strcmp(gui, 'SELEset_Species') if action == 0 tx_SELEset_Species = uicantrol(fg_SELEset, .. . 'Style', 'text', 'BackgroundC', [0.5 0.5 0.5], .. . 'ForegroundC', (1 1 1], ... 'Units', 'normalized', 'Position', [0.100 0.231 0.243 0.038], ... 'String', 'Number of Species', ... 'CallBack', 'zzzdar(' 'SELEset",' 'SELEset_Species' ',1);'); end end i f strcmp (gui, 'SELEset_Minspec' ) if action == 0 ed_SELEset_Minspec = uicontrol(fg_SELEset, ... 'Style', 'edit', 'BackgroundColor', [0.50 0.50 0.50], ... 'units', 'normalized', 'Position', [0.214 0.154 0.086 0.058], ... 'String' , , " ... 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Minspec",l); '); end
357 end i f strcnp(gui, 'SELEsetJ(inspectx')
if action == 0 tx_SELEset_Minspectx = uicontrol(fg_SELEset, ... 'Style', 'text', 'BackgroundC', [0.5 0.5 0.5), .•. 'ForegroundC', [1 1 1), ... 'Units', 'normalized', 'Position', [0.314 0.154 0.157 0.058), ... 'String', 'Minimum', ..• 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Minspectx' ',1);'); end end i f strcnp (gui, 'SELEset_CUri tertx' ) if action == 0 tx_SELEset_CUritertx = uicontrol(f9-SELEset, ... 'Style', 'text', 'BackgroundC', [0.5 0.5 0.5), ..• 'ForegroundC', [1 1 1), ... 'Units', 'normalized', 'Position', [0.557 0.077 0.171 0.096), ..• 'String', 'NUmber of AR iterations', ... 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_CUritertx' ',1); '); end end if strcnp(gui, 'SELEset_CUriter') if action == 0 ed_SELEset_CUriter = uicontrol(fg_SELEset, ... 'Style', 'edit', 'BackgroundColor', [0.50 0.50 0.50), ... 'Units', 'normalized', 'Position', [0.743 0.115 0.100 0.058), ... 'String' , , " ... 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Curiter",l); '); end end i f strcnp(gui, 'SELEset_Maxspec') if action == 0 ed_SELEset_Maxspec = uicontrol(fg_SELEset, ... 'Style', 'edit', 'BackgroundColor', [0.50 0.50 0.50), ... 'Units', 'normalized', 'Position', [0.214 0.077 0.086 0.058), ... , String' , , , , ... 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Maxspec",l)i'); end end i f strcnp(gui, 'SELEset_Maxspectx') if action == 0 tx_SELEset_Maxspectx = uicontrol(fg_SELEset, .. . 'Style', 'text', 'BackgroundC', [0.5 0.5 0.5), .. . 'ForegroundC', [1 1 1), ... 'Units', 'normalized', 'Position', [0.314 0.077 0.157 0.058], ... 'String', 'Maximum' , ••. 'CallBack', 'zzzdar(' 'SELEset' ',' 'SELEset_Maxspectx' ',1);'); end end end if strcnp (page, 'SELErun') figure (fg_SELErun) set (gcf, 'NumberTitle', 'off',
358
'Name', 'SELErun', ... 'backingstore', 'off'); if strcmp(gui, 'initgui') zzzdar ( , SELErun' , 'SELErun_MENU1' , 0) ; zzzdar('SELErun', 'SELErun_Menu2',O); zzzdar('SELErun', 'SELErun_Back',O); zzzdar('SELErun', 'SELErun_Stepct',O); zzzdar('SELErun', 'SELErun_Help',O); zzzdar('SELErun', 'SELErun_Boot',l); end i f strcmp (gui, 'SELErun_MENU1' ) if action == 0 mn_SELErun_Files = uimenu(f~SELErun, ... 'Label', 'Files'); mi_SELErun_Save_spectra = UllnenU (mn_SELErun_Files, ... 'Label', 'Save_spectra', •.. 'CallBack', 'zzzdar(' 'SELErun' ',' 'SELErun_save_s' ',1); '); mi_SELErun_Save_curves = uimenu (mn_SELEruILFiles, •.. 'Label', 'Save_curves', .•• 'CallBack', 'zzzdar(' 'SELErun' ',' 'SELErun_save_c' ',1); '); mi_SELErun_Quit = uimenu (mn_SELErun_Files, ... 'Label', 'Quit', ... 'CallBack', 'zzzdar(' 'SELErun' ',' 'SELErun_b¥e' ',1);'); end end i f strcmp (gui, 'SELErun_Menu2' ) if action == 0 mn_SELErun_GOTO = uimenu(fg_SELErun, ... 'Label' , 'GOTO') ; mi_SELErun_Back = uimenu (mn_SELErun_GOTO, ... 'Label', 'Back', ... 'CallBack', 'zzzdar(' 'SELErun' ',' 'SELErun_setthem' ',1);'); mi_SELErun_Help = uimenu (mn_SELErun_GOTO, ... 'Label', 'Help', ... 'CallBack', 'zzzdar(' 'SELErun' ',' 'SELErun_Help' ',1);'); end end i f strcmp(gui, 'SELErun_setthem') if action == 1 figure (fg_SELEset) page = 1; end end if strcmp(gui, 'SELErun_runthem') if action == 1 figure (fg_SELErun) page = 2; end end i f strcmp (gui, 'SELErun_Back' ) if action == 0 Pb_SELErun_Back = uicontrol(fg_SELErun, ... 'Style', 'pushbutton', ...
359 'Units', 'normalized', 'Position', [0.000 0.000 0.186 0.058], ... 'String', 'Back', 'BackgroundColor', [0.8 0.8 0.8], ... 'CallBack', 'zzzdar(' 'SELErun' ',' 'SELErun_Back",1);'); end if action == 1 plot (1, 'k' ) axis ( 'off' ) figure (fg_SELEset) page = 1; end end i f strcmp(gui, 'SELErurLbye') if action == 1 close (fg_SELEset) close (fg_SELErun) end end if strcmp (gui, 'SELErun_savethem' ) if action == 1 %global SavedFile [filename,pathname] = uiputfile('*.mat', ..• 'Data Filenarne',50,50)i if filename -= 0 SavedFile = [pathname filename]i clear filename pathname i eval(['save ' SavedFile 'i'])i end end end if strcmp (gui, 'SELErun_saveasthem' ) if action == 1 %global savedFile if (strcmp(SavedFile,' '» [filename,pathname] = uiputfile('*.mat', ... 'Data Filename',50,50)i else [fi1ename,pathname] = uiputfile(SavedFile, •.. 'Data Filename',50,50)i end if filename 0 SavedFile = [pathname filename] i clear filename pathname; eval(['save ' savedFile 'j']); end end end if strcmp (gui, 'SELErun_Execute' ) if action == 1 %g lobal grptct %global gminspec %global gmaxspec %global gmaxiter %global gspectmax
-=
360
%global gspectmin %global gspectsteps %global gelpsteps %global gelpmin %g lobal gelpmax %global stepcount %global S %global C load OBS TObs=OBS; Obs=TObs' ;
[nk, mk] = size(kombi); totalsteps = gspectsteps*gelpsteps*(gmaxspecgminspec+l)*gcurrpt; SVF=zeros(l,l); SFF=zeros(l,l); tstp = gtotalsteps * grptct; ~rintf('\n*** AutoAR/Select ***\n\n') ~rintf('Max iterations: %3.0f Repeats: %3.0f sets:%3.0f\n', ... gmaxiter,grptct,tstp) if elpchoice == 1 fprintf('Elution curve baseline: %7.6f - %7.6f steps:%4.0f\n', ... gelpmin/lOO,gelpmax/100,gelpsteps) else fprintf('Elution curve baseline: %7.6f - %7.6f steps:%4.0f\n', ... gelpmin/100,gelpmax/100,gelpsteps)
Total
Lin
Log
end
if spectchoice == 1 fprintf('Spectral baseline: %7.6f - %7.6f steps:%4.0f\n', ... gspectmin/100,gspectmax/lOO,gspectsteps) else fprintf('Spectral baseline: %7.6f - %7.6f steps:%4.0f\n', ... gspectmin/lOO,gspectmax/lOO,gspectsteps)
Lin
Log
end
fprintf('No. of species: %2.0f -%2.0f\n\n',gminspec,gmaxspec) if elpchoice == 1 elpvector = linspace(gelpmin/100,gelpmax/lOO,gelpsteps); else elpmi = loglO(gelpmin/lOO); elpma = loglO(gelpmax/lOO); elpvector = logspace(elpmi,elpma,gelpsteps); end
elp = elpvector(gelpcur); if spectchoice == 1 spectvector = linspace(gspectmin/lOO, ... gspectmax/100,gspectsteps); else spectmi = loglO(gspectmin/100);
361
spectma = log10(gspectmax/100): spectvector = logspace(spectmi,spectma,gspectsteps): end spect = spectvector(gspectcur): siemen = 0: siemen2 = 0: fprintf ( , Selection: \n \n ' ) for i i = 1:nk wnspec = kombi(ii,1): welp = kombi(ii,2): wspect = kombi(ii,3): wAF = kombi(ii,4); WSF = kombi(ii,5): wsiemen = kombi(ii,6): wsiemen2 = kombi(ii,7): It = 0.00000001: if wnspec == gcurspec if abs(welp-e1p) < It if abs(wspect-spect) < It siemen = wsiemen: siemen2 = wsiemen2; end end end end figure (f9-.SELErun) stepcount = 0: iteration fit' ) disp('setel.curve spectral no. of %' ) disp('count baseline baseline species per level rand ( , seed' , siemen) : randn ( , seed' , siemen2) : nspec = gcurspec: F=zeros(gcurrpt,1): TT=zeros(I,nspec); 'lTI'=zeros (gcurrpt, nspec) : [nlines, nscans]=size(Obs): total=nor.m(Obs, 'fro'); for rr = 1:gcurrpt S=rand(nlines,nspec): bestfit=9999999; for iter=1:gcuriter S = (S > zeros(size(S») .*S; S = S+0.00000000001*abs(randn(size(S»): for j=1:nspec S(1:nlines,j)=S(1:nlines,j)/surn(S(1:nlines,j»: end if iter == gcuriter PI=S*C: DI = Obs-PI; diff = 100*nor.m(DI, 'fro'}/total: stepcount = stepcount+1; %4.0f fprintf('%5.0f %7.6f %7.6f %4.0f %5.3f\n', ...
362 stepcount,elp,spect,nspec,iter,diff) set(ed_SELErun_Stepct,'String',num2str(stepcount»; end C1 = pinv(S) ; C = C1*Obs; %solve concentrations C = (C > zeros(size(C») .*C; C = C + O.OOOOOOOOOOl*abs(randn(size(C»); for j=l :nspec if unichoice == 1 % Make monotonic temp=C(j,l:nscans); [arvo paikka] =max (temp) ; templs=sort(temp(l:paikka»; temprs=sort(temp(paikka:nscans»; C(j,l:nscans)=[templs temprs«nscans-paikka) :-1:1)]; end W=C(j,l:nscans); whig = max (W) ; wsmall = min (W) ; wlirnit = wbig*elp; i f wsmall < wlirni t ero = wlimit-wsmall; W=W+ero; end C(j,l:nscans) = W; end %j % Last iteration: show & save results if iter gcuriter if unichoice 1 [WWW, KKK] = max(C'); [LLL,MMM]=sort(KKK); C = C (MMM, : ) ; S = S ( : , MMM) ; else Tr=sum(C'); [WWW, KKK] = sort(Tr); C = C (KKK, :) ; S = S ( : , KKK) ; end plot(C' ) title(['AR iteration #',num2str(iter), , Fit=',
==
==
num2str(diff)] ) xlabel ( 'Scan number' ) drawnow save C C save S S end G = pinv(C'); ST = G*TObs; ST = (ST > zeros(size(ST») .*ST; ST = ST + O.OOOOOOOOOOl*abs(randn(size(ST»); for j=l:nspec W=ST(j,l:nlines);
363
whig = max (W) ; wsmall = min (W) ; wlirnit = whig*spect; i f wsmall < wlirnit ero = wlirnit-wsmall; W=W+ero; end ST(j,l:nlines) = W; end %j S
= ST';
end %iter F(rr)=diff; TT=sum(C') ; TTl' (rr, : ) ='l"I' ; end %rr if gcurrpt == 1 W
= 0;
else W = std (TTl') ; end MM = mean (TTl') ; SVF(1)=100*sum(W)/sum(MM); SFF(l) =mean (F) ;
fprintf ( , \nScatter: \n' ) fprintf('%6.4f %6.4f %6.4f %6.4f %6.4f %6.4f\n',SVF) fprintf('\nFit:\n') fprintf('%6.4f %6.4f %6.4f %6.4f %6.4f %6.4f\n',SFF) fprintf ( , \n ' ) end end i f strcmp (gui, 'SELErun_Help' ) if action == 0 pb_SELErun_Help = uicontrol(fg_SELErun, ... 'Style', 'pushbutton', ... 'Units', 'normalized', 'position', [0.814 0.000 0.098 0.058], ... 'String', 'Help', 'BackgroundColor', [0.8 0.8 0.8], ... 'CallBack', 'zzzdar(' 'SELErun' ',' 'SELErun_Help' ',1);'); end if action == 1 help helpdar; end end if strcmp (gui, 'SELErun_Save_s') if action == 1 [filename, path]=uiputfile('S.mat', 'Save spectra file: '); vari=filenamei pit=length(filename); if filename -= 0 i f pit> 4 vari=filename(1:pit-4); end zapu=[vari, , = S; ']; eval(zapu)
364
rapu= [ 'save' vari,' , vari]; eval(rapu) end end end if strcmp(gui, '~Save_c') if action == 1 [filename, path]=uiputfile('C.mat', ... 'Save elution curves file:'); vari=filename ; pit=length(filename); if filename -= 0 i f pit> 4 vari=filename(1:pit-4); end zapu=[vari, , = C;']j eval(zapu) rapu= [ 'save " vari,' , vari] j eval(rapu) end end end i f strcmp(gui, '~Stepct') if action == 0 ed_SELErun_Stepct = uicontrol(fg_SELErun, ... 'Style', 'edit', 'BackgroundColor', [0.50 0.50 0.50], ... 'Units', 'normalized', 'Position', [0.686 0.000 0.100 0.058], ... 'String',", ... 'CallBack', 'zzzdar(' 'SELErun' ',' 'SELErun_Stepct' ',1);'); end end end % ##### End of program #####