Who even knows at this point
This commit is contained in:
@@ -293,7 +293,7 @@ function NewExpDat_Callback(~, ~, ~)
|
||||
|
||||
% create supporting dirs
|
||||
% this is also in the workflow script but here for standalone mode
|
||||
dirs={'PrintResults', 'CFfigs', 'Fotos', 'Fotos/BkUp'};
|
||||
dirs={'PrintResults', 'CFfigs', 'Fotos'};
|
||||
for i=1:length(dirs)
|
||||
d=dirs{i};
|
||||
if ~exist(fullfile(easyResultsDir, d), 'dir')
|
||||
@@ -335,7 +335,7 @@ function LoadDatFile_Callback(~, ~, ~)
|
||||
global fhconsole
|
||||
|
||||
try
|
||||
questdlg('Load results .mat from ../ExpJobs/YourJob/Results/matResults/','File Creation','OK', struct('Default','OK','Interpreter','tex'));
|
||||
questdlg('Load results .mat from ../out/project/','File Creation','OK', struct('Default','OK','Interpreter','tex'));
|
||||
[inputFile,inputPath]=uigetfile('.mat','Open Experiment folder and data storage .mat file name','MultiSelect','off');
|
||||
matDir=fullfile(inputPath);
|
||||
matFile=fullfile(inputPath,inputFile);
|
||||
@@ -370,11 +370,6 @@ function LoadDatFile_Callback(~, ~, ~)
|
||||
disp('WARNING: cannot find project scans');
|
||||
end
|
||||
|
||||
bkupDir=fullfile(matDir,'BkUp');
|
||||
if ~exist(bkupDir, 'dir')
|
||||
mkkdir(bkupDir);
|
||||
end
|
||||
|
||||
% Create supporting dirs
|
||||
dirs={'PrintResults', 'figs', 'CFfigs', 'PTmats', 'Fotos'};
|
||||
for i=1:length(dirs)
|
||||
|
||||
@@ -48,7 +48,7 @@ end
|
||||
% EASYconsole
|
||||
|
||||
if exist(matFile, 'file')
|
||||
bkUpMatFile=fullfile(matDir,'BkUp',matFile);
|
||||
bkUpMatFile=fullfile(matFile, '.bk');
|
||||
copyfile(matFile,bkUpMatFile);
|
||||
end
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ for n=1:(size(c,1))
|
||||
ii=ii+1;
|
||||
expDlst(ii)=exDlst(n);
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
clear matFile
|
||||
@@ -21,7 +20,6 @@ ii=0;
|
||||
for m= 1:size(expDlst,2)
|
||||
exD=fullfile(exFolder,cell2mat(expDlst(m)))
|
||||
dirLst=dir(exD);
|
||||
|
||||
clear matFlst
|
||||
clear resF
|
||||
clear resMatF
|
||||
@@ -37,11 +35,10 @@ for m= 1:size(expDlst,2)
|
||||
resDir{ii}=fullfile(exFolder,cell2mat(expDlst(m)),resF)
|
||||
matFile(m)=cellstr(fullfile(resMatF,matFlst(o).name))
|
||||
end
|
||||
end %for o=1:size(matFlst,1)
|
||||
|
||||
end %if sum(ismember('Results2', dirLst(n).name))
|
||||
end %for n=1:size(dirLst,1)
|
||||
end %for m= 1:size(expDlst,2)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Exp(expN).DexpLength= size(matFile,2);
|
||||
Exp(expN).DexpN= size(matFile,2);
|
||||
|
||||
@@ -1,27 +1,23 @@
|
||||
% EZplotUcmp.m
|
||||
|
||||
%***********User find and build composite of Selected Gene Composite and
|
||||
%*************Plot it on OLay Plot and Trend plot DNLaxles
|
||||
%***************For Single and Multi experiment Studies
|
||||
% User find and build composite of Selected Gene Composite and
|
||||
% Plot it on OLay Plot and Trend plot DNLaxles
|
||||
% For Single and Multi experiment Studies
|
||||
% Called when Composite_ toggle button is clicked.
|
||||
% Data stored for printable Trend Plot production (click [L] in DNLaxes )
|
||||
%*********************
|
||||
|
||||
global ghandles
|
||||
global Exp
|
||||
global exDlst
|
||||
global exFolder
|
||||
|
||||
|
||||
traceN=Exp(expN).traceN;
|
||||
DexpN=Exp(expN).DexpN;
|
||||
dmSel=Exp(zoneSel).Dexp(DexpN).pertSel;
|
||||
% dmSel=str2num(get(ghandles.DMed3,'string'))
|
||||
|
||||
|
||||
patrnN=strfind(selGnOrf{1},':'); %Extract Gene-Orf Name
|
||||
patrnN=strfind(selGnOrf{1},':'); % extract Gene-Orf Name
|
||||
patrndash=strfind(selGnOrf{1},'-');
|
||||
selStrNm= char(selGnOrf)
|
||||
selStrNm=char(selGnOrf);
|
||||
usrGene=selStrNm(1:(patrnN(1)-1));
|
||||
|
||||
if strcmpi(selStrNm(1:3),'RF-')
|
||||
usrGeneSearch=selStrNm(4:(patrndash(2)-1));
|
||||
elseif strcmp(selStrNm(1:3),'RF1')
|
||||
@@ -30,14 +26,13 @@ else
|
||||
usrGeneSearch=selStrNm(1:(patrnN(1)-1));
|
||||
end
|
||||
|
||||
|
||||
|
||||
prompt={'Enter Specifics Term if used to futher specify selection '};
|
||||
dlg_title='User Specifics Term for Refinement Composite';
|
||||
num_lines=1;
|
||||
def={'None'};
|
||||
answer=inputdlg(prompt,dlg_title,num_lines,def);
|
||||
usrSpec=cell2mat(answer(1));
|
||||
|
||||
if strcmpi(usrSpec,'None'), usrGnSp={strcat(usrGene,'-')};
|
||||
elseif length(usrSpec)> 8,
|
||||
trimUspec=usrSpec(1:8);
|
||||
@@ -47,27 +42,19 @@ end
|
||||
usrGnSp=strcat(usrGene,',',{trimUspec});
|
||||
end
|
||||
|
||||
%for n= DexpN:DexpN %n= 1:Exp(expN).DexpLength %LOOP Thru DayExps
|
||||
% For n=DexpN:DexpN %n=1:Exp(expN).DexpLength %LOOP Thru DayExps
|
||||
n=DexpN;
|
||||
MPnum=length(Exp(expN).Dexp(DexpN).MP);
|
||||
DMnum=length(Exp(expN).Dexp(DexpN).DM.drug);
|
||||
|
||||
% Extract expDay from ExpName string
|
||||
dayNpos=max(strfind(Exp(expN).Dexp(DexpN).ExpFoldr, '_D'));
|
||||
dayLbl=Exp(expN).Dexp(DexpN).ExpFoldr(dayNpos+1:end);
|
||||
|
||||
|
||||
%*********************************
|
||||
|
||||
dRF1indx=0;
|
||||
|
||||
usrSp=usrSpec; % user entry of Specifics for Ref selection
|
||||
|
||||
%*******************************************************
|
||||
for mp=1:length(Exp(expN).Dexp(DexpN).MP)
|
||||
|
||||
for ind384=1:384
|
||||
try %
|
||||
try
|
||||
% Insert test for numeric in genename and orf if isnumeric
|
||||
% Correct common EXCEL problem of converting OCT1 into a date numeric
|
||||
if cell2mat(Exp(expN).Dexp(DexpN).MP(mp).genename{1}(ind384))==38991,
|
||||
@@ -75,34 +62,27 @@ for mp=1:length(Exp(expN).Dexp(DexpN).MP)
|
||||
elseif isnumeric(cell2mat(Exp(expN).Dexp(DexpN).MP(mp).genename{1}(ind384)))
|
||||
Exp(expN).Dexp(DexpN).MP(mp).genename{1}(ind384)={' '};
|
||||
end
|
||||
%*****************************************************************
|
||||
|
||||
% DISPersed REFerence capture and find Medians
|
||||
if ( ((strcmpi((Exp(expN).Dexp(DexpN).MP(mp).genename{1}(ind384)),usrGeneSearch) && ...
|
||||
strcmpi((Exp(expN).Dexp(DexpN).MP(mp).specifics{1}(ind384)),usrSp)))...
|
||||
|| ((strcmpi((Exp(expN).Dexp(DexpN).MP(mp).genename{1}(ind384)),usrGeneSearch) && ...
|
||||
strcmpi((Exp(expN).Dexp(DexpN).MP(mp).specifics{1}(ind384)),usrSp))) || ...
|
||||
((strcmpi((Exp(expN).Dexp(DexpN).MP(mp).genename{1}(ind384)),usrGeneSearch) && ...
|
||||
strcmpi(usrSp,'None'))) ),
|
||||
|
||||
dRF1indx=dRF1indx+1;
|
||||
Exp(expN).Dexp(DexpN).MP(mp).genename{1}(ind384) =strrep((Exp(expN).Dexp(DexpN).MP(mp).genename{1}(ind384)),':',' ');
|
||||
drf(dRF1indx,1)=(Exp(expN).Dexp(DexpN).MP(mp).genename{1}(ind384));
|
||||
drf(dRF1indx,2)={mp}; drfMP(dRF1indx,mp)=mp;
|
||||
drf(dRF1indx,3)={ind384}; drfPindx(dRF1indx,mp)=ind384;
|
||||
%drf(dRF1indx,7)=(Exp(expN).Dexp(DexpN).MP(mp).specifics{1}(ind384));
|
||||
|
||||
end %if isempty(regexpi(char((Exp(expN).Dexp(DexpN).MP(mp).genename{1}(ind384))),'blank'))...
|
||||
%*******************************************************************************
|
||||
end
|
||||
catch
|
||||
msgBadGeneName=strcat('check genename at mp=',num2str(mp),' indx=',num2str(ind384))
|
||||
end
|
||||
|
||||
end %end associated with for ind384=1:384
|
||||
end
|
||||
mp
|
||||
end %end associated with for mp=1:length(Exp(expN).Dexp(DexpN).MP)
|
||||
%*****************************************************
|
||||
%************************************************************************************************
|
||||
end
|
||||
|
||||
vvL=[]; %Initialize to cover case where all spot are Zero NoGrowth See NIGrowthflg==0
|
||||
vvL=[]; % initialize to cover case where all spot are Zero NoGrowth See NIGrowthflg==0
|
||||
if exist('drf','var')
|
||||
% Det. index of change from one MP to the next
|
||||
i=2;
|
||||
@@ -114,65 +94,50 @@ for j=1:length(drf(:,3))
|
||||
end
|
||||
end
|
||||
chgIndx(length(chgIndx)+1)=size(drf,1) +1; % length(drf)+1;
|
||||
|
||||
vvL=zeros(size(drf,1),1 ); % length(drf)+1;
|
||||
%************************************
|
||||
dMPs=unique(cell2mat(drf(:,2)));
|
||||
%*****************************************
|
||||
for d=1:length(Exp(expN).Dexp(DexpN).DM.drug)
|
||||
for mm=1:length(dMPs) % length(chgIndx)
|
||||
usrScNdisp=((dMPs(mm)-1)*DMnum)+(d);
|
||||
NZusrIndx= drfPindx((find(drfPindx(:,dMPs(mm)))),dMPs(mm)); medianIndxDisp= NZusrIndx;
|
||||
NZusrIndx=drfPindx((find(drfPindx(:,dMPs(mm)))),dMPs(mm));
|
||||
medianIndxDisp=NZusrIndx;
|
||||
vvL(chgIndx(mm):(chgIndx(mm+1)-1))=Exp(expN).Dexp(DexpN).scan(usrScNdisp).plate(1).CFout(NZusrIndx,5);
|
||||
%For Global Ref Composite 17_1009 %**************************************************************************
|
||||
vvK(chgIndx(mm):(chgIndx(mm+1)-1))=Exp(expN).Dexp(DexpN).scan(usrScNdisp).plate(1).CFout(NZusrIndx,3);
|
||||
vvr(chgIndx(mm):(chgIndx(mm+1)-1))=Exp(expN).Dexp(DexpN).scan(usrScNdisp).plate(1).CFout(NZusrIndx,4);
|
||||
%*****************************************************************************************************
|
||||
end %for mm=1:length(dMPs)
|
||||
end
|
||||
|
||||
%****************CALC. GLOBAL MEAN, STD, AND MEDIAN FOR DISTRIBUTED REFERENCES******************************************************************
|
||||
% CALC. GLOBAL MEAN, STD, AND MEDIAN FOR DISTRIBUTED REFERENCES
|
||||
% for d=1:length(Exp(expN).Dexp(DexpN).DM.drug)
|
||||
NZusrIndxG=[];
|
||||
NZusrIndxG=find(vvL);
|
||||
|
||||
if isempty(nonzeros(vvL)), nonZeroCntD=0;
|
||||
else nonZeroCntD= length(nonzeros(vvL));
|
||||
if isempty(nonzeros(vvL))
|
||||
nonZeroCntD=0;
|
||||
else
|
||||
nonZeroCntD=length(nonzeros(vvL));
|
||||
end
|
||||
%Calc. of median value for composite doesn't require and odd number of Indx items
|
||||
NZusrIndxG=NZusrIndxG(:);
|
||||
if ~isempty(NZusrIndxG) && length(NZusrIndxG) > 0 %(.15*size(drf,1)) %To calc. a median, more than 15% of spots must be nonZero
|
||||
|
||||
UsrLvals{d}=vvL(NZusrIndxG);
|
||||
UsrKvals{d}=vvK(NZusrIndxG);
|
||||
Usrrvals{d}=vvr(NZusrIndxG);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end % if exist('drf','var')
|
||||
|
||||
%END OF DISPERSE
|
||||
%*********************************************************************
|
||||
%####################################################################
|
||||
%end %for n=1:Exp(expN).DexpLength %Loop thru Dayexps
|
||||
|
||||
|
||||
if ~exist('drf','var'),
|
||||
if ~exist('drf','var')
|
||||
errordlg('Gene-Specifics combination not found. Check spelling of Specifics entry.','Entry Warning');
|
||||
break;
|
||||
end
|
||||
|
||||
NoGrowthflg=0;
|
||||
if isempty(vvL),
|
||||
if isempty(vvL)
|
||||
warndlg('No Growth condition found for Gene-Specifics combination. . ','No Growth warning');
|
||||
NoGrowthflg=1;
|
||||
end
|
||||
|
||||
|
||||
%#######################################################################
|
||||
|
||||
|
||||
%***********PLOT Values Selected Gene-Specifics Composite ******************************************try
|
||||
% Plot Values Selected Gene-Specifics Composite
|
||||
if NoGrowthflg==0
|
||||
smpSz=size(NZusrIndxG,1);
|
||||
K=median(cell2mat((UsrKvals(dmSel)))); Ks=num2str(K); Kstd=std(cell2mat((UsrKvals(dmSel)))); KstdStr=num2str(Kstd);
|
||||
@@ -201,21 +166,17 @@ try Kstr=Ks(1:5); catch, Kstr = Ks(1:length(Ks)); end
|
||||
try rstr=rs(1:5); catch, rstr=rs(1:length(rs)); end
|
||||
try Lstr=Ls(1:5); catch, Lstr=Ls(1:length(Ls)); end
|
||||
|
||||
|
||||
plateNum=(LBmp-1)*destPerMP + dmSel;
|
||||
MP=Exp(zoneSel).Dexp(DexpN).MP;
|
||||
|
||||
try
|
||||
|
||||
t=1:200;
|
||||
clear g;
|
||||
|
||||
try
|
||||
g=K ./ (1 + exp(-r.* (t - l )));
|
||||
gSlow=Kl ./ (1 + exp(-rl.* (t - lslow )));
|
||||
gFast=Ku ./ (1 + exp(-ru.* (t - lfast )));
|
||||
if K==0||r==0||l==0, g(1:200)=1;gSlow(1:200)=1;gFast(1:200)=1;end
|
||||
|
||||
if zoneSel==1, plotAxes=ghandles.Paxes1; OLaxes=ghandles.OLaxes1;
|
||||
Dlaxes=ghandles.Dlaxes1;Dkaxes=ghandles.Dkaxes1;Draxes=ghandles.Draxes1;
|
||||
Exp(1).traceN=Exp(1).traceN+1;
|
||||
@@ -233,7 +194,6 @@ if K==0||r==0||l==0, g(1:200)=1;gSlow(1:200)=1;gFast(1:200)=1;end
|
||||
end
|
||||
plot(plotAxes,t,g);hold (plotAxes,'on');
|
||||
plot(plotAxes,t,gSlow,'y');plot(plotAxes,t,gFast,'r');hold (plotAxes,'off');
|
||||
|
||||
Exp(expN).Trace(traceN).UsrGLB=usrGnSp;
|
||||
Exp(expN).Trace(traceN).dmSel=dmSel;
|
||||
Exp(expN).Trace(traceN).DexpN=DexpN;
|
||||
@@ -242,30 +202,29 @@ Exp(expN).Trace(traceN).Dexp(DexpN).DM(d).UsrLvals= UsrLvals(d);
|
||||
Exp(expN).Trace(traceN).Dexp(DexpN).DM(d).UsrKvals=UsrKvals(d);
|
||||
Exp(expN).Trace(traceN).Dexp(DexpN).DM(d).Usrrvals=Usrrvals(d);
|
||||
end
|
||||
%************CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC**************************************
|
||||
|
||||
% Store L R and K valves for manual selected Composite [C] plots
|
||||
Exp(expN).ll(traceN)=l; Exp(expN).rr(traceN)=r; Exp(expN).kk(traceN)=K;
|
||||
Exp(expN).lslow(traceN)=lslow; Exp(expN).lfast(traceN)=lfast;
|
||||
%************************************************************************
|
||||
try for i=1:length(Exp(zoneSel).hOL(:)),set(Exp(zoneSel).hOL(i),'color',[0 0 1]); end, catch; end
|
||||
|
||||
try
|
||||
for i=1:length(Exp(zoneSel).hOL(:)),set(Exp(zoneSel).hOL(i),'color',[0 0 1]); end
|
||||
catch
|
||||
end
|
||||
|
||||
Exp(zoneSel).hOL(traceN)=plot(OLaxes,t,g);hold on;
|
||||
set(Exp(zoneSel).hOL(traceN),'color',[1 0 0])
|
||||
|
||||
catch
|
||||
catchissue='Ln100 EZlstBoxExt'
|
||||
end %trycatch
|
||||
end
|
||||
|
||||
% Get the DM agar description
|
||||
if expN==1,DMstr=char(get(handles.DM1,'string'));end
|
||||
if expN==2,DMstr=char(get(handles.DM2,'string'));end
|
||||
if expN==3,DMstr=char(get(handles.DM3,'string'));end
|
||||
|
||||
|
||||
|
||||
gene=usrGnSp; orf='' %MP(1,LBmp).orf{1,1}(indx);
|
||||
geneOrfstr=strcat(gene,'_',orf,'_');
|
||||
grfgenestr=strcat(gene,'_',orf,'_');
|
||||
|
||||
graphStr=strcat(usrGnSp,'_','L=',Lstr,'_','Ls=',LstdStr,'_','r=',rstr,'_','rs=',rstdStr,'_','K=',Kstr,'Ks=',KstdStr);
|
||||
spotDescrip=strcat(graphStr,'->',DMstr);
|
||||
|
||||
@@ -285,8 +244,6 @@ Exp(zoneSel).hOLexpNm(traceN)= expStr;
|
||||
Exp(zoneSel).hOLresDir(traceN)={Exp(zoneSel).Dexp(DexpN).resDir};
|
||||
Exp(zoneSel).hOLplateNum(traceN)=plateNum;
|
||||
|
||||
|
||||
|
||||
if zoneSel==1,set(ghandles.GeneOrfLoc1,'string',geneOrfstr);end % Displays the value.
|
||||
if zoneSel==2,set(ghandles.GeneOrfLoc2,'string',geneOrfstr);end
|
||||
if zoneSel==3,set(ghandles.GeneOrfLoc3,'string',geneOrfstr);end
|
||||
@@ -296,4 +253,4 @@ if zoneSel==3,set(ghandles.graphStrLoc3,'string',spotDescrip);end %graphStr);en
|
||||
catch
|
||||
catchissue='Ln141 EZlstBoxExt'
|
||||
msg='Error'
|
||||
end % trycatch zoneSel<4 datatip selection from Image (not from an OverLay Plot)
|
||||
end
|
||||
|
||||
@@ -4,8 +4,8 @@ DexpN= Exp(expN).DexpN;
|
||||
rnames=Exp(expN).Dexp(DexpN).RFrnames;
|
||||
data=Exp(expN).Dexp(DexpN).RFdata;
|
||||
cnames=[{'Median'},{'Mean'},{'STD'},{'Minimum'},{'Maximum'}];
|
||||
f = figure('Menubar','none','Position',[1000 100 640 750],'Name',Exp(expN).Dexp(DexpN).ExpFoldr );
|
||||
|
||||
f=figure('Menubar','none','Position',[1000 100 640 750],...
|
||||
'Name',Exp(expN).Dexp(DexpN).ExpFoldr );
|
||||
t=uitable('Parent',f,'Data',data,'ColumnName',cnames,...
|
||||
'RowName',rnames,'Position',[20 20 620 730]);
|
||||
|
||||
|
||||
@@ -3,14 +3,11 @@ function output_txt = myfunction(obj,event_obj)
|
||||
% 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)]};
|
||||
|
||||
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
|
||||
%waitforbuttonpress
|
||||
end
|
||||
@@ -598,7 +598,7 @@ easy() {
|
||||
# Make EASY dirs
|
||||
debug "mkdir -p $EASY_RESULTS_DIR"
|
||||
mkdir -p "$EASY_RESULTS_DIR"
|
||||
dirs=('PrintResults' 'CFfigs' 'Fotos' 'Fotos/BkUp' 'matResults')
|
||||
dirs=('PrintResults' 'CFfigs' 'Fotos')
|
||||
for d in "${dirs[@]}"; do
|
||||
debug "mkdir $EASY_RESULTS_DIR/$d"
|
||||
mkdir "$EASY_RESULTS_DIR/$d"
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
is.numeric(NA)
|
||||
is.numeric(as.numeric(NA)
|
||||
)
|
||||
inp= a
|
||||
inp= "a"
|
||||
inp <- inp[!is.na(inp)]
|
||||
inp
|
||||
!is.na(inp)
|
||||
is.na(inp)
|
||||
inp
|
||||
gsub(pattern = (/D)), replacement= 3)
|
||||
gsub(pattern = ("[/D)"), replacement= 3)
|
||||
gsub(pattern = inp("[/D)"), replacement= 3)
|
||||
list.files
|
||||
list.files()
|
||||
@@ -1,212 +0,0 @@
|
||||
% FrontEnd utility to copy source result sheet into Exp_ folders of
|
||||
% StudiesQHTCP/StudyName/Exp1(2,3,4). This allow the automation of path
|
||||
% capture to the StudiesDataArchieve.txt study log.
|
||||
% Select, copy and Capture Study Exp_ details to study log
|
||||
|
||||
%Exp meta data collection
|
||||
|
||||
% Set path variables
|
||||
wCodeDir=pwd;
|
||||
Wstudy=fullfile('../', wCodeDir);
|
||||
studyDate=datetime('now');
|
||||
|
||||
%Load results file meta data into workspace
|
||||
try
|
||||
ExpLabel= strcat('Exp',wCodeDir(end))
|
||||
questdlg('\fontsize{20} Select the !!Results File','File Selection','OK', struct('Default','OK','Interpreter','tex'));
|
||||
[resFile,resPath]= uigetfile('*.txt')
|
||||
copyfile((fullfile(resPath,resFile)),fullfile(wCodeDir))
|
||||
resDate= char(regexp(resFile, '(\d\d\_\d\d\d\d)|( \d\d\_\d\d\d\d|\d\d\d\d\d\d)','match'))
|
||||
cd ..
|
||||
|
||||
if ispc
|
||||
lastSep=max(strfind(Wstudy,'\'))
|
||||
studyName=Wstudy((lastSep+1):end)
|
||||
else
|
||||
lastSep=max(strfind(Wstudy,'/'))
|
||||
studyName=Wstudy((lastSep+1):end)
|
||||
end
|
||||
|
||||
% Build the study info array
|
||||
S.sDate(1)= {studyDate};
|
||||
S.sName(1)= {studyName}
|
||||
S.sPath(1)= {Wstudy}
|
||||
S.ELabel(1)= {ExpLabel}
|
||||
S.EresDate(1)= {resDate}
|
||||
S.EresFile(1)= {resFile}
|
||||
S.EresPath(1)= {resPath}
|
||||
|
||||
cd ..
|
||||
|
||||
fid = fopen('StudiesDataArchive.txt','a');
|
||||
fprintf(fid,'StudyDate\tStudyName\tStudyPath\tExpNum\tExpDate\tExpPath\tResultFile\n');
|
||||
fprintf(fid, '%s\t %s\t %s\t %s\t %s\t %s\t %s \n',S.sDate{1},S.sName{1},S.sPath{1},S.ELabel{1},S.EresDate{1},S.EresPath{1},S.EresFile{1});
|
||||
fclose(fid);
|
||||
fclose('all');
|
||||
|
||||
catch
|
||||
cd(wCodeDir)
|
||||
disp('Error: Unable to Execute ExpFrontend.m')
|
||||
end
|
||||
|
||||
cd(wCodeDir)
|
||||
|
||||
%*************************************************************************************
|
||||
%*************************************************************************************
|
||||
%#####################################################################################
|
||||
%Improved storage ammenable for database use
|
||||
%FrontEnd utility to copy source result sheet into Exp_ folders of
|
||||
%StudiesQHTCP/StudyName/Exp1(2,3,4). This allow the automation of path
|
||||
%capture to the StudiesDataArchieve.txt study log.
|
||||
%Select, copy and Capture Study Exp_ details to study log
|
||||
studyDateNow= studyDate %preserve the 'Now' date
|
||||
nowNumFNm= strcat((int2str(now)),'.mat') % from previous section incase the /StudyName doesn't have a standard date
|
||||
%capture the /StudiesQHTCP directory for storing log data
|
||||
cd ../..
|
||||
logPath= pwd %is /.../Exp_
|
||||
cd(wCodeDir)
|
||||
%Try to load an existing data set from previous Frontend calls
|
||||
try %end ~ln121
|
||||
load(fullfile(logPath,'.studyLog.mat')) %load(fullfile('../../','studyLog.mat'))
|
||||
catch %If no studyLog.mat found [Initial First Entry]
|
||||
ExpLabel= strcat('Exp',wCodeDir(end))
|
||||
resDate= char(regexp(resFile, '(\d\d\_\d\d\d\d)|( \d\d\_\d\d\d\d|\d\d\d\d\d\d)','match'))
|
||||
cd .. %move up to current study folder from ../Exp_ folder;
|
||||
%Study meta data collection
|
||||
Wstudy= pwd %Capture the specific current Study directory
|
||||
try %try to extract study date from folder name
|
||||
studyDate= char(regexp(Wstudy, '(\d\d\_\d\d\d\d)|( \d\d\_\d\d\d\d|\d\d\d\d\d\d)| \d\d\d\d\d\d)','match'))
|
||||
S.sDate(1)= {studyDate};
|
||||
catch %if unsuccessful, accept the current date and convert to a 6 char string
|
||||
studyDate= yyyymmdd(studyDateNow);
|
||||
studyDate= (int2str(studyDate))
|
||||
studyDate= studyDate(3:8)
|
||||
end
|
||||
%Capture StudyName
|
||||
if ispc
|
||||
lastSep=max(strfind(Wstudy,'\'))
|
||||
studyName= Wstudy((lastSep+1):end)
|
||||
else
|
||||
lastSep=max(strfind(Wstudy,'/'))
|
||||
studyName= Wstudy((lastSep+1):end)
|
||||
|
||||
end
|
||||
%Put current First data entry into Structure of Save to StudyLog.mat file
|
||||
S.sDate(1)= {studyDate};
|
||||
S.sName(1)= {studyName}
|
||||
S.sPath(1)= {Wstudy}
|
||||
S.ELabel(1)= {ExpLabel}
|
||||
S.EresDate(1)= {resDate}
|
||||
S.EresFile(1)= {resFile}
|
||||
S.EresPath(1)= {resPath}
|
||||
|
||||
cd(wCodeDir)
|
||||
|
||||
logFiletxt= fullfile(logPath,'StudiesDataArchive4DB.txt') %relative .txt path
|
||||
%Initialize the StudiesDataArchive.txt file with the First row of meta data
|
||||
|
||||
%Print to a .txt spreadsheet the first set of data in the logFiletxt file
|
||||
fid = fopen(logFiletxt,'w');
|
||||
fprintf(fid,'StudyDate\tStudyName\tStudyPath\tExpNum\tExpDate\tExpPath\tResultFile\n');
|
||||
fprintf(fid, '%s\t %s\t %s\t %s\t %s\t %s\t %s \n',studyDate,studyName,Wstudy,ExpLabel,resDate,resPath,resFile);
|
||||
fclose(fid);
|
||||
%Save the first entry meta data into a permanent .mat files for future recall
|
||||
save(fullfile(logPath,'studyLog4DB.mat'), 'S')
|
||||
save(fullfile(logPath,'.studyLog.mat'), 'S')
|
||||
save(fullfile(logPath,'.nowNumFNm.mat'), 'S')
|
||||
|
||||
|
||||
|
||||
end %end for try for the First entry only
|
||||
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
%++++++++END of FIRST ENTRY startup section++++++++++++++++++++++++++++++++
|
||||
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
||||
|
||||
|
||||
%Begin routine for all Entries After the Initial data entry****************
|
||||
ExpLabel= strcat('Exp',wCodeDir(end))
|
||||
resDate= char(regexp(resFile, '(\d\d\_\d\d\d\d)|( \d\d\_\d\d\d\d|\d\d\d\d\d\d)','match')) %Capture date from !!Results file
|
||||
|
||||
cd .. %Move to the current study folder
|
||||
|
||||
%Capture study meta dat
|
||||
Wstudy= pwd % Capture the path to the current study
|
||||
|
||||
%Attempt to extract study date from folder name and convert to a
|
||||
%searchable numeric date
|
||||
studyDate= char(regexp(Wstudy, '(\d\d\_\d\d\d\d)|( \d\d\_\d\d\d\d|\d\d\d\d\d\d)| \d\d\d\d\d\d)','match'))
|
||||
if ~isempty(studyDate) %If no date in folder name use current date and convert to 6char string
|
||||
S.sDate(1)= {studyDate};
|
||||
if isequal((str2num(studyDate(3))),'_') %Remove '_' so that date is a number for easy DB search
|
||||
studyDate= strcat(studyDate(1:2),studyDate(4:6))
|
||||
end
|
||||
else
|
||||
studyDate= yyyymmdd(studyDateNow);
|
||||
studyDate= (int2str(studyDate))
|
||||
studyDate= studyDate(3:8)
|
||||
end
|
||||
|
||||
if ispc
|
||||
lastSep=max(strfind(Wstudy,'\'))
|
||||
studyName= Wstudy((lastSep+1):end)
|
||||
else
|
||||
lastSep=max(strfind(Wstudy,'/'))
|
||||
studyName= Wstudy((lastSep+1):end)
|
||||
end
|
||||
|
||||
%Put meta data into a structure for storage (studyLog.mat) and future
|
||||
%compare operations
|
||||
lastRow= length(S.sPath)
|
||||
|
||||
%Compare these just obtained paths with those stored in the studyLog.mat
|
||||
%file and add a new row if the study or results sheet meta data is new or different
|
||||
cd .. %Move the the /QHTPCstudies folder
|
||||
logtxt= 'StudiesDataArchive4DB.txt'
|
||||
logFiletxt= fullfile(logPath,logtxt) %
|
||||
try
|
||||
matched=0;
|
||||
for n= 1:(lastRow)
|
||||
if strcmp(Wstudy,S.sPath(n)) && strcmp(resPath, S.EresPath(n)) && strcmp(ExpLabel, S.ELabel(n))
|
||||
matched= 1;
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
%Update the StudiesDataArchive.txt file with a new row of meta data
|
||||
if matched== 0 %if no match for this entry then add a line to the text archive file
|
||||
fid = fopen(logFiletxt,'w');
|
||||
S.sDate(lastRow+1)= {studyDate};
|
||||
S.sName(lastRow+1)= {studyName};
|
||||
S.sPath(lastRow+1)= {Wstudy};
|
||||
S.ELabel(lastRow+1)= {ExpLabel};
|
||||
S.EresDate(lastRow+1)= {resDate};
|
||||
S.EresFile(lastRow+1)= {resFile};
|
||||
S.EresPath(lastRow+1)= {resPath};
|
||||
for n= 1:(lastRow +1)
|
||||
%Print to a .txt spreadsheet and Save update to .mat files
|
||||
if n==1
|
||||
fprintf(fid,'StudyDate\tStudyName\tStudyPath\tExpNum\tExpDate\tExpPath\tResultFile\n');
|
||||
end
|
||||
fprintf(fid, '%s\t %s\t %s\t %s\t %s\t %s\t %s \n',S.sDate{n},S.sName{n},S.sPath{n},S.ELabel{n},S.EresDate{n},S.EresPath{n},S.EresFile{n});
|
||||
end
|
||||
|
||||
fclose(fid); %close DBase amenable study log file after data update
|
||||
|
||||
save((fullfile(logPath,'studyLog4DB.mat')), 'S') % path for studyLog.mat
|
||||
save((fullfile(logPath,'.studyLog.mat')), 'S') %path backup studyLogBU.mat
|
||||
save((fullfile(logPath,strcat('.',nowNumFNm))), 'S')
|
||||
end
|
||||
fclose('all');
|
||||
|
||||
catch
|
||||
cd(wCodeDir) %Return to the location of the frontend.m code (/studyName/Exp_)
|
||||
fclose('all');
|
||||
clear S %clear data structure variable 'S.'
|
||||
end
|
||||
|
||||
cd(wCodeDir) %Return to the location of the frontend.m code (/studyName/Exp_)
|
||||
clear all %clear workspace variables
|
||||
|
||||
|
||||
Reference in New Issue
Block a user