Update DgenResults.m

This commit is contained in:
2024-07-27 02:48:07 -04:00
parent 94e61712bc
commit 5269962927

View File

@@ -1,18 +1,21 @@
%% CALLED BY EASYconsole.m %% %% CALLED BY EASYconsole.m %%
% Updated 240724 Bryan C Roessler to improve file operations and portability % Updated 240724 Bryan C Roessler to improve file operations and portability
%Console globals******* %
global ExpPath global scansDir
global resDir global easyResultsDir
global ExpOutmat global matFile
global ImParMat global defImParMat
global printResultsDir
global fotosResultsDir
global pointMapsFile
ln=1; ln=1;
%******Version compatability fixes*******assoc'd with diff and solve v11a='7.12.0.635 (R2011a)'; % Version compatability fixes
if verLessThan('matlab','8.3') %original work 23_0227 updated 23_0525 (8.4 changed to 8.3) if verLessThan('matlab','8.3')
fd4=diff(sym('K / (1 + exp(-r* (t - l )))'),4); fd4=diff(sym('K / (1 + exp(-r* (t - l )))'),4);
sols=solve(fd4); sols=solve(fd4);
else %accomodate new matlab changes after 2014a fix 2nd update 23_0227 else % accomodate new matlab changes after 2014a
syms t K r l; syms t K r l;
fd4=diff(K / (1 + exp(-r* (t - l ))),t,4); fd4=diff(K / (1 + exp(-r* (t - l ))),t,4);
sols=solve(fd4); sols=solve(fd4);
@@ -24,16 +27,17 @@ end
% MPnum=ImParMat(1); % MPnum=ImParMat(1);
% opt=questdlg('Print Results Only (RES), DB Only (DB), or Both','Results Printout Options','Res','DB','Both','Both'); % opt=questdlg('Print Results Only (RES), DB Only (DB), or Both','Results Printout Options','Res','DB','Both','Both');
opt='Res'; opt='Res';
if ~exist('ImParMat','var') || isempty(ImParMat) if ~exist('defImParMat','var') || isempty(defImParMat) % TODO needs better explanation
load ImParameters load(pointMapsFile);
end end
destPerMP=ImParMat(2); destPerMP=ImParMat(2); % TODO this is weird, needs explanation
load (ExpOutmat); load(matFile);
load (fullfile(ExpPath,'MasterPlateFiles','MPDMmat.mat')) load(mpdmFile)
numOfDrgs=length(DM.drug); numOfDrgs=length(DM.drug);
numOfMeds=length(DM.media); numOfMeds=length(DM.media);
destPerMP=numOfDrgs; destPerMP=numOfDrgs;
% TODO this should be rewritten or is uncessary, what is this for
% Determine the longest set of intensity(tPts) for the Experiment Data Set % Determine the longest set of intensity(tPts) for the Experiment Data Set
maxNumIntens=0; maxNumIntens=0;
for n=1:size(scan,2) for n=1:size(scan,2)
@@ -41,41 +45,41 @@ for n=1:size(scan,2)
maxNumIntens=max(maxNumIntens,size(scan(n).plate(m).intens,2)); maxNumIntens=max(maxNumIntens,size(scan(n).plate(m).intens,2));
end end
end end
if length(ExpPath)==max(strfind(ExpPath,'\'))
localExpPath=ExpPath(1:end-1); % if length(scansDir) == max(strfind(scansDir,'\'))
else % localscansDir=scansDir(1:end-1);
localExpPath=ExpPath; % else
end % localscansDir=scansDir;
if ispc %Linux accommodation % end
expNm=localExpPath(max(strfind(localExpPath,'\'))+1:end);
drivePos=min(strfind(localExpPath,'\')); expNm=scansDir(max(strfind(scansDir,'\'))+1:end);
elseif ((isunix) || (ismac)) drivePos=min(strfind(scansDir,'\'));
expNm=localExpPath(max(strfind(localExpPath,'/'))+1:end) elseif (isunix || ismac)
drivePos=min(strfind(localExpPath,'/')); expNm=scansDir(max(strfind(scansDir,'/'))+1:end);
drivePos=min(strfind(scansDir,'/'));
end end
drive=localExpPath(1:(drivePos-1)); drive=scansDir(1:(drivePos-1));
DBupload=fullfile(drive,'EZdbFiles','DBupLOADfiles'); DBupload=fullfile(drive,'EZdbFiles','DBupLOADfiles');
%Added to allow backward compatability************************************ % Added to allow backward compatability
% Test for CFoutStd as indication of 2018version with r_refined fit code;If % Test for CFoutStd as indication of 2018version with r_refined fit code;If
%earlier version with only a standard composite fite, Print results to % earlier version with only a standard composite fite, Print results to !!ResultsStd_...txt only
%!!ResultsStd_...txt only
try try
scan(1).plate(1).CFoutStd(1,1); scan(1).plate(1).CFoutStd(1,1);
resultsFilename=fullfile(resDir,'PrintResults', strcat('!!ResultsELr_',expNm,'.txt')); resultsFilename=fullfile(printResultsDir, strcat('!!ResultsELr_',expNm,'.txt'));
DBfilename=fullfile(resDir,'PrintResults', strcat('!!DbaseELr_',expNm,'.txt')); DBfilename=fullfile(printResultsDir, strcat('!!DbaseELr_',expNm,'.txt'));
catch catch
resultsFilename=fullfile(resDir,'PrintResults', strcat('!!ResultsStd_',expNm,'.txt')); resultsFilename=fullfile(printResultsDir, strcat('!!ResultsStd_',expNm,'.txt'));
DBfilename=fullfile(resDir,'PrintResults', strcat('!!DbaseStd_',expNm,'.txt')); DBfilename=fullfile(printResultsDir, strcat('!!DbaseStd_',expNm,'.txt'));
end end
if isequal(opt,'Res')||isequal(opt,'Both'),fid=fopen(resultsFilename,'w');end 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,'DB')||isequal(opt,'Both'),fid2=fopen(DBfilename,'w');end
if isequal(opt,'Res')||isequal(opt,'Both') %print Results if isequal(opt,'Res')||isequal(opt,'Both')
fprintf(fid,'%d\t',ln); % Results header fprintf(fid,'%d\t',ln); % Results header
fprintf(fid,'%s\t\n',localExpPath); fprintf(fid,'%s\t\n',scansDir);
ln=ln+1; ln=ln+1;
fprintf(fid,'%d\t',ln); fprintf(fid,'%d\t',ln);
end end
@@ -86,9 +90,9 @@ drgCnt=0;
medCnt=0; medCnt=0;
try try
load(fullfile(resDir,'Fotos','Nbdg')) %Convolute scan array data into plates load(fullfile(easyResultsDir,'Fotos','Nbdg')) % Convolute scan array data into plates
catch catch
load(fullfile(resDir,'PTmats','Nbdg')) %Convolute scan array data into plates load(fullfile(easyResultsDir,'PTmats','Nbdg')) % Convolute scan array data into plates
end end
for s=1:size(scan,2) for s=1:size(scan,2)
@@ -371,23 +375,19 @@ if isequal(opt,'DB')||isequal(opt,'Both')
errordlg(rep) errordlg(rep)
end end
end end
% ln; TODO removed by BCR, this doesn't seem necessary
%*********************************************************************** % Print results using the standard method
%BEGIN PRINT RESULTS ROUTINE FOR STANDARD METHOD
%***********************************************************************
try try
scan(1).plate(1).CFoutStd(1,1) %Test for 2018 r_refined version scan(1).plate(1).CFoutStd(1,1) %Test for 2018 r_refined version
ln=1; ln=1;
resultsFilename= fullfile(resDir,'PrintResults', strcat('!!ResultsStd_',expNm,'.txt')); resultsFilename=fullfile(printResultsDir, strcat('!!ResultsStd_',expNm,'.txt'));
DBfilename= fullfile(resDir,'PrintResults', strcat('!!DbaseStd_',expNm,'.txt')); DBfilename=fullfile(printResultsDir, strcat('!!DbaseStd_',expNm,'.txt'));
if isequal(opt,'Res')||isequal(opt,'Both'),fid = fopen(resultsFilename,'w');end 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,'DB')||isequal(opt,'Both'),fid2 = fopen(DBfilename,'w');end %121012 Combo
if isequal(opt,'Res')||isequal(opt,'Both') %print Results if isequal(opt,'Res')||isequal(opt,'Both') %print Results
fprintf(fid,'%d\t',ln); %Results header fprintf(fid,'%d\t',ln); %Results header
fprintf(fid,'%s\t\n',localExpPath); fprintf(fid,'%s\t\n',scansDir);
ln=ln+1; ln=ln+1;
fprintf(fid,'%d\t',ln); fprintf(fid,'%d\t',ln);
end end
@@ -664,9 +664,9 @@ try
end end
end end
msgbox(['Printing Script complete. Check !!Results sheets in ../PrintResults folder.']) msgbox([strcat('Printing Script complete. Check !!Results sheets in ',printResultsDir,' for results.')])
catch ME catch ME
errorNstdResults='Catch at line720 for printing ResultsStd' disp(strcat("Results printing failed with error: ", getReport(ME, 'basic')))
end end