From b8ebff2c182d894cf0d7ec68462430ba75503dfe Mon Sep 17 00:00:00 2001 From: Bryan Roessler Date: Sat, 27 Jul 2024 19:13:51 -0400 Subject: [PATCH] Formatting --- workflow/apps/easy/DMPexcel2mat.m | 26 ++++++------- workflow/apps/easy/DgenResults.m | 4 +- workflow/apps/easy/EASYconsole.m | 38 ++++++++++--------- workflow/apps/easy/NCdisplayGui.m | 58 ++++++++++++++--------------- workflow/apps/easy/par4Gbl_Main8c.m | 2 +- 5 files changed, 66 insertions(+), 62 deletions(-) diff --git a/workflow/apps/easy/DMPexcel2mat.m b/workflow/apps/easy/DMPexcel2mat.m index 238b02ef..87a5f7c0 100755 --- a/workflow/apps/easy/DMPexcel2mat.m +++ b/workflow/apps/easy/DMPexcel2mat.m @@ -49,7 +49,7 @@ if ~exist(masterPlateFile, 'file') || isempty(masterPlateFile) disp('Using newest MasterPlate file: ', masterPlateFile, ', skipping directory selection'); break catch ME - h = msgbox(ME.message, 'Error', 'error'); + h=msgbox(ME.message, 'Error', 'error'); disp('Rerunning directory selection'); % I don't know what else we'll need to do here end @@ -74,7 +74,7 @@ if ~exist(masterPlateFile, 'file') || isempty(masterPlateFile) disp('Using newest MasterPlate file: ', masterPlateFile, ', skipping directory selection'); break catch ME - h = msgbox(ME.message, 'Error', 'error'); + h=msgbox(ME.message, 'Error', 'error'); uiwait(h); disp('Rerunning directory selection'); % I don't know what else we'll need to do here @@ -108,18 +108,18 @@ try excLnNum=3; while (isequal(txt{excLnNum,1},'###')) numb=numb+1; - MP(numb).head = {raw(excLnNum,2:6)}; - MP(numb).recNum = {raw((excLnNum+1):(excLnNum+384),1)}; - MP(numb).orf = {raw((excLnNum+1):(excLnNum+384),2)}; - MP(numb).strain = {raw((excLnNum+1):(excLnNum+384),3)}; - MP(numb).genename= {raw((excLnNum+1):(excLnNum+384),12)}; - MP(numb).drug= {raw((excLnNum+1):(excLnNum+384),8)}; - MP(numb).media= {raw((excLnNum+1):(excLnNum+384),7)}; + MP(numb).head={raw(excLnNum,2:6)}; + MP(numb).recNum={raw((excLnNum+1):(excLnNum+384),1)}; + MP(numb).orf={raw((excLnNum+1):(excLnNum+384),2)}; + MP(numb).strain={raw((excLnNum+1):(excLnNum+384),3)}; + MP(numb).genename={raw((excLnNum+1):(excLnNum+384),12)}; + MP(numb).drug={raw((excLnNum+1):(excLnNum+384),8)}; + MP(numb).media={raw((excLnNum+1):(excLnNum+384),7)}; if size(raw,2)>15 - MP(numb).orfRep= {raw((excLnNum+1):(excLnNum+384),16)}; % added 12_1005 to specify replicates Orfs in MP - MP(numb).specifics= {raw((excLnNum+1):(excLnNum+384),17)}; % added 12_1008 to specify replicates Specific details in MP + MP(numb).orfRep={raw((excLnNum+1):(excLnNum+384),16)}; % added 12_1005 to specify replicates Orfs in MP + MP(numb).specifics={raw((excLnNum+1):(excLnNum+384),17)}; % added 12_1008 to specify replicates Specific details in MP else - MP(numb).orfRep= ' '; + MP(numb).orfRep=' '; MP(numb).specifics= ' '; end % Future MP field @@ -161,7 +161,7 @@ try end end catch ME - h = msgbox(ME.message, 'Error', 'error'); + h=msgbox(ME.message, 'Error', 'error'); uiwait(h); end diff --git a/workflow/apps/easy/DgenResults.m b/workflow/apps/easy/DgenResults.m index 403bcb16..17b95dff 100755 --- a/workflow/apps/easy/DgenResults.m +++ b/workflow/apps/easy/DgenResults.m @@ -379,8 +379,8 @@ try ln=1; resultsFilename=fullfile(printResultsDir, strcat('!!ResultsStd_',expNm,'.txt')); DBfilename=fullfile(printResultsDir, strcat('!!DbaseStd_',expNm,'.txt')); - if isequal(opt,'Res')||isequal(opt,'Both'),fid = fopen(resultsFilename,'w');end - if isequal(opt,'DB')||isequal(opt,'Both'),fid2 = fopen(DBfilename,'w');end %121012 Combo + if isequal(opt,'Res')||isequal(opt,'Both'),fid=fopen(resultsFilename,'w');end + if isequal(opt,'DB')||isequal(opt,'Both'),fid2=fopen(DBfilename,'w');end %121012 Combo if isequal(opt,'Res')||isequal(opt,'Both') %print Results fprintf(fid,'%d\t',ln); %Results header fprintf(fid,'%s\t\n',scansDir); diff --git a/workflow/apps/easy/EASYconsole.m b/workflow/apps/easy/EASYconsole.m index d00d8291..32d201e2 100644 --- a/workflow/apps/easy/EASYconsole.m +++ b/workflow/apps/easy/EASYconsole.m @@ -50,23 +50,27 @@ function varargout = EASYconsole(varargin) fprintf('Using scans directory: %s from environment variable SCANS_DIR\n', scansDir); disp('This usually indicates that we are in module mode'); else - dirToScan=fullfile(parentDir,'..','ExpJobs'); % hardcoded relative to easy script dir TODO: if we change pj layout this will change - if exist(dirToScan, 'dir') - dirs=dir(fullfile(dirToScan, 'dir')); % filter for dirs only - [~, sortedIndices]=sort(datenum({dirs.date}), 'descend'); % sort by newest first - sortedDirs=dirs{sortedIndices}; - scansDir=sortedDirs{1}; - disp('Beginning in newest project scans directory'); - fprintf('Using scans directory: %s from hardcoded relative path\n', scansDir); - disp('This usually indicates that we are in stand-alone mode without PROJECT or SCANS_DIR environment variables'); - else - scansDir=fullfile(parentDir, '..', 'demo', '20240727_hartmanlab_demo_project'); - if exist(scansDir, 'dir') - demo=1; - fprintf('Using scans directory: %s from hardcoded absolute path to demo project\n', scansDir); - else - fprintf('Error: demo project %s not found\n', scansDir); - disp('Attempting to continue but this may get ugly'); + % Change these when modifying EASY_DIR in workflow + fprintf('Beginning parent scans directory search\n'); + fprintf('This usually indicates that we are in stand-alone mode without PROJECT or SCANS_DIR environment variables\n'); + dirsToScan={ + fullfile(parentDir,'..', '..', 'scans'), + fullfile(parentDir, '..', '..', 'ExpJobs'), + fullfile('/mnt/data/scans'), + fullfile('/mnt/data/ExpJobs'), + fullfile(parentDir, '..', 'demo', '20240727_hartmanlab_demo_project') + }; + for d=dirsToScan + if exist(d, 'dir') + subDirs=dir(d); + if ~isempty(subDirs) + fprintf('Found a non-empty parent scans directory in our list: %s\n', d); + fprintf('Scanning inside for a project scan directory\n'); + [~, sortedIndices]=sort(datenum({dirs.date}), 'descend'); % sort by newest first + sortedDirs=dirs{sortedIndices}; + scansDir=sortedDirs{1}; + fprintf('Selected newest project scans directory: %s\n', scansDir); + end end end end diff --git a/workflow/apps/easy/NCdisplayGui.m b/workflow/apps/easy/NCdisplayGui.m index f741297e..2f445654 100755 --- a/workflow/apps/easy/NCdisplayGui.m +++ b/workflow/apps/easy/NCdisplayGui.m @@ -124,7 +124,7 @@ end %function end $$$$$[/INST] yPos=0.85-(lblNumber-1)*(btnHt+spacing); btnPos=[xLPos yPos-spacing btnWid btnHt]; -htxt = uicontrol(... +htxt=uicontrol(... 'Style', 'text',... 'String','BG Threshold (%above) Detection',... 'Units','normalized',... @@ -136,7 +136,7 @@ htxt = uicontrol(... yPos=0.85-(lblNumber-1)*(btnHt+spacing); btnPos=[xLPos yPos-spacing btnWid btnHt]; -htxt = uicontrol(... +htxt=uicontrol(... 'Style', 'text',... 'String','SpotDetThres(1-60%)',... 'Units','normalized',... @@ -147,7 +147,7 @@ htxt = uicontrol(... yPos=0.85-(lblNumber-1)*(btnHt+spacing); btnPos=[xLPos yPos-spacing btnWid btnHt]; -htxt = uicontrol(... +htxt=uicontrol(... 'Style', 'text',... 'String','Radius',... %'String','Width',... 'Units','normalized',... @@ -157,7 +157,7 @@ lblNumber=6; yPos=0.85-(lblNumber-1)*(btnHt+spacing); btnPos=[xLPos yPos-spacing btnWid btnHt]; -htxt = uicontrol(... +htxt=uicontrol(... 'Style', 'text',... 'String','Dither',... 'Units','normalized',... @@ -168,7 +168,7 @@ lblNumber=7; yPos=0.85-(lblNumber-1)*(btnHt+spacing); btnPos=[xLPos yPos-spacing btnWid btnHt]; -htxt = uicontrol(... +htxt=uicontrol(... 'Style', 'text',... 'String','SearchRange',... 'Units','normalized',... @@ -180,7 +180,7 @@ lblNumber=8; yPos=0.85-(lblNumber-1)*(btnHt+spacing); btnPos=[xLPos yPos-spacing btnWid btnHt]; -htxt = uicontrol(... +htxt=uicontrol(... 'Style', 'text',... 'String','Blank2',... 'Units','normalized',... @@ -199,7 +199,7 @@ btnNumber=6; yPos=0.85-(btnNumber-1)*(btnHt+spacing); btnPos=[xPos yPos-spacing btnWid btnHt]; srcExtendFactor=ImParMat(7); -hedit = uicontrol(... +hedit=uicontrol(... 'Style', 'edit',... 'String',srcLoIntensThres,... 'Units','normalized',... @@ -207,7 +207,7 @@ hedit = uicontrol(... 'callback',{@entryExtendFactor}); function entryExtendFactor(source,eventdata) -user_entry = str2double(get(source,'string')); +user_entry=str2double(get(source,'string')); if (isnan(user_entry)||(user_entry<1.8)||(user_entry>4.0)) errordlg('You must enter a numeric value between 1.8 and 2.1','Bad Input','modal') return @@ -226,7 +226,7 @@ user_entry = str2double(get(source,'string')); yPos=0.85-(btnNumber-1)*(btnHt+spacing); btnPos=[xPos yPos-spacing btnWid btnHt]; srcBGthreshold=ImParMat(3); -hedit = uicontrol(... +hedit=uicontrol(... 'Style', 'edit',... 'String',srcBGthreshold,... 'Units','normalized',... @@ -234,7 +234,7 @@ hedit = uicontrol(... 'callback',{@entryBGthreshold}); % 'Position', [5 100 60 20]) function entryBGthreshold(source,eventdata) -user_entry = str2double(get(source,'string')); +user_entry=str2double(get(source,'string')); if (isnan(user_entry)||(user_entry<1)||(user_entry>100)) errordlg('Enter a numeric value between 1 and 100 percent to produce a Background Threshold value as a percent above the time series average background for each spot.','Bad Input','modal') return @@ -250,7 +250,7 @@ btnNumber=4; %Enter spot detection threshold (lock-in Image frame) yPos=0.85-(btnNumber-1)*(btnHt+spacing); btnPos=[xPos yPos-spacing btnWid btnHt]; srcSpotThres=ImParMat(4); -hedit = uicontrol(... +hedit=uicontrol(... 'Style', 'edit',... 'String',srcSpotThres,... 'Units','normalized',... @@ -258,7 +258,7 @@ hedit = uicontrol(... 'callback',{@entrySpotThres}); function entrySpotThres(source,eventdata) -user_entry = str2double(get(source,'string')); +user_entry=str2double(get(source,'string')); if (isnan(user_entry)||(user_entry<1)||(user_entry>60)) errordlg('You must enter a numeric value between 1 and 60','Bad Input','modal') return @@ -274,7 +274,7 @@ btnNumber=5; yPos=0.85-(btnNumber-1)*(btnHt+spacing); btnPos=[xPos yPos-spacing btnWid btnHt]; srcRadius=ImParMat(10); -hedit = uicontrol(... +hedit=uicontrol(... 'Style', 'edit',... 'String',srcRadius,... 'Units','normalized',... @@ -282,7 +282,7 @@ hedit = uicontrol(... 'callback',{@entryRadius}); % 'Position', [5 100 60 20]) function entryRadius(source,eventdata) -user_entry = str2double(get(source,'string')); +user_entry=str2double(get(source,'string')); if (isnan(user_entry)||(user_entry<12)||(user_entry>17)) errordlg('You must enter a numeric value between 12 and 17','Bad Input','modal') return @@ -298,7 +298,7 @@ btnNumber=5; yPos=0.85-(btnNumber-1)*(btnHt+spacing); btnPos=[xPos yPos-spacing btnWid btnHt]; srcWidth=ImParMat(5); -hedit = uicontrol(... +hedit=uicontrol(... 'Style', 'edit',... 'String',srcWidth,... 'Units','normalized',... @@ -306,7 +306,7 @@ hedit = uicontrol(... 'callback',{@entryWidth}); % 'Position', [5 100 60 20]) function entryWidth(source,eventdata) -user_entry = str2double(get(source,'string')); +user_entry=str2double(get(source,'string')); if (isnan(user_entry)||(user_entry<5)||(user_entry>41)) errordlg('You must enter a numeric value between 5 and 40','Bad Input','modal') return @@ -322,7 +322,7 @@ user_entry = str2double(get(source,'string')); yPos=0.85-(btnNumber-1)*(btnHt+spacing); btnPos=[xPos yPos-spacing btnWid btnHt]; srcDither= ImParMat(6); -hedit = uicontrol(... +hedit=uicontrol(... 'Style', 'edit',... 'String',srcDither,... 'Units','normalized',... @@ -330,7 +330,7 @@ hedit = uicontrol(... 'callback',{@entryDither}); function entryDither(source,eventdata) -user_entry = str2double(get(source,'string')); +user_entry=str2double(get(source,'string')); if (isnan(user_entry)||(user_entry<0)||(user_entry>5)) errordlg('You must enter a numeric value between 1 and 4','Bad Input','modal') return @@ -363,7 +363,7 @@ btnNumber=7; end end %} -hSearchRange = uicontrol(... +hSearchRange=uicontrol(... 'Style', 'edit',... 'String',srchRange,... 'Units','normalized',... @@ -371,7 +371,7 @@ hSearchRange = uicontrol(... 'callback',{@CsearchRange}); function CsearchRange(source,eventdata) - user_entry = str2double(get(source,'string')); + user_entry=str2double(get(source,'string')); if (isnan(user_entry)||(user_entry<1)||(user_entry>50)) %originally 18; 19_0729 increased errordlg('You must enter a numeric value between 1 and 18 12->18 recommended. (ImParMat(12)))','Bad Input','modal') return @@ -387,7 +387,7 @@ btnNumber=7; btnPos=[xPos yPos-spacing btnWid btnHt]; srcExtend=ImParMat(7); -hedit = uicontrol(... +hedit=uicontrol(... 'Style', 'edit',... 'String',srcExtend,... 'Units','normalized',... @@ -395,7 +395,7 @@ hedit = uicontrol(... 'callback',{@entryExtend}); function entryExtend(source,eventdata) -user_entry = str2double(get(source,'string')); +user_entry=str2double(get(source,'string')); if (isnan(user_entry)||(user_entry<-0.10)||(user_entry>0.4)) errordlg('You must enter a numeric value between 0 and 0.4. 0.10 recommended','Bad Input','modal') return @@ -411,7 +411,7 @@ btnNumber=8; btnPos=[xPos yPos-spacing btnWid btnHt]; %ImParMat(8)=1; srcpointExtend=ImParMat(8); -hedit = uicontrol(... +hedit=uicontrol(... 'Style', 'edit',... 'String',srcpointExtend,... 'Units','normalized',... @@ -419,7 +419,7 @@ hedit = uicontrol(... 'callback',{@entrypointExtend}); function entrypointExtend(source,eventdata) -user_entry = str2double(get(source,'string')); +user_entry=str2double(get(source,'string')); user_entry= floor(user_entry); if (isnan(user_entry)||(user_entry<-3)||(user_entry>5)) errordlg('You must enter an integer value between 0 and 5. 1 recommended','Bad Input','modal') @@ -436,7 +436,7 @@ btnNumber=9; yPos=0.85-(btnNumber-1)*(btnHt+spacing); btnPos=[xPos yPos-spacing btnWid btnHt]; -hedit = uicontrol(... +hedit=uicontrol(... 'Style', 'popupmenu',... 'String',{'GrowthArea','FixedArea'},... 'Units','normalized',... @@ -444,14 +444,14 @@ hedit = uicontrol(... 'callback',{@grwArea}); function grwArea(source,eventdata) - str = get(source, 'String'); - val = get(source,'Value'); + str=get(source, 'String'); + val=get(source,'Value'); % Set current data to the selected data set. switch str{val}; case 'GrowthArea' ;% User selects Peaks. - SWgrowthArea = 1 + SWgrowthArea=1 case 'FixedArea' % User selects Membrane. - SWgrowthArea = 0 + SWgrowthArea=0 end end %} diff --git a/workflow/apps/easy/par4Gbl_Main8c.m b/workflow/apps/easy/par4Gbl_Main8c.m index a3e4d128..c5aa9c92 100755 --- a/workflow/apps/easy/par4Gbl_Main8c.m +++ b/workflow/apps/easy/par4Gbl_Main8c.m @@ -68,7 +68,7 @@ catch end % Load Fotos stored data fotosToLoad = {'Coordinates', 'BGatTpts', 'anlZones', 'NCFparms'}; -for i = 1:length(fotosToLoad) +for i=1:length(fotosToLoad) try load(fullfile(fotosResultsDir, fotosToLoad{i})); catch