EASY rewrite
This commit is contained in:
246
workflow/templates/easy/DMPexcel2mat.m
Executable file
246
workflow/templates/easy/DMPexcel2mat.m
Executable file
@@ -0,0 +1,246 @@
|
||||
%% CALLED BY EASYconsole.m %%
|
||||
w = pwd;
|
||||
%{
|
||||
cd ..
|
||||
if exist('ExpJobs/')
|
||||
cd('ExpJobs/');
|
||||
else
|
||||
pwd
|
||||
end
|
||||
%}
|
||||
|
||||
try
|
||||
cd(ExpPath)
|
||||
catch
|
||||
cd(w)
|
||||
end
|
||||
pwd
|
||||
|
||||
numOfMPs=0;
|
||||
%GUI input for selecting a MasterPlate Excel file
|
||||
questdlg('\fontsize{20} Select Master Plate File','File Selection','OK', struct('Default','OK','Interpreter','tex'))
|
||||
[Scanfiles, pathname]=uigetfile('*.*','MultiSelect','off');
|
||||
if ispc
|
||||
MPdir= fullfile(pathname,'\');
|
||||
else
|
||||
MPdir=fullfile(pathname,'/');
|
||||
end
|
||||
|
||||
|
||||
infile= Scanfiles(1,:);
|
||||
cd(MPdir)
|
||||
%fid=fopen(infile)%('exp23PrintTimes.xls'); % textread puts date and time sequentially into vector
|
||||
if ispc
|
||||
[num, txt, raw] = xlsread(infile); %,'Yor1HitsMPsetFinal');
|
||||
fields= {txt(2,1:15)}; %or 1:17 for later but dont wish to exceed and cause error ? if used
|
||||
|
||||
else
|
||||
clear MPtbl
|
||||
opts = detectImportOptions(infile);
|
||||
MPtbl = readtable(infile,opts);
|
||||
MPtbl= readtable(infile);
|
||||
fields= {opts.VariableNames}; %? if used anywhere although 'saved' to MPDMmat
|
||||
MPcell= readcell(infile);
|
||||
end
|
||||
|
||||
|
||||
cd(w)
|
||||
numb= 0;
|
||||
clear MP;
|
||||
try
|
||||
|
||||
if ispc
|
||||
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)};
|
||||
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
|
||||
else
|
||||
MP(numb).orfRep= ' ';
|
||||
MP(numb).specifics= ' ';
|
||||
end
|
||||
%{
|
||||
if size(raw,2)>17 ; Future MP field
|
||||
MP(numb).specifics2= {raw((excLnNum+1):(excLnNum+384),18)}; %added 12_1008 to specify strain Bkground in MP
|
||||
else
|
||||
MP(numb).specifics2= ' ';
|
||||
end
|
||||
%}
|
||||
excLnNum=excLnNum+385;
|
||||
|
||||
msg=strcat('NumberOfMP = ',num2str(numb), ' lastLineNo. = ',num2str(excLnNum));
|
||||
|
||||
end % end if ispc
|
||||
else %if not ispc
|
||||
excLnNum=1;
|
||||
while (isequal(MPcell{(excLnNum+2),1},'###'))
|
||||
numb=numb+1;
|
||||
MP(numb).head = {MPtbl(excLnNum,2:6)};
|
||||
MP(numb).head{1}= table2cell(MP(numb).head{1});
|
||||
MP(numb).recNum = {MPtbl((excLnNum+1):(excLnNum+384),1)};
|
||||
MP(numb).recNum{1}= table2cell(MP(numb).recNum{1});
|
||||
MP(numb).orf = {MPtbl((excLnNum+1):(excLnNum+384),2)};
|
||||
MP(numb).orf{1}= table2cell(MP(numb).orf{1});
|
||||
MP(numb).strain = {MPtbl((excLnNum+1):(excLnNum+384),3)};
|
||||
MP(numb).strain{1}= table2cell(MP(numb).strain{1});
|
||||
MP(numb).genename= {MPtbl((excLnNum+1):(excLnNum+384),12)};
|
||||
MP(numb).genename{1}= table2cell(MP(numb).genename{1});
|
||||
MP(numb).media= {MPtbl((excLnNum+1):(excLnNum+384),7)};
|
||||
MP(numb).media{1}= table2cell(MP(numb).media{1});
|
||||
if size(MPtbl,2)>15
|
||||
MP(numb).orfRep= {MPtbl((excLnNum+1):(excLnNum+384),16)}; %added 12_1005 to specify replicates Orfs in MP
|
||||
MP(numb).orfRep{1}= table2cell(MP(numb).orfRep{1});
|
||||
MP(numb).specifics= {MPtbl((excLnNum+1):(excLnNum+384),17)}; %added 12_1008 to specify replicates Specific details in MP
|
||||
MP(numb).specifics{1}= table2cell(MP(numb).specifics{1});
|
||||
else
|
||||
MP(numb).orfRep= ' ';
|
||||
MP(numb).specifics= ' ';
|
||||
end
|
||||
|
||||
excLnNum=excLnNum+385;
|
||||
msg=strcat('NumberOfMP = ',num2str(numb), 'lastLineNo. = ',num2str(excLnNum))
|
||||
end
|
||||
|
||||
end %end of if ispc for MP while loop choice PC or Linux-other (ln~48)
|
||||
|
||||
catch ME
|
||||
h = msgbox(msg,'Check Number of Master Plates and Excel Lines')
|
||||
uiwait(h);
|
||||
end %end for try MP excel sheet input
|
||||
|
||||
%*********************************************************************
|
||||
%DMupload
|
||||
%Drug and Media Plate setup Upload from Excel
|
||||
%scan().plate().LocInd().gene
|
||||
cd(MPdir);
|
||||
excLnNum=1;
|
||||
%w=pwd
|
||||
%cd('D:\EASY\Experiments\'); %cd(ExpPath); %
|
||||
numOfDrugs=0;
|
||||
numOfMedias=0;
|
||||
%GUI input for selecting a MasterPlate Excel file
|
||||
questdlg('\fontsize{20} Select DrugMedia File','File Selection','OK', struct('Default','OK','Interpreter','tex'));
|
||||
[Scanfiles, pathname]=uigetfile('*.*', 'MultiSelect','off');
|
||||
if ispc
|
||||
DMdir= fullfile(pathname,'\');
|
||||
else
|
||||
DMdir=fullfile(pathname,'/');
|
||||
end
|
||||
|
||||
clear infile;
|
||||
infile= Scanfiles(1,:);
|
||||
cd(DMdir)
|
||||
%fid=fopen(infile)%('exp23PrintTimes.xls'); % textread puts date and time sequentially into vector
|
||||
if ispc
|
||||
[num, txt, raw] = xlsread(infile); %,'Yor1HitsMPsetFinal');
|
||||
fields= {txt(2,1:5)};
|
||||
Linked= num(1,1);
|
||||
else
|
||||
opts = detectImportOptions(infile);
|
||||
DMtbl= readtable(infile,opts);
|
||||
fields= opts.VariableOptions;
|
||||
Linked= DMtbl{1,1};
|
||||
DMcell= readcell(infile);
|
||||
end
|
||||
cd(w)
|
||||
numb=0;
|
||||
|
||||
%fields= {txt(2,1:5)};
|
||||
%Linked= num(1,1);
|
||||
|
||||
|
||||
if isequal(Linked,1) %Drugs and Media are linked 1 to 1; else they are combinatorial
|
||||
clear DM;
|
||||
%try
|
||||
excLnNum=2;
|
||||
if ispc
|
||||
while (~isequal(txt{excLnNum,2},'###'))
|
||||
numb=numb+1;
|
||||
DM.drug(numb) = {raw(excLnNum,2)};
|
||||
DM.conc(numb) = {raw(excLnNum,3)};
|
||||
DM.media(numb) = {raw(excLnNum,4)};
|
||||
DM.mod1(numb) = {raw(excLnNum,5)};
|
||||
DM.conc1(numb) = {raw(excLnNum,6)};
|
||||
DM.mod2(numb) = {raw(excLnNum,7)};
|
||||
DM.conc2(numb) = {raw(excLnNum,8)};
|
||||
excLnNum=excLnNum+1;
|
||||
msg=strcat('NumberOf1:1DrugMediaPlates = ',num2str(numb), ' lastLineNo. = ',num2str(excLnNum))
|
||||
end
|
||||
else
|
||||
clear DM
|
||||
excLnNum=1;
|
||||
while (~isequal(DMcell{excLnNum+1,2},'###'))
|
||||
numb=numb+1;
|
||||
DM.drug(numb) = {DMtbl(excLnNum,2)};
|
||||
DM.drug(numb)= table2cell(DM.drug{numb});
|
||||
DM.conc(numb) = {DMtbl(excLnNum,3)};
|
||||
DM.conc(numb)= table2cell(DM.conc{numb});
|
||||
DM.media(numb) = {DMtbl(excLnNum,4)};
|
||||
DM.media(numb)= table2cell(DM.media{numb});
|
||||
DM.mod1(numb) = {DMtbl(excLnNum,5)};
|
||||
DM.mod1(numb)= table2cell(DM.mod1{numb});
|
||||
DM.conc1(numb) = {DMtbl(excLnNum,6)};
|
||||
DM.conc1(numb)= table2cell(DM.conc1{numb});
|
||||
DM.mod2(numb) = {DMtbl(excLnNum,7)};
|
||||
DM.mod2(numb)= table2cell(DM.mod2{numb});
|
||||
DM.conc2(numb) = {DMtbl(excLnNum,8)};
|
||||
DM.conc2(numb)= table2cell(DM.conc2{numb});
|
||||
excLnNum=excLnNum+1;
|
||||
msg=strcat('NumberOf1:1DrugMediaPlates = ',num2str(numb), ' lastLineNo. = ',num2str(excLnNum))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
%Legacy contengency -Not ever used!!
|
||||
if isequal(Linked,0) %0 indicates Drugs and Media are combinatorial
|
||||
clear DM;
|
||||
excLnNum=2;
|
||||
drgCnt=0;
|
||||
medCnt=0;
|
||||
if ispc
|
||||
while (~isequal(txt{excLnNum,2},'###'))
|
||||
drgCnt=drgCnt+1;
|
||||
DM.drug(drgCnt) = {raw(excLnNum,2)};
|
||||
DM.conc(drgCnt) = {raw(excLnNum,3)};
|
||||
excLnNum=excLnNum+1;
|
||||
end
|
||||
|
||||
while (~isequal(txt{excLnNum,4},'###'))
|
||||
medCnt=medCnt+1;
|
||||
DM.media(medCnt) = {raw(excLnNum,4)};
|
||||
excLnNum=excLnNum+1;
|
||||
end
|
||||
else %else if not PC (Then linux or other)
|
||||
excLnNum=1;
|
||||
while (~isequal(DMcell{excLnNum+1,2},'###'))
|
||||
drgCnt=drgCnt+1;
|
||||
DM.drug(drgCnt) = {DMtbl(excLnNum,2)};
|
||||
DM.conc(drgCnt) = {DMtbl(excLnNum,3)};
|
||||
excLnNum=excLnNum+1;
|
||||
end
|
||||
|
||||
while (~isequal(DMcel{excLnNum+1,4},'###'))
|
||||
medCnt=medCnt+1;
|
||||
DM.media(medCnt) = {DMtbl(excLnNum,4)};
|
||||
excLnNum=excLnNum+1;
|
||||
end
|
||||
end
|
||||
|
||||
msg=strcat('NumberOfDrugs = ',num2str(drgCnt), ' NumberOfMedias = ',num2str(medCnt) )
|
||||
|
||||
end
|
||||
|
||||
save (fullfile(MPdir,'MPDMmat'), 'fields','MP','DM','Linked');
|
||||
|
||||
cd(w)
|
||||
msgbox(['Drug-Media-MasterPlate Annotation File Generation Complete'])
|
||||
727
workflow/templates/easy/DgenResults.m
Executable file
727
workflow/templates/easy/DgenResults.m
Executable file
@@ -0,0 +1,727 @@
|
||||
%% CALLED BY EASYconsole.m %%
|
||||
%to 'Fotos' from 'PTmaps'
|
||||
%Console globals*******
|
||||
global ExpPath
|
||||
global resDir
|
||||
global ExpOutmat
|
||||
global ImParMat
|
||||
|
||||
w=pwd;
|
||||
ln=1;
|
||||
|
||||
|
||||
%******Version compatability fixes*******assoc'd with diff and solve v11a='7.12.0.635 (R2011a)';
|
||||
if verLessThan('matlab','8.3') %original work 23_0227 updated 23_0525 (8.4 changed to 8.3)
|
||||
fd4=diff(sym('K / (1 + exp(-r* (t - l )))'),4);
|
||||
sols= solve(fd4);
|
||||
else %accomodate new matlab changes after 2014a fix 2nd update 23_0227
|
||||
syms t K r l;
|
||||
fd4= diff(K / (1 + exp(-r* (t - l ))),t,4);
|
||||
sols= solve(fd4);
|
||||
tmpswap= sols(1);
|
||||
sols(1)= sols(3);
|
||||
sols(3)= tmpswap;
|
||||
end
|
||||
|
||||
%MPnum=ImParMat(1);
|
||||
%opt = questdlg('Print Results Only (RES), DB Only (DB), or Both','Results Printout Options','Res','DB','Both','Both');
|
||||
opt='Res';
|
||||
|
||||
if ~exist('ImParMat','var') || isempty(ImParMat)
|
||||
load ImParameters
|
||||
end
|
||||
destPerMP=ImParMat(2);
|
||||
load (ExpOutmat);
|
||||
load (fullfile(ExpPath,'MasterPlateFiles','MPDMmat.mat'))
|
||||
numOfDrgs= length(DM.drug);
|
||||
numOfMeds= length(DM.media);
|
||||
destPerMP=numOfDrgs;
|
||||
|
||||
%Determine the longest set of intensity(tPts) for the Experiment Data Set
|
||||
maxNumIntens=0;
|
||||
for n=1:size(scan,2)
|
||||
for m=1:size(scan(n).plate,2)
|
||||
maxNumIntens= max(maxNumIntens,size(scan(n).plate(m).intens,2));
|
||||
end
|
||||
end
|
||||
if length(ExpPath)== max(strfind(ExpPath,'\'))
|
||||
localExpPath=ExpPath(1:end-1);
|
||||
else
|
||||
localExpPath=ExpPath;
|
||||
end
|
||||
if ispc %Linux accommodation
|
||||
expNm=localExpPath(max(strfind(localExpPath,'\'))+1:end);
|
||||
else
|
||||
if isunix,expNm=localExpPath(max(strfind(localExpPath,'/'))+1:end);end
|
||||
if ismac,expNm=localExpPath(max(strfind(localExpPath,'/'))+1:end);end
|
||||
end
|
||||
if ispc
|
||||
drivePos=min(strfind(localExpPath,'\'));
|
||||
else
|
||||
drivePos= min(strfind(localExpPath,'/'));
|
||||
end
|
||||
drive= localExpPath(1:(drivePos-1));
|
||||
|
||||
DBupload=fullfile(drive,'EZdbFiles','DBupLOADfiles');
|
||||
%DBupload=['G:\EZdbFiles\DBupLOADfiles']
|
||||
%resultsFilename= strcat(resDir,'\PrintResults\!!Results_Output.txt') %'\PrintResults\zDevelCFitOutIndxSelectedRawDatTimesDrugMedia.txt'
|
||||
%DBfilename= strcat(resDir,'\PrintResults\!!Dbase_Output.txt') % Print !Dbase file in PrintResults dir
|
||||
%resultsFilename= strcat(resDir,'\PrintResults\!!Results_',expNm,'.txt')
|
||||
%DBfilename= strcat(resDir,'\PrintResults\!!Dbase_',expNm,'.txt')
|
||||
|
||||
%Added to allow backward compatability************************************
|
||||
%Test for CFoutStd as indication of 2018version with r_refined fit code;If
|
||||
%earlier version with only a standard composite fite, Print results to
|
||||
%!!ResultsStd_...txt only
|
||||
%***********************
|
||||
try
|
||||
scan(1).plate(1).CFoutStd(1,1);
|
||||
resultsFilename= fullfile(resDir,'PrintResults', strcat('!!ResultsELr_',expNm,'.txt'));
|
||||
DBfilename= fullfile(resDir,'PrintResults', strcat('!!DbaseELr_',expNm,'.txt'));
|
||||
catch
|
||||
resultsFilename= fullfile(resDir,'PrintResults', strcat('!!ResultsStd_',expNm,'.txt'));
|
||||
DBfilename= fullfile(resDir,'PrintResults', strcat('!!DbaseStd_',expNm,'.txt'));
|
||||
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,'Res')||isequal(opt,'Both') %print Results
|
||||
fprintf(fid,'%d\t',ln); %Results header
|
||||
fprintf(fid,'%s\t\n',localExpPath);
|
||||
ln=ln+1;
|
||||
fprintf(fid,'%d\t',ln);
|
||||
end
|
||||
|
||||
mpCnt=0;
|
||||
totPlCnt=0;
|
||||
drgCnt=0;
|
||||
medCnt=0;
|
||||
%load(fullfile(resDir,'PTmats','Nbdg')) %Convolute scan array data into plates
|
||||
try
|
||||
load(fullfile(resDir,'Fotos','Nbdg')) %Convolute scan array data into plates
|
||||
catch
|
||||
load(fullfile(resDir,'PTmats','Nbdg')) %Convolute scan array data into plates
|
||||
end
|
||||
for s=1:size(scan,2)
|
||||
%Convolute scan array data into plates DconB for DBcombo
|
||||
clear Diag
|
||||
try
|
||||
Diag(:,:,:,1)= sbdg{s}(1:1:24,16:-1:1,:);
|
||||
catch
|
||||
sbdg{s};
|
||||
end
|
||||
%*****************************************************
|
||||
for p=1:size((scan(s).plate),2)
|
||||
totPlCnt=totPlCnt+1;
|
||||
|
||||
if destPerMP>1 &&rem(totPlCnt,destPerMP)==1, mpCnt=mpCnt+1; end
|
||||
if destPerMP==1,mpCnt=mpCnt+1; end
|
||||
pertCnt= rem(totPlCnt,destPerMP);
|
||||
if pertCnt==0, pertCnt= destPerMP;end
|
||||
pert= strcat('Perturb_',num2str(pertCnt));
|
||||
s
|
||||
p
|
||||
clear outCmat
|
||||
outCmat=scan(s).plate(p).CFout;
|
||||
%Print Time Point HEADER for each plate for newly added intensity data
|
||||
if isequal(opt,'Res')||isequal(opt,'Both')
|
||||
fprintf(fid, '\n');
|
||||
ln=ln+1;
|
||||
fprintf(fid,'%d\t',ln);
|
||||
fprintf(fid,'Scan\tPlate\tRow\tCol\t');
|
||||
try
|
||||
asd=cell2mat(scan(s).plate(1).CFparameters(1));
|
||||
aucEndPt= strcat('AUC',num2str(asd(9)));
|
||||
catch
|
||||
asd=cell2mat(scan(s).plate(1).CFparameters{1,1}(1,384));
|
||||
aucEndPt= strcat('AUC',num2str(asd(9)));
|
||||
end
|
||||
|
||||
fprintf(fid, 'Num.\tDiagnostics\tDrug\tConc\tMedia\tModifier1\tConc1\tModifier2\tConc2\tORF\tGene');
|
||||
fprintf(fid, '\t %s',aucEndPt);
|
||||
fprintf(fid, '\triseTm\tK\tr\tl\tR-squared\tK-lower\tK-upper\tr-lower\tr-upper\tl-lower\tl-upper\tArea\tLastInten\tSplineMaxRateTm\tLastFitTm\t1stFitTm\tMedianBase\tFitBase\tMinTm\tThreshTm');
|
||||
|
||||
if size(outCmat,2)==27
|
||||
fprintf(fid, '\ttc11Cut\ttc12Cut\ttc21Cut\ttc22Cut'); %'\tEarly1\tEarly2\tLate1\tLate2'); 17_0629 MinBaseIntens update for MedianBase label
|
||||
end
|
||||
fprintf(fid, '\tTotFitPts\tPostThreshFitPts\t1stBackgrd\tLstBackgrd\t1stMeanTotBackgrd\tLstMeanTotBackgrd');
|
||||
|
||||
|
||||
end
|
||||
clear outTseries
|
||||
outTseries=[];
|
||||
outTseries=scan(s).plate(p).tSeries;
|
||||
TseriesSize= size(outTseries,1);
|
||||
|
||||
%***************************************************************
|
||||
%clear outCmat
|
||||
%outCmat=scan(s).plate(p).CFout;
|
||||
clear outIntens
|
||||
outIntens=[];
|
||||
RawIntens=[];
|
||||
RawIntens=scan(s).plate(p).intens;
|
||||
RawIntensSize= size(RawIntens,2)
|
||||
|
||||
clear Ag; %Ag is Growth Area
|
||||
Ag=scan(s).plate(p).Ag;
|
||||
AgSize= size(Ag);
|
||||
%***************************************
|
||||
dataLength= min(TseriesSize,RawIntensSize);
|
||||
%for j=1:length(outTseries)%(size(outTseries,2)
|
||||
if isequal(opt,'Res')||isequal(opt,'Both')
|
||||
for j=1:dataLength
|
||||
fprintf(fid, '\t%.5f', outTseries(j));
|
||||
end
|
||||
end
|
||||
%numBlkColTm=(maxNumIntens - size(outTseries,1));
|
||||
numBlkCol=(maxNumIntens - dataLength); %size(outTseries,1));
|
||||
%for nn=1:numBlkColTm %extend to col beyond longest rawDataSet
|
||||
if isequal(opt,'Res')||isequal(opt,'Both')
|
||||
for nn=1:numBlkCol %extend to col beyond longest rawDataSet
|
||||
fprintf(fid, '\t');
|
||||
end
|
||||
|
||||
fprintf(fid,'\tOrfRep');
|
||||
fprintf(fid,'\tSpecifics');
|
||||
fprintf(fid,'\tStrainBkGrd');
|
||||
fprintf(fid, '\n');
|
||||
ln=ln+1;
|
||||
fprintf(fid,'%d\t',ln);
|
||||
end
|
||||
%*****************************************Begin Data Section
|
||||
|
||||
n=0;
|
||||
for r=1:16
|
||||
|
||||
for c=1:24
|
||||
n=n+1;
|
||||
clear selcode;
|
||||
Kval=outCmat(n,3);
|
||||
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 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))...
|
||||
||isnan(outCmat(n,10))||isnan(outCmat(n,11))...
|
||||
||isnan(outCmat(n,12)), selcode=strcat(selcode,' NaN');
|
||||
end
|
||||
|
||||
%*************RiseTime Calculation*****************************************
|
||||
K= (outCmat(n,3));
|
||||
R= (outCmat(n,4));
|
||||
L= (outCmat(n,5));
|
||||
|
||||
if R>0 && L>0 && K>0
|
||||
rr=R; ll=L;
|
||||
tc1= eval(sols(2));
|
||||
tc2= eval(sols(3));
|
||||
LL= eval(sols(1));
|
||||
riseTm= LL-tc1;
|
||||
else
|
||||
riseTm=0;
|
||||
end
|
||||
%*************************************************************************
|
||||
|
||||
if Ag(n)< .30*(scan(s).Awindow),selcode=strcat(selcode,' smArea'); end %12_1030
|
||||
if outCmat(n,3)==0,selcode=strcat('0 ',selcode); end
|
||||
|
||||
orf=cell2mat(MP(mpCnt).orf{1}(n));
|
||||
gene=cell2mat(MP(mpCnt).genename{1}(n));
|
||||
orfRep=cell2mat(MP(mpCnt).orfRep{1}(n));
|
||||
specifics=cell2mat(MP(mpCnt).specifics{1}(n));
|
||||
strain=cell2mat(MP(mpCnt).strain{1}(n));
|
||||
drug= char(DM.drug{pertCnt});
|
||||
conc= char(DM.conc{pertCnt});
|
||||
media= char(DM.media{pertCnt});
|
||||
try
|
||||
mod1= char(DM.mod1{pertCnt});
|
||||
conc1= char(DM.conc1{pertCnt});
|
||||
catch
|
||||
mod1= ' ';
|
||||
conc1= ' ';
|
||||
end
|
||||
try
|
||||
mod2= char(DM.mod2{pertCnt});
|
||||
conc2= char(DM.conc2{pertCnt});
|
||||
catch
|
||||
mod2= ' ';
|
||||
conc2= ' ';
|
||||
end
|
||||
|
||||
if ~isempty(outCmat)
|
||||
if isequal(opt,'Res')||isequal(opt,'Both')
|
||||
fprintf(fid,'%d\t %d\t %d\t %d\t %d\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t',s,p,r,c,n,selcode,drug,conc,media,mod1,conc1,mod2,conc2,orf,gene);
|
||||
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',...
|
||||
outCmat(n,1),riseTm,outCmat(n,3),outCmat(n,4),...
|
||||
outCmat(n,5),outCmat(n,6),outCmat(n,7),outCmat(n,8),...
|
||||
outCmat(n,9),outCmat(n,10),outCmat(n,11),outCmat(n,12),...
|
||||
outCmat(n,13),outCmat(n,14),outCmat(n,15),outCmat(n,16));
|
||||
|
||||
fprintf(fid, '\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f',...
|
||||
outCmat(n,17),outCmat(n,18),outCmat(n,19),...
|
||||
outCmat(n,20),outCmat(n,21));
|
||||
%failPt= [s n r c]
|
||||
|
||||
%Added for data cut times used in 'r'optomized method 06/14/2018
|
||||
if size(outCmat,2)==27
|
||||
fprintf(fid, '\t%.5f\t%.5f\t%.5f\t%.5f',...
|
||||
outCmat(n,24),outCmat(n,25),outCmat(n,26),outCmat(n,27));
|
||||
end
|
||||
fprintf(fid, '\t%d\t%d\t%d\t%d\t%d\t%d',...
|
||||
outCmat(n,22),outCmat(n,23),Diag(c,r,1,p),Diag(c,r,2,p),Diag(c,r,3,p),Diag(c,r,4,p)); %,Diag(r,c,3,p),Diag(r,c,4,p));
|
||||
end %Results print
|
||||
%DBfile*******************************************
|
||||
%riseTm calc*****
|
||||
if isequal(opt,'DB')||isequal(opt,'Both')
|
||||
dbRsq= 0;dbKup= 0; dbKlo= 0; dbrup= 0; dbrlo= 0; dbLlo= 0; dbLup= 0;
|
||||
if isnumeric(outCmat(n,6)), dbRsq= outCmat(n,6);end
|
||||
if isnumeric(outCmat(n,7)), dbKup= outCmat(n,7);end
|
||||
if isnumeric(outCmat(n,8)), dbKlo= outCmat(n,8);end
|
||||
if isnumeric(outCmat(n,9)), dbrup= outCmat(n,9);end
|
||||
if isnumeric(outCmat(n,10)), dbrlo= outCmat(n,10);end
|
||||
if isnumeric(outCmat(n,11)), dbLlo= outCmat(n,11);end
|
||||
if isnumeric(outCmat(n,12)), dbLup= outCmat(n,12);end
|
||||
end
|
||||
|
||||
%****************
|
||||
if isequal(opt,'DB')||isequal(opt,'Both')
|
||||
fprintf(fid2,'%s\t %d\t %d\t %d\t %d\t %d\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t',expNm,s,p,r,c,n,selcode,drug,conc,media,mod1,conc1,mod2,conc2,orf,gene);
|
||||
fprintf(fid2, '%.5f\t %.5f\t %.5f\t %.5f\t %.5f\t %.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f',...
|
||||
outCmat(n,1),riseTm,outCmat(n,3),outCmat(n,4),...
|
||||
outCmat(n,5),dbRsq,dbKup,dbKlo,...
|
||||
dbrup,dbrlo,dbLlo,dbLup); %\t%.5f\t%.5f\t%.5f\t%.5f
|
||||
%... outCmat(n,13),outCmat(n,14),outCmat(n,15),outCmat(n,16));
|
||||
|
||||
end
|
||||
%*****DB analysis data end************************************************
|
||||
%Add Intensities series to end of curve fit data
|
||||
outIntens=[];
|
||||
outIntens=zeros(384,dataLength);
|
||||
intensBlob='';
|
||||
tmBlob ='';
|
||||
|
||||
for j=1:dataLength %size(RawIntens,2) %size(outTseries,1)
|
||||
if Ag(n)==0,Ag(n)=scan(s).Awindow;end
|
||||
outIntens(n,j)= RawIntens(n,j)/Ag(n);
|
||||
if isequal(opt,'Res')||isequal(opt,'Both')
|
||||
fprintf(fid, '\t%.5f', outIntens(n,j)); % Results print Intens
|
||||
end
|
||||
if isequal(opt,'DB')||isequal(opt,'Both')
|
||||
if j<dataLength
|
||||
intensBlob= strcat(intensBlob,num2str(outIntens(n,j)),';');
|
||||
else
|
||||
intensBlob= strcat(intensBlob,num2str(outIntens(n,j)));
|
||||
end
|
||||
if outTseries(j)<.0001,outTseries(j)=0;end
|
||||
if j<dataLength
|
||||
tmBlob= strcat(tmBlob,num2str(outTseries(j)),';');
|
||||
else
|
||||
tmBlob= strcat(tmBlob,num2str(outTseries(j)));
|
||||
end
|
||||
end %if DB
|
||||
end %j
|
||||
%***************************
|
||||
|
||||
|
||||
% Results fprint***********
|
||||
if isequal(opt,'Res')||isequal(opt,'Both')
|
||||
for nn=1:numBlkCol %extend to col beyond longest rawDataSet
|
||||
fprintf(fid, '\t');
|
||||
end
|
||||
%-----------------------------------------------
|
||||
% UPDATE 14_0626 to writein ' ' if personnel fail to in their
|
||||
% Masterplate sheet
|
||||
if ~isnan(orfRep)
|
||||
fprintf(fid, '\t%s', orfRep); %print OrfRep
|
||||
else
|
||||
fprintf(fid, '\t%s', ' ');
|
||||
end
|
||||
if ~isnan(specifics)
|
||||
fprintf(fid, '\t%s', specifics);
|
||||
else
|
||||
fprintf(fid, '\t%s', ' ');
|
||||
end
|
||||
if ~isnan(strain)
|
||||
fprintf(fid, '\t%s', strain);
|
||||
else
|
||||
fprintf(fid, '\t%s', ' ');
|
||||
end
|
||||
%-----------------------------------------------
|
||||
%****************************
|
||||
fprintf(fid, '\n');
|
||||
ln=ln+1;
|
||||
fprintf(fid,'%d\t',ln);
|
||||
end
|
||||
%****************************
|
||||
%DB Raw Intensities and Timepoints
|
||||
if isequal(opt,'DB')||isequal(opt,'Both')
|
||||
fprintf(fid2, '\t%s\t%s',intensBlob,tmBlob );
|
||||
|
||||
%-------------------------------
|
||||
% UPDATE 14_0626 to writein ' ' if personnel fail to in their
|
||||
% Masterplate sheet
|
||||
if ~isnan(orfRep)
|
||||
fprintf(fid2, '\t%s',orfRep );
|
||||
else
|
||||
fprintf(fid2, '\t%s', ' ');
|
||||
end
|
||||
if ~isnan(specifics)
|
||||
fprintf(fid2, '\t%s',specifics );
|
||||
else
|
||||
fprintf(fid2, '\t%s', ' ');
|
||||
end
|
||||
if ~isnan(strain)
|
||||
fprintf(fid2, '\t%s',strain );
|
||||
else
|
||||
fprintf(fid2, '\t%s', ' ');
|
||||
end
|
||||
%---------------------------------
|
||||
fprintf(fid2, '\n');
|
||||
end %DB print
|
||||
end %if ~isempty(outCmat)
|
||||
|
||||
end %c
|
||||
end %r
|
||||
end %p
|
||||
end %s
|
||||
|
||||
if isequal(opt,'Res')||isequal(opt,'Both')
|
||||
fclose(fid);
|
||||
end
|
||||
if isequal(opt,'DB')||isequal(opt,'Both')
|
||||
fclose(fid2);
|
||||
|
||||
try
|
||||
copyfile(DBfilename,DBupload)
|
||||
catch ME
|
||||
rep = getReport(ME, 'basic');
|
||||
rep=strcat('Failed copyfile to ',DBupload,' -', rep);
|
||||
errordlg(rep)
|
||||
end
|
||||
end %if DB
|
||||
ln;
|
||||
cd(w)
|
||||
|
||||
|
||||
%***********************************************************************
|
||||
%BEGIN PRINT RESULTS ROUTINE FOR STANDARD METHOD
|
||||
%***********************************************************************
|
||||
try
|
||||
scan(1).plate(1).CFoutStd(1,1) %Test for 2018 r_refined version
|
||||
|
||||
ln=1;
|
||||
resultsFilename= fullfile(resDir,'PrintResults', strcat('!!ResultsStd_',expNm,'.txt'));
|
||||
DBfilename= fullfile(resDir,'PrintResults', 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') %print Results
|
||||
fprintf(fid,'%d\t',ln); %Results header
|
||||
fprintf(fid,'%s\t\n',localExpPath);
|
||||
ln=ln+1;
|
||||
fprintf(fid,'%d\t',ln);
|
||||
end
|
||||
|
||||
mpCnt=0;
|
||||
totPlCnt=0;
|
||||
drgCnt=0;
|
||||
medCnt=0;
|
||||
|
||||
for s=1:size(scan,2)
|
||||
%Convolute scan array data into plates DconB for DBcombo
|
||||
clear Diag
|
||||
try
|
||||
Diag(:,:,:,1)= sbdg{s}(1:1:24,16:-1:1,:);
|
||||
catch
|
||||
sbdg{s};
|
||||
end
|
||||
%*****************************************************
|
||||
for p=1:size((scan(s).plate),2)
|
||||
totPlCnt=totPlCnt+1;
|
||||
|
||||
if destPerMP>1 &&rem(totPlCnt,destPerMP)==1, mpCnt=mpCnt+1; end
|
||||
if destPerMP==1,mpCnt=mpCnt+1; end
|
||||
pertCnt= rem(totPlCnt,destPerMP);
|
||||
if pertCnt==0, pertCnt= destPerMP;end
|
||||
pert= strcat('Perturb_',num2str(pertCnt));
|
||||
s
|
||||
|
||||
%Print Time Point HEADER for each plate for newly added intensity data
|
||||
if isequal(opt,'Res')||isequal(opt,'Both')
|
||||
fprintf(fid, '\n');
|
||||
ln=ln+1;
|
||||
fprintf(fid,'%d\t',ln);
|
||||
fprintf(fid,'Scan\tPlate\tRow\tCol\t');
|
||||
|
||||
try
|
||||
asd=cell2mat(scan(s).plate(1).CFparameters(1));
|
||||
aucEndPt= strcat('AUC',num2str(asd(9)));
|
||||
catch
|
||||
asd=cell2mat(scan(s).plate(1).CFparameters{1,1}(1,384));
|
||||
aucEndPt= strcat('AUC',num2str(asd(9)));
|
||||
end
|
||||
fprintf(fid, 'Num.\tDiagnostics\tDrug\tConc\tMedia\tModifier1\tConc1\tModifier2\tConc2\tORF\tGene')
|
||||
fprintf(fid, '\t %s',aucEndPt)
|
||||
fprintf(fid, '\triseTm\tK\tr\tl\tR-squared\tK-lower\tK-upper\tr-lower\tr-upper\tl-lower\tl-upper\tArea\tLastInten\tSplineMaxRateTm\tLastFitTm\t1stFitTm\tMedianBase\tFitBase\tMinTm\tThreshTm\tTotFitPts\tPostThreshFitPts\t1stBackgrd\tLstBackgrd\t1stMeanTotBackgrd\tLstMeanTotBackgrd'); %17_0629 MinBaseIntens update for MedianBase label
|
||||
end
|
||||
clear outTseries
|
||||
outTseries=[];
|
||||
outTseries=scan(s).plate(p).tSeries;
|
||||
TseriesSize= size(outTseries,1);
|
||||
|
||||
%***************************************************************
|
||||
clear outCmat
|
||||
outCmat=scan(s).plate(p).CFoutStd;
|
||||
clear outIntens
|
||||
outIntens=[];
|
||||
RawIntens=[];
|
||||
RawIntens=scan(s).plate(p).intens;
|
||||
RawIntensSize= size(RawIntens,2)
|
||||
clear Ag; %Ag is Growth Area
|
||||
Ag=scan(s).plate(p).Ag;
|
||||
AgSize= size(Ag);
|
||||
%***************************************
|
||||
dataLength= min(TseriesSize,RawIntensSize);
|
||||
if isequal(opt,'Res')||isequal(opt,'Both')
|
||||
for j=1:dataLength
|
||||
fprintf(fid, '\t%.5f', outTseries(j));
|
||||
end
|
||||
end
|
||||
|
||||
numBlkCol=(maxNumIntens - dataLength); %size(outTseries,1));
|
||||
|
||||
if isequal(opt,'Res')||isequal(opt,'Both')
|
||||
for nn=1:numBlkCol %extend to col beyond longest rawDataSet
|
||||
fprintf(fid, '\t');
|
||||
end
|
||||
|
||||
fprintf(fid,'\tOrfRep');
|
||||
fprintf(fid,'\tSpecifics');
|
||||
fprintf(fid,'\tStrainBkGrd');
|
||||
fprintf(fid, '\n');
|
||||
ln=ln+1;
|
||||
fprintf(fid,'%d\t',ln);
|
||||
end
|
||||
%*****************************************Begin Data Section
|
||||
|
||||
n=0;
|
||||
for r=1:16
|
||||
|
||||
for c=1:24
|
||||
n=n+1;
|
||||
clear selcode;
|
||||
Kval=outCmat(n,3);
|
||||
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 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))...
|
||||
||isnan(outCmat(n,10))||isnan(outCmat(n,11))...
|
||||
||isnan(outCmat(n,12)), selcode=strcat(selcode,' NaN');
|
||||
end
|
||||
|
||||
%*************RiseTime Calculation*****************************************
|
||||
K= (outCmat(n,3));
|
||||
R= (outCmat(n,4));
|
||||
L= (outCmat(n,5));
|
||||
if R>0 && L>0 && K>0
|
||||
rr=R; ll=L;
|
||||
tc1= eval(sols(2));
|
||||
tc2= eval(sols(3));
|
||||
LL= eval(sols(1));
|
||||
riseTm= LL-tc1;
|
||||
else
|
||||
riseTm=0;
|
||||
end
|
||||
|
||||
%*************************************************************************
|
||||
|
||||
if Ag(n)< .30*(scan(s).Awindow),selcode=strcat(selcode,' smArea'); end %12_1030
|
||||
if outCmat(n,3)==0,selcode=strcat('0 ',selcode); end
|
||||
|
||||
orf=cell2mat(MP(mpCnt).orf{1}(n));
|
||||
gene=cell2mat(MP(mpCnt).genename{1}(n));
|
||||
orfRep=cell2mat(MP(mpCnt).orfRep{1}(n));
|
||||
specifics=cell2mat(MP(mpCnt).specifics{1}(n));
|
||||
strain=cell2mat(MP(mpCnt).strain{1}(n));
|
||||
drug= char(DM.drug{pertCnt});
|
||||
conc= char(DM.conc{pertCnt});
|
||||
media= char(DM.media{pertCnt});
|
||||
try
|
||||
mod1= char(DM.mod1{pertCnt});
|
||||
conc1= char(DM.conc1{pertCnt});
|
||||
catch
|
||||
mod1= ' ';
|
||||
conc1= ' ';
|
||||
end
|
||||
try
|
||||
mod2= char(DM.mod2{pertCnt});
|
||||
conc2= char(DM.conc2{pertCnt});
|
||||
catch
|
||||
mod2= ' ';
|
||||
conc2= ' ';
|
||||
end
|
||||
|
||||
if ~isempty(outCmat)
|
||||
if isequal(opt,'Res')||isequal(opt,'Both')
|
||||
fprintf(fid,'%d\t %d\t %d\t %d\t %d\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t',s,p,r,c,n,selcode,drug,conc,media,mod1,conc1,mod2,conc2,orf,gene);
|
||||
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',...
|
||||
outCmat(n,1),riseTm,outCmat(n,3),outCmat(n,4),...
|
||||
outCmat(n,5),outCmat(n,6),outCmat(n,7),outCmat(n,8),...
|
||||
outCmat(n,9),outCmat(n,10),outCmat(n,11),outCmat(n,12),...
|
||||
outCmat(n,13),outCmat(n,14),outCmat(n,15),outCmat(n,16));
|
||||
|
||||
fprintf(fid, '\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%d\t%d',...
|
||||
outCmat(n,17),outCmat(n,18),outCmat(n,19),...
|
||||
outCmat(n,20),outCmat(n,21),outCmat(n,22),outCmat(n,23));
|
||||
|
||||
fprintf(fid, '\t%d\t%d\t%d\t%d',...
|
||||
Diag(c,r,1,p),Diag(c,r,2,p),Diag(c,r,3,p),Diag(c,r,4,p)); %,Diag(r,c,3,p),Diag(r,c,4,p));
|
||||
end %Results print
|
||||
%DBfile*******************************************
|
||||
%riseTm calc*****
|
||||
if isequal(opt,'DB')||isequal(opt,'Both')
|
||||
dbRsq= 0;dbKup= 0; dbKlo= 0; dbrup= 0; dbrlo= 0; dbLlo= 0; dbLup= 0;
|
||||
if isnumeric(outCmat(n,6)), dbRsq= outCmat(n,6);end
|
||||
if isnumeric(outCmat(n,7)), dbKup= outCmat(n,7);end
|
||||
if isnumeric(outCmat(n,8)), dbKlo= outCmat(n,8);end
|
||||
if isnumeric(outCmat(n,9)), dbrup= outCmat(n,9);end
|
||||
if isnumeric(outCmat(n,10)), dbrlo= outCmat(n,10);end
|
||||
if isnumeric(outCmat(n,11)), dbLlo= outCmat(n,11);end
|
||||
if isnumeric(outCmat(n,12)), dbLup= outCmat(n,12);end
|
||||
end
|
||||
|
||||
%****************
|
||||
if isequal(opt,'DB')||isequal(opt,'Both')
|
||||
fprintf(fid2,'%s\t %d\t %d\t %d\t %d\t %d\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t',expNm,s,p,r,c,n,selcode,drug,conc,media,mod1,conc1,mod2,conc2,orf,gene);
|
||||
fprintf(fid2, '%.5f\t %.5f\t %.5f\t %.5f\t %.5f\t %.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f',...
|
||||
outCmat(n,1),riseTm,outCmat(n,3),outCmat(n,4),...
|
||||
outCmat(n,5),dbRsq,dbKup,dbKlo,...
|
||||
dbrup,dbrlo,dbLlo,dbLup); %\t%.5f\t%.5f\t%.5f\t%.5f
|
||||
%... outCmat(n,13),outCmat(n,14),outCmat(n,15),outCmat(n,16));
|
||||
|
||||
end
|
||||
%*****DB analysis data end************************************************
|
||||
%Add Intensities series to end of curve fit data
|
||||
outIntens=[];
|
||||
outIntens=zeros(384,dataLength);
|
||||
intensBlob='';
|
||||
tmBlob ='';
|
||||
|
||||
for j=1:dataLength %size(RawIntens,2) %size(outTseries,1)
|
||||
if Ag(n)==0,Ag(n)=scan(s).Awindow;end
|
||||
outIntens(n,j)= RawIntens(n,j)/Ag(n);
|
||||
if isequal(opt,'Res')||isequal(opt,'Both')
|
||||
fprintf(fid, '\t%.5f', outIntens(n,j)); % Results print Intens
|
||||
end
|
||||
if isequal(opt,'DB')||isequal(opt,'Both')
|
||||
if j<dataLength
|
||||
intensBlob= strcat(intensBlob,num2str(outIntens(n,j)),';');
|
||||
else
|
||||
intensBlob= strcat(intensBlob,num2str(outIntens(n,j)));
|
||||
end
|
||||
if outTseries(j)<.0001,outTseries(j)=0;end
|
||||
if j<dataLength
|
||||
tmBlob= strcat(tmBlob,num2str(outTseries(j)),';');
|
||||
else
|
||||
tmBlob= strcat(tmBlob,num2str(outTseries(j)));
|
||||
end
|
||||
end %if DB
|
||||
end %j
|
||||
%***************************
|
||||
|
||||
|
||||
% Results fprint***********
|
||||
if isequal(opt,'Res')||isequal(opt,'Both')
|
||||
for nn=1:numBlkCol %extend to col beyond longest rawDataSet
|
||||
fprintf(fid, '\t');
|
||||
end
|
||||
|
||||
%-----------------------------------------------
|
||||
% UPDATE 14_0626 to writein ' ' if personnel fail to in their
|
||||
% Masterplate sheet
|
||||
if ~isnan(orfRep)
|
||||
fprintf(fid, '\t%s', orfRep); %print OrfRep
|
||||
else
|
||||
fprintf(fid, '\t%s', ' ');
|
||||
end
|
||||
if ~isnan(specifics)
|
||||
fprintf(fid, '\t%s', specifics);
|
||||
else
|
||||
fprintf(fid, '\t%s', ' ');
|
||||
end
|
||||
if ~isnan(strain)
|
||||
fprintf(fid, '\t%s', strain);
|
||||
else
|
||||
fprintf(fid, '\t%s', ' ');
|
||||
end
|
||||
%-----------------------------------------------
|
||||
%****************************
|
||||
fprintf(fid, '\n');
|
||||
ln=ln+1;
|
||||
fprintf(fid,'%d\t',ln);
|
||||
end
|
||||
%****************************
|
||||
%DB Raw Intensities and Timepoints
|
||||
if isequal(opt,'DB')||isequal(opt,'Both')
|
||||
fprintf(fid2, '\t%s\t%s',intensBlob,tmBlob );
|
||||
|
||||
%-------------------------------
|
||||
% UPDATE 14_0626 to writein ' ' if personnel fail to in their
|
||||
% Masterplate sheet
|
||||
if ~isnan(orfRep)
|
||||
fprintf(fid2, '\t%s',orfRep );
|
||||
else
|
||||
fprintf(fid2, '\t%s', ' ');
|
||||
end
|
||||
if ~isnan(specifics)
|
||||
fprintf(fid2, '\t%s',specifics );
|
||||
else
|
||||
fprintf(fid2, '\t%s', ' ');
|
||||
end
|
||||
if ~isnan(strain)
|
||||
fprintf(fid2, '\t%s',strain );
|
||||
else
|
||||
fprintf(fid2, '\t%s', ' ');
|
||||
end
|
||||
%---------------------------------
|
||||
fprintf(fid2, '\n');
|
||||
end %DB print
|
||||
end %if ~isempty(outCmat)
|
||||
|
||||
|
||||
end %c
|
||||
end %r
|
||||
end %p
|
||||
end %s
|
||||
|
||||
if isequal(opt,'Res')||isequal(opt,'Both')
|
||||
fclose(fid);
|
||||
end
|
||||
if isequal(opt,'DB')||isequal(opt,'Both')
|
||||
fclose(fid2);
|
||||
|
||||
try
|
||||
copyfile(DBfilename,DBupload)
|
||||
catch ME
|
||||
rep = getReport(ME, 'basic');
|
||||
rep=strcat('Failed copyfile to ',DBupload,' -', rep);
|
||||
errordlg(rep)
|
||||
end
|
||||
end %if DB
|
||||
ln;
|
||||
|
||||
catch
|
||||
errorNstdResults='Catch at line720 for printing ResultsStd'
|
||||
end %try scan(1).plate(1).CFoutStd(1,1) to test for 2018 r_refined version
|
||||
|
||||
cd(w)
|
||||
|
||||
scriptComplete= "line724 "
|
||||
msgbox(['Printing Script complete. Check !!Results sheets in ../PrintResults folder.'])
|
||||
BIN
workflow/templates/easy/EASYconsole.fig
Executable file
BIN
workflow/templates/easy/EASYconsole.fig
Executable file
Binary file not shown.
430
workflow/templates/easy/EASYconsole.m
Executable file
430
workflow/templates/easy/EASYconsole.m
Executable file
@@ -0,0 +1,430 @@
|
||||
% Launch the MATLAB EASY console
|
||||
|
||||
% From EstartConsole.m
|
||||
clear;
|
||||
clc;
|
||||
global openExpfile
|
||||
global openExppath
|
||||
global newExpfile
|
||||
global newExppath
|
||||
global SWnewExp
|
||||
global ExpOutmat
|
||||
global ExpPath
|
||||
global matDir
|
||||
global resDir
|
||||
global wCodeDir
|
||||
global fhconsole
|
||||
global ImParMat
|
||||
global scan
|
||||
|
||||
% Set working dir as the pwd
|
||||
wCodeDir=pwd
|
||||
|
||||
% Try to enter WCodeDir
|
||||
function returnHome
|
||||
global wCodeDir
|
||||
try
|
||||
cd(wCodeDir)
|
||||
catch
|
||||
msgbox('Failed to enter selected default directory so starting search at root.');
|
||||
if ispc
|
||||
cd(fullfile('C:\'));
|
||||
elseif (isunix | ismac)
|
||||
cd(fullfile('/mnt/data'));
|
||||
else
|
||||
msgbox('Unknown platform')
|
||||
end
|
||||
end
|
||||
|
||||
% Init
|
||||
function varargout = EASYconsole(varargin)
|
||||
% initialize global variables for function EASYconsole
|
||||
global ExpOutmat
|
||||
global ExpPath
|
||||
global fhconsole
|
||||
global resDir
|
||||
global wCodeDir
|
||||
global ImParMat
|
||||
|
||||
% changing directory to wCodeDir
|
||||
returnHome
|
||||
|
||||
%% GUI INTERFACE DESIGN %%
|
||||
% beginning of GUI formation & design, see help GUI or help GUIDE in
|
||||
% command window for more information
|
||||
gui_Singleton = 1;
|
||||
gui_State = struct('gui_Name', mfilename, ...
|
||||
'gui_Singleton', gui_Singleton, ...
|
||||
'gui_OpeningFcn', @EASYconsole_OpeningFcn, ...
|
||||
'gui_OutputFcn', @EASYconsole_OutputFcn, ...
|
||||
'gui_LayoutFcn', [] , ...
|
||||
'gui_Callback', []);
|
||||
if nargin && ischar(varargin{1})
|
||||
gui_State.gui_Callback = str2func(varargin{1});
|
||||
end
|
||||
|
||||
if nargout
|
||||
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
|
||||
else
|
||||
gui_mainfcn(gui_State, varargin{:});
|
||||
end
|
||||
|
||||
% GUI
|
||||
% Easyconcole_OpeningFcn executes just before the EASYconsole GUI is made visible.
|
||||
% This function has no output args, see OutputFcn.
|
||||
% hObject--handle to figure
|
||||
% eventdata reserved - to be defined in a future version of MATLAB
|
||||
% handles--structure with handles and user data (see GUIDATA)
|
||||
% varargin--input arguments to EASYconsole (see VARARGIN)
|
||||
function EASYconsole_OpeningFcn(hObject, ~, handles, varargin)
|
||||
|
||||
global ExpOutmat
|
||||
global ExpPath
|
||||
global fhconsole
|
||||
global resDir
|
||||
global wCodeDir
|
||||
global ImParMat
|
||||
|
||||
% Choose default command line output for EASYconsole
|
||||
handles.output = hObject;
|
||||
|
||||
% Update handles structure
|
||||
guidata(hObject, handles);
|
||||
|
||||
%Figure header, Toolbar, etc. Setup
|
||||
fhconsole=gcf;
|
||||
set(fhconsole,'Toolbar','none');
|
||||
fhconsole=gcf;
|
||||
|
||||
if exist('resDir','var')&&~isempty(resDir)
|
||||
set(fhconsole,'Name',strcat('EASYconsole- ',char(resDir)));
|
||||
else
|
||||
set(fhconsole,'Name','EASYconsole -Exp. Analysis NOT selected.')
|
||||
end
|
||||
|
||||
% Output
|
||||
% Outputs from this function are returned to the command line.
|
||||
% varargout--cell array for returning output args (see VARARGOUT);
|
||||
% hObject--handle to figure
|
||||
% eventdata reserved - to be defined in a future version of MATLAB
|
||||
% handles--structure with handles and user data (see GUIDATA)
|
||||
function varargout = EASYconsole_OutputFcn(~, ~, handles)
|
||||
% Get default command line output from handles structure
|
||||
varargout{1} = handles.output;
|
||||
|
||||
%% CONSOLE BUTTON INTERFACES %%
|
||||
% File Button Interface
|
||||
function FileMenu_Callback(~, ~, ~)
|
||||
returnHome
|
||||
|
||||
% Load Experiment Button Interface
|
||||
function LoadExp_Callback(~, ~, ~)
|
||||
returnHome
|
||||
|
||||
% New Experiment Button Interface
|
||||
function NewExpDat_Callback(~, ~, ~)
|
||||
global newExpfile
|
||||
global newExppath
|
||||
global SWnewExp
|
||||
global ExpOutmat
|
||||
global ExpPath
|
||||
global matDir
|
||||
global resDir
|
||||
global wCodeDir
|
||||
global fhconsole
|
||||
global scan
|
||||
|
||||
% CREATE NEW EXPERIMENT %
|
||||
try
|
||||
questdlg('\fontsize{20} NAME the file and NAVIGATE to the directory with the image folders.','File Creation','OK', struct('Default','OK','Interpreter','tex'));
|
||||
[newExpfile,newExppath] = uiputfile(' .mat');
|
||||
SWnewExp=1;
|
||||
returnHome
|
||||
newExpfilePref= strrep(newExpfile,'.mat','');
|
||||
resDirName=strcat('Results',datestr(now,29),newExpfilePref);
|
||||
|
||||
% creation of the Results file
|
||||
if ~exist(fullfile(newExppath,resDirName,'matResults'))
|
||||
mkdir (fullfile(newExppath,resDirName,'matResults'));
|
||||
end
|
||||
|
||||
% assigning paths to global variables
|
||||
resDir= fullfile(newExppath,resDirName);
|
||||
matDir= fullfile(newExppath,resDirName,'matResults');
|
||||
ExpOutmat=fullfile(matDir,strcat(datestr(now,29),newExpfile));
|
||||
ExpPath= fullfile(newExppath);
|
||||
|
||||
% Added for 'parfor global' to preallocate 'scan' structure 20-0123
|
||||
nlist=dir(fullfile(ExpPath,'*'));
|
||||
nnn=0;
|
||||
for n=1:size(nlist,1)
|
||||
if (~isempty(str2num(nlist(n).name)))
|
||||
nnn=nnn+1;
|
||||
PnumLst(nnn)= (str2num(nlist(n).name));
|
||||
sl(nnn,1)={(nlist(n).name)};
|
||||
end
|
||||
end
|
||||
scanSize= size(sl,1);
|
||||
scanMax= max(str2double(sl));
|
||||
clear scan;
|
||||
scan(scanMax)= struct(); %changed for parfor global 20_0118
|
||||
save(ExpOutmat,'scan')
|
||||
|
||||
% create 'PrintResults' file
|
||||
if ~exist(fullfile(ExpPath,resDirName,'PrintResults'))
|
||||
mkdir(fullfile(ExpPath,resDirName,'PrintResults'));
|
||||
end
|
||||
% copy 'figs' file and place it in ExpPath Directory
|
||||
if ~exist(fullfile(ExpPath,resDirName,'figs'))
|
||||
copyfile((fullfile(wCodeDir,'figs')), (fullfile(ExpPath,resDirName,'figs')))
|
||||
end
|
||||
% create 'CFfigs' file
|
||||
if ~exist(fullfile(ExpPath,resDirName,'CFfigs'))
|
||||
mkdir(fullfile(ExpPath,resDirName,'CFfigs'));
|
||||
end
|
||||
% copy 'PTmats' file and place it in ExpPath Directory
|
||||
if ~exist(fullfile(ExpPath,resDirName,'PTmats'))
|
||||
copyfile((fullfile(wCodeDir,'PTmats')), (fullfile(ExpPath,resDirName,'PTmats')))
|
||||
end
|
||||
% create 'Fotos' file
|
||||
if ~exist(fullfile(ExpPath,resDirName,'Fotos'))
|
||||
mkdir(fullfile(ExpPath,resDirName,'Fotos'));
|
||||
clear sbdg % reduce possible retention of a previous job sdbg
|
||||
sbdg= cell(1,scanMax);
|
||||
save((fullfile(resDir,'Fotos','Nbdg')),'sbdg');
|
||||
end
|
||||
% create backup 'Fotos' file
|
||||
if ~exist(fullfile(ExpPath,resDirName,'Fotos','BkUp'))
|
||||
mkdir(fullfile(ExpPath,resDirName,'Fotos','BkUp'));
|
||||
end
|
||||
|
||||
catch ME
|
||||
returnHome
|
||||
disp('Error Creating a New Experiment. Loc: EASYconsole.m Lines 106-197')
|
||||
end
|
||||
|
||||
% set the title for fhconsole depending on existence
|
||||
if exist('resDir','var')&&~isempty(resDir)
|
||||
set(fhconsole,'Name',strcat('EASYconsole- ',char(resDir)))
|
||||
else
|
||||
set(fhconsole,'Name','EASYconsole -Exp. Analysis NOT selected.')
|
||||
end
|
||||
|
||||
|
||||
% Load a previous experiment
|
||||
% Load Experiment Analysis directory/file structure
|
||||
function LoadDatFile_Callback(~, ~, ~)
|
||||
global openExpfile
|
||||
global openExppath
|
||||
global SWnewExp
|
||||
global ExpOutmat
|
||||
global ExpPath
|
||||
global matDir
|
||||
global resDir
|
||||
global wCodeDir
|
||||
global fhconsole
|
||||
global ImParMat
|
||||
|
||||
returnHome
|
||||
|
||||
questdlg('\fontsize{20} Load file from ExpJobs/YourJob/YourResults/matResults','File Creation','OK', struct('Default','OK','Interpreter','tex'));
|
||||
[openExpfile,openExppath] = uigetfile('.mat','Open Experiment folder and data storage .mat file name','MultiSelect','off');
|
||||
SWnewExp=0;
|
||||
|
||||
ExpOutmat= fullfile(openExppath,openExpfile);
|
||||
load(ExpOutmat);
|
||||
|
||||
cd(openExppath)
|
||||
cd ..;
|
||||
resDir=pwd;
|
||||
cd ..;
|
||||
ExpPath=pwd;
|
||||
cd (wCodeDir)
|
||||
ExpPath= fullfile(ExpPath);
|
||||
|
||||
|
||||
|
||||
if isfolder(fullfile(openExppath, '..','..','1')) %If Inovation Vrobot Then
|
||||
if exist(fullfile(resDir,'PTmats','NImParameters.mat'))
|
||||
load(fullfile(resDir,'PTmats','NImParameters.mat'));
|
||||
else
|
||||
curDir=pwd;
|
||||
returnHome
|
||||
load NImParameters.mat
|
||||
cd(curDir)
|
||||
end
|
||||
else %If Epson 10Plate Scans Then>
|
||||
if exist(fullfile(resDir,'PTmats','ImParameters.mat'))
|
||||
load(fullfile(resDir,'PTmats','ImParameters.mat'));
|
||||
else
|
||||
curDir=pwd;
|
||||
returnHome
|
||||
load ImParameters.mat
|
||||
cd(curDir)
|
||||
end
|
||||
end
|
||||
|
||||
matDir= fullfile(openExppath,'\');
|
||||
mkdir(fullfile(matDir,'BkUp'));
|
||||
|
||||
% create supporting files
|
||||
if ~exist(fullfile(resDir,'PrintResults'))
|
||||
mkdir(fullfile(resDir,'PrintResults'));
|
||||
end
|
||||
if ~exist(fullfile(resDir,'figs'))
|
||||
mkdir(fullfile(resDir,'figs'));
|
||||
end
|
||||
if ~exist(fullfile(resDir,'CFfigs'))
|
||||
mkdir(fullfile(resDir,'CFfigs'));
|
||||
end
|
||||
if ~exist(fullfile(resDir,'PTmats'))
|
||||
mkdir(fullfile(resDir,'PTmats'));
|
||||
end
|
||||
if ~exist(fullfile(resDir,'Fotos'))
|
||||
mkdir(fullfile(resDir,'Fotos'));
|
||||
end
|
||||
|
||||
catch
|
||||
returnHome
|
||||
end
|
||||
clear scan
|
||||
|
||||
if exist('resDir','var')&&~isempty(resDir)
|
||||
fhconsole= gcf;
|
||||
set(fhconsole,'Name',strcat('EASYconsole- ',char(resDir)))
|
||||
else
|
||||
set(fhconsole,'Name','EASYconsole -Exp. Analysis NOT selected.')
|
||||
end
|
||||
|
||||
%% CALLBACKS %%
|
||||
% callback for the 'Run' in the dropdown menu
|
||||
function run_Callback(~, ~, ~)
|
||||
returnHome
|
||||
|
||||
function runPlateMapPintool_Callback(~, ~, ~)
|
||||
returnHome
|
||||
try
|
||||
NImapPT
|
||||
catch ME
|
||||
returnHome
|
||||
EASYconsole
|
||||
end
|
||||
|
||||
function NImCFcombo_Callback(~, ~, ~)
|
||||
returnHome
|
||||
try
|
||||
par4Gbl_Main8c
|
||||
catch
|
||||
returnHome
|
||||
EASYconsole
|
||||
end
|
||||
|
||||
function runPlateImAnal_Callback(~, ~, ~)
|
||||
returnHome
|
||||
try
|
||||
NImStartupOnly
|
||||
catch ME
|
||||
returnHome
|
||||
EASYconsole
|
||||
end
|
||||
|
||||
function PlateCFit_Callback(~, ~, ~)
|
||||
returnHome
|
||||
try
|
||||
NCstart
|
||||
catch ME
|
||||
returnHome
|
||||
end
|
||||
|
||||
function GenPrintouts_Callback(~, ~, ~)
|
||||
|
||||
function uploadExcelMP2DB_Callback(~, ~, ~)
|
||||
|
||||
function runDMPexcel_Callback(~, ~, ~)
|
||||
try
|
||||
DMPexcel2mat
|
||||
catch ME
|
||||
returnHome
|
||||
EASYconsole
|
||||
end
|
||||
|
||||
function runResults_DBcombo_Callback(~, ~, ~)
|
||||
try
|
||||
DgenResults %similar but semicolons removed to restore so cmdLine display info.
|
||||
%DgenResults %par4global -convert 1x1cell of 384cells to be like previous 1x384 cells CFparameter
|
||||
catch ME
|
||||
disp('Error in DgenResults')
|
||||
returnHome
|
||||
EASYconsole
|
||||
end
|
||||
|
||||
function Tools_Callback(~, ~, ~)
|
||||
|
||||
function runOverlayPlots_Callback(~, ~, ~)
|
||||
returnHome
|
||||
try
|
||||
DoverlayPlots2
|
||||
returnHome
|
||||
EASYconsole
|
||||
catch ME
|
||||
returnHome
|
||||
EASYconsole
|
||||
end
|
||||
|
||||
function runFotoStrip_Callback(~, ~, ~)
|
||||
returnHome
|
||||
try
|
||||
F_NImStartup_CentCir
|
||||
returnHome
|
||||
EASYconsole
|
||||
catch ME
|
||||
returnHome
|
||||
EASYconsole
|
||||
end
|
||||
|
||||
function runDisplayFig_Callback(~, ~, ~)
|
||||
returnHome
|
||||
try
|
||||
UfigDisplay
|
||||
catch ME
|
||||
returnHome
|
||||
EASYconsole
|
||||
end
|
||||
|
||||
function runViewParameters_Callback(~, ~, ~)
|
||||
returnHome
|
||||
try
|
||||
% This was blank in original
|
||||
catch ME
|
||||
returnHome
|
||||
EASYconsole
|
||||
end
|
||||
|
||||
function QkviewN_Callback(~, ~, ~)
|
||||
global ExpPath
|
||||
returnHome
|
||||
try
|
||||
try
|
||||
cd fullfile(ExpPath)
|
||||
catch
|
||||
if ispc cd c:\
|
||||
else
|
||||
cd (fullfile('~'));
|
||||
end
|
||||
end
|
||||
QkviewImages
|
||||
catch ME
|
||||
returnHome
|
||||
EASYconsole
|
||||
end
|
||||
|
||||
function CFdisplay_Callback(~, ~, ~)
|
||||
returnHome
|
||||
try
|
||||
NCsingleDisplay
|
||||
returnHome
|
||||
EASYconsole
|
||||
catch ME
|
||||
returnHome
|
||||
EASYconsole
|
||||
end
|
||||
497
workflow/templates/easy/NCdisplayGui.m
Executable file
497
workflow/templates/easy/NCdisplayGui.m
Executable file
@@ -0,0 +1,497 @@
|
||||
%% CALLED WHEN ACCESSING 'CurveFit Display' %%
|
||||
function [scLst, row, col] = NCdisplayGui(eDir) %(ExpPath)
|
||||
%global ExpPath
|
||||
%global expDir
|
||||
|
||||
xPos=0.05;
|
||||
btnWid=0.10;
|
||||
btnHt=0.05;
|
||||
spacing=0.02;% Spacing between the button and the next command's label
|
||||
|
||||
%hSpot= figure;
|
||||
%figure
|
||||
%====================================
|
||||
% The ADD Groups button
|
||||
btnNumber=1;
|
||||
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
|
||||
btnPos=[xPos yPos-spacing btnWid btnHt];
|
||||
%
|
||||
row=1;
|
||||
hedit = uicontrol(...
|
||||
'Style', 'edit',...
|
||||
'String',row,...
|
||||
'Units','normalized',...
|
||||
'Position', btnPos,... % [.002 .70 .08 .10],...
|
||||
'callback',{@editRowNum}); % 'Position', [5 100 60 20])
|
||||
|
||||
function editRowNum(source,~)
|
||||
user_entry = str2double(get(source,'string'));
|
||||
if (isnan(user_entry)||(user_entry<0)||(user_entry>17) )
|
||||
errordlg('Enter a Row between 1 and 16','Bad Input','modal')
|
||||
return
|
||||
end
|
||||
row= user_entry;
|
||||
|
||||
end
|
||||
%-------------------222222-----------
|
||||
%
|
||||
btnNumber=2;
|
||||
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
|
||||
btnPos=[xPos yPos-spacing btnWid btnHt];
|
||||
|
||||
|
||||
col= 1;
|
||||
hedit = uicontrol(...
|
||||
'Style', 'edit',...
|
||||
'String',col,...
|
||||
'Units','normalized',...
|
||||
'Position', btnPos,... % [.002 .70 .08 .10],...
|
||||
'callback',{@entryColNum}); % 'Position', [5 100 60 20])
|
||||
|
||||
function entryColNum(source,~)
|
||||
user_entry = str2double(get(source,'string'));
|
||||
if (isnan(user_entry)||(user_entry<0)||(user_entry>25))
|
||||
errordlg('Enter a Column between 1 and 24','Bad Input','modal')
|
||||
return
|
||||
end
|
||||
col= user_entry;
|
||||
|
||||
end
|
||||
%}
|
||||
|
||||
%*************************************************************
|
||||
|
||||
%Ncode 12_0120 for reading in numeric folder names
|
||||
nlist=dir(fullfile(eDir,'*')); %(ExpPath,'*'));
|
||||
nnn=0;
|
||||
for n=1:size(nlist,1)
|
||||
if (~isempty(str2num(nlist(n).name)))
|
||||
nnn=nnn+1;
|
||||
PnumLst(nnn)= (str2num(nlist(n).name));
|
||||
slst(nnn,1)={(nlist(n).name)};
|
||||
end
|
||||
end
|
||||
|
||||
hListbox = uicontrol(...
|
||||
'Style', 'listbox',...
|
||||
'String',sort(slst),...
|
||||
'value',[],...
|
||||
'max',1000,...
|
||||
'min',1,...
|
||||
'Units','normalized',...
|
||||
'Position', [.40 .40 .10 .60],...
|
||||
'callback',{@load_listbox}); %'uiresume(gcbf)'); 'Position', [5 100 60 20])
|
||||
|
||||
function load_listbox(source,~)
|
||||
userIndx = (get(source,'value'));
|
||||
userStr = (get(source,'string'));
|
||||
%scLstIndx= str2num(char(strrep(userStr(userIndx), 'Scan', '')))
|
||||
|
||||
user_entry=userStr(userIndx);
|
||||
scLst= user_entry;
|
||||
end
|
||||
|
||||
%*****************************************************************
|
||||
%-------------------10 10 10 10-----------
|
||||
|
||||
btnNumber=10;
|
||||
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
|
||||
btnPos=[xPos yPos-spacing btnWid btnHt];
|
||||
|
||||
hedit8 = uicontrol(...
|
||||
'Style', 'pushbutton',...
|
||||
'String',{'Continue'},...
|
||||
'Units','normalized',...
|
||||
'Position', btnPos,...
|
||||
'callback','uiresume(gcbf)');
|
||||
|
||||
|
||||
%------------------------------
|
||||
|
||||
%***************************************************************
|
||||
% {
|
||||
%********LABELS******************************
|
||||
% The Labels
|
||||
xLPos=0.175;
|
||||
yPos=0;
|
||||
btnWid=0.20;
|
||||
|
||||
|
||||
% Removed Not needed for Ncode ImRobot
|
||||
lblNumber=1;
|
||||
yPos=0.85-(lblNumber-1)*(btnHt+spacing);
|
||||
btnPos=[xLPos yPos-spacing btnWid btnHt];
|
||||
|
||||
htxt = uicontrol(...
|
||||
'Style', 'text',...
|
||||
'String','Row',...
|
||||
'Units','normalized',...
|
||||
'Position', btnPos);
|
||||
%-------------------222222-----------
|
||||
lblNumber=2;
|
||||
yPos=0.85-(lblNumber-1)*(btnHt+spacing);
|
||||
btnPos=[xLPos yPos-spacing btnWid btnHt];
|
||||
|
||||
htxt = uicontrol(...
|
||||
'Style', 'text',...
|
||||
'String','Column',...
|
||||
'Units','normalized',...
|
||||
'Position', btnPos);
|
||||
% Not needed for Ncode ImRobot
|
||||
|
||||
uiwait(gcf);
|
||||
end %function end $$$$$
|
||||
%}
|
||||
%{
|
||||
%-------------------333333-----------
|
||||
|
||||
lblNumber=3;
|
||||
yPos=0.85-(lblNumber-1)*(btnHt+spacing);
|
||||
btnPos=[xLPos yPos-spacing btnWid btnHt];
|
||||
|
||||
htxt = uicontrol(...
|
||||
'Style', 'text',...
|
||||
'String','BG Threshold (%above) Detection',...
|
||||
'Units','normalized',...
|
||||
'Position', btnPos);
|
||||
|
||||
%-------------------4-----------
|
||||
|
||||
lblNumber=4;
|
||||
yPos=0.85-(lblNumber-1)*(btnHt+spacing);
|
||||
btnPos=[xLPos yPos-spacing btnWid btnHt];
|
||||
|
||||
htxt = uicontrol(...
|
||||
'Style', 'text',...
|
||||
'String','SpotDetThres(1-60%)',...
|
||||
'Units','normalized',...
|
||||
'Position', btnPos);
|
||||
|
||||
%-------------------55555-----------
|
||||
lblNumber=5;
|
||||
yPos=0.85-(lblNumber-1)*(btnHt+spacing);
|
||||
btnPos=[xLPos yPos-spacing btnWid btnHt];
|
||||
|
||||
htxt = uicontrol(...
|
||||
'Style', 'text',...
|
||||
'String','Radius',... %'String','Width',...
|
||||
'Units','normalized',...
|
||||
'Position', btnPos);
|
||||
%-------------------66666-----------
|
||||
lblNumber=6;
|
||||
yPos=0.85-(lblNumber-1)*(btnHt+spacing);
|
||||
btnPos=[xLPos yPos-spacing btnWid btnHt];
|
||||
|
||||
htxt = uicontrol(...
|
||||
'Style', 'text',...
|
||||
'String','Dither',...
|
||||
'Units','normalized',...
|
||||
'Position', btnPos);
|
||||
%-------------------77777-----------
|
||||
|
||||
lblNumber=7;
|
||||
yPos=0.85-(lblNumber-1)*(btnHt+spacing);
|
||||
btnPos=[xLPos yPos-spacing btnWid btnHt];
|
||||
|
||||
htxt = uicontrol(...
|
||||
'Style', 'text',...
|
||||
'String','SearchRange',...
|
||||
'Units','normalized',...
|
||||
'Position', btnPos);
|
||||
|
||||
%-------------------88888-----------
|
||||
%{
|
||||
lblNumber=8;
|
||||
yPos=0.85-(lblNumber-1)*(btnHt+spacing);
|
||||
btnPos=[xLPos yPos-spacing btnWid btnHt];
|
||||
|
||||
htxt = uicontrol(...
|
||||
'Style', 'text',...
|
||||
'String','Blank2',...
|
||||
'Units','normalized',...
|
||||
'Position', btnPos);
|
||||
%----------------------------------------
|
||||
%}
|
||||
%}
|
||||
|
||||
|
||||
|
||||
%{
|
||||
|
||||
|
||||
%-------------------66666-----------
|
||||
btnNumber=6;
|
||||
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
|
||||
btnPos=[xPos yPos-spacing btnWid btnHt];
|
||||
srcExtendFactor=ImParMat(7);
|
||||
hedit = uicontrol(...
|
||||
'Style', 'edit',...
|
||||
'String',srcLoIntensThres,...
|
||||
'Units','normalized',...
|
||||
'Position', btnPos,...
|
||||
'callback',{@entryExtendFactor});
|
||||
|
||||
function entryExtendFactor(source,eventdata)
|
||||
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
|
||||
end
|
||||
ExtendFactor=user_entry
|
||||
ImParMat(7)= ExtendFactor
|
||||
ExtendFactor
|
||||
end
|
||||
%}
|
||||
|
||||
|
||||
%{
|
||||
%-------------------333333-----------
|
||||
|
||||
btnNumber=3;
|
||||
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
|
||||
btnPos=[xPos yPos-spacing btnWid btnHt];
|
||||
srcBGthreshold=ImParMat(3);
|
||||
hedit = uicontrol(...
|
||||
'Style', 'edit',...
|
||||
'String',srcBGthreshold,...
|
||||
'Units','normalized',...
|
||||
'Position', btnPos,... % [.002 .70 .08 .10],...
|
||||
'callback',{@entryBGthreshold}); % 'Position', [5 100 60 20])
|
||||
|
||||
function entryBGthreshold(source,eventdata)
|
||||
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
|
||||
end
|
||||
BGthresInput=user_entry
|
||||
ImParMat(3)= BGthresInput
|
||||
BGthresInput
|
||||
end
|
||||
|
||||
%-------------------444444-----------
|
||||
|
||||
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(...
|
||||
'Style', 'edit',...
|
||||
'String',srcSpotThres,...
|
||||
'Units','normalized',...
|
||||
'Position', btnPos,...
|
||||
'callback',{@entrySpotThres});
|
||||
|
||||
function entrySpotThres(source,eventdata)
|
||||
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
|
||||
end
|
||||
spotThres=user_entry
|
||||
ImParMat(4)= spotThres
|
||||
spotThres
|
||||
end
|
||||
%
|
||||
%---------555555 Radius Entry After Sept.2014---------------------------------**
|
||||
|
||||
btnNumber=5;
|
||||
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
|
||||
btnPos=[xPos yPos-spacing btnWid btnHt];
|
||||
srcRadius=ImParMat(10);
|
||||
hedit = uicontrol(...
|
||||
'Style', 'edit',...
|
||||
'String',srcRadius,...
|
||||
'Units','normalized',...
|
||||
'Position', btnPos,... % [.002 .70 .08 .10],...
|
||||
'callback',{@entryRadius}); % 'Position', [5 100 60 20])
|
||||
|
||||
function entryRadius(source,eventdata)
|
||||
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
|
||||
end
|
||||
Radius=user_entry
|
||||
ImParMat(10)= Radius
|
||||
Radius
|
||||
end
|
||||
|
||||
%---------555555 Width Entry prior the Sept.2014---------------------------------**
|
||||
%{
|
||||
btnNumber=5;
|
||||
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
|
||||
btnPos=[xPos yPos-spacing btnWid btnHt];
|
||||
srcWidth=ImParMat(5);
|
||||
hedit = uicontrol(...
|
||||
'Style', 'edit',...
|
||||
'String',srcWidth,...
|
||||
'Units','normalized',...
|
||||
'Position', btnPos,... % [.002 .70 .08 .10],...
|
||||
'callback',{@entryWidth}); % 'Position', [5 100 60 20])
|
||||
|
||||
function entryWidth(source,eventdata)
|
||||
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
|
||||
end
|
||||
Width=user_entry
|
||||
ImParMat(5)= Width
|
||||
Width
|
||||
end
|
||||
%}
|
||||
%-------------------66666 Dither unnecessary after Sept.2014-----------
|
||||
|
||||
btnNumber=6;
|
||||
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
|
||||
btnPos=[xPos yPos-spacing btnWid btnHt];
|
||||
srcDither= ImParMat(6);
|
||||
hedit = uicontrol(...
|
||||
'Style', 'edit',...
|
||||
'String',srcDither,...
|
||||
'Units','normalized',...
|
||||
'Position', btnPos,...
|
||||
'callback',{@entryDither});
|
||||
|
||||
function entryDither(source,eventdata)
|
||||
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
|
||||
end
|
||||
Dither=user_entry
|
||||
ImParMat(6)= Dither
|
||||
Dither
|
||||
end
|
||||
%-------------------77777----------- Added July 7,2015 to allow Search Range constraint
|
||||
btnNumber=7;
|
||||
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
|
||||
btnPos=[xPos yPos-spacing btnWid btnHt];
|
||||
try
|
||||
CSrchRange=ImParMat(12);
|
||||
CSrchRng=ImParMat(12)
|
||||
catch %Legacy default value was 18 before being made a user input variable (ImParMat(12)). A preferable value now might be 12 or 14.
|
||||
CSrchRange=18;
|
||||
ImParMat(12)=18
|
||||
CSrchRng=ImParMat(12)
|
||||
end
|
||||
|
||||
%{
|
||||
if size(scLst)>1
|
||||
CSrchRange=ImParMat(12);
|
||||
else
|
||||
try
|
||||
CSrchRange=CSearchRange(str2double(scLst))
|
||||
catch
|
||||
CSrchRange=ImParMat(12);
|
||||
end
|
||||
end
|
||||
%}
|
||||
hSearchRange = uicontrol(...
|
||||
'Style', 'edit',...
|
||||
'String',CSrchRange,...
|
||||
'Units','normalized',...
|
||||
'Position', btnPos,...
|
||||
'callback',{@CsearchRange});
|
||||
|
||||
function CsearchRange(source,eventdata)
|
||||
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
|
||||
end
|
||||
CSrchRng=user_entry
|
||||
|
||||
end
|
||||
|
||||
%-------------------77777-----------
|
||||
%{
|
||||
btnNumber=7;
|
||||
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
|
||||
btnPos=[xPos yPos-spacing btnWid btnHt];
|
||||
srcExtend=ImParMat(7);
|
||||
|
||||
hedit = uicontrol(...
|
||||
'Style', 'edit',...
|
||||
'String',srcExtend,...
|
||||
'Units','normalized',...
|
||||
'Position', btnPos,...
|
||||
'callback',{@entryExtend});
|
||||
|
||||
function entryExtend(source,eventdata)
|
||||
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
|
||||
end
|
||||
extend=user_entry
|
||||
ImParMat(7)= extend
|
||||
extend
|
||||
end
|
||||
%-------------------888888-----------
|
||||
|
||||
btnNumber=8;
|
||||
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
|
||||
btnPos=[xPos yPos-spacing btnWid btnHt];
|
||||
%ImParMat(8)=1;
|
||||
srcpointExtend=ImParMat(8);
|
||||
hedit = uicontrol(...
|
||||
'Style', 'edit',...
|
||||
'String',srcpointExtend,...
|
||||
'Units','normalized',...
|
||||
'Position', btnPos,...
|
||||
'callback',{@entrypointExtend});
|
||||
|
||||
function entrypointExtend(source,eventdata)
|
||||
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')
|
||||
return
|
||||
end
|
||||
pointExtend=user_entry
|
||||
ImParMat(8)= pointExtend
|
||||
pointExtend
|
||||
end
|
||||
%}
|
||||
%-------------------999999-----------
|
||||
|
||||
btnNumber=9;
|
||||
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
|
||||
btnPos=[xPos yPos-spacing btnWid btnHt];
|
||||
|
||||
hedit = uicontrol(...
|
||||
'Style', 'popupmenu',...
|
||||
'String',{'GrowthArea','FixedArea'},...
|
||||
'Units','normalized',...
|
||||
'Position', btnPos,...
|
||||
'callback',{@grwArea});
|
||||
|
||||
function grwArea(source,eventdata)
|
||||
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
|
||||
case 'FixedArea' % User selects Membrane.
|
||||
SWgrowthArea = 0
|
||||
end
|
||||
end
|
||||
%}
|
||||
%global SWsingleSc
|
||||
%global SWgrowthArea
|
||||
%global selScan
|
||||
%global scan
|
||||
%global scLst
|
||||
%global ImParMat
|
||||
%global CSearchRange
|
||||
%global CSrchRng
|
||||
%global defImParMat
|
||||
%global fhImRun
|
||||
%global fhconsole
|
||||
%global resDir
|
||||
%global ExpOutmat
|
||||
%global numRows;
|
||||
%global numCols;
|
||||
275
workflow/templates/easy/NCfitImCFparforFailGbl2.m
Executable file
275
workflow/templates/easy/NCfitImCFparforFailGbl2.m
Executable file
@@ -0,0 +1,275 @@
|
||||
%% CALLED BY par4GblFnc8c.m %%
|
||||
function [par4scanselIntensStd,par4scanselTimesStd,par4scanTimesELr,par4scanIntensELr,par4scanCFparameters,par4scanCFdate,outC,outCstd]= ...
|
||||
NCfitImCFparforFailGbl2(parMat,times, values, timeOffsets, fileSuffix, AUCfinalTime, ~, spotAreas, outputDirectory, ~,~, sols, ~) %,scan)
|
||||
|
||||
|
||||
%Preallocation for parfor loop**********************************
|
||||
st(1,1:size(times,2))= 1111;
|
||||
resMat(1,1:27)= 0;
|
||||
resMatStd= resMat;
|
||||
outC= zeros(384,27);
|
||||
outCstd= zeros(384,27);
|
||||
for m=1:384
|
||||
pa{m}= st;
|
||||
|
||||
par4scanCFparameters{m}= parMat;
|
||||
par4scanCFdate{m}= datestr((now),31);
|
||||
end
|
||||
par4scanselTimesStd= pa;
|
||||
par4scanselIntensStd= pa;
|
||||
par4scanTimesELr= pa;
|
||||
par4scanIntensELr= pa;
|
||||
par4resMat= zeros(384,27);
|
||||
par4resMatStd= zeros(384,27);
|
||||
%****************************************************************
|
||||
|
||||
%*****************Begin the Spot(cultures) loop****************************
|
||||
for ii= 1:384 %startSpot:numCultures
|
||||
%parfor ii= 1:384 %startSpot:numCultures
|
||||
ii; %%%db print out the culture number
|
||||
|
||||
timepts= [];
|
||||
currValues=[];
|
||||
currSpotAreas=[];
|
||||
currSpotArea=[];
|
||||
|
||||
dataMatrix=[];
|
||||
selTimesStd=[]; %191024 parfor
|
||||
selIntensStd=[]; %191024 parfor
|
||||
FiltTimesELr=[]; %191024 parfor
|
||||
NormIntensELr=[]; %191024 parfor
|
||||
|
||||
% add offset...1 offset PER PLATE
|
||||
timepts = times + timeOffsets; %(floor((ii-1)/arrayFormat) + 1);
|
||||
currValues = values(ii,:); %change values(spotNum,:);
|
||||
% get spot areas for this culture
|
||||
currSpotArea = spotAreas(:,ii);
|
||||
|
||||
% just use the area at the last time point
|
||||
%currSpotArea = currSpotAreas(1);
|
||||
|
||||
%--------------------------------------------------------------
|
||||
|
||||
%Preallocate to accomodate parfor loop **************************
|
||||
resMatStd= zeros(1,27);
|
||||
resMat= zeros(1,27);
|
||||
currNormIntens = currValues/currSpotArea;
|
||||
tmpx=find(currNormIntens>5); %15jh % 2.3);
|
||||
validSpot=true;
|
||||
if(isempty(tmpx) || (length(tmpx)<3))
|
||||
validSpot= false;
|
||||
normIntens= currNormIntens;
|
||||
filterTimes= timepts; %filterTimes; %currTimes;
|
||||
|
||||
selTimesStd= timepts;
|
||||
selIntensStd= currNormIntens;
|
||||
FiltTimesELr= timepts;
|
||||
NormIntensELr= currNormIntens;
|
||||
|
||||
else
|
||||
|
||||
%*******************************************************
|
||||
%NCfilImCF
|
||||
%NCfilImCF.m called from NCfitImCF.m line 119*******************
|
||||
%Preallocate incase something bails in NCscurImCFparfor
|
||||
resMatStd= zeros(1,27);
|
||||
resMat= zeros(1,27);
|
||||
|
||||
hold off %09_0704
|
||||
dataMatrix=[];
|
||||
K=0;r=0;l=0;Klow=0;Kup=0;rlow=0;rup=0;llow=0;lup=0;AUC=0;MSR=0; rsquare=0;
|
||||
bl=0;
|
||||
Tpt1=0; numFitTpts =0;thresGT2=0;minTime=0;fitbl=0; %diagnostic outputs only
|
||||
|
||||
timepts= timepts; %timepts= currTimes; parfor
|
||||
normIntens= currNormIntens;
|
||||
|
||||
dataMatrix= []; %parfor move clear from NCfitImCF...m
|
||||
loIntensThres=parMat(4);
|
||||
stdLoIntLim=parMat(5);
|
||||
|
||||
%******Begin basic filter**********
|
||||
%[loInten Thres,stdbased Trim before Scurve start, and dropout detection]
|
||||
if(max(normIntens) > 2.29)
|
||||
threshold = loIntensThres; %1.9; %Increase this value to reduce low data point (flag=2)
|
||||
else
|
||||
threshold = 0;
|
||||
end
|
||||
|
||||
dropThreshold= -0.0001* max(normIntens);
|
||||
%Initialize dataMatrix**********************************
|
||||
dataMatrix(1,:)=timepts;
|
||||
dataMatrix(2,:)=normIntens;
|
||||
dataMatrix(3,:)= ones;
|
||||
dataMatrix(4,:)=normIntens;
|
||||
|
||||
%Determine a mean Intensity Index point and assoc'd TimePt
|
||||
a= min(normIntens(normIntens>=0)); %(find(normIntens>=0)));
|
||||
b= max(normIntens(normIntens>=0)); %(find(normIntens>=0)));
|
||||
c= 0.5*(b-a);
|
||||
d= b-c;
|
||||
|
||||
meanIntIndPt= find(normIntens>d,1);
|
||||
meanInt= normIntens(meanIntIndPt);
|
||||
meanTime= times(meanIntIndPt);
|
||||
%**********************************************************
|
||||
|
||||
%**************************************************************************
|
||||
% NCLoIntstdTrim
|
||||
%NCLoSstdTrim.m called by NCfilImCF and NCfil.m
|
||||
flg1=0;
|
||||
loScurvLim=stdLoIntLim; %
|
||||
loStimeN=1;
|
||||
last2n=1;
|
||||
|
||||
stdDev= [];
|
||||
nrmIntens0= normIntens;
|
||||
for n=1:meanIntIndPt
|
||||
if nrmIntens0(n)<=0
|
||||
nrmIntens0(n)=0;
|
||||
end
|
||||
|
||||
if(nrmIntens0(n)<threshold)
|
||||
if (loStimeN-2)>0,dataMatrix(3,1:(n-2))= 2; %add to lowIntensity cull flags, the pre S cull data
|
||||
else dataMatrix(3,1:n)= 2;end
|
||||
dataMatrix(3,1:(n-2))= 2;
|
||||
last2n=n;
|
||||
end
|
||||
if n<(length(nrmIntens0)-3)
|
||||
x=nrmIntens0(n:(n+3));
|
||||
stdDev(n)=std(x);
|
||||
if (stdDev(n)<loScurvLim && flg1~=1)
|
||||
loStime=timepts(n);
|
||||
loStimeN=n;
|
||||
end
|
||||
if stdDev(n)>6 ,flg1=1;end %detect S curve rise->stop stdLoInt detection
|
||||
|
||||
end
|
||||
|
||||
end %end for
|
||||
|
||||
if (loStimeN-2)>0,dataMatrix(3,1:(loStimeN-2))= 2; %add to lowIntensity cull flags, the pre S cull data
|
||||
else dataMatrix(3,1:(loStimeN-2))= 2;end
|
||||
|
||||
qcutoff=2;
|
||||
qind=find(normIntens>2); %,:,'first');
|
||||
if ~isempty(qind(3)), qcutoff=qind(3);end
|
||||
[minInt,I]= min(normIntens(2:qcutoff));
|
||||
bl=minInt;
|
||||
minTime=dataMatrix(1,I); %diagnostic output only
|
||||
|
||||
if (length(qind)>5)&&I>1,dataMatrix(3,1:(I-1))=5; end
|
||||
|
||||
tGT2Flg=0;
|
||||
for n=1:length(normIntens)
|
||||
dataMatrix(4,n)=normIntens(n)-bl;
|
||||
if n>I && dataMatrix(4,n)>=2 && tGT2Flg==0
|
||||
thresGT2=n;thresGT2Tm=dataMatrix(1,n);tGT2Flg=1;
|
||||
end %diagnostic output only
|
||||
end
|
||||
|
||||
resMat(18)= bl;
|
||||
resMatStd(18)= bl;
|
||||
resMatStd(20)= minTime;
|
||||
resMat(20)= minTime;
|
||||
|
||||
%&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&
|
||||
%*********************************************************
|
||||
%DropOut cull section(single drop points)*******************
|
||||
DropOutStartPt=length(normIntens);
|
||||
for n=1:length(normIntens)
|
||||
if(n>1)
|
||||
if(((normIntens(n)- normIntens(n-1))< dropThreshold))&& ...
|
||||
(n > max(meanIntIndPt,thresGT2) )
|
||||
dataMatrix(3,n)= 6;
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
%??????should/could this be removed as recreated in%NCscurImCF_3parfor.m????????????????????
|
||||
%Post Stdtest cull for low intensities inclusion of additional low value points
|
||||
%selTimes= [--,--] %don't know size before as it is a filtered output
|
||||
tmpIndx= 0;
|
||||
for n=1:length(normIntens)
|
||||
if (dataMatrix(3,n)==1)
|
||||
tmpIndx= tmpIndx+1;
|
||||
selTimes(tmpIndx)= dataMatrix(1,n); %selTimes(nn)= dataMatrix(1,n);
|
||||
selIntens(tmpIndx)= dataMatrix(4,n); %selIntens(nn)= dataMatrix(4,n);
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
selTimes=selTimes';
|
||||
selIntens=selIntens';
|
||||
%???????????????????????????????????????????????????
|
||||
%**********End Basic filter******************
|
||||
|
||||
|
||||
%******************************************************
|
||||
|
||||
filtNormIntens=normIntens;
|
||||
|
||||
dataMatrix0= dataMatrix;
|
||||
filterTimes= timepts; %parfor
|
||||
|
||||
%_____________________________________________________________
|
||||
%*******************************************
|
||||
%NCscurImCF
|
||||
%NCscurImCF_1
|
||||
%NCscurImCF_2
|
||||
%NCscurImCF_3
|
||||
%NCscurImCF_3parfor
|
||||
%NCscurImCF_3parfor(dataMatrix, AUCfinalTime)
|
||||
|
||||
%dataMatrix %debugging parfor gbl ok 85.7145; 126.4579,6, 124.5264 37tPt
|
||||
%adsfj %debugging parfor gbl
|
||||
[resMatStd, resMat, selTimesStd, selIntensStd, FiltTimesELr, NormIntensELr] =...
|
||||
NCscurImCF_3parfor(dataMatrix0, AUCfinalTime, currSpotArea, sols, bl, minTime);
|
||||
|
||||
end % end JUMP OVER associated with if(find(intensities>1000)<5)
|
||||
%resMatStd
|
||||
%asdf
|
||||
%To accommodate parfor can't use global 'scan' variable 191002================
|
||||
% {
|
||||
par4scanselTimesStd{ii}= selTimesStd; %timepts'; %filterTimes';
|
||||
par4scanselIntensStd{ii}= selIntensStd; %normIntens';
|
||||
par4scanTimesELr{ii}= FiltTimesELr; %19_1021 preserve for CurveDisplay and EZview
|
||||
par4scanIntensELr{ii}= NormIntensELr; %19_1021 preserve for CurveDisplay and EZview
|
||||
%}
|
||||
%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
|
||||
%************* striped down OutCell code was put back into NCfitImCF
|
||||
|
||||
|
||||
outC(ii,:)= resMat; %{ii, par4resMat};
|
||||
outCstd(ii,:)= resMatStd; %{ii, par4resMatStd};
|
||||
|
||||
end %Multispot parfor ii loop end PARFOR LOOP END##############################################################################
|
||||
%###############################################################################################################################
|
||||
%###############################################################################################################################
|
||||
|
||||
|
||||
|
||||
%outC
|
||||
|
||||
%*********************************19_1001***********************************
|
||||
%To accomodate parfor copy par4scan thru global p4 functions inside of
|
||||
%parfor loop --then outside to par4Gbl_Main8b.m
|
||||
|
||||
%**************************************************************************
|
||||
fileExt = '.txt';
|
||||
filePrefix = 'FitResultsComplete_';
|
||||
fileNamePlate = [filePrefix fileSuffix fileExt];
|
||||
fileName= fullfile(outputDirectory, fileNamePlate); %[outputDirectory fileNamePlate];
|
||||
fid = fopen(fileName,'w');
|
||||
fprintf(fid, 'Fit Results Complete\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');
|
||||
fclose(fid);
|
||||
|
||||
|
||||
end %function end
|
||||
|
||||
%&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
|
||||
%##########################################################################
|
||||
|
||||
437
workflow/templates/easy/NCscurImCF_3parfor.m
Executable file
437
workflow/templates/easy/NCscurImCF_3parfor.m
Executable file
@@ -0,0 +1,437 @@
|
||||
%% CALLED BY NCfitImCFparforFailGbl2.m %%
|
||||
function [resMatStd, resMat, selTimesStd, selIntensStd, FiltTimesELr, NormIntensELr] =...
|
||||
NCscurImCF_3parfor(dataMatrix, AUCfinalTime, currSpotArea, sols, bl, minTime)
|
||||
%Major revision for Early-Late data cuts to improve accuracof 'r'. Removed legacy iterative method.
|
||||
%Significant Modification for Parfor
|
||||
%***************************************************************
|
||||
|
||||
%##########################################################################
|
||||
%******************************************* New Stage 1***************************************************************
|
||||
%Preallocate
|
||||
resMatStd= zeros(1,27);
|
||||
resMat= zeros(1,27);
|
||||
%Set internal variables sent to matlab fit function
|
||||
me=200;
|
||||
meL=750;
|
||||
mi=25; %50
|
||||
miL=250;
|
||||
%***********************************
|
||||
rmsStg1=0;
|
||||
rmsStg1I(1)= 0;
|
||||
slps=1;
|
||||
|
||||
filterTimes=[];
|
||||
normIntens=[];
|
||||
nn=1;
|
||||
numFitTpts=0;
|
||||
%Build filterTimes and normIntens from spot dataMatrix selection codes produced in filter section
|
||||
for n=1:size(dataMatrix,2)
|
||||
if (((dataMatrix(3,n)==1))||(dataMatrix(3,n)==3)||(dataMatrix(3,n)==2)...
|
||||
||(dataMatrix(3,n)==0))
|
||||
filterTimes(nn)= dataMatrix(1,n);
|
||||
normIntens(nn)=dataMatrix(4,n);
|
||||
nn=nn+1;
|
||||
end
|
||||
end
|
||||
|
||||
%------------------------------------------------------------------
|
||||
|
||||
%++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
filterTimes=filterTimes';
|
||||
selTimesStd=filterTimes;
|
||||
normIntens=normIntens';
|
||||
selIntensStd=normIntens;
|
||||
|
||||
%normIntens %debugging parfor gbl 200330 good values
|
||||
%afgj
|
||||
|
||||
lastTptUsed= 1;
|
||||
lastIntensUsed= 1;
|
||||
thresGT2TmStd=0;
|
||||
try
|
||||
|
||||
lastTptUsed=max(filterTimes);
|
||||
lastIntensUsed=normIntens(length(normIntens));
|
||||
lastIntensUsedStd= lastIntensUsed;
|
||||
|
||||
lastTptUsedStd= lastTptUsed;
|
||||
Tpt1Std= filterTimes(1);
|
||||
numFitTptsStd=nnz((normIntens(:)>=0)==1);
|
||||
thresGT2 = find(((normIntens(:)>2)==1), 1);
|
||||
if isempty(thresGT2)
|
||||
thresGT2TmStd=0;
|
||||
else
|
||||
thresGT2TmStd = filterTimes(thresGT2);
|
||||
end
|
||||
numTptsGT2Std = nnz((normIntens(:)>=2)==1); %nnz(filterTimes(find(filterTimes>=thresGT2Tm)));
|
||||
K_Guess = max(normIntens);
|
||||
numTimePts = length(filterTimes);
|
||||
opts = fitoptions('Method','Nonlinear','Robust','On',...
|
||||
'DiffMinChange',1.0E-11,'DiffMaxChange',0.001,...
|
||||
'MaxFunEvals',me, 'MaxIter', mi, 'TolFun', 1.0E-12, 'TolX', 1.0E-10, 'Lower', [K_Guess*0.5,0,0], 'StartPoint', [K_Guess,filterTimes(floor(numTimePts/2)),0.30], 'Upper', [K_Guess*2.0,max(filterTimes),1.0],'Display','off');
|
||||
ftype = fittype('K / (1 + exp(-r* (t - l )))','independent','t','dependent',['K','r','l'],'options',opts);
|
||||
|
||||
% carry out the curve fitting process
|
||||
[fitObject, errObj] = fit(filterTimes,normIntens,ftype);
|
||||
coeffsArray = coeffvalues(fitObject);
|
||||
rmsStg1=errObj.rsquare;
|
||||
rmsStg1I(slps)= errObj.rsquare;
|
||||
sDat(slps,1)=errObj.rsquare;
|
||||
K = coeffsArray(1); sDat(slps,2)= coeffsArray(1); % Carrying Capacity
|
||||
l = coeffsArray(2); sDat(slps,3)= coeffsArray(2); %lag time
|
||||
r = coeffsArray(3); sDat(slps,4)= coeffsArray(3); % rateS
|
||||
|
||||
% integrate (from first to last time point)
|
||||
numVals = size(filterTimes);
|
||||
numVals = numVals(1);
|
||||
t_begin = 0;
|
||||
t_end = AUCfinalTime;
|
||||
AUC = (K/r*log(1+exp(-r*(t_end-l)))-K/r*log(exp(-r*(t_end-l)))) - (K/r*log(1+exp(-r*(t_begin-l)))-K/r*log(exp(-r*(t_begin-l))));
|
||||
MSR = r;
|
||||
|
||||
rsquare = errObj.rsquare;
|
||||
confObj = confint(fitObject,0.9); % get the 90% confidence
|
||||
|
||||
NANcond=0; stdNANcond=0; %stdNANcond added to relay not to attempt ELr as there is no curve to find critical point
|
||||
confObj_filtered=confObj;
|
||||
Klow = confObj(1,1); sDat(slps,5)=confObj(1,1);
|
||||
Kup = confObj(2,1); sDat(slps,6)=confObj(2,1);
|
||||
llow = confObj(1,2); sDat(slps,7)=confObj(1,2);
|
||||
lup = confObj(2,2); sDat(slps,8)=confObj(2,2);
|
||||
rlow = confObj(1,3); sDat(slps,9)=confObj(1,3);
|
||||
rup = confObj(2,3); sDat(slps,10)=confObj(2,3);
|
||||
if(isnan(Klow)||isnan(Kup)||isnan(llow)||isnan(lup)||isnan(rlow)||isnan(rup))
|
||||
NANcond=1; stdNANcond=1; %stdNANcond added to relay not to attempt ELr as there is no curve to find critical point
|
||||
end
|
||||
|
||||
%rup %debugging parfor gbl 200330
|
||||
%Klow
|
||||
%asdfjj114
|
||||
% {
|
||||
catch %ME
|
||||
% if no data is given, return zeros
|
||||
AUC = 0;MSR = 0;K = 0;r = 0;l = 0;rsquare = 0;Klow = 0;Kup = 0;
|
||||
rlow = 0;rup = 0;lup = 0;llow = 0;
|
||||
NANcond=1; stdNANcond=1; %stdNANcond added to relay not to attempt ELr as there is no curve to find critical point
|
||||
end %end Try
|
||||
%}
|
||||
if (exist('K','var')&& exist('r','var') && exist('l','var'))
|
||||
t = (0:1:200);
|
||||
Growth = K ./ (1 + exp(-r.* (t - l )));
|
||||
fitblStd= min(Growth); %jh diag
|
||||
end
|
||||
|
||||
cutTm(1:4)= 1000; %-1 means cuts not used or NA
|
||||
%{
|
||||
l %debugging parfor
|
||||
K
|
||||
r
|
||||
Klow
|
||||
k
|
||||
%}
|
||||
%***Preserve for ResultsStd+++++++++++++++++++++++++++++
|
||||
|
||||
resMatStd(1)= AUC;
|
||||
resMatStd(2)= MSR;
|
||||
resMatStd(3)= K;
|
||||
resMatStd(4)= r;
|
||||
resMatStd(5)= l;
|
||||
resMatStd(6)= rsquare;
|
||||
resMatStd(7)= Klow;
|
||||
resMatStd(8)= Kup;
|
||||
resMatStd(9)= rlow;
|
||||
resMatStd(10)= rup;
|
||||
resMatStd(11)= llow;
|
||||
resMatStd(12)= lup;
|
||||
resMatStd(13)= currSpotArea;
|
||||
resMatStd(14)= lastIntensUsedStd; %filtNormIntens(length(filtNormIntens));
|
||||
|
||||
%spline fit unneccessary and removed;therefore No maxRateTime assoc'd w/spline fit
|
||||
%try
|
||||
%resMatStd(15)= maxRateTime;
|
||||
%catch
|
||||
maxRateTime= 0; %[]; %Std shows []; ELr shows 0; %parfor
|
||||
resMatStd(15)= 0; %maxRateTimestdMeth;
|
||||
%end
|
||||
|
||||
|
||||
resMatStd(16)= lastTptUsedStd; %filterTimes(length(filterTimes));
|
||||
if isempty(Tpt1Std)
|
||||
Tpt1Std= 777; %0.000002; %
|
||||
end
|
||||
resMatStd(17)= Tpt1Std;
|
||||
resMatStd(18)= bl; %perform in the filter section of NCfitImCFparfor
|
||||
resMatStd(19)= fitblStd; %Taken from NCfil... and not affected by NCscur...changes
|
||||
resMatStd(20)= minTime; %Not affected by changes made in NCscur...for refined 'r'
|
||||
resMatStd(21)= thresGT2TmStd;
|
||||
resMatStd(22)= numFitTptsStd;
|
||||
resMatStd(23)= numTptsGT2Std;
|
||||
|
||||
resMatStd(24)= 999; %The Standard method has no cuts .:.no cutTm
|
||||
resMatStd(25)= 999;
|
||||
resMatStd(26)= 999;
|
||||
resMatStd(27)= 999;
|
||||
|
||||
|
||||
%if SwitchEvsEL==3 %Remove 'SwitchEvsEL==...' temporary SWITCH when Hartman decides what he wants
|
||||
%*********************************************************************************
|
||||
%ELr New Experimental data through L+deltaS Logistic fit for 'Improved r' Fitting
|
||||
%*********************************************************************************
|
||||
FiltTimesELr= []; %{ii}= filterTimes;
|
||||
NormIntensELr= []; %{ii}= normIntens;
|
||||
normIntens= selIntensStd;
|
||||
filterTimes= selTimesStd;
|
||||
stdIntens= selIntensStd;
|
||||
tmpIntens= selIntensStd;
|
||||
stdTimes= selTimesStd;
|
||||
|
||||
if stdNANcond==0
|
||||
%Determine critical points and offsets for selecting Core Data based on
|
||||
%Standard curve fit run. Put diff into NImStartupImCF02.m calling source
|
||||
%to reduce repeated execution since it doesn't change.
|
||||
%fd4=diff(sym('K / (1 + exp(-r* (t - l )))'),4);
|
||||
%sols=solve(fd4);
|
||||
tc1= eval(sols(2));
|
||||
tc2= eval(sols(3));
|
||||
LL= l; %eval(sols(1)); %exactly the same as 'l' from std. fit method-Save time
|
||||
rsTmStd= LL-tc1; %%riseTime (first critical point to L)
|
||||
deltS= rsTmStd/2;
|
||||
tc1Early= tc1-deltS; %AKA- tc1AdjTm %2*tc1 -LL
|
||||
L_Late= LL+deltS;
|
||||
|
||||
|
||||
tc1EdatPt= find(filterTimes>(tc1Early),1,'first');
|
||||
cutTm(1)= filterTimes(2);
|
||||
cutDatNum(1)= 2;
|
||||
cutTm(2)= tc1Early;
|
||||
cutDatNum(2)= tc1EdatPt-1;
|
||||
|
||||
L_LDatPt= find(filterTimes< L_Late,1,'last');
|
||||
tc2LdatPt= find(filterTimes< tc2+rsTmStd,1,'last');
|
||||
|
||||
cutTm(3)= L_Late;
|
||||
cutDatNum(3)= L_LDatPt;
|
||||
|
||||
%Select Core Data Set (Remove Early data before critical point)
|
||||
ints=[];
|
||||
ints(1:L_LDatPt-tc1EdatPt+2)= (tmpIntens(L_LDatPt));
|
||||
ints(2:end)= tmpIntens(tc1EdatPt:L_LDatPt);
|
||||
ints(1)= tmpIntens(1);
|
||||
tms=[];
|
||||
tms(1:L_LDatPt-tc1EdatPt+2)= (stdTimes(L_LDatPt));
|
||||
tms(2:end)= stdTimes(tc1EdatPt:L_LDatPt);
|
||||
tms(1)= stdTimes(1);
|
||||
%-----------------------------------------------
|
||||
%Include/Keep late data that define K *********
|
||||
if length(tmpIntens(tc2LdatPt:end))> 4
|
||||
KlastInts= tmpIntens(tc2LdatPt:end);
|
||||
KlastTms= stdTimes(tc2LdatPt:end);
|
||||
lengthKlast= length(tmpIntens(tc2LdatPt:end));
|
||||
ints(end:(end+ lengthKlast-1))= KlastInts;
|
||||
tms(end:(end+ lengthKlast-1 ))= KlastTms;
|
||||
|
||||
cutTm(4)= tc2+rsTmStd;
|
||||
cutDatNum(4)= tc2LdatPt-1;
|
||||
|
||||
|
||||
else
|
||||
lengthKlast= length(tmpIntens(tc2LdatPt-1:end));
|
||||
if lengthKlast>1
|
||||
KlastInts= tmpIntens(end-(lengthKlast-1):end);
|
||||
KlastTms= stdTimes(end-(lengthKlast-1):end);
|
||||
ints(end:(end+ lengthKlast-1 ))= KlastInts;
|
||||
tms(end:(end+ lengthKlast-1 ))= KlastTms;
|
||||
end
|
||||
|
||||
cutTm(4)= stdTimes(tc2LdatPt-1);
|
||||
cutDatNum(4)= tc2LdatPt-2; %length(stdTimes(end-(lengthKlast-1):end));
|
||||
|
||||
end
|
||||
|
||||
|
||||
%************************************************
|
||||
Ints=[];
|
||||
Tms=[];
|
||||
Ints= ints';
|
||||
Tms= tms';
|
||||
|
||||
try
|
||||
filterTimes= Tms; filterTimes4= Tms;
|
||||
normIntens= Ints; normIntens4=Ints;
|
||||
|
||||
%----------------------------------------------------------------------------------------------
|
||||
|
||||
%classic symetric logistic curve fit setup restated as COMMENTS for reference convenience----------------------------
|
||||
%opts= fitoptions is the same as for Std and so is redundant
|
||||
%opts = fitoptions('Method','Nonlinear','Robust','On',...
|
||||
% 'DiffMinChange',1.0E-11,'DiffMaxChange',0.001,...
|
||||
% 'MaxFunEvals',me, 'MaxIter', mi, 'TolFun', 1.0E-12, 'TolX', 1.0E-10, 'Lower', [K_Guess*0.5,0,0], 'StartPoint', [K_Guess,filterTimes(floor(numTimePts/2)),0.30], 'Upper', [K_Guess*2.0,max(filterTimes),1.0]);
|
||||
|
||||
ftype = fittype('K / (1 + exp(-r* (t - l )))','independent','t','dependent',['K','l','r'],'options',opts);
|
||||
fitObject=[]; errObj=[];
|
||||
% carry out the curve fitting process
|
||||
[fitObject, errObj] = fit(Tms,Ints,ftype);
|
||||
coeffsArray = coeffvalues(fitObject);
|
||||
r3 = coeffsArray(3); %sDat(slps,4)= coeffsArray(3); % rateS
|
||||
|
||||
if (exist('K','var')&& exist('r','var') && exist('l','var'))
|
||||
t = (0:1:200);
|
||||
GrowthELr = K ./ (1 + exp(-r.* (t - l )));
|
||||
fitblELr= min(GrowthELr); %jh diag
|
||||
end
|
||||
|
||||
catch ME
|
||||
% if no data is given, return zeros
|
||||
AUC = 0;MSR = 0;K = 0;r = 0;l = 0;rsquare = 0;Klow = 0;Kup = 0;
|
||||
rlow = 0;rup = 0;lup = 0;llow = 0; %normIntens=[];
|
||||
|
||||
end %end Try
|
||||
|
||||
end %if stdNANcond=0
|
||||
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
%Update values if r is better(higher) with removal of early data
|
||||
try
|
||||
if r3>r && stdNANcond==0
|
||||
r = r3; sDat(slps,4)= sDat(slps,4); % rateS
|
||||
K = coeffsArray(1); sDat(slps,2)= coeffsArray(1); % Carrying Capacity
|
||||
l = coeffsArray(2); sDat(slps,3)= coeffsArray(2); %lag time
|
||||
|
||||
coeffsArray = coeffvalues(fitObject);
|
||||
rmsStg1=errObj.rsquare;
|
||||
rmsStg1I(slps)= errObj.rsquare;
|
||||
sDat(slps,1)=errObj.rsquare;
|
||||
|
||||
%jh diagnostics*************
|
||||
numFitTpts=nnz((normIntens(:)>=0)==1);
|
||||
thresGT2 = find(((normIntens(:)>2)==1), 1);
|
||||
thresGT2Tm = filterTimes(thresGT2);
|
||||
numTptsGT2 = nnz((normIntens(:)>=2)==1);
|
||||
numTimePts = length(filterTimes);
|
||||
|
||||
AUC = (K/r*log(1+exp(-r*(t_end-l)))-K/r*log(exp(-r*(t_end-l)))) - (K/r*log(1+exp(-r*(t_begin-l)))-K/r*log(exp(-r*(t_begin-l))));
|
||||
MSR = r3;
|
||||
%***************************
|
||||
|
||||
rsquare = errObj.rsquare;
|
||||
confObj = confint(fitObject,0.9); % get the 90% confidence
|
||||
NANcond=0;
|
||||
|
||||
confObj_filtered=confObj;
|
||||
Klow = confObj(1,1); sDat(slps,5)=confObj(1,1);
|
||||
Kup = confObj(2,1); sDat(slps,6)=confObj(2,1);
|
||||
llow = confObj(1,2); sDat(slps,7)=confObj(1,2);
|
||||
lup = confObj(2,2); sDat(slps,8)=confObj(2,2);
|
||||
rlow = confObj(1,3); sDat(slps,9)=confObj(1,3);
|
||||
rup = confObj(2,3); sDat(slps,10)=confObj(2,3);
|
||||
if(isnan(Klow)||isnan(Kup)||isnan(llow)||isnan(lup)||isnan(rlow)||isnan(rup))
|
||||
NANcond=1;
|
||||
end
|
||||
|
||||
filterTimes= Tms;
|
||||
normIntens= Ints;
|
||||
resMat(17)= .00002;
|
||||
resMat(18)= bl;
|
||||
resMat(19)= fitblELr;
|
||||
resMat(20)= minTime;
|
||||
else % r is better than r3 so use the Std data in the ELr result sheet
|
||||
filterTimes=selTimesStd;
|
||||
normIntens=selIntensStd;
|
||||
|
||||
lastTptUsed= lastTptUsedStd; %Reinstall Std values for jh diags
|
||||
|
||||
Tpt1=filterTimes(1);
|
||||
try
|
||||
if isempty(Tpt1)
|
||||
Tpt1= 0.00002; %777;
|
||||
end
|
||||
catch
|
||||
Tpt1= 0.00002; %777;
|
||||
end
|
||||
|
||||
resMat(17)= Tpt1;
|
||||
numFitTpts= numFitTptsStd;
|
||||
numTptsGT2= numTptsGT2Std;
|
||||
thresGT2Tm = thresGT2TmStd;
|
||||
|
||||
cutTm(1:4)= 1000; %-1 means cuts not used or NA
|
||||
|
||||
resMat(18)= bl; %only applicable to Std curve Fit; ELr superceeds and makes meaningless
|
||||
resMat(19)= fitblStd; %only applicable to Std curve Fit; ELr superceeds and makes meaningless
|
||||
resMat(20)= minTime; %only applicable to Std curve Fit; ELr superceeds and makes meaningless
|
||||
end %if r3>r1
|
||||
|
||||
%rup
|
||||
%asdf352
|
||||
% {
|
||||
catch ME
|
||||
% if no data is given, return zeros
|
||||
AUC = 0;MSR = 0;K = 0;r = 0;l = 0;rsquare = 0;Klow = 0;Kup = 0;
|
||||
rlow = 0;rup = 0;lup = 0;llow = 0; %normIntens=[];
|
||||
|
||||
end %end Try
|
||||
%}
|
||||
resMat(1)= AUC;
|
||||
resMat(2)= MSR;
|
||||
resMat(3)= K;
|
||||
resMat(4)= r;
|
||||
resMat(5)= l;
|
||||
resMat(6)= rsquare;
|
||||
resMat(7)= Klow;
|
||||
resMat(8)= Kup;
|
||||
resMat(9)= rlow;
|
||||
resMat(10)= rup;
|
||||
resMat(11)= llow;
|
||||
resMat(12)= lup;
|
||||
resMat(13)= currSpotArea;
|
||||
resMat(14)= lastIntensUsed; %filtNormIntens(length(filtNormIntens));
|
||||
|
||||
%spline fit unneccessary and removed therfor no max spline rate time->set 0
|
||||
maxRateTime=0; %ELr will show 0; Std will show []
|
||||
resMat(15)= maxRateTime;
|
||||
|
||||
resMat(16)= lastTptUsed; %filterTimes(length(filterTimes));
|
||||
|
||||
|
||||
try %if Std fit used no cuts .:. no cutTm
|
||||
resMat(24)= cutTm(1);
|
||||
resMat(25)= cutTm(2);
|
||||
resMat(26)= cutTm(3);
|
||||
resMat(27)= cutTm(4);
|
||||
catch
|
||||
resMat(24)= 999; %if Std fit used no cuts .:. no cutTm
|
||||
resMat(25)= 999;
|
||||
resMat(26)= 999;
|
||||
resMat(27)= 999;
|
||||
end
|
||||
|
||||
FiltTimesELr= filterTimes;
|
||||
NormIntensELr= normIntens;
|
||||
|
||||
%**********************************************************************************
|
||||
%##########################################################################
|
||||
|
||||
lastTptUsed=max(filterTimes);
|
||||
lastIntensUsed=normIntens(length(normIntens));
|
||||
|
||||
if (exist('K','var')&& exist('r','var') && exist('l','var'))
|
||||
t = (0:1:200);
|
||||
Growth = K ./ (1 + exp(-r.* (t - l )));
|
||||
fitbl= min(Growth); %jh diag
|
||||
end
|
||||
%}
|
||||
try
|
||||
if isempty(thresGT2Tm),thresGT2Tm=0;end %jh diag
|
||||
catch
|
||||
thresGT2Tm= 0;
|
||||
numTptsGT2= 0;
|
||||
end
|
||||
|
||||
resMat(21)= thresGT2Tm;
|
||||
resMat(22)= numFitTpts;
|
||||
resMat(23)= numTptsGT2;
|
||||
|
||||
|
||||
end %function end
|
||||
|
||||
|
||||
110
workflow/templates/easy/NCsingleDisplay.m
Executable file
110
workflow/templates/easy/NCsingleDisplay.m
Executable file
@@ -0,0 +1,110 @@
|
||||
%% CALLED WHEN ACCESSING 'CurveFit Display' %%
|
||||
global expDir
|
||||
global scLst
|
||||
global ExpPath
|
||||
global scan
|
||||
|
||||
eDir= ExpPath;
|
||||
hf= figure;
|
||||
%**************Parameter Entry******************
|
||||
[scLst, row, col] = NCdisplayGui(eDir); %(ExpPath); %Ncode 122111replaced removed ,numOfPrtTimes)
|
||||
%***********************************************
|
||||
|
||||
close(hf)
|
||||
|
||||
|
||||
selSpot= (row-1)*24 + col;
|
||||
for iPlate=1:length(scLst)
|
||||
scanPltNum= str2double(scLst(iPlate));
|
||||
%scanPltNum(iPlate);
|
||||
%-----------------------------------------------------------------------
|
||||
K= scan(scanPltNum).plate(1).CFout((selSpot),3);
|
||||
r= scan(scanPltNum).plate(1).CFout((selSpot),4);
|
||||
l= scan(scanPltNum).plate(1).CFout((selSpot),5);
|
||||
|
||||
suffix= strcat('Scan-Plate', scLst(iPlate)); %char(QspLst(n));
|
||||
%fileSpotSuffix = strcat('-Spot#',num2str(selSpot),'-Row=',selSpotRC(1),'-Col=',selSpotRC(2),'-FitData','-L=',num2str(l),'-r=',num2str(r),'-K=',num2str(K));
|
||||
fileSpotSuffix = strcat('-Spot#',num2str(selSpot),'-Row=',num2str(row),'-Col=',num2str(col),'-FitData','-L=',num2str(l),'-r=',num2str(r),'-K=',num2str(K));
|
||||
filenameNoExt= [suffix fileSpotSuffix];
|
||||
|
||||
timeArr= scan(scanPltNum).plate(1).tSeries;
|
||||
rawIntens= scan(scanPltNum).plate(1).intens((selSpot),:)/scan(scanPltNum).plate(1).Ag((selSpot));
|
||||
try
|
||||
filterTms= scan(scanPltNum).plate(1).filterTimes{(selSpot)};
|
||||
normInts= scan(scanPltNum).plate(1).normIntens{(selSpot)};
|
||||
catch
|
||||
end
|
||||
%********************************
|
||||
|
||||
if (exist('K','var')&& exist('r','var') && exist('l','var'))
|
||||
t = (0:1:200);
|
||||
Growth = K ./ (1 + exp(-r.* (t - l )));
|
||||
end
|
||||
if length(scLst)>1
|
||||
figure
|
||||
else
|
||||
cla
|
||||
end
|
||||
|
||||
hold on
|
||||
plot(timeArr,rawIntens,'g*');
|
||||
try
|
||||
plot(filterTms,normInts,'o');
|
||||
catch
|
||||
end
|
||||
hold on;
|
||||
title(strcat(filenameNoExt,''));
|
||||
xlabel('Hours');
|
||||
ylabel('Intensities Normalized by Area');
|
||||
grid on;
|
||||
|
||||
if (exist('K','var')&& exist('r','var') && exist('l','var'))
|
||||
plot(t, Growth,'b-');
|
||||
%*********Plot L on curvefit figure***********
|
||||
grL=Growth(round(l)); %growthCurve timePT for l in hours
|
||||
plot(l,0:grL,'-b') %to display position of l
|
||||
plot(l,grL,'^b') %to display l position on curve as an arrowhead
|
||||
|
||||
%***Plot Arbitrary User Entry AUC "finalTimePt"
|
||||
% plot(finalTimePt,0,'+m')
|
||||
% plot(0:finalTimePt,bl,'-m')
|
||||
|
||||
end
|
||||
end
|
||||
%end %end for SWsingle display/plot figure
|
||||
|
||||
%############################################################
|
||||
|
||||
|
||||
|
||||
%Spot entry form------------------------------------------------------
|
||||
%{
|
||||
prompt = {'Enter spot to analyse:'};
|
||||
dlg_title = 'Input spot to curve fit';
|
||||
num_lines = 1;
|
||||
def = {'1'};
|
||||
selSpot = inputdlg(prompt,dlg_title,num_lines,def);
|
||||
K= scan(scanPltNum).plate(1).CFout(str2double(selSpot),3);
|
||||
r= scan(scanPltNum).plate(1).CFout(str2double(selSpot),4);
|
||||
l= scan(scanPltNum).plate(1).CFout(str2double(selSpot),5);
|
||||
|
||||
suffix= strcat('Scan-Plate', scLst); %char(QspLst(n));
|
||||
fileSpotSuffix = strcat('-Spot#',selSpot,'-FitData','-L=',num2str(l),'-r=',num2str(r),'-K=',num2str(K));
|
||||
filenameNoExt= [suffix fileSpotSuffix];
|
||||
|
||||
timeArr= scan(scanPltNum).plate(1).tSeries;
|
||||
rawIntens= scan(scanPltNum).plate(1).intens(str2double(selSpot),:)/scan(scanPltNum).plate(1).Ag(str2double(selSpot));
|
||||
filterTms= scan(scanPltNum).plate(1).filterTimes{str2double(selSpot)};
|
||||
normInts= scan(scanPltNum).plate(1).normIntens{str2double(selSpot)};
|
||||
|
||||
%}
|
||||
%-----------------------------------------------------------------------
|
||||
%{
|
||||
prompt = {'Enter Spot row:','Enter Spot column:'};
|
||||
dlg_title = 'Input spot to curve fit';
|
||||
num_lines = 2;
|
||||
def = {'1','1'};
|
||||
selSpotRC = inputdlg(prompt,dlg_title,num_lines,def);
|
||||
row= str2double(selSpotRC(1)); col=str2double(selSpotRC(2));
|
||||
%}
|
||||
%row= cell2mat(row);
|
||||
62
workflow/templates/easy/NIcircle.m
Executable file
62
workflow/templates/easy/NIcircle.m
Executable file
@@ -0,0 +1,62 @@
|
||||
%% CALLED BY par4Gbl_Main8c.m %%
|
||||
%{
|
||||
%Imaging ToolBox method
|
||||
r=14;
|
||||
A=zeros(70,70); %(fIntsc(refPtR:(refPtRExt),refPtC:(refPtCExt)))
|
||||
m= {40,40};
|
||||
A(m{:})=1;
|
||||
B= imdilate(A,strel('disk',r,0) );
|
||||
imshow(B)
|
||||
|
||||
area=pi*r^2
|
||||
|
||||
clear all
|
||||
%}
|
||||
|
||||
%without Image Proc. Toolbox
|
||||
%r=14;
|
||||
%A=zeros(70,70);
|
||||
%A=zeros(r,r);
|
||||
%P=[40,40];
|
||||
%center= [refPtR+ round(.5*width), refPtC+ round(.5*width)];
|
||||
%A=zeros(70,70);
|
||||
%---------------------------------------------------------------------
|
||||
%radius=14;
|
||||
diaExt=2*(radius+1);
|
||||
circBoxA=zeros(diaExt,diaExt);
|
||||
center= [radius+2, radius+2];
|
||||
[m, n ]=size(circBoxA);
|
||||
X = bsxfun(@plus,(1:m)', zeros(1,n));
|
||||
Y = bsxfun(@plus,(1:n), zeros(m,1));
|
||||
cirMask= sqrt(sum(bsxfun(@minus,cat(3,X,Y),reshape(center,1,1,[])) .^2,3))<=radius;
|
||||
area=pi*radius^2;
|
||||
|
||||
cirPixA= nnz(cirMask);
|
||||
|
||||
optCirMask= double(cirMask);
|
||||
optCirMask(optCirMask==0)= 0.8;
|
||||
|
||||
%+++++++++++Foto Circle Fram(e)+++++++++++++++++++++
|
||||
expansion=2;
|
||||
radExpan= radius+expansion;
|
||||
FdiaExt=2*(radExpan);
|
||||
circBoxA=zeros(FdiaExt,FdiaExt);
|
||||
center= [radExpan+1, radExpan+1];
|
||||
[m, n ]=size(circBoxA);
|
||||
X = bsxfun(@plus,(1:m)', zeros(1,n));
|
||||
Y = bsxfun(@plus,(1:n), zeros(m,1));
|
||||
FcirMask= sqrt(sum(bsxfun(@minus,cat(3,X,Y),reshape(center,1,1,[])) .^2,3))<=radExpan;
|
||||
|
||||
%FcirPixA= nnz(cirMask);
|
||||
FoptCirMask= double(FcirMask);
|
||||
FoptCirMask(FoptCirMask==1)= 2;
|
||||
%FoptCirMask(FoptCirMask==0)= 1;
|
||||
%********Combine Masks to create circular boundry************
|
||||
padOptCirMask= padarray(optCirMask,[expansion-1 expansion-1],0.8);
|
||||
FoptCirMask= FoptCirMask .* padOptCirMask;
|
||||
FoptCirMask(FoptCirMask==1.6)= 0.8;
|
||||
FoptCirMask(FoptCirMask==0)= 1;
|
||||
FoptCirMask(FoptCirMask==2)= 1;
|
||||
|
||||
%---------------------------------------------------
|
||||
%imagesc(cirMask)
|
||||
281
workflow/templates/easy/NImParamRadiusGui.m
Executable file
281
workflow/templates/easy/NImParamRadiusGui.m
Executable file
@@ -0,0 +1,281 @@
|
||||
%% CALLED BY par4Gbl_Main8c.m %%
|
||||
function NImParamRadiusGui(expDir) %, numOfPrtTimes) 122111replace removed
|
||||
global SWsingleSc
|
||||
global SWgrowthArea
|
||||
%global selScan
|
||||
global scan
|
||||
global scLst
|
||||
global ImParMat
|
||||
%global CSearchRange
|
||||
global CSrchRng
|
||||
global defImParMat
|
||||
global fhImRun
|
||||
global fhconsole
|
||||
global resDir
|
||||
global ExpOutmat
|
||||
global numRows;
|
||||
global numCols;
|
||||
global scanSize
|
||||
global scanMax
|
||||
defImParMat=[1, 1, 15, 34, 24, 1,0,0,1,14,1,18]; %Ncode ImRobot adaptation
|
||||
if ImParMat(3)==0 || ImParMat(4)==0 ||ImParMat(5)==0 || ImParMat(10)==0 ||ImParMat(11)==0
|
||||
ImParMat=defImParMat;
|
||||
end
|
||||
if size(ImParMat,2)<12
|
||||
ImParMat(12)=18; %Default before user input CsearchRange value
|
||||
msg= 'Data made before SearchRange user entry added (ImParMat(12). 18 was the set value and the current default.)';
|
||||
end
|
||||
%ImParMat=defImParMat; %Activate for INITIAL USE only
|
||||
MPnum=1;
|
||||
destPerMP=1;
|
||||
selScan=1;
|
||||
SWgrowthArea=1;
|
||||
|
||||
if exist(fullfile(resDir,'PTmats','NImParameters.mat'))
|
||||
load(fullfile(resDir,'PTmats','NImParameters'));
|
||||
else
|
||||
load NImParameters
|
||||
end
|
||||
ImParMat;
|
||||
%end
|
||||
%if ~exist('CSearchRange','var') || isempty(CSearchRange)
|
||||
if ~isequal(exist(fullfile(resDir,'Fotos','CSearchRange.mat')),0)
|
||||
load(fullfile(resDir,'Fotos','CSearchRange'))
|
||||
CSearchRange;
|
||||
end
|
||||
|
||||
|
||||
% yInitPos=0.30;
|
||||
xPos=0.05;
|
||||
btnWid=0.10;
|
||||
btnHt=0.05;
|
||||
spacing=0.02;% Spacing between the button and the next command's label
|
||||
|
||||
|
||||
%====================================
|
||||
% The ADD Groups button
|
||||
btnNumber=1;
|
||||
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
|
||||
btnPos=[xPos yPos-spacing btnWid btnHt];
|
||||
fhImParm=gcf;
|
||||
if exist('resDir','var')&& ~isempty(resDir)
|
||||
set(fhImParm,'NumberTitle','off')
|
||||
set(fhImParm,'Name',strcat('ImageAnalysis- ',char(resDir)))
|
||||
else
|
||||
set(fhImParm,'NumberTitle','off')
|
||||
set(fhImParm,'Name','EASYconsole -Exp. Analysis NOT selected.')
|
||||
end
|
||||
|
||||
|
||||
|
||||
btnNumber=5;
|
||||
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
|
||||
btnPos=[xPos yPos-spacing btnWid btnHt];
|
||||
srcRadius=ImParMat(10);
|
||||
hedit = uicontrol(...
|
||||
'Style', 'edit',...
|
||||
'String',srcRadius,...
|
||||
'Units','normalized',...
|
||||
'Position', btnPos,... % [.002 .70 .08 .10],...
|
||||
'callback',{@entryRadius}); % 'Position', [5 100 60 20])
|
||||
|
||||
function entryRadius(source,~)
|
||||
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
|
||||
end
|
||||
Radius=user_entry;
|
||||
ImParMat(10)= Radius;
|
||||
Radius;
|
||||
end
|
||||
|
||||
|
||||
btnNumber=6;
|
||||
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
|
||||
btnPos=[xPos yPos-spacing btnWid btnHt];
|
||||
srcDither= ImParMat(6);
|
||||
hedit = uicontrol(...
|
||||
'Style', 'edit',...
|
||||
'String',srcDither,...
|
||||
'Units','normalized',...
|
||||
'Position', btnPos,...
|
||||
'callback',{@entryDither});
|
||||
|
||||
function entryDither(source,~)
|
||||
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
|
||||
end
|
||||
Dither=user_entry;
|
||||
ImParMat(6)= Dither;
|
||||
Dither;
|
||||
end
|
||||
%-------------------77777----------- Added July 7,2015 to allow Search Range constraint
|
||||
btnNumber=7;
|
||||
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
|
||||
btnPos=[xPos yPos-spacing btnWid btnHt];
|
||||
try
|
||||
CSrchRange=ImParMat(12);
|
||||
CSrchRng=ImParMat(12);
|
||||
catch %Legacy default value was 18 before being made a user input variable (ImParMat(12)). A preferable value now might be 12 or 14.
|
||||
CSrchRange=18;
|
||||
ImParMat(12)=18;
|
||||
CSrchRng=ImParMat(12);
|
||||
end
|
||||
|
||||
hSearchRange = uicontrol(...
|
||||
'Style', 'edit',...
|
||||
'String',CSrchRange,...
|
||||
'Units','normalized',...
|
||||
'Position', btnPos,...
|
||||
'callback',{@CsearchRange});
|
||||
|
||||
function CsearchRange(source,~)
|
||||
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
|
||||
end
|
||||
CSrchRng=user_entry;
|
||||
|
||||
end
|
||||
|
||||
%Ncode 12_0120 for reading in numeric folder names
|
||||
nlist=dir(fullfile(expDir,'*'));
|
||||
nnn=0;
|
||||
for n=1:size(nlist,1)
|
||||
if (~isempty(str2num(nlist(n).name)))
|
||||
nnn=nnn+1;
|
||||
PnumLst(nnn)= (str2num(nlist(n).name));
|
||||
sl(nnn,1)={(nlist(n).name)};
|
||||
end
|
||||
end
|
||||
scanSize= size(sl,1);
|
||||
scanMax= max(str2double(sl));
|
||||
|
||||
hListbox = uicontrol(...
|
||||
'Style', 'listbox',...
|
||||
'String',sort(sl),...
|
||||
'value',[],...
|
||||
'max',1000,...
|
||||
'min',1,...
|
||||
'Units','normalized',...
|
||||
'Position', [.70 .40 .10 .60],...
|
||||
'callback',{@load_listbox}); %'uiresume(gcbf)'); 'Position', [5 100 60 20])
|
||||
|
||||
function load_listbox(source,~)
|
||||
%global CSrchRng
|
||||
%global CSrearchRange
|
||||
userIndx = (get(source,'value'));
|
||||
userStr = (get(source,'string'));
|
||||
%scLstIndx= str2num(char(strrep(userStr(userIndx), 'Scan', '')))
|
||||
|
||||
user_entry=userStr(userIndx);
|
||||
scLst=user_entry;
|
||||
if size(scLst,1)>1
|
||||
%CSrchRng=num2str(ImParMat(12))
|
||||
set(hSearchRange,'string',num2str(ImParMat(12)))
|
||||
else
|
||||
try
|
||||
CSrchRng=CSearchRange(str2double(scLst));
|
||||
set(hSearchRange,'string',CSearchRange(str2double(scLst)))
|
||||
catch
|
||||
% CSrchRng=num2str(ImParMat(12))
|
||||
% set(hSearchRange,'string',num2str(ImParMat(12)))
|
||||
end
|
||||
end
|
||||
|
||||
%ImParMat(7)=MPnum
|
||||
|
||||
end
|
||||
scLst;
|
||||
|
||||
%*****************************************************************
|
||||
%-------------------10 10 10 10-----------
|
||||
|
||||
btnNumber=10;
|
||||
yPos=0.85-(btnNumber-1)*(btnHt+spacing);
|
||||
btnPos=[xPos yPos-spacing btnWid btnHt];
|
||||
|
||||
hedit8 = uicontrol(...
|
||||
'Style', 'pushbutton',...
|
||||
'String',{'Continue'},...
|
||||
'Units','normalized',...
|
||||
'Position', btnPos,...
|
||||
'callback','uiresume(gcbf)');
|
||||
|
||||
|
||||
%------------------------------
|
||||
|
||||
%***************************************************************
|
||||
%********LABELS******************************
|
||||
% The Labels
|
||||
xLPos=0.175;
|
||||
yPos=0;
|
||||
btnWid=0.20;
|
||||
|
||||
|
||||
%-------------------55555-----------
|
||||
lblNumber=5;
|
||||
yPos=0.85-(lblNumber-1)*(btnHt+spacing);
|
||||
btnPos=[xLPos yPos-spacing btnWid btnHt];
|
||||
|
||||
htxt = uicontrol(...
|
||||
'Style', 'text',...
|
||||
'String','Radius',... %'String','Width',...
|
||||
'Units','normalized',...
|
||||
'Position', btnPos);
|
||||
%-------------------66666-----------
|
||||
lblNumber=6;
|
||||
yPos=0.85-(lblNumber-1)*(btnHt+spacing);
|
||||
btnPos=[xLPos yPos-spacing btnWid btnHt];
|
||||
|
||||
htxt = uicontrol(...
|
||||
'Style', 'text',...
|
||||
'String','Dither',...
|
||||
'Units','normalized',...
|
||||
'Position', btnPos);
|
||||
%-------------------77777-----------
|
||||
|
||||
lblNumber=7;
|
||||
yPos=0.85-(lblNumber-1)*(btnHt+spacing);
|
||||
btnPos=[xLPos yPos-spacing btnWid btnHt];
|
||||
|
||||
htxt = uicontrol(...
|
||||
'Style', 'text',...
|
||||
'String','SearchRange',...
|
||||
'Units','normalized',...
|
||||
'Position', btnPos);
|
||||
|
||||
|
||||
uiwait(gcf);
|
||||
for i=1:length(scLst)
|
||||
CSearchRange(str2double(scLst(i)))= CSrchRng;
|
||||
ImParMat(12)= CSrchRng;
|
||||
end
|
||||
|
||||
ImParMat;
|
||||
CSearchRange;
|
||||
try
|
||||
save('NImParameters','ImParMat')
|
||||
% save('CSearchRange','CSearchRange')
|
||||
catch
|
||||
save(fullfile('\','NImParameters'),'ImParMat')
|
||||
%save(fullfile('\','CSearchRange'),'CSearchRange')
|
||||
end
|
||||
save((fullfile(resDir,'PTmats','NImParameters')), 'ImParMat');
|
||||
save((fullfile(resDir,'Fotos','CSearchRange')),'CSearchRange');
|
||||
|
||||
close
|
||||
|
||||
return
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1381
workflow/templates/easy/NIscanIntensBGpar4GblFnc.m
Executable file
1381
workflow/templates/easy/NIscanIntensBGpar4GblFnc.m
Executable file
File diff suppressed because it is too large
Load Diff
BIN
workflow/templates/easy/PTmats/NCFparms.mat
Executable file
BIN
workflow/templates/easy/PTmats/NCFparms.mat
Executable file
Binary file not shown.
BIN
workflow/templates/easy/PTmats/NImParameters.mat
Executable file
BIN
workflow/templates/easy/PTmats/NImParameters.mat
Executable file
Binary file not shown.
BIN
workflow/templates/easy/PTmats/NPTdirectParameters.mat
Executable file
BIN
workflow/templates/easy/PTmats/NPTdirectParameters.mat
Executable file
Binary file not shown.
BIN
workflow/templates/easy/PTmats/NPTmapDirect.mat
Executable file
BIN
workflow/templates/easy/PTmats/NPTmapDirect.mat
Executable file
Binary file not shown.
BIN
workflow/templates/easy/PTmats/NPTmapSearch.mat
Executable file
BIN
workflow/templates/easy/PTmats/NPTmapSearch.mat
Executable file
Binary file not shown.
BIN
workflow/templates/easy/PTmats/NPTsearchParameters.mat
Executable file
BIN
workflow/templates/easy/PTmats/NPTsearchParameters.mat
Executable file
Binary file not shown.
BIN
workflow/templates/easy/PTmats/Nbdg.mat
Executable file
BIN
workflow/templates/easy/PTmats/Nbdg.mat
Executable file
Binary file not shown.
15
workflow/templates/easy/datatipp.m
Executable file
15
workflow/templates/easy/datatipp.m
Executable file
@@ -0,0 +1,15 @@
|
||||
%% PART OF GUI FUNCTIONALITY %%
|
||||
function output_txt = datatipp(~,event_obj)
|
||||
% Display the position of the data cursor
|
||||
% obj Currently not used (empty)
|
||||
% event_obj Handle to event object
|
||||
% output_txt Data cursor text string (string or cell array of strings).
|
||||
|
||||
pos = get(event_obj,'Position');
|
||||
output_txt = {['X: ',num2str(pos(1),4)],...
|
||||
['Y: ',num2str(pos(2),4)]};
|
||||
|
||||
% If there is a Z-coordinate in the position, display it as well
|
||||
if length(pos) > 2
|
||||
output_txt{end+1} = ['Z: ',num2str(pos(3),4)];
|
||||
end
|
||||
BIN
workflow/templates/easy/figs/NPTdirect.fig
Executable file
BIN
workflow/templates/easy/figs/NPTdirect.fig
Executable file
Binary file not shown.
BIN
workflow/templates/easy/figs/searchNPTIm.fig
Executable file
BIN
workflow/templates/easy/figs/searchNPTIm.fig
Executable file
Binary file not shown.
43
workflow/templates/easy/p4loop8c.m
Executable file
43
workflow/templates/easy/p4loop8c.m
Executable file
@@ -0,0 +1,43 @@
|
||||
%% CALLED BY par4Gbl_Main8c.m %%
|
||||
function[p4L4,...
|
||||
TmpexpScanIntens4,TmpFexpScanSpots4,TmpFexpScanBMtp4,TmpanlZoneRefs4,Tmpsbdg4]= ...
|
||||
p4loop8c(parMat,tptLength,numScans,selScanNumLst,SWsingleSc,Fflg,PTmapPos,optCirMask,diaExt,doCircle,cirPixA,cirMask,width, ...
|
||||
TmpexpScanIntens00,TmpFexpScanSpots00,TmpFexpScanBMtp00,TmpanlZoneRefs00,~,tifFileLstP4,pathname,ImParMat, ...
|
||||
numRows,numCols,scLst,resDir,expDir, p4L00,TmpexpScanIntens4,TmpFexpScanSpots4,TmpFexpScanBMtp4,TmpanlZoneRefs4, Tmpsbdg00, Tmpsbdg4)
|
||||
p4L0=p4L00;
|
||||
TmpexpScanIntens0= TmpexpScanIntens00;
|
||||
TmpFexpScanSpots0= TmpFexpScanSpots00;
|
||||
TmpFexpScanBMtp0= TmpFexpScanBMtp00;
|
||||
TmpanlZoneRefs0= TmpanlZoneRefs00;
|
||||
Tmpsbdg0= Tmpsbdg00;
|
||||
%resDir %for debugging
|
||||
%START PARFOR PARFOR PARFOR PARFOR PARFOR PARFOR PARFOR PARFOR PARFOR PARFOR
|
||||
%************************************************************************************************************************
|
||||
%---------------Global Parfor Loop-----------------------------------------
|
||||
%for scCount=1:numScans
|
||||
if SWsingleSc==1
|
||||
parforArg=0;
|
||||
else
|
||||
parforArg= inf;
|
||||
end
|
||||
%for (scCount=1:numScans)
|
||||
parfor (scCount=1:numScans,parforArg)
|
||||
scCount %for debugging
|
||||
p4L0= cell(18,1);
|
||||
[p4L3,...
|
||||
TmpexpScanIntens3,TmpFexpScanSpots3,TmpFexpScanBMtp3,TmpanlZoneRefs3,Tmpsbdg3]= ...
|
||||
par4GblFnc8c(parMat,tptLength,numScans,selScanNumLst,SWsingleSc,Fflg,PTmapPos,optCirMask,diaExt,doCircle,cirPixA,cirMask,width, ...
|
||||
TmpexpScanIntens0,TmpFexpScanSpots0,TmpFexpScanBMtp0,TmpanlZoneRefs0,scCount,tifFileLstP4,pathname,ImParMat, ...
|
||||
numRows,numCols, scLst,resDir,expDir, p4L0,Tmpsbdg0);
|
||||
|
||||
p4L4(:,scCount)= p4L3; %(:,scCount);
|
||||
TmpexpScanIntens4(scCount)= TmpexpScanIntens3;
|
||||
TmpFexpScanSpots4(scCount)= TmpFexpScanSpots3;
|
||||
TmpFexpScanBMtp4(scCount)= TmpFexpScanBMtp3;
|
||||
TmpanlZoneRefs4(scCount)= TmpanlZoneRefs3;
|
||||
|
||||
Tmpsbdg4(scCount)= Tmpsbdg3;
|
||||
%End of Global Scan loop*******************************************************************************************
|
||||
%**************************************************************************************************************************
|
||||
end
|
||||
%---------------END OF Global Parfor Loop-----------------------------------------%**************************************************************************************************************************
|
||||
357
workflow/templates/easy/par4GblFnc8c.m
Executable file
357
workflow/templates/easy/par4GblFnc8c.m
Executable file
@@ -0,0 +1,357 @@
|
||||
%% CALLED By p4loop8c.m %%
|
||||
function [p4L2, ...
|
||||
TmpexpScanIntens3,TmpFexpScanSpots3,TmpFexpScanBMtp3,TmpanlZoneRefs3,Tmpsbdg3]= ...
|
||||
par4GblFnc8c(parMat,tptLength,~,selScanNumLst,~,Fflg,PTmapPos,optCirMask,diaExt,doCircle,cirPixA,cirMask,~,...
|
||||
TmpexpScanIntens,TmpFexpScanSpots,TmpFexpScanBMtp,TmpanlZoneRefs,scCount,tifFileLstP4,~,ImParMat, ...
|
||||
numRows,numCols,scLst,resDir,expDir,~, Tmpsbdg)
|
||||
|
||||
|
||||
|
||||
selScan= selScanNumLst(scCount);
|
||||
|
||||
tptLength0= length(tifFileLstP4{scCount});
|
||||
%tptLength= numFiles;
|
||||
tifFileLst={tifFileLstP4(scCount)};
|
||||
|
||||
% Extract the Imaging time stamps from selected tif files
|
||||
%clear('e','f'); %can't use clear inside a parfor loop. Preallocation
|
||||
%can be larger than useable .bmp files! Therefore must be small and
|
||||
%increased during for loop to maintain cell size integrity between e & f
|
||||
e= cell(1,2); f= cell(1,2); %(tptLength,2); f= cell(tptLength,2);
|
||||
nndx=0;
|
||||
|
||||
|
||||
for tPt=1:tptLength0 %size(tifFileLst,1) %length(tifFileLst)
|
||||
tifFileLstP4{scCount}(tPt)
|
||||
scLst;
|
||||
scLst(scCount)
|
||||
char(scLst(scCount))
|
||||
char(fullfile(expDir,char(scLst(scCount))))
|
||||
expDir;
|
||||
swCatch=0;
|
||||
nndx=nndx+1;
|
||||
|
||||
tifFile=char(fullfile(expDir,char(scLst(scCount)), tifFileLstP4{scCount}(tPt)));
|
||||
try
|
||||
info = imfinfo(tifFile); %('D:\jwrDevel\DevelCurveFittingJWR\ImageScans\Scan2\020hr002.tif')
|
||||
|
||||
catch ME
|
||||
%Note: During parallel operation Matlab will not open file (fid)
|
||||
%etc. Therefore error message text will not be written.The only way
|
||||
%to get it out would be to pass variable through called function to
|
||||
%the ..Main8c script outside the parfor loop and print to file from
|
||||
%there. Consequently for now it only prints error to file when one
|
||||
%edits p4loop8c.m from 'parfor' to ordinary 'for' loop
|
||||
fFail=((fullfile(resDir,'PrintResults','ImageFileReadFailure.txt')));
|
||||
fid = fopen(fFail,'a'); %create,open and append
|
||||
%fprintf(fid,'%s \n',char(tifFile))
|
||||
fclose(fid)
|
||||
nndx=nndx-1;
|
||||
swCatch=1;
|
||||
rep = getReport(ME, 'basic');
|
||||
rep=strcat('Read info failure for-',tifFile,' -', rep);
|
||||
%fprintf(fid,'%s \n',rep) %See Note:
|
||||
|
||||
end
|
||||
tptLength= nndx;
|
||||
scTmNumeric= 1; %initialize for parfor
|
||||
if swCatch==0
|
||||
scTmNumeric(nndx)=datenum(info.FileModDate);
|
||||
e(nndx,:)= {tifFile, scTmNumeric(nndx)};
|
||||
%newtifFileLst(nndx)= tifFileLst(tPt);
|
||||
end
|
||||
end % end for tPt=1:length(tifFileLst) loop
|
||||
|
||||
%clear tifFileLst; %Can't use clear inside a parfor loop
|
||||
tifFileLst= cell(nndx,1);
|
||||
f= {sortrows(e,2)};
|
||||
tifFileLst= f{1,1}(:,1);
|
||||
|
||||
areaOfIntensAboveBG= zeros(24,16,length(tifFileLst));
|
||||
% *******Calculate Time series for each Plate of Selected Scan ********
|
||||
lastPlateOnScan=1; %Ncode
|
||||
|
||||
tSeriesv=[]; t0Seriesv=[];
|
||||
if tptLength>0 %added to jump over and fill data for invalid Sscan(plate runs
|
||||
scTmNumv= cell2mat(f{1,1}(:,2)); %(:,2)) %120613 fix for variant length data
|
||||
prtTmNumv=min(scTmNumv)-.000001;
|
||||
tSeriesv=((scTmNumv-prtTmNumv)*24);
|
||||
t0Seriesv=((scTmNumv-scTmNumv(1))*24);
|
||||
|
||||
end
|
||||
|
||||
%*********************
|
||||
|
||||
%-------------------------------------------------------
|
||||
|
||||
if tptLength>= 3 %added to jump over and fill data for invalid Sscan(plate runs
|
||||
%*******Create Blank Scan*********************
|
||||
ImHeigth=2075;
|
||||
ImWidth=1400;
|
||||
Empsc=zeros(ImHeigth,ImWidth); %Ncode
|
||||
|
||||
|
||||
%**************************************************************************
|
||||
%*********Start Scan Loop**************************************************
|
||||
lastPlateOnScan=1; %Ncode
|
||||
%**********************************************************************************************************************************
|
||||
disp('Before call to NIscanIntens.....')
|
||||
resDir; %debugging parfor
|
||||
%>>>*******Execute Image conversion into Intensity Data******
|
||||
[Tmpsbdg2, scanIntens, ~, ~, ~, TmpexpScanIntens2, TmpFexpScanSpots2, TmpFexpScanBMtp2, TmpanlZoneRefs2,areaOfIntensAboveBG]= ...
|
||||
NIscanIntensBGpar4GblFnc(Fflg,tifFileLst, ImParMat, PTmapPos,optCirMask,diaExt,doCircle,cirPixA,numRows,numCols,ImHeigth,ImWidth,cirMask, ...
|
||||
tptLength,selScan,Empsc,TmpexpScanIntens,TmpFexpScanSpots,TmpFexpScanBMtp,TmpanlZoneRefs,resDir, Tmpsbdg);
|
||||
|
||||
%<<<<*******************************************************************************************************************************
|
||||
|
||||
TmpexpScanIntens3= TmpexpScanIntens2;
|
||||
TmpFexpScanSpots3= TmpFexpScanSpots2;
|
||||
TmpFexpScanBMtp3= TmpFexpScanBMtp2;
|
||||
TmpanlZoneRefs3= TmpanlZoneRefs2;
|
||||
Tmpsbdg3= Tmpsbdg2;
|
||||
|
||||
|
||||
%***********************************************************************************
|
||||
|
||||
%Package Image data ->for Legacy Printing
|
||||
|
||||
%clear plate %Can't use clear inside a parfor loop
|
||||
CFscanIntens= zeros(384,1);%zeros(16,24);
|
||||
plate= [];
|
||||
plate= zeros(24,16,tptLength);
|
||||
|
||||
plate(:,:,:,1)= scanIntens(1:1:24,16:-1:1,:); %TmpexpScanIntens2(1:1:24,16:-1:1,:);%Ncode Dev3Vertical Similar to below
|
||||
|
||||
%*******************************
|
||||
%NIcheck %Check for bad scans at time points (swapped plates etc.)
|
||||
%*******************************
|
||||
%set up cell arrays for storing each plate in each Scan ..(scan,plate)
|
||||
SWprint=0;
|
||||
if SWprint==1
|
||||
wkDir=pwd;
|
||||
cd (fullfile(resDir,'PrintResults'));
|
||||
end
|
||||
|
||||
% Construct Legacy ...Intens.txt file
|
||||
if SWprint==1
|
||||
filename=(strcat('Plate',num2str(selScan),'_Intens.txt'));
|
||||
fid = fopen(filename,'w');
|
||||
end
|
||||
if length(size(plate))==2 %Only two dims if only one image
|
||||
numOfImages=1;
|
||||
else
|
||||
numOfImages= size(plate,3);
|
||||
end
|
||||
CFscanIntens= zeros(384,numOfImages);
|
||||
locIndx=0; pl=1;
|
||||
for n=1:numCols %Ncode changed to 16 for Vert
|
||||
for m=1:numRows %Ncode change to 24 for Vert
|
||||
locIndx=locIndx+1;
|
||||
|
||||
for k=1:numOfImages
|
||||
if SWprint==1
|
||||
if k==1 && numOfImages==1, fprintf(fid,'%.2f\n',plate(m,n,k,pl));end
|
||||
if k==1 && numOfImages~=1, fprintf(fid,'%.2f',plate(m,n,k,pl));end
|
||||
if k>1 && k<numOfImages, fprintf(fid,'\t%.2f',plate(m,n,k,pl));end %
|
||||
if k~=1 && k==numOfImages,fprintf(fid,'\t%.2f\n',plate(m,n,k,pl));end
|
||||
end
|
||||
|
||||
|
||||
CFscanIntens(locIndx,k)= plate(m,n,k,pl);
|
||||
end
|
||||
%MatLab Cell storage
|
||||
|
||||
end
|
||||
end %end row loop n
|
||||
|
||||
if SWprint==1
|
||||
fclose(fid);
|
||||
end
|
||||
|
||||
%++++++++++++++++++++++
|
||||
%printGrwAreas
|
||||
|
||||
%Area as the max number of pixels with intensities greater than the Background
|
||||
%grArea(row,col,tPt,Plate) Note that images r and c are 90 degrees shifted
|
||||
%and then mirror imaged. Thus data must be inverted and rotated to get
|
||||
%for the rows a-p and col 1-24 (and the EMS expected 1-384) orientation
|
||||
%clear grArea
|
||||
grArea= ones(24,16,tptLength);
|
||||
grArea(:,:,:,1)= areaOfIntensAboveBG(1:1:24,16:-1:1,:); %for Ncode dev3vert
|
||||
|
||||
%for p=1:lastPlateOnScan
|
||||
if SWprint==1
|
||||
if SWgrowthArea==1
|
||||
filename=(strcat('Plate',num2str(selScan),'_Areas.txt'));
|
||||
else
|
||||
filename=(strcat('ALTgrowthA_Scan',num2str(selScan),'_Plate',num2str(1),'_Areas.txt'));
|
||||
filename=(strcat('ALTgrowthA_Plate',num2str(selScan),'_Plate','_Areas.txt'));
|
||||
end
|
||||
fid = fopen(filename,'w');
|
||||
end
|
||||
locIndx=0;
|
||||
Ag= zeros(1,384);
|
||||
for m=1:16 %Ncode change from 16 %Vert back to 16
|
||||
for n=1:24 %Ncode change from 24 %Vert back to 24
|
||||
growthArea=max(grArea(n,m,:,1));
|
||||
if SWprint==1
|
||||
fprintf(fid,'%3.f\n',growthArea);
|
||||
end
|
||||
locIndx=locIndx+1;
|
||||
Ag(locIndx)= growthArea;
|
||||
end
|
||||
end
|
||||
if SWprint==1
|
||||
fclose(fid);
|
||||
end
|
||||
%end
|
||||
%++++++++++++++++++++++++
|
||||
|
||||
if SWprint==1
|
||||
cd(wkDir);
|
||||
fclose('all');
|
||||
end
|
||||
|
||||
%********AutoImCF curveFit kickoff setup***********************************************************
|
||||
autoImCFlag=1;
|
||||
|
||||
if autoImCFlag==1, SWgrowthArea=1;end
|
||||
|
||||
times= tSeriesv;
|
||||
|
||||
scanAreas= Ag; %growthArea;
|
||||
offsets=0;
|
||||
suffix= strcat('Scan', num2str(selScan),'_Plate', num2str(1)); %char(QspLst(n));
|
||||
AUCfinalTime=96;
|
||||
arrayFormat=384;
|
||||
currDirResults= fullfile(resDir,'PrintResults');
|
||||
|
||||
%******Version compatability fixes*******assoc'd with diff and solve
|
||||
%{
|
||||
v11a='7.12.0.635 (R2011a)';
|
||||
v14a='8.3.0.532 (R2014a)';
|
||||
%v14b='8.4.0.150421 (R2014b)';
|
||||
v18a='9.4.0.813654 (R2018a)';
|
||||
v18b='9.5.0.944444 (R2018b)';
|
||||
%Fourth order derivative of logistic equation********************************
|
||||
if isequal(v18a,version)||isequal(v18b,version)
|
||||
syms t K r l;
|
||||
fd4= diff(K / (1 + exp(-r* (t - l ))),t,4);
|
||||
else
|
||||
fd4=diff(sym('K / (1 + exp(-r* (t - l )))'),4);
|
||||
end
|
||||
sols= solve(fd4);
|
||||
if isequal(v11a,version) || isequal(v14a,version)
|
||||
else
|
||||
tmpswap= sols(1);
|
||||
sols(1)= sols(3);
|
||||
sols(3)= tmpswap;
|
||||
end
|
||||
%}
|
||||
|
||||
if verLessThan('matlab','8.3') %original work 23_0227 updated 23_0525 (8.4 changed to 8.3)
|
||||
fd4=diff(sym('K / (1 + exp(-r* (t - l )))'),4);
|
||||
sols= solve(fd4);
|
||||
else %accomodate new matlab changes after 2014a fix 2nd update 23_0227
|
||||
syms t K r l;
|
||||
fd4= diff(K / (1 + exp(-r* (t - l ))),t,4);
|
||||
sols= solve(fd4);
|
||||
tmpswap= sols(1);
|
||||
sols(1)= sols(3);
|
||||
sols(3)= tmpswap;
|
||||
end
|
||||
%********************************************************************************
|
||||
%CFscanIntens
|
||||
%adsd
|
||||
%********************************************************************************
|
||||
|
||||
%>>>>>>>>>>>Call CurveFit routine >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
%NCfitImCF(times, CFscanIntens, offsets, suffix, AUCfinalTime, arrayFormat, scanAreas, currDirResults, autoImCFlag, selScan,sols) %,scan)%, scPltList) outputDirectory;
|
||||
%[scanTmp2]= NCfitImCFparforFailGbl(times, CFscanIntens, offsets, suffix, AUCfinalTime, arrayFormat, scanAreas, currDirResults, autoImCFlag, selScan, sols, scanTmp); %,scan)%, scPltList) outputDirectory;
|
||||
|
||||
[par4scanselIntensStd,par4scanselTimesStd,par4scanTimesELr,par4scanIntensELr,par4scanCFparameters,par4scanCFdate,outC2,outCstd2]= ...
|
||||
NCfitImCFparforFailGbl2(parMat,times, CFscanIntens, offsets, suffix, AUCfinalTime, arrayFormat, scanAreas, currDirResults, autoImCFlag, selScan, sols); %,scan)%, scPltList) outputDirectory;
|
||||
%<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
else %fill with default values when an invalid plate scan occurs
|
||||
CFscanIntens= zeros(16,24);
|
||||
Ag= zeros(1,384);
|
||||
%Preallocation for parfor loop**********************************
|
||||
|
||||
times= tSeriesv;
|
||||
st(1,1:size(times,2))= 1111;
|
||||
resMat(1,1:27)= 0;
|
||||
resMatStd= resMat;
|
||||
outC2= zeros(384,27);
|
||||
outCstd2= zeros(384,27);
|
||||
for m=1:384
|
||||
pa{m}= st;
|
||||
|
||||
par4scanCFparameters{m}= parMat;
|
||||
par4scanCFdate{m}= datestr((now),31);
|
||||
end
|
||||
par4scanselTimesStd= pa;
|
||||
par4scanselIntensStd= pa;
|
||||
par4scanTimesELr= pa;
|
||||
par4scanIntensELr= pa;
|
||||
par4resMat= zeros(384,27);
|
||||
par4resMatStd= zeros(384,27);
|
||||
%{
|
||||
TmpexpScanIntens00= cell(1); %cell(1,scanMax);
|
||||
TmpFexpScanSpots00= cell(1); %cell(1,scanMax);
|
||||
TmpFexpScanBMtp00= cell(1); %cell(1,scanMax);
|
||||
TmpanlZoneRefs00= cell(1); %cell(1,scanMax);
|
||||
Tmpsbdg00= cell(1);
|
||||
%}
|
||||
|
||||
TmpexpScanIntens3= cell(1); %TmpexpScanIntens2;
|
||||
TmpFexpScanSpots3= cell(1); %TmpFexpScanSpots2;
|
||||
TmpFexpScanBMtp3= cell(1); %TmpFexpScanBMtp2;
|
||||
TmpanlZoneRefs3= cell(1); %TmpanlZoneRefs2;
|
||||
Tmpsbdg3= cell(1); %Tmpsbdg2;
|
||||
%****************************************************************
|
||||
|
||||
|
||||
end %if tptLenth>=3 line19 20_0928
|
||||
|
||||
|
||||
|
||||
|
||||
tSeriesv; %debuggin parfor
|
||||
p4L1{1}= tSeriesv;
|
||||
p4L1{2}= t0Seriesv;
|
||||
p4L1{3}= datestr(prtTmNumv,31);
|
||||
p4L1{4}= CFscanIntens;
|
||||
|
||||
|
||||
locIndx=0;
|
||||
for n=1:numCols %Ncode changed to 16 for Vert
|
||||
for m=1:numRows %Ncode change to 24 for Vert
|
||||
locIndx=locIndx+1;
|
||||
rc=[n,m];
|
||||
p4rcTmp(locIndx)={rc};
|
||||
p4pIndxTmp(locIndx)=locIndx;
|
||||
end
|
||||
end
|
||||
|
||||
p4L1{5}= p4rcTmp;
|
||||
p4L1{6}= p4pIndxTmp;
|
||||
p4L1{7}= Ag;
|
||||
|
||||
p4L1{8}= par4scanselIntensStd;
|
||||
p4L1{9}= par4scanselTimesStd;
|
||||
p4L1{10}= par4scanTimesELr;
|
||||
p4L1{11}= par4scanIntensELr;
|
||||
|
||||
p4L1{12}= par4scanCFparameters;
|
||||
p4L1{13}= par4scanCFdate;
|
||||
|
||||
p4L1{14}= outC2;
|
||||
p4L1{15}= outCstd2;
|
||||
p4L1{16}= selScan;
|
||||
|
||||
p4L1{17}= cirPixA;
|
||||
p4L1{18}= datestr((now),31);
|
||||
|
||||
p4L2= p4L1;
|
||||
end
|
||||
|
||||
342
workflow/templates/easy/par4Gbl_Main8c.m
Executable file
342
workflow/templates/easy/par4Gbl_Main8c.m
Executable file
@@ -0,0 +1,342 @@
|
||||
%% CALLED BY EASYconsole.m %%
|
||||
|
||||
%function NImStartupImCF02par4Gbl
|
||||
Fflg= 1; %0;
|
||||
|
||||
fclose('all'); %close all open files
|
||||
clear ('plate2', 'scanIntens','Scanfiles','pathname','tifFileLstP4')
|
||||
|
||||
%global SWsingleSc
|
||||
global SWgrowthArea
|
||||
global scLst
|
||||
global ImParMat
|
||||
%global CSearchRange
|
||||
%global CSrchRng
|
||||
global expDir
|
||||
global SWnewExp
|
||||
%Console globals*******
|
||||
global openExpfile
|
||||
global openExppath
|
||||
global newExpfile
|
||||
global newExppath
|
||||
global ExpOutmat
|
||||
global fhconsole
|
||||
global ExpPath
|
||||
global resDir
|
||||
global wCodeDir
|
||||
global matDir %
|
||||
|
||||
global ImWidth
|
||||
global ImHeigth
|
||||
global numRows;
|
||||
global numCols;
|
||||
%global SWprintLeg
|
||||
global scan
|
||||
%global scanSize
|
||||
global scanMax
|
||||
global tptLength
|
||||
|
||||
%global sols
|
||||
%global CFmeth
|
||||
numRows=24; %for Single Vertical
|
||||
numCols=16; %for Single Vertical
|
||||
|
||||
%global scanPar4x
|
||||
%*************CIRCLE related*************************
|
||||
|
||||
doCircle=1; %use Circle area analysis 14_0807
|
||||
radius=14;
|
||||
ImParMat(10)=radius;
|
||||
ImParMat(11)=doCircle;
|
||||
|
||||
try
|
||||
clf(fhconsole,'reset')
|
||||
catch ME
|
||||
end
|
||||
close
|
||||
%******************************************
|
||||
EASYconsole
|
||||
%******************************************
|
||||
try
|
||||
load(ExpOutmat)
|
||||
copyfile(ExpOutmat,(fullfile(matDir,'BkUp',strcat((num2str(datenum(now))),'.mat'))))
|
||||
catch
|
||||
end
|
||||
|
||||
try
|
||||
load(fullfile(resDir,'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
|
||||
%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(resDir,'PTmats','Nbdg')) %Left in to accomodate loads of work before 20_0819
|
||||
end
|
||||
%++++++++++++++Load Fotos stored data++++++++++++++++++++
|
||||
try
|
||||
load(fullfile(resDir,'Fotos','Coordinates'))
|
||||
catch
|
||||
end
|
||||
try
|
||||
load(fullfile(resDir,'Fotos','BGatTpts'))
|
||||
catch
|
||||
end
|
||||
try
|
||||
load(fullfile(resDir,'Fotos','anlZones'))
|
||||
catch
|
||||
end
|
||||
%******autoImCF*******************
|
||||
try
|
||||
load(fullfile(resDir,'PTmats','NCFparms'))
|
||||
catch ME
|
||||
load parameters
|
||||
end
|
||||
%*******************************
|
||||
%************Get Print Times*******************************
|
||||
PrintTimes=[];
|
||||
w= cd; %Capture current dir in w
|
||||
if ispc %Linux accommodation
|
||||
expDir=fullfile(ExpPath,'\');
|
||||
else
|
||||
if isunix, expDir= ExpPath;end
|
||||
if ismac , expDir=ExpPath;end
|
||||
end
|
||||
scLst={};
|
||||
%**************Parameter Entry******************
|
||||
NImParamRadiusGui(expDir) %Ncode 122111replaced removed ,numOfPrtTimes)
|
||||
%***********************************************
|
||||
%width=ImParMat(5);
|
||||
width=24;
|
||||
widthEx=width-1; %width extention from reference point
|
||||
dither=ImParMat(6);
|
||||
radius=ImParMat(10);
|
||||
%>>>>>>>>>>>>>>>>>>>>>>
|
||||
NIcircle
|
||||
%<<<<<<<<<<<<<<<<<<<<<<<
|
||||
|
||||
%***************** Load Stuff*************************
|
||||
|
||||
lastPlateOnLastScan=1; %Ncode
|
||||
|
||||
if size(scLst,1)==1,SWsingleSc=1;else SWsingleSc=0;end
|
||||
%**************************????????????????????????
|
||||
|
||||
dvec=datevec(datestr(floor(now))); %method to get current offset year '01-Jan-"currentyr"'
|
||||
dvec(2)=1;
|
||||
dvec(3)=1;
|
||||
%yrOffset=datenum('01-Jan-2012');%(dvec); %('01-Jan-2009'); %time num default is currentyear jan1
|
||||
%******************+++++++++++++*****************+++++++++++++++***********
|
||||
numScans=size(scLst,1);
|
||||
|
||||
if(isequal(SWsingleSc,1))
|
||||
selScan=str2double(char(scLst(1)));
|
||||
%numScans=selScan;
|
||||
%startScan=selScan;
|
||||
else
|
||||
%startScan=1;
|
||||
end
|
||||
|
||||
SWgrowthArea= ImParMat(9);
|
||||
load(fullfile(resDir,'PTmats','NPTmapSearch'))
|
||||
PTmapPos= detPos;
|
||||
|
||||
%**************************************************************************
|
||||
selScanNumLst= [];
|
||||
|
||||
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
%**************************************************************************
|
||||
%*********Preallocation for Scan Loop**************************************************
|
||||
|
||||
Scanfiles=[];
|
||||
pathname=[];
|
||||
%++++++++++++++++++++++++++++++++ SETUP FOR GLOBAL PARFOR LOOP+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
%if SWsingleSc == 1 %if single scan else do expMultiTseries to execute multiple scans
|
||||
%******Gui Select Scan -> *.tif files for Analysis*****************
|
||||
w= cd; %Capture current dir in w
|
||||
if ispc
|
||||
cd(char(strcat(expDir,scLst(1))))
|
||||
end
|
||||
if isunix
|
||||
cd (fullfile(expDir,cell2mat(scLst(1))));
|
||||
end
|
||||
Scanfiles=[];
|
||||
pathname=[];
|
||||
|
||||
|
||||
for ii= 1:length(scLst)
|
||||
if SWsingleSc == 1
|
||||
[Scanfiles, pathname]=uigetfile('*.bmp', 'Select files','MultiSelect','on');% change '*hr*.bmp' 12/20/2011
|
||||
if ischar(Scanfiles)
|
||||
scd= imread(char(Scanfiles));
|
||||
tptLength=1;
|
||||
|
||||
else
|
||||
scd= imread(char(Scanfiles(1,1)));
|
||||
tptLength= length(Scanfiles);
|
||||
end
|
||||
ImHeigth= size(scd,1);
|
||||
ImWidth= size(scd,2);
|
||||
sc=scd(1:ImHeigth,1:ImWidth); %?Not used RefOnly
|
||||
end
|
||||
|
||||
cd (w);
|
||||
numFiles= size(Scanfiles,2);
|
||||
%tifFileLst= Scanfiles;
|
||||
|
||||
%Initialize tifFilesLst for parfor loop
|
||||
if ispc %Linux and mac accomodation
|
||||
tifFileLst4MultiT = dir(fullfile(expDir, char(scLst(ii)), '\*.bmp'));
|
||||
end
|
||||
if isunix || ismac
|
||||
tifFileLst4MultiT = dir(fullfile(expDir, char(scLst(ii)), '*.bmp'));
|
||||
end
|
||||
numFiles=length(tifFileLst4MultiT);
|
||||
tptLength= numFiles;
|
||||
tifFileLstP4{ii}={tifFileLst4MultiT.name};
|
||||
%{
|
||||
dateTmStampP4{ii}= {tifFileLst4MultiT.date}
|
||||
dateTmNum{ii}= datenum(dateTmStampP4{1});
|
||||
info{ii} = imfinfo(tifFileLstP4{ii});
|
||||
scTmNumericP4(ii)=datenum(info{ii}.FileModDate);
|
||||
%}
|
||||
end
|
||||
|
||||
|
||||
|
||||
%**************************************************************************
|
||||
%**************************************************************************
|
||||
|
||||
for jj= 1:numScans %startScan:numScans
|
||||
selScan= str2double(char(scLst(jj)));
|
||||
selScanNumLst(jj)= selScan;
|
||||
end
|
||||
selScanNumLst2= selScanNumLst; %function passthrough, passback to par4gbl_Main 20_0205
|
||||
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
%PREALLOCATION PREALLOCATION PREALLOCATION PREALLOCATION PREALLOCATION
|
||||
%******************************************************************************
|
||||
scCount= [];
|
||||
|
||||
TmpexpScanIntens00= cell(1); %cell(1,scanMax);
|
||||
TmpFexpScanSpots00= cell(1); %cell(1,scanMax);
|
||||
TmpFexpScanBMtp00= cell(1); %cell(1,scanMax);
|
||||
TmpanlZoneRefs00= cell(1); %cell(1,scanMax);
|
||||
Tmpsbdg00= cell(1);
|
||||
|
||||
TmpexpScanIntens4= cell(1,numScans);
|
||||
TmpFexpScanSpots4= cell(1,numScans);
|
||||
TmpFexpScanBMtp4= cell(1,numScans);
|
||||
TmpanlZoneRefs4= cell(1,numScans);
|
||||
Tmpsbdg4= cell(1,numScans);
|
||||
TmpexpScanIntens5= cell(1,numScans);
|
||||
TmpFexpScanSpots5= cell(1,numScans);
|
||||
TmpFexpScanBMtp5= cell(1,numScans);
|
||||
TmpanlZoneRefs5= cell(1,numScans);
|
||||
Tmpsbdg5= cell(1,numScans);
|
||||
|
||||
p4L00= cell(18,1);
|
||||
p4L0= p4L00;
|
||||
|
||||
p4L4= cell(18,numScans);
|
||||
p4L5= p4L4;
|
||||
|
||||
Ag= ones(384);
|
||||
CFscanIntens= zeros(16,24);
|
||||
|
||||
|
||||
[p4L4,...
|
||||
TmpexpScanIntens5,TmpFexpScanSpots5,TmpFexpScanBMtp5,TmpanlZoneRefs5,Tmpsbdg5]= ...
|
||||
p4loop8c(parMat,tptLength,numScans,selScanNumLst,SWsingleSc,Fflg,PTmapPos,optCirMask,diaExt,doCircle,cirPixA,cirMask,width, ...
|
||||
TmpexpScanIntens00,TmpFexpScanSpots00,TmpFexpScanBMtp00,TmpanlZoneRefs00,scCount,tifFileLstP4,pathname,ImParMat, ...
|
||||
numRows,numCols,scLst,resDir,expDir, p4L00,TmpexpScanIntens4,TmpFexpScanSpots4,TmpFexpScanBMtp4,TmpanlZoneRefs4, ...
|
||||
Tmpsbdg00,Tmpsbdg4);
|
||||
|
||||
|
||||
|
||||
for scanCnt= 1:numScans
|
||||
selScan= p4L4{16,scanCnt}; %determine the actual scan in the scanCnt parfor distributed "id"
|
||||
scan(selScan).plate(1).tSeries= cell2mat(p4L4(1,scanCnt));
|
||||
scan(selScan).plate(1).t0Series= cell2mat(p4L4(2,scanCnt));
|
||||
scan(selScan).plate(1).printTm= cell2mat(p4L4(3,scanCnt));
|
||||
scan(selScan).plate(1).intens= cell2mat(p4L4(4,scanCnt));
|
||||
scan(selScan).plate(1).rc= p4L4(5,scanCnt);
|
||||
scan(selScan).plate(1).pIndx= cell2mat(p4L4(6,scanCnt));
|
||||
scan(selScan).plate(1).Ag= cell2mat(p4L4(7,scanCnt));
|
||||
|
||||
scan(selScan).plate(1).selIntens= p4L4(8,scanCnt);
|
||||
scan(selScan).plate(1).selTimes= p4L4(9,scanCnt);
|
||||
scan(selScan).plate(1).filterTimes= p4L4(10,scanCnt);
|
||||
scan(selScan).plate(1).normIntens= p4L4(11,scanCnt);
|
||||
|
||||
%scan(selScan).plate(1).CFparameters= p4L4(12,scanCnt); %Need to convert to a matrix form like Old versions
|
||||
CFparm(1:384)=p4L4{12,scanCnt}(1:384);
|
||||
scan(selScan).plate(1).CFparameters= CFparm;
|
||||
scan(selScan).plate(1).CFdate= p4L4(13,scanCnt);
|
||||
scan(selScan).plate(1).CFout= cell2mat(p4L4(14,scanCnt));
|
||||
scan(selScan).plate(1).CFoutStd= cell2mat(p4L4(15,scanCnt));
|
||||
|
||||
|
||||
scan(selScan).Awindow= cell2mat(p4L4(17,scanCnt));
|
||||
scan(selScan).Idate= cell2mat(p4L4(18,scanCnt));
|
||||
|
||||
|
||||
expScanIntens(selScan)= TmpexpScanIntens5(scanCnt);
|
||||
FexpScanSpots(selScan)= TmpFexpScanSpots5(scanCnt);
|
||||
FexpScanBMtp(selScan)= TmpFexpScanBMtp5(scanCnt);
|
||||
anlZoneRefs(selScan)= TmpanlZoneRefs5(scanCnt);
|
||||
if ~isempty(Tmpsbdg5{scanCnt})
|
||||
sbdg(selScan)= Tmpsbdg5(scanCnt);
|
||||
else
|
||||
sbdg{selScan}= uint8(zeros(24,16,4));
|
||||
end
|
||||
end
|
||||
|
||||
%SAVE DATA in .mat files
|
||||
save(ExpOutmat,'scan');
|
||||
save((fullfile(resDir,'PTmats','Nbdg')), 'sbdg'); %legacy location can probably get rid of in time
|
||||
save((fullfile(resDir,'Fotos','Nbdg')), 'sbdg');
|
||||
|
||||
save((fullfile(resDir,'Fotos','Coordinates')),'FexpScanSpots') %Saves frames at each tPt
|
||||
save((fullfile(resDir,'Fotos','BGatTpts')),'FexpScanBMtp')
|
||||
save((fullfile(resDir,'Fotos','anlZones')),'anlZoneRefs')%Saves anl Positions at each tPt
|
||||
|
||||
%Print FitResults *******************************************************
|
||||
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));
|
||||
fileNamePlate = [filePrefix fileSuffix fileExt];
|
||||
fileName= fullfile(resDir,'PrintResults', 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
|
||||
%used as a diagnostic tool.
|
||||
|
||||
|
||||
outCprint= p4L4;
|
||||
|
||||
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');
|
||||
for n=1:384 %startCount:numCultures
|
||||
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',...
|
||||
outCprint{14,scanCnt}(n,1),outCprint{14,scanCnt}(n,2),outCprint{14,scanCnt}(n,3),outCprint{14,scanCnt}(n,4),...
|
||||
outCprint{14,scanCnt}(n,5),outCprint{14,scanCnt}(n,6),outCprint{14,scanCnt}(n,7),outCprint{14,scanCnt}(n,8),...
|
||||
outCprint{14,scanCnt}(n,9),outCprint{14,scanCnt}(n,10),outCprint{14,scanCnt}(n,11),outCprint{14,scanCnt}(n,12),...
|
||||
outCprint{14,scanCnt}(n,13),outCprint{14,scanCnt}(n,14),outCprint{14,scanCnt}(n,15),outCprint{14,scanCnt}(n,16));
|
||||
end
|
||||
fclose(fid);
|
||||
end
|
||||
|
||||
EASYconsole;
|
||||
|
||||
|
||||
%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
Reference in New Issue
Block a user