strcat to sprintf

This commit is contained in:
2024-07-27 13:39:18 -04:00
parent 5a4bb8c90a
commit bb103a6f9a
6 changed files with 99 additions and 99 deletions

View File

@@ -7,7 +7,7 @@ global matDir
% If we already have mpdmFile, don't recreate % If we already have mpdmFile, don't recreate
if (exist(mpdmFile, 'file') && ~isempty(mpdmFile)) if (exist(mpdmFile, 'file') && ~isempty(mpdmFile))
disp(strcat('The Drug Media/MasterPlate Annotation File: ', mpdmFile, ' exists, skipping DMPexcel2mat.m')); disp(sprintf('The Drug Media/MasterPlate Annotation File: %s exists, skipping DMPexcel2mat.m\n', mpdmFile));
return return
end end
@@ -82,7 +82,7 @@ if ~exist(masterPlateFile, 'file') || isempty(masterPlateFile)
end end
end end
else else
disp(strcat('Using MasterPlate file: ', masterPlateFile, ', skipping directory selection')); disp(sprintf('Using MasterPlate file: %s skipping directory selection\n', masterPlateFile));
end end
% fid=fopen(masterPlateFile)%('exp23PrintTimes.xls'); % textread puts date and time sequentially into vector % fid=fopen(masterPlateFile)%('exp23PrintTimes.xls'); % textread puts date and time sequentially into vector
@@ -183,7 +183,7 @@ if ~exist(drugMediaFile, 'file') || isempty(drugMediaFile)
dmFileToTest=fullfile(mpPath, 'DrugMedia_', mpBareFileName, '.xlsx'); dmFileToTest=fullfile(mpPath, 'DrugMedia_', mpBareFileName, '.xlsx');
if exist(dmFileToTest, 'file') % Try to find a matching drug media file if exist(dmFileToTest, 'file') % Try to find a matching drug media file
drugMediaFile=dmFileToTest; drugMediaFile=dmFileToTest;
disp(strcat('Using matching DrugMedia file: ', drugMediaFile, ', skipping directory selection')); disp(sprintf('Using matching DrugMedia file: %s, skipping directory selection\n', drugMediaFile));
else else
% Try to find the DrugMedia file automatically (newest created first) % Try to find the DrugMedia file automatically (newest created first)
files=dir(matDir); files=dir(matDir);
@@ -195,7 +195,8 @@ if ~exist(drugMediaFile, 'file') || isempty(drugMediaFile)
[~, sortedIndices]=sort(datenum({files(strncmp(dmFiles.name, 'DrugMedia_', 10)).date}), 'descend'); [~, sortedIndices]=sort(datenum({files(strncmp(dmFiles.name, 'DrugMedia_', 10)).date}), 'descend');
sortedFiles=dmFiles{sortedIndices}; sortedFiles=dmFiles{sortedIndices};
drugMediaFile=sortedFiles{1}; drugMediaFile=sortedFiles{1};
disp(strcat('Using newest DrugMedia file: ', drugMediaFile, ', skipping directory selection')); disp(sprintf('Using newest DrugMedia file: %s, skipping directory selection\n', drugMediaFile));
end end
catch Me catch Me
% This can be silent, not really an error % This can be silent, not really an error
@@ -228,7 +229,7 @@ if ~exist(drugMediaFile, 'file') || isempty(drugMediaFile)
end end
end end
else else
disp(strcat('Using drugMediaFile: ', drugMediaFile, ', skipping directory selection')); disp(sprintf('Using drugMediaFile: %s, skipping directory selection\n', drugMediaFile));
end end
% Drug and Media Plate setup % Drug and Media Plate setup
@@ -325,4 +326,4 @@ if isequal(Linked,0) % 0 indicates Drugs and Media are combinatorial
end end
save(mpdmFile, 'fields','MP','DM','Linked'); save(mpdmFile, 'fields','MP','DM','Linked');
msgbox([strcat('Drug-Media-MasterPlate Annotation File', mpdmFile,'Generation Complete')]) msgbox(sprintf('Drug-Media-MasterPlate Annotation File %s Generation Complete', mpdmFile))

View File

@@ -366,9 +366,9 @@ if isequal(opt,'DB')||isequal(opt,'Both')
try try
copyfile(DBfilename,DBupload) copyfile(DBfilename,DBupload)
catch ME catch ME
rep=getReport(ME, 'basic'); disp(sprintf('DB upload failed with error: %s\n', getReport(ME, 'basic')));
rep=strcat('Failed copyfile to ',DBupload,' -', rep); rep=sprintf('Failed copyfile to %s - %s', DBupload, rep);
errordlg(rep) errordlg(rep);
end end
end end
@@ -406,9 +406,9 @@ try
totPlCnt=totPlCnt+1; totPlCnt=totPlCnt+1;
if destPerMP>1 &&rem(totPlCnt,destPerMP)==1, mpCnt=mpCnt+1; end if destPerMP>1 &&rem(totPlCnt,destPerMP)==1, mpCnt=mpCnt+1; end
if destPerMP==1,mpCnt=mpCnt+1; end if destPerMP==1,mpCnt=mpCnt+1; end
pertCnt= rem(totPlCnt,destPerMP); pertCnt=rem(totPlCnt,destPerMP);
if pertCnt==0, pertCnt= destPerMP;end if pertCnt==0, pertCnt= destPerMP;end
pert= strcat('Perturb_',num2str(pertCnt)); pert=strcat('Perturb_',num2str(pertCnt));
s % BCR seems wrong s % BCR seems wrong
%Print Time Point HEADER for each plate for newly added intensity data %Print Time Point HEADER for each plate for newly added intensity data
@@ -420,10 +420,10 @@ try
try try
asd=cell2mat(scan(s).plate(1).CFparameters(1)); asd=cell2mat(scan(s).plate(1).CFparameters(1));
aucEndPt= strcat('AUC',num2str(asd(9))); aucEndPt=strcat('AUC',num2str(asd(9)));
catch catch
asd=cell2mat(scan(s).plate(1).CFparameters{1,1}(1,384)); asd=cell2mat(scan(s).plate(1).CFparameters{1,1}(1,384));
aucEndPt= strcat('AUC',num2str(asd(9))); aucEndPt=strcat('AUC',num2str(asd(9)));
end end
fprintf(fid, 'Num.\tDiagnostics\tDrug\tConc\tMedia\tModifier1\tConc1\tModifier2\tConc2\tORF\tGene'); fprintf(fid, 'Num.\tDiagnostics\tDrug\tConc\tMedia\tModifier1\tConc1\tModifier2\tConc2\tORF\tGene');
fprintf(fid, '\t %s',aucEndPt); fprintf(fid, '\t %s',aucEndPt);
@@ -475,8 +475,8 @@ try
rSq=outCmat(n,6); rSq=outCmat(n,6);
lval=outCmat(n,5); lval=outCmat(n,5);
if Kval>160, selcode='K_Hi'; else selcode=' ';end if Kval>160, selcode='K_Hi'; else selcode=' ';end
if Kval<40, selcode=strcat(selcode,' K_Lo'); end %12_1030 if Kval<40, selcode=strcat(selcode,' K_Lo');end % TODO sprintf if you want a space
if rSq<.97 && rSq>0, selcode=strcat(selcode,' rSqLo'); end if rSq<.97 && rSq>0, selcode=strcat(selcode,' rSqLo');end
if lval>(0.85*(max(outTseries))), selcode=strcat(selcode,' late');end if lval>(0.85*(max(outTseries))), selcode=strcat(selcode,' late');end
if isnan(outCmat(n,7))||isnan(outCmat(n,8))||isnan(outCmat(n,9))... if isnan(outCmat(n,7))||isnan(outCmat(n,8))||isnan(outCmat(n,9))...
||isnan(outCmat(n,10))||isnan(outCmat(n,11))... ||isnan(outCmat(n,10))||isnan(outCmat(n,11))...
@@ -497,7 +497,7 @@ try
riseTm=0; riseTm=0;
end end
if Ag(n)< .30*(scan(s).Awindow),selcode=strcat(selcode,' smArea'); end if Ag(n)< .30*(scan(s).Awindow),selcode=strcat(selcode,' smArea'); end % same, need sprintf for space
if outCmat(n,3)==0,selcode=strcat('0 ',selcode); end if outCmat(n,3)==0,selcode=strcat('0 ',selcode); end
orf=cell2mat(MP(mpCnt).orf{1}(n)); orf=cell2mat(MP(mpCnt).orf{1}(n));
gene=cell2mat(MP(mpCnt).genename{1}(n)); gene=cell2mat(MP(mpCnt).genename{1}(n));
@@ -575,15 +575,15 @@ try
end end
if isequal(opt,'DB')||isequal(opt,'Both') if isequal(opt,'DB')||isequal(opt,'Both')
if j<dataLength if j<dataLength
intensBlob= strcat(intensBlob,num2str(outIntens(n,j)),';'); intensBlob=strcat(intensBlob,num2str(outIntens(n,j)),';');
else else
intensBlob= strcat(intensBlob,num2str(outIntens(n,j))); intensBlob=strcat(intensBlob,num2str(outIntens(n,j)));
end end
if outTseries(j)<.0001,outTseries(j)=0;end if outTseries(j)<.0001,outTseries(j)=0;end
if j<dataLength if j<dataLength
tmBlob= strcat(tmBlob,num2str(outTseries(j)),';'); tmBlob=strcat(tmBlob,num2str(outTseries(j)),';');
else else
tmBlob= strcat(tmBlob,num2str(outTseries(j))); tmBlob=strcat(tmBlob,num2str(outTseries(j)));
end end
end end
end end
@@ -654,15 +654,15 @@ try
try try
copyfile(DBfilename,DBupload) copyfile(DBfilename,DBupload)
catch ME catch ME
rep = getReport(ME, 'basic'); disp(sprintf('DB upload failed with error: %s\n', getReport(ME, 'basic')));
rep=strcat('Failed copyfile to ',DBupload,' -', rep); rep=sprintf('Failed copyfile to %s - %s\n', DBupload, rep);
errordlg(rep) errordlg(rep)
end end
end end
msgbox([strcat('Printing Script complete. Check !!Results sheets in ',printResultsDir,' for results.')]) msgbox([sprintf('Printing Script complete. Check !!Results sheets in %s for results.', printResultsDir)])
catch ME catch ME
disp(strcat("Results printing failed with error: ", getReport(ME, 'basic'))) disp(sprintf('Printing Script failed with error: %s\n', getReport(ME, 'basic')));
end end

View File

@@ -30,28 +30,37 @@ function varargout = EASYconsole(varargin)
userName=system('whoami'); userName=system('whoami');
todayStr=datetime('now', 'Format', 'yyyyMMdd'); % This should match the parent workflow script todayStr=datetime('now', 'Format', 'yyyyMMdd'); % This should match the parent workflow script
disp(strcat('This script name: ', easyFileName)) disp(sprintf('This script name: %s\n', easyFileName))
% Set scansDir intelligently (project scans directory) % Set scansDir intelligently (project scans directory)
% Allow users to specify a PROJECT=/mnt/data/ExpJobs/Job directory to analyze with EASY % Allow users to specify a PROJECT=/mnt/data/ExpJobs/Job directory to analyze with EASY
% This better enables running the new EASY in standalone mode % This better enables running the new EASY in standalone mode
if exist('PROJECT', 'var') && ~isempty(getenv('PROJECT')) if exist('PROJECT', 'var') && ~isempty(getenv('PROJECT'))
scansDir=get_env('PROJECT'); scansDir=getenv('PROJECT')
disp(strcat('Using project path: ', scansDir, ' from environment variable PROJECT')); disp(sprintf('Using project path: %s from environment variable PROJECT\n', scansDir));
disp('This usually indicates that we are in standalone mode'); disp('This usually indicates that we are in standalone mode');
elseif exist('SCANS_DIR', 'var') && ~isempty(getenv('SCANS_DIR')) elseif exist('SCANS_DIR', 'var') && ~isempty(getenv('SCANS_DIR'))
scansDir=get_env('SCANS_DIR'); scansDir=getenv('SCANS_DIR');
disp(strcat('Using scans directory: ', scansDir, ' from environment variable SCANS_DIR')); disp(sprintf('Using scans directory: %s from environment variable SCANS_DIR\n', scansDir));
disp('This usually indicates that we are in module mode'); disp('This usually indicates that we are in module mode');
else else
dirToScan=fullfile(parentDir,'ExpJobs'); % hardcoded relative to easy script dir TODO: if we change pj layout this will change dirToScan = fullfile(parentDir,'ExpJobs'); % hardcoded relative to easy script dir TODO: if we change pj layout this will change
dirs=dir(fullfile(dirToScan, 'dir')); % filter for dirs only if exist(dirToScan, 'dir')
[~, sortedIndices] = sort(datenum({dirs.date}), 'descend'); % sort by newest first dirs=dir(fullfile(dirToScan, 'dir')); % filter for dirs only
sortedDirs=dirs{sortedIndices}; [~, sortedIndices]=sort(datenum({dirs.date}), 'descend'); % sort by newest first
scansDir=sortedDirs{1}; sortedDirs=dirs{sortedIndices};
disp('Beginning in newest project scans directory'); scansDir=sortedDirs{1};
disp(strcat('Using scans directory: ', scansDir, ' from hardcoded default')); disp('Beginning in newest project scans directory');
disp('This usually indicates that we are in stand-alone mode without PROJECT or SCANS_DIR environment variables'); disp(sprintf('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('/mnt/data/ExpJobs/demo')
if exist(scansDir, 'dir')
disp(sprintf('Using scans directory: %s from hardcoded absolute path to demo\n', scansDir));
else
disp(sprintf('Error: scansDir %s does not exist\n', scansDir));
end
end
end end
% If we don't have the EASY_SUFFIX from the module, generate it from scansDir % If we don't have the EASY_SUFFIX from the module, generate it from scansDir
@@ -67,7 +76,7 @@ function varargout = EASYconsole(varargin)
oldSuffix=easySuffix; oldSuffix=easySuffix;
while exist(easySuffix, 'dir') while exist(easySuffix, 'dir')
count=1; count=1;
easySuffix=strcat(oldSuffix,'.', num2str(count)); easySuffix=strcat(oldSuffix,'.',num2str(count));
end end
end end
% Might as well check this too % Might as well check this too
@@ -89,9 +98,9 @@ function varargout = EASYconsole(varargin)
disp("This is probably OK but if strange beahvior arises, we'll need to fix it in code"); disp("This is probably OK but if strange beahvior arises, we'll need to fix it in code");
easyDir=EASY_DIR; easyDir=EASY_DIR;
end end
disp(strcat('Using EASY script directory: ', easyDir, ' from environment variable EASY_DIR')); disp(sprintf('Using EASY script directory: %s from environment variable EASY_DIR\n', easyDir));
else else
disp(strcat('Using EASY script directory: ', easyDir, ' from hardcoded default')); disp(sprintf('Using EASY script directory: %s from hardcoded default\n', easyDir));
end end
if exist('PROJECT_USER', 'var') && ~isempty(getenv('PROJECT_USER')) if exist('PROJECT_USER', 'var') && ~isempty(getenv('PROJECT_USER'))
@@ -102,23 +111,22 @@ function varargout = EASYconsole(varargin)
if exist('EASY_RESULTS_DIR', 'var') && ~isempty(getenv('EASY_RESULTS_DIR')) if exist('EASY_RESULTS_DIR', 'var') && ~isempty(getenv('EASY_RESULTS_DIR'))
easyResultsDir=fullfile(get_env('EASY_RESULTS_DIR')); easyResultsDir=fullfile(get_env('EASY_RESULTS_DIR'));
disp(strcat('Using output directory: ', easyResultsDir, ' from environment variable EASY_RESULTS_DIR')) disp(sprintf('Using output directory: %s from environment variable EASY_RESULTS_DIR\n', easyResultsDir))
else else
easyResultsDirName=strcat('Results_',todayStr,'_',userName,'_',easySuffix); easyResultsDirName=strcat('Results_',todayStr,'_',userName,'_',easySuffix);
easyResultsDir=fullfile(scansDir,easyResultsDirName); easyResultsDir=fullfile(scansDir,easyResultsDirName);
disp(sprintf('Using output directory: %s\n', PROJECT_PREFIX))
disp(strcat('Using output directory: ', PROJECT_PREFIX, ' from environment variable PROJECT_PREFIX'))
end end
if exist('MASTER_PLATE_FILE', 'var') && ~isempty(getenv('MASTER_PLATE_FILE')) if exist('MASTER_PLATE_FILE', 'var') && ~isempty(getenv('MASTER_PLATE_FILE'))
masterPlateFile=fullfile(get_env('MASTER_PLATE_FILE')); masterPlateFile=fullfile(get_env('MASTER_PLATE_FILE'));
disp(strcat('Using drug media file: ', masterPlateFile, ' from environment variable MASTER_PLATE_FILE')) disp(sprintf('Using drug media file: %s from environment variable MASTER_PLATE_FILE\n', masterPlateFile))
else else
% Try to find MasterPlate_ file on our own % Try to find MasterPlate_ file on our own
mp=fullfile(scansDir,'MasterPlateFiles',strcat('MasterPlate_', easySuffix,'.xlsx')); mp=fullfile(scansDir,'MasterPlateFiles',strcat('MasterPlate_', easySuffix,'.xlsx'));
if exist(mp, 'file') if exist(mp, 'file')
masterPlateFile=mp; masterPlateFile=mp;
disp(strcat('Using drug media file: ', masterPlateFile, ' from internal logic')) disp(sprintf('Using drug media file: %s from internal logic\n', masterPlateFile))
else else
disp("WARNING: Have you created a MasterPlate_ file?") disp("WARNING: Have you created a MasterPlate_ file?")
end end
@@ -126,13 +134,13 @@ function varargout = EASYconsole(varargin)
if exist('DRUG_MEDIA_FILE', 'var') && ~isempty(getenv('DRUG_MEDIA_FILE')) if exist('DRUG_MEDIA_FILE', 'var') && ~isempty(getenv('DRUG_MEDIA_FILE'))
drugMediaFile=fullfile(get_env('DRUG_MEDIA_FILE')); drugMediaFile=fullfile(get_env('DRUG_MEDIA_FILE'));
disp(strcat('Using drug media file: ', drugMediaFile, ' from environment variable DRUG_MEDIA_FILE')) disp(sprintf('Using drug media file: %s from environment variable DRUG_MEDIA_FILE\n', drugMediaFile))
else else
% Try to find MasterPlate_ file on our own % Try to find MasterPlate_ file on our own
dm=fullfile(scansDir,'MasterPlateFiles',strcat('DrugMedia_', easySuffix,'.xlsx')); dm=fullfile(scansDir,'MasterPlateFiles',strcat('DrugMedia_', easySuffix,'.xlsx'));
if exist(mp, 'file') if exist(mp, 'file')
drugMediaFile=dm; drugMediaFile=dm;
disp(strcat('Using drug media file: ', drugMediaFile, ' from internal logic')) disp(sprintf('Using drug media file: %s from internal logic\n', drugMediaFile))
else else
disp("WARNING: Have you created a DrugMedia_ file?") disp("WARNING: Have you created a DrugMedia_ file?")
end end
@@ -167,7 +175,7 @@ function varargout = EASYconsole(varargin)
% Pulled this out of the opening function % Pulled this out of the opening function
% Seems better to wait until we have our ars set % Seems better to wait until we have our ars set
if exist('scansDir','var') && ~isempty(scansDir) if exist('scansDir','var') && ~isempty(scansDir)
set(fhconsole,'Name',strcat('EASYconsole - ',char(scansDir))); set(fhconsole,'Name',sprintf('EASYconsole - %s', scansDir));
else else
set(fhconsole,'Name','EASYconsole - No Active Experiment.') set(fhconsole,'Name','EASYconsole - No Active Experiment.')
end end
@@ -311,14 +319,14 @@ function NewExpDat_Callback(~, ~, ~)
sbdg= cell(1,scanMax); sbdg= cell(1,scanMax);
save((fullfile(easyResultsDir,'Fotos','Nbdg')),'sbdg'); save((fullfile(easyResultsDir,'Fotos','Nbdg')),'sbdg');
catch ME catch ME
disp(strcat('ERROR: ', ME.message)) disp(sprintf('ERROR: %s\n', ME.message));
end end
% set the title for fhconsole depending on existence % set the title for fhconsole depending on existence
if exist('easyResultsDir','var')&&~isempty(easyResultsDir) if exist('easyResultsDir','var')&&~isempty(easyResultsDir)
set(fhconsole,'Name',strcat('EASYconsole- ',char(easyResultsDir))) set(fhconsole,'Name',sprintf('EASYconsole - %s', easyResultsDir));
else else
set(fhconsole,'Name','EASYconsole -Exp. Analysis NOT selected.') set(fhconsole,'Name','EASYconsole - Master Plate directory not selected.');
end end
end end
@@ -385,9 +393,9 @@ function LoadDatFile_Callback(~, ~, ~)
if exist('easyResultsDir','var') && ~isempty(easyResultsDir) if exist('easyResultsDir','var') && ~isempty(easyResultsDir)
fhconsole=gcf; fhconsole=gcf;
set(fhconsole,'Name',strcat('EASYconsole- ',char(easyResultsDir))) set(fhconsole,'Name',sprintf('EASYconsole - %s', easyResultsDir));
else else
set(fhconsole,'Name','EASYconsole -Exp. Analysis NOT selected.') set(fhconsole,'Name','EASYconsole -Exp. Analysis NOT selected.');
end end
end end
@@ -447,7 +455,7 @@ function runResults_DBcombo_Callback(~, ~, ~)
DgenResults %similar but semicolons removed to restore so cmdLine display info. DgenResults %similar but semicolons removed to restore so cmdLine display info.
%Dgen241010qhtcp %par4global -convert 1x1cell of 384cells to be like previous 1x384 cells CFparameter %Dgen241010qhtcp %par4global -convert 1x1cell of 384cells to be like previous 1x384 cells CFparameter
catch ME catch ME
disp(strcat('Error in DgenResults240430: ', ME.message)) disp(sprintf('Error in DgenResults: %s\n', ME.message));
EASYconsole EASYconsole
end end
end end

View File

@@ -39,14 +39,14 @@ for iPlate=1:length(scLst)
catch catch
end end
hold on; hold on;
title(strcat(filenameNoExt,'')); title(filenameNoExt); % this didn't make sense so changed
xlabel('Hours'); xlabel('Hours');
ylabel('Intensities Normalized by Area'); ylabel('Intensities Normalized by Area');
grid on; grid on;
if (exist('K','var')&& exist('r','var') && exist('l','var')) if (exist('K','var')&& exist('r','var') && exist('l','var'))
plot(t, Growth,'b-'); plot(t, Growth,'b-');
% Plot L on curvefit figure % Plot L on curvefit figure
grL=Growth(round(l)); %growthCurve timePT for l in hours grL=Growth(round(l)); % growthCurve timePT for l in hours
plot(l,0:grL,'-b') % to display position of l plot(l,0:grL,'-b') % to display position of l
plot(l,grL,'^b') % to display l position on curve as an arrowhead plot(l,grL,'^b') % to display l position on curve as an arrowhead

View File

@@ -1,7 +1,6 @@
%% CALLED BY par4Gbl_Main8c.m %% %% CALLED BY par4Gbl_Main8c.m %%
% TODO Should some of these vars be pulled out higher so they are easier to change? % TODO Should some of these vars be pulled out higher so they are easier to change?
% %
function NImParamRadiusGui(scansDir) function NImParamRadiusGui(scansDir)
global SWsingleSc global SWsingleSc
global SWgrowthArea global SWgrowthArea

View File

@@ -7,6 +7,7 @@ global scansDir
global matFile global matFile
global fhconsole global fhconsole
global easyResultsDir global easyResultsDir
global printResultsDir
global pointMapsResultsDir global pointMapsResultsDir
global fotosResultsDir global fotosResultsDir
global matDir global matDir
@@ -17,6 +18,7 @@ global numCols
global scan global scan
global scanMax global scanMax
global tptLength global tptLength
global easyDir
numRows=24; % for Single Vertical numRows=24; % for Single Vertical
numCols=16; % for Single Vertical numCols=16; % for Single Vertical
@@ -34,10 +36,10 @@ Fflg=1;
% fclose('all'); % close all open files % fclose('all'); % close all open files
% Unset some vars just in case they are already set % Unset some vars just in case they are already set
clear('scanIntens','Scanfiles','pathname','tifFileLstP4') clear('scanIntens','Scanfiles','pathname','tifFileLstP4');
try try
clf(fhconsole,'reset') clf(fhconsole,'reset');
catch catch
end end
@@ -46,42 +48,32 @@ end
% EASYconsole % EASYconsole
if exist(matFile, 'file') if exist(matFile, 'file')
bkUpMatFile=fullfile(matDir,'BkUp',matFile) bkUpMatFile=fullfile(matDir,'BkUp',matFile);
copyfile(matFile,(fullfile(matDir,'BkUp',matFile))) copyfile(matFile,bkUpMatFile);
end end
% Reloacated from 'PTmats' to prevent potential overwrite when PTmats is
% copied into new job when the PT template is about the same. We also
% now have a default template if one is not made. i.e., when the images
% from the new experiment are too sketchy to make a good pintool
% template. By moving it to 'Fotos' we avoid possible issues due to
% copying the Nbdg.mat file along with the default template '.mat' files.
% A copy of Ndbg.mat is placed also saved to the 'PTmats' directory
% after each run to allow previous version of EASY to access data made
% by EASY versions after 20_0819.
try try
load(fullfile(easyResultsDir,'Fotos','Nbdg')) %Modified to load from 'Fotos' 20_0819 load(fullfile(fotosResultsDir,'Nbdg')); %Modified to load from 'Fotos' 20_0819
catch catch
% Reloacated from 'PTmats' to prevent potential overwrite when PTmats is load(fullfile(pointMapsResultsDir,'Nbdg')); %Left in to accomodate loads of work before 20_0819
% copied into new job when the PT template is about the same. We also
% now have a default template if one is not made. i.e., when the images
% from the new experiment are too sketchy to make a good pintool
% template. By moving it to 'Fotos' we avoid possible issues due to
% copying the Nbdg.mat file along with the default template '.mat' files.
% A copy of Ndbg.mat is placed also saved to the 'PTmats' directory
% after each run to allow previous version of EASY to access data made
% by EASY versions after 20_0819.
load(fullfile(easyResultsDir,'PTmats','Nbdg')) %Left in to accomodate loads of work before 20_0819
end end
% Load Fotos stored data % Load Fotos stored data
try fotosToLoad = {'Coordinates', 'BGatTpts', 'anlZones', 'NCFparms'};
load(fullfile(easyResultsDir,'Fotos','Coordinates')) for i = 1:length(fotosToLoad)
catch try
end load(fullfile(fotosResultsDir, fotosToLoad{i}));
try catch
load(fullfile(easyResultsDir,'Fotos','BGatTpts')) load(fullfile(easyDir,'parameters'));
catch end
end
try
load(fullfile(easyResultsDir,'Fotos','anlZones'))
catch
end
% autoImCF
try
load(fullfile(easyResultsDir,'PTmats','NCFparms'))
catch ME
load parameters
end end
% Get Print Times % Get Print Times
@@ -89,12 +81,12 @@ PrintTimes=[];
scLst={}; scLst={};
% Parameter Entry % Parameter Entry
NImParamRadiusGui(scansDir) % Ncode 122111replaced removed ,numOfPrtTimes) NImParamRadiusGui(scansDir); % Ncode 122111replaced removed ,numOfPrtTimes)
width=24; width=24;
widthEx=width-1; % width extention from reference point widthEx=width-1; % width extention from reference point
dither=ImParMat(6); dither=ImParMat(6);
radius=ImParMat(10); radius=ImParMat(10);
NIcircle NIcircle;
% Load Stuff % Load Stuff
lastPlateOnLastScan=1; % Ncode lastPlateOnLastScan=1; % Ncode
@@ -118,7 +110,7 @@ else
end end
SWgrowthArea=ImParMat(9); SWgrowthArea=ImParMat(9);
load(fullfile(pointMapsResultsDir,'NPTmapSearch')) load(fullfile(pointMapsResultsDir,'NPTmapSearch'));
PTmapPos=detPos; PTmapPos=detPos;
selScanNumLst=[]; selScanNumLst=[];
Scanfiles=[]; Scanfiles=[];
@@ -157,10 +149,10 @@ selScanNumLst2=selScanNumLst; % function passthrough, passback to par4gbl_Main 2
% Preallocation % Preallocation
scCount=[]; scCount=[];
TmpexpScanIntens00=cell(1); % cell(1,scanMax); TmpexpScanIntens00=cell(1); % cell(1,scanMax);
TmpFexpScanSpots00=cell(1); % cell(1,scanMax); TmpFexpScanSpots00=cell(1); % cell(1,scanMax);
TmpFexpScanBMtp00=cell(1); % cell(1,scanMax); TmpFexpScanBMtp00=cell(1); % cell(1,scanMax);
TmpanlZoneRefs00=cell(1); % cell(1,scanMax); TmpanlZoneRefs00=cell(1); % cell(1,scanMax);
Tmpsbdg00=cell(1); Tmpsbdg00=cell(1);
TmpexpScanIntens4=cell(1,numScans); TmpexpScanIntens4=cell(1,numScans);
TmpFexpScanSpots4=cell(1,numScans); TmpFexpScanSpots4=cell(1,numScans);
@@ -230,9 +222,9 @@ fileExt='.txt';
filePrefix='FitResults_'; filePrefix='FitResults_';
for scanCnt=1:numScans for scanCnt=1:numScans
selScan=p4L4{16,scanCnt}; % determine the actual scan in the scanCnt parfor distributed "id" selScan=p4L4{16,scanCnt}; % determine the actual scan in the scanCnt parfor distributed "id"
fileSuffix=strcat('Scan', num2str(selScan),'_Plate', num2str(1)); fileSuffix=sprintf('Scan%d_Plate%d', selScan, 1);
fileNamePlate=[filePrefix fileSuffix fileExt]; fileNamePlate=[filePrefix fileSuffix fileExt];
fileName=fullfile(easyResultsDir,'PrintResults', fileNamePlate); % [outputDirectory fileNamePlate]; fileName=fullfile(printResultsDir, fileNamePlate); % [outputDirectory fileNamePlate];
% This,fprint for loop,is an very old legacy feature which slows processing. Could be % This,fprint for loop,is an very old legacy feature which slows processing. Could be
% removed but allows easy observation of how a run is progressing and can be % removed but allows easy observation of how a run is progressing and can be
@@ -241,7 +233,7 @@ for scanCnt=1:numScans
fid=fopen(fileName,'w'); fid=fopen(fileName,'w');
fprintf(fid, 'Num.\tAUC\tMSR\tK\tr\tl\tR-squared\tK-lower\tK-upper\tr-lower\tr-upper\tl-upper\tl-lower\tArea\tLastInten\tSpineMaxRateTimePt\tLastFitTimePt\n'); fprintf(fid, 'Num.\tAUC\tMSR\tK\tr\tl\tR-squared\tK-lower\tK-upper\tr-lower\tr-upper\tl-upper\tl-lower\tArea\tLastInten\tSpineMaxRateTimePt\tLastFitTimePt\n');
for n=1:384 % startCount:numCultures for n=1:384 % startCount:numCultures
fprintf(fid,'%d\t',n); fprintf(fid,'%d\t',n);
fprintf(fid, '%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\n',... fprintf(fid, '%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\n',...
outCprint{14,scanCnt}(n,1),outCprint{14,scanCnt}(n,2),outCprint{14,scanCnt}(n,3),outCprint{14,scanCnt}(n,4),... outCprint{14,scanCnt}(n,1),outCprint{14,scanCnt}(n,2),outCprint{14,scanCnt}(n,3),outCprint{14,scanCnt}(n,4),...