strcat to sprintf
This commit is contained in:
@@ -7,7 +7,7 @@ global matDir
|
||||
|
||||
% If we already have mpdmFile, don't recreate
|
||||
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
|
||||
end
|
||||
|
||||
@@ -82,7 +82,7 @@ if ~exist(masterPlateFile, 'file') || isempty(masterPlateFile)
|
||||
end
|
||||
end
|
||||
else
|
||||
disp(strcat('Using MasterPlate file: ', masterPlateFile, ', skipping directory selection'));
|
||||
disp(sprintf('Using MasterPlate file: %s skipping directory selection\n', masterPlateFile));
|
||||
end
|
||||
|
||||
% 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');
|
||||
if exist(dmFileToTest, 'file') % Try to find a matching drug media file
|
||||
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
|
||||
% Try to find the DrugMedia file automatically (newest created first)
|
||||
files=dir(matDir);
|
||||
@@ -195,7 +195,8 @@ if ~exist(drugMediaFile, 'file') || isempty(drugMediaFile)
|
||||
[~, sortedIndices]=sort(datenum({files(strncmp(dmFiles.name, 'DrugMedia_', 10)).date}), 'descend');
|
||||
sortedFiles=dmFiles{sortedIndices};
|
||||
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
|
||||
catch Me
|
||||
% This can be silent, not really an error
|
||||
@@ -228,7 +229,7 @@ if ~exist(drugMediaFile, 'file') || isempty(drugMediaFile)
|
||||
end
|
||||
end
|
||||
else
|
||||
disp(strcat('Using drugMediaFile: ', drugMediaFile, ', skipping directory selection'));
|
||||
disp(sprintf('Using drugMediaFile: %s, skipping directory selection\n', drugMediaFile));
|
||||
end
|
||||
|
||||
% Drug and Media Plate setup
|
||||
@@ -325,4 +326,4 @@ if isequal(Linked,0) % 0 indicates Drugs and Media are combinatorial
|
||||
end
|
||||
|
||||
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))
|
||||
|
||||
@@ -366,9 +366,9 @@ if isequal(opt,'DB')||isequal(opt,'Both')
|
||||
try
|
||||
copyfile(DBfilename,DBupload)
|
||||
catch ME
|
||||
rep=getReport(ME, 'basic');
|
||||
rep=strcat('Failed copyfile to ',DBupload,' -', rep);
|
||||
errordlg(rep)
|
||||
disp(sprintf('DB upload failed with error: %s\n', getReport(ME, 'basic')));
|
||||
rep=sprintf('Failed copyfile to %s - %s', DBupload, rep);
|
||||
errordlg(rep);
|
||||
end
|
||||
end
|
||||
|
||||
@@ -475,7 +475,7 @@ try
|
||||
rSq=outCmat(n,6);
|
||||
lval=outCmat(n,5);
|
||||
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 lval>(0.85*(max(outTseries))), selcode=strcat(selcode,' late');end
|
||||
if isnan(outCmat(n,7))||isnan(outCmat(n,8))||isnan(outCmat(n,9))...
|
||||
@@ -497,7 +497,7 @@ try
|
||||
riseTm=0;
|
||||
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
|
||||
orf=cell2mat(MP(mpCnt).orf{1}(n));
|
||||
gene=cell2mat(MP(mpCnt).genename{1}(n));
|
||||
@@ -654,15 +654,15 @@ try
|
||||
try
|
||||
copyfile(DBfilename,DBupload)
|
||||
catch ME
|
||||
rep = getReport(ME, 'basic');
|
||||
rep=strcat('Failed copyfile to ',DBupload,' -', rep);
|
||||
disp(sprintf('DB upload failed with error: %s\n', getReport(ME, 'basic')));
|
||||
rep=sprintf('Failed copyfile to %s - %s\n', DBupload, rep);
|
||||
errordlg(rep)
|
||||
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
|
||||
disp(strcat("Results printing failed with error: ", getReport(ME, 'basic')))
|
||||
disp(sprintf('Printing Script failed with error: %s\n', getReport(ME, 'basic')));
|
||||
end
|
||||
|
||||
|
||||
@@ -30,28 +30,37 @@ function varargout = EASYconsole(varargin)
|
||||
userName=system('whoami');
|
||||
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)
|
||||
% 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
|
||||
if exist('PROJECT', 'var') && ~isempty(getenv('PROJECT'))
|
||||
scansDir=get_env('PROJECT');
|
||||
disp(strcat('Using project path: ', scansDir, ' from environment variable PROJECT'));
|
||||
scansDir=getenv('PROJECT')
|
||||
disp(sprintf('Using project path: %s from environment variable PROJECT\n', scansDir));
|
||||
disp('This usually indicates that we are in standalone mode');
|
||||
elseif exist('SCANS_DIR', 'var') && ~isempty(getenv('SCANS_DIR'))
|
||||
scansDir=get_env('SCANS_DIR');
|
||||
disp(strcat('Using scans directory: ', scansDir, ' from environment variable SCANS_DIR'));
|
||||
scansDir=getenv('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');
|
||||
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');
|
||||
disp(strcat('Using scans directory: ', scansDir, ' from hardcoded default'));
|
||||
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
|
||||
|
||||
% If we don't have the EASY_SUFFIX from the module, generate it from scansDir
|
||||
@@ -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");
|
||||
easyDir=EASY_DIR;
|
||||
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
|
||||
disp(strcat('Using EASY script directory: ', easyDir, ' from hardcoded default'));
|
||||
disp(sprintf('Using EASY script directory: %s from hardcoded default\n', easyDir));
|
||||
end
|
||||
|
||||
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'))
|
||||
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
|
||||
easyResultsDirName=strcat('Results_',todayStr,'_',userName,'_',easySuffix);
|
||||
easyResultsDir=fullfile(scansDir,easyResultsDirName);
|
||||
|
||||
disp(strcat('Using output directory: ', PROJECT_PREFIX, ' from environment variable PROJECT_PREFIX'))
|
||||
disp(sprintf('Using output directory: %s\n', PROJECT_PREFIX))
|
||||
end
|
||||
|
||||
if exist('MASTER_PLATE_FILE', 'var') && ~isempty(getenv('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
|
||||
% Try to find MasterPlate_ file on our own
|
||||
mp=fullfile(scansDir,'MasterPlateFiles',strcat('MasterPlate_', easySuffix,'.xlsx'));
|
||||
if exist(mp, 'file')
|
||||
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
|
||||
disp("WARNING: Have you created a MasterPlate_ file?")
|
||||
end
|
||||
@@ -126,13 +134,13 @@ function varargout = EASYconsole(varargin)
|
||||
|
||||
if exist('DRUG_MEDIA_FILE', 'var') && ~isempty(getenv('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
|
||||
% Try to find MasterPlate_ file on our own
|
||||
dm=fullfile(scansDir,'MasterPlateFiles',strcat('DrugMedia_', easySuffix,'.xlsx'));
|
||||
if exist(mp, 'file')
|
||||
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
|
||||
disp("WARNING: Have you created a DrugMedia_ file?")
|
||||
end
|
||||
@@ -167,7 +175,7 @@ function varargout = EASYconsole(varargin)
|
||||
% Pulled this out of the opening function
|
||||
% Seems better to wait until we have our ars set
|
||||
if exist('scansDir','var') && ~isempty(scansDir)
|
||||
set(fhconsole,'Name',strcat('EASYconsole - ',char(scansDir)));
|
||||
set(fhconsole,'Name',sprintf('EASYconsole - %s', scansDir));
|
||||
else
|
||||
set(fhconsole,'Name','EASYconsole - No Active Experiment.')
|
||||
end
|
||||
@@ -311,14 +319,14 @@ function NewExpDat_Callback(~, ~, ~)
|
||||
sbdg= cell(1,scanMax);
|
||||
save((fullfile(easyResultsDir,'Fotos','Nbdg')),'sbdg');
|
||||
catch ME
|
||||
disp(strcat('ERROR: ', ME.message))
|
||||
disp(sprintf('ERROR: %s\n', ME.message));
|
||||
end
|
||||
|
||||
% set the title for fhconsole depending on existence
|
||||
if exist('easyResultsDir','var')&&~isempty(easyResultsDir)
|
||||
set(fhconsole,'Name',strcat('EASYconsole- ',char(easyResultsDir)))
|
||||
set(fhconsole,'Name',sprintf('EASYconsole - %s', easyResultsDir));
|
||||
else
|
||||
set(fhconsole,'Name','EASYconsole -Exp. Analysis NOT selected.')
|
||||
set(fhconsole,'Name','EASYconsole - Master Plate directory not selected.');
|
||||
end
|
||||
end
|
||||
|
||||
@@ -385,9 +393,9 @@ function LoadDatFile_Callback(~, ~, ~)
|
||||
|
||||
if exist('easyResultsDir','var') && ~isempty(easyResultsDir)
|
||||
fhconsole=gcf;
|
||||
set(fhconsole,'Name',strcat('EASYconsole- ',char(easyResultsDir)))
|
||||
set(fhconsole,'Name',sprintf('EASYconsole - %s', easyResultsDir));
|
||||
else
|
||||
set(fhconsole,'Name','EASYconsole -Exp. Analysis NOT selected.')
|
||||
set(fhconsole,'Name','EASYconsole -Exp. Analysis NOT selected.');
|
||||
end
|
||||
end
|
||||
|
||||
@@ -447,7 +455,7 @@ function runResults_DBcombo_Callback(~, ~, ~)
|
||||
DgenResults %similar but semicolons removed to restore so cmdLine display info.
|
||||
%Dgen241010qhtcp %par4global -convert 1x1cell of 384cells to be like previous 1x384 cells CFparameter
|
||||
catch ME
|
||||
disp(strcat('Error in DgenResults240430: ', ME.message))
|
||||
disp(sprintf('Error in DgenResults: %s\n', ME.message));
|
||||
EASYconsole
|
||||
end
|
||||
end
|
||||
|
||||
@@ -39,7 +39,7 @@ for iPlate=1:length(scLst)
|
||||
catch
|
||||
end
|
||||
hold on;
|
||||
title(strcat(filenameNoExt,''));
|
||||
title(filenameNoExt); % this didn't make sense so changed
|
||||
xlabel('Hours');
|
||||
ylabel('Intensities Normalized by Area');
|
||||
grid on;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
%% CALLED BY par4Gbl_Main8c.m %%
|
||||
% TODO Should some of these vars be pulled out higher so they are easier to change?
|
||||
%
|
||||
|
||||
function NImParamRadiusGui(scansDir)
|
||||
global SWsingleSc
|
||||
global SWgrowthArea
|
||||
|
||||
@@ -7,6 +7,7 @@ global scansDir
|
||||
global matFile
|
||||
global fhconsole
|
||||
global easyResultsDir
|
||||
global printResultsDir
|
||||
global pointMapsResultsDir
|
||||
global fotosResultsDir
|
||||
global matDir
|
||||
@@ -17,6 +18,7 @@ global numCols
|
||||
global scan
|
||||
global scanMax
|
||||
global tptLength
|
||||
global easyDir
|
||||
|
||||
numRows=24; % for Single Vertical
|
||||
numCols=16; % for Single Vertical
|
||||
@@ -34,10 +36,10 @@ Fflg=1;
|
||||
% fclose('all'); % close all open files
|
||||
|
||||
% Unset some vars just in case they are already set
|
||||
clear('scanIntens','Scanfiles','pathname','tifFileLstP4')
|
||||
clear('scanIntens','Scanfiles','pathname','tifFileLstP4');
|
||||
|
||||
try
|
||||
clf(fhconsole,'reset')
|
||||
clf(fhconsole,'reset');
|
||||
catch
|
||||
end
|
||||
|
||||
@@ -46,13 +48,10 @@ end
|
||||
% EASYconsole
|
||||
|
||||
if exist(matFile, 'file')
|
||||
bkUpMatFile=fullfile(matDir,'BkUp',matFile)
|
||||
copyfile(matFile,(fullfile(matDir,'BkUp',matFile)))
|
||||
bkUpMatFile=fullfile(matDir,'BkUp',matFile);
|
||||
copyfile(matFile,bkUpMatFile);
|
||||
end
|
||||
|
||||
try
|
||||
load(fullfile(easyResultsDir,'Fotos','Nbdg')) %Modified to load from 'Fotos' 20_0819
|
||||
catch
|
||||
% 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
|
||||
@@ -62,26 +61,19 @@ catch
|
||||
% 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
|
||||
try
|
||||
load(fullfile(fotosResultsDir,'Nbdg')); %Modified to load from 'Fotos' 20_0819
|
||||
catch
|
||||
load(fullfile(pointMapsResultsDir,'Nbdg')); %Left in to accomodate loads of work before 20_0819
|
||||
end
|
||||
% Load Fotos stored data
|
||||
fotosToLoad = {'Coordinates', 'BGatTpts', 'anlZones', 'NCFparms'};
|
||||
for i = 1:length(fotosToLoad)
|
||||
try
|
||||
load(fullfile(easyResultsDir,'Fotos','Coordinates'))
|
||||
load(fullfile(fotosResultsDir, fotosToLoad{i}));
|
||||
catch
|
||||
load(fullfile(easyDir,'parameters'));
|
||||
end
|
||||
try
|
||||
load(fullfile(easyResultsDir,'Fotos','BGatTpts'))
|
||||
catch
|
||||
end
|
||||
try
|
||||
load(fullfile(easyResultsDir,'Fotos','anlZones'))
|
||||
catch
|
||||
end
|
||||
% autoImCF
|
||||
try
|
||||
load(fullfile(easyResultsDir,'PTmats','NCFparms'))
|
||||
catch ME
|
||||
load parameters
|
||||
end
|
||||
|
||||
% Get Print Times
|
||||
@@ -89,12 +81,12 @@ PrintTimes=[];
|
||||
scLst={};
|
||||
|
||||
% Parameter Entry
|
||||
NImParamRadiusGui(scansDir) % Ncode 122111replaced removed ,numOfPrtTimes)
|
||||
NImParamRadiusGui(scansDir); % Ncode 122111replaced removed ,numOfPrtTimes)
|
||||
width=24;
|
||||
widthEx=width-1; % width extention from reference point
|
||||
dither=ImParMat(6);
|
||||
radius=ImParMat(10);
|
||||
NIcircle
|
||||
NIcircle;
|
||||
|
||||
% Load Stuff
|
||||
lastPlateOnLastScan=1; % Ncode
|
||||
@@ -118,7 +110,7 @@ else
|
||||
end
|
||||
|
||||
SWgrowthArea=ImParMat(9);
|
||||
load(fullfile(pointMapsResultsDir,'NPTmapSearch'))
|
||||
load(fullfile(pointMapsResultsDir,'NPTmapSearch'));
|
||||
PTmapPos=detPos;
|
||||
selScanNumLst=[];
|
||||
Scanfiles=[];
|
||||
@@ -230,9 +222,9 @@ fileExt='.txt';
|
||||
filePrefix='FitResults_';
|
||||
for scanCnt=1:numScans
|
||||
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];
|
||||
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
|
||||
% removed but allows easy observation of how a run is progressing and can be
|
||||
|
||||
Reference in New Issue
Block a user