594 lines
25 KiB
Matlab
Executable File
594 lines
25 KiB
Matlab
Executable File
%EZfigTrendOL.m called from EZviewGui.m LKrTog__ Callback
|
|
%Uses data stored from OLay ; Clearing OLay clears data used by this
|
|
%Trending Utility
|
|
|
|
|
|
global Exp
|
|
global userPars
|
|
|
|
%try
|
|
kfiltLim= userPars.kfiltLim;
|
|
%catch
|
|
%kfiltLim= str2double(userPars.BPdefault(6));
|
|
%end
|
|
|
|
if get(handles.CompositeTog1, 'Value')
|
|
cmpTogFlg=1;
|
|
else
|
|
cmpTogFlg=0;
|
|
end
|
|
|
|
|
|
DexpN= Exp(expN).DexpN;
|
|
if strcmp(Exp(expN).DexpType, 'chrono')
|
|
maxRows=1; Lmax= 1; bpInd=0;
|
|
for n=1:length(Exp(expN).Dexp) %LOOP Thru DayExps
|
|
for trc= 1:Exp(expN).traceN %length(Exp(expN).Trace)
|
|
try
|
|
if isequal(get(Exp(expN).hOL(trc),'Visible'),'on')
|
|
|
|
dmSel= Exp(expN).Trace(trc).dmSel;
|
|
if iscell(Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrLvals)
|
|
rows= length(cell2mat(Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrLvals));
|
|
else
|
|
rows=1;
|
|
end
|
|
if iscell(Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrLvals)
|
|
if rows> maxRows, maxRows= rows; end
|
|
LsmpMax= max(cell2mat(Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrLvals));
|
|
else
|
|
LsmpMax= max(Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrLvals);
|
|
end
|
|
if LsmpMax> Lmax, Lmax= LsmpMax; end
|
|
bpInd=bpInd+1;
|
|
end %if isequal(get(Exp(1).hOL(trc),'Visible'),'on')
|
|
catch
|
|
end
|
|
end % for trc= 1:
|
|
end %for n=1:length(Exp(expN).Dexp)
|
|
maxCols= bpInd; %length(Exp(expN).Dexp) * length(Exp(expN).Trace)
|
|
BPvals(1:maxRows,1:maxCols)= nan; %BoxPlot requires a matrix with uniform length even if data is not of the same length
|
|
|
|
bpInd=0;
|
|
for n=1:length(Exp(expN).Dexp) %LOOP Thru DayExps
|
|
for trc= 1:Exp(expN).traceN %length(Exp(expN).Trace)
|
|
try
|
|
if isequal(get(Exp(expN).hOL(trc),'Visible'),'on')
|
|
dmSel= Exp(expN).Trace(trc).dmSel;
|
|
bpInd=bpInd+1;
|
|
if iscell(Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrLvals)
|
|
kFiltrIndx= find((cell2mat(Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrKvals))<= kfiltLim);
|
|
tmp= cell2mat(Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrLvals);
|
|
BPvals(1:length(kFiltrIndx),bpInd)= tmp(kFiltrIndx);
|
|
%BPvals(1:length(cell2mat(Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrLvals)),bpInd)= cell2mat(Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrLvals);
|
|
cnt= length(kFiltrIndx); %length(cell2mat(Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrLvals));
|
|
else
|
|
if length(Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrLvals)> 1 %>= 1
|
|
kFiltrIndx= find(((Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrKvals))<= kfiltLim);
|
|
tmp= Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrLvals;
|
|
BPvals(1:length(kFiltrIndx),bpInd)= tmp(kFiltrIndx);
|
|
cnt= length(kFiltrIndx);
|
|
%BPvals(1:length((Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrLvals)),bpInd)= Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrLvals;
|
|
%cnt= length((Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrLvals));
|
|
else
|
|
BPvals(1,bpInd)= Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrLvals;
|
|
cnt= length(Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrLvals);
|
|
end
|
|
end
|
|
|
|
%scnt(bpInd)= strcat('[',num2str(cnt),']');
|
|
scnt= strcat('[',num2str(cnt),']');
|
|
%Get Agar DrugMedia
|
|
drug= Exp(expN).Dexp(n).DM.drug{dmSel};
|
|
conc= Exp(expN).Dexp(n).DM.conc{dmSel};
|
|
media= Exp(expN).Dexp(n).DM.media{dmSel};
|
|
mod1= Exp(expN).Dexp(n).DM.mod1{dmSel}; if isnan(cell2mat(mod1)), mod1='';end
|
|
conc1= Exp(expN).Dexp(n).DM.conc1{dmSel}; if isnan(cell2mat(conc1)), conc1='';end
|
|
mod2= Exp(expN).Dexp(n).DM.mod2{dmSel}; if isnan(cell2mat(mod2)), mod2='';end
|
|
conc2=Exp(expN).Dexp(n).DM.conc2{dmSel}; if isnan(cell2mat(conc2)), conc2='';end
|
|
dmStr= strcat(drug,conc,'_',media,'_',mod1,conc1,mod2,conc2);
|
|
|
|
%Extract expDay from ExpName string
|
|
dayNpos= max(strfind(Exp(expN).Dexp(n).ExpFoldr, '_D'));
|
|
dayLbl= Exp(expN).Dexp(n).ExpFoldr(dayNpos+1:end);
|
|
|
|
label= strcat(dayLbl,'-', Exp(expN).Trace(trc).UsrGLB, dmStr,scnt); %scnt(bpInd));
|
|
tickLabelStr{bpInd}= label;
|
|
end %if isequal(get(Exp(1).hOL(trc),'Visible'),'on')
|
|
catch
|
|
end
|
|
end %for trc=
|
|
end %for n=1:length(Exp(expN).Dexp)
|
|
|
|
else %if 'single' or 'multi' experiment setup for DM trends
|
|
maxRows=1; Lmax= 1; bpInd=0;
|
|
%for n=1:length(Exp(expN).Dexp) %LOOP Thru Multi Experiments
|
|
DexpN=Exp(expN).DexpN;
|
|
for dm=1:length(Exp(expN).Dexp(DexpN).DM.drug) %LOOP Thru DM perturbations
|
|
for trc= 1:Exp(expN).traceN %length(Exp(expN).Trace)
|
|
% tempLB= Exp(expN).Trace(trc).UsrGLB;
|
|
try
|
|
if isequal(get(Exp(expN).hOL(trc),'Visible'),'on')
|
|
|
|
DexpN= Exp(expN).Trace(trc).DexpN;
|
|
if iscell(Exp(expN).Trace(trc).Dexp(DexpN).DM(dm).UsrLvals)
|
|
rows= length(cell2mat(Exp(expN).Trace(trc).Dexp(DexpN).DM(dm).UsrLvals));
|
|
else
|
|
rows=1;
|
|
end
|
|
if iscell(Exp(expN).Trace(trc).Dexp(DexpN).DM(dm).UsrLvals)
|
|
if rows> maxRows, maxRows= rows; end
|
|
LsmpMax= max(cell2mat(Exp(expN).Trace(trc).Dexp(DexpN).DM(dm).UsrLvals));
|
|
else
|
|
LsmpMax= max(Exp(expN).Trace(trc).Dexp(DexpN).DM(dm).UsrLvals);
|
|
end
|
|
if LsmpMax> Lmax, Lmax= LsmpMax; end
|
|
bpInd=bpInd+1;
|
|
end %if isequal(get(Exp(1).hOL(trc),'Visible'),'on')
|
|
catch
|
|
end
|
|
|
|
end % for trc= 1:
|
|
end %for
|
|
%end %for n=1:length(Exp(expN).Dexp)
|
|
%end
|
|
|
|
maxCols= bpInd; %length(Exp(expN).Dexp) * length(Exp(expN).Trace)
|
|
BPvals(1:maxRows,1:maxCols)= nan; %BoxPlot requires a matrix with uniform length even if data is not of the same length
|
|
|
|
bpInd=0;
|
|
for dm=1:length(Exp(expN).Dexp(DexpN).DM.drug) %LOOP Thru DM perturbations
|
|
for trc= 1:Exp(expN).traceN %length(Exp(expN).Trace)
|
|
try
|
|
if isequal(get(Exp(expN).hOL(trc),'Visible'),'on')
|
|
DexpN= Exp(expN).Trace(trc).DexpN;
|
|
bpInd=bpInd+1;
|
|
if iscell(Exp(expN).Trace(trc).Dexp(DexpN).DM(dm).UsrLvals)
|
|
kFiltrIndx= find((cell2mat(Exp(expN).Trace(trc).Dexp(DexpN).DM(dm).UsrKvals))<= kfiltLim);
|
|
tmp= cell2mat(Exp(expN).Trace(trc).Dexp(DexpN).DM(dm).UsrLvals);
|
|
BPvals(1:length(kFiltrIndx),bpInd)= tmp(kFiltrIndx);
|
|
cnt= length(kFiltrIndx);
|
|
%BPvals(1:length(cell2mat(Exp(expN).Trace(trc).Dexp(DexpN).DM(dm).UsrLvals)),bpInd)= cell2mat(Exp(expN).Trace(trc).Dexp(DexpN).DM(dm).UsrLvals);
|
|
%cnt= length(cell2mat(Exp(expN).Trace(trc).Dexp(DexpN).DM(dm).UsrLvals));
|
|
|
|
else
|
|
if length(Exp(expN).Trace(trc).Dexp(DexpN).DM(dm).UsrLvals)> 1
|
|
kFiltrIndx= find(((Exp(expN).Trace(trc).Dexp(DexpN).DM(dm).UsrKvals))<= kfiltLim);
|
|
tmp= Exp(expN).Trace(trc).Dexp(DexpN).DM(dm).UsrLvals;
|
|
BPvals(1:length(kFiltrIndx),bpInd)= tmp(kFiltrIndx);
|
|
cnt= length(kFiltrIndx);
|
|
else
|
|
BPvals(1,bpInd)= Exp(expN).Trace(trc).Dexp(DexpN).DM(dm).UsrLvals;
|
|
cnt= length(Exp(expN).Trace(trc).Dexp(DexpN).DM(dm).UsrLvals);
|
|
end
|
|
end
|
|
|
|
%scnt(bpInd)= {strcat('[',num2str(cnt),']')};
|
|
scnt= {strcat('[',num2str(cnt),']')};
|
|
%Get Agar DrugMedia
|
|
drug= Exp(expN).Dexp(DexpN).DM.drug{dm};
|
|
conc= Exp(expN).Dexp(DexpN).DM.conc{dm};
|
|
media= Exp(expN).Dexp(DexpN).DM.media{dm};
|
|
mod1= Exp(expN).Dexp(DexpN).DM.mod1{dm}; if isnan(cell2mat(mod1)), mod1='';end
|
|
conc1= Exp(expN).Dexp(DexpN).DM.conc1{dm}; if isnan(cell2mat(conc1)), conc1='';end
|
|
mod2= Exp(expN).Dexp(DexpN).DM.mod2{dm}; if isnan(cell2mat(mod2)), mod2='';end
|
|
conc2=Exp(expN).Dexp(DexpN).DM.conc2{dm}; if isnan(cell2mat(conc2)), conc2='';end
|
|
dmStr= strcat(drug,'_',conc,'_',media,'_',mod1,conc1,mod2,conc2);
|
|
|
|
%Extract expDay from ExpName string
|
|
dayNpos= max(strfind(Exp(expN).Dexp(DexpN).ExpFoldr, '_D'));
|
|
dayLbl= Exp(expN).Dexp(DexpN).ExpFoldr(dayNpos+1:end);
|
|
if ~isempty(dayLbl), dayLbl=strcat(dayLbl,'_'); end
|
|
|
|
label= strcat(dayLbl,Exp(expN).Trace(trc).UsrGLB, dmStr,scnt);
|
|
tickLabelStr{bpInd}= label;
|
|
end %if isequal(get(Exp(1).hOL(trc),'Visible'),'on')
|
|
|
|
catch
|
|
end
|
|
end %for trc=
|
|
end %for dm=1:length(Exp(expN).Dexp(DexpN).DM.drug)
|
|
%{
|
|
if isequal(tempLB(4:6),'cmp')||isequal(tempLB(3:6),'cmpG'),
|
|
RFcmpFlg=1;
|
|
else
|
|
RFcmpFlg=0;
|
|
end
|
|
%}
|
|
|
|
end %if strcmp(Exp(expN).DexpType, 'chrono') else if Single or Multi experiment
|
|
%***********************************************************************************************
|
|
%Box Plot Plotting section
|
|
if userPars.boxplotFlg==1
|
|
BPoutliers= userPars.BPoutliers;
|
|
BPnotch= userPars.BPnotch;
|
|
sh= userPars.BPlblShft;
|
|
fontSize= userPars.BPfontSz;
|
|
rotation= userPars.BProt;
|
|
|
|
%fontSize=8;
|
|
%tickLabelStr={'Label alpha','Label beta','Label chi','Label delta',...
|
|
% 'Label epsilon','Label fish','Label gamma','Label hallo','Label ingo'}
|
|
% generate data
|
|
if size(BPvals,1)==1, BPvals(2,1:maxCols)= nan; end
|
|
final_res=BPvals; %10*randn(300,9)+10;
|
|
|
|
% group boxes
|
|
%sh=0.3; %sh is shift value
|
|
width=.5*sh;
|
|
|
|
|
|
%pos=[1+sh 2-sh 3+sh 4-sh 5+sh 6-sh 7+sh 8-sh 9+sh];
|
|
bpn=1;
|
|
if strcmp(Exp(expN).DexpType, 'chrono')
|
|
ticDim= length(Exp(expN).Dexp);
|
|
else
|
|
ticDim= length(Exp(expN).Dexp(DexpN).DM.drug);
|
|
end
|
|
for dim=1:ticDim %LOOP Thru DM perturbations
|
|
shn=0;
|
|
for trc= 1:Exp(expN).traceN %length(Exp(expN).Trace)
|
|
if isequal(get(Exp(expN).hOL(trc),'Visible'),'on')
|
|
pos(bpn)= dim + (shn*sh);
|
|
shn= shn+1;
|
|
bpn= bpn+1;
|
|
end
|
|
end
|
|
end
|
|
wid=width * ones(1,length(pos));
|
|
|
|
% boxplot
|
|
figure
|
|
set(gcf,'OuterPosition',(get(0,'screensize')))
|
|
if strcmpi(BPnotch,'on'),
|
|
boxplot(final_res, 'notch', 'on', ...
|
|
'positions', pos,...
|
|
'widths', wid)
|
|
elseif strcmpi(BPnotch,'off'),
|
|
boxplot(final_res, 'notch', 'off', ...
|
|
'positions', pos,...
|
|
'widths', wid)
|
|
end
|
|
|
|
% label, change fontsize
|
|
% y-axis
|
|
set(gca, 'FontSize', fontSize)
|
|
ylim([-.5 (Lmax+10)])
|
|
ylabel('L in Hours', 'FontSize', fontSize)
|
|
|
|
%x-labels
|
|
text_h=findobj(gca, 'Type', 'text');
|
|
%rotation=45;
|
|
|
|
for cnt=1:length(text_h)
|
|
set(text_h(cnt), 'FontSize', fontSize,...
|
|
'Rotation', rotation, ...
|
|
'String', tickLabelStr{length(tickLabelStr)-cnt+1}, ...
|
|
'HorizontalAlignment', 'right')
|
|
end
|
|
|
|
% 'VerticalAlignment', 'cap', ...
|
|
|
|
% smaller box for axes, in order to un-hide the labels
|
|
squeeze=0.2;
|
|
left=0.02;
|
|
right=1;
|
|
bottom=squeeze;
|
|
top=1-squeeze;
|
|
set(gca, 'OuterPosition', [left bottom right top])
|
|
|
|
% remove outliers
|
|
hout=findobj(gca,'tag','Outliers');
|
|
for out_cnt=1 : length(hout)
|
|
if strcmpi(BPoutliers,'on'),
|
|
set(hout(out_cnt), 'Visible', 'on')
|
|
elseif strcmpi(BPnotch,'off'),
|
|
set(hout(out_cnt), 'Visible', 'off')
|
|
end
|
|
end
|
|
|
|
end %if userlPars.boxplotFlg==1
|
|
% END OF BOX PLOT CODE****************************************************
|
|
|
|
|
|
|
|
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
%*****************PLOT OVERLAY CODE**************************************
|
|
%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
%++++++++PLOT OVERLAY OF TRENDS FOR CHRONO OR DRUG-MEDIA PERMUTATIONS++++++++
|
|
try
|
|
lnwidth= str2num(Exp(4).plotPars{1});
|
|
axisFontSz= str2num(Exp(4).plotPars{2});
|
|
legFontSz= str2num(Exp(4).plotPars{3});
|
|
markerSz= str2num(Exp(4).plotPars{4});
|
|
catch
|
|
lnwidth=4;
|
|
axisFontSz=36;
|
|
legFontSz= 10;
|
|
markerSz=5;
|
|
end
|
|
|
|
|
|
if userPars.boxplotFlg~=1 %PLOT OVERLAY OF TRENDS
|
|
figure
|
|
set(gcf,'OuterPosition',(get(0,'screensize')))
|
|
if strcmp(Exp(expN).DexpType, 'chrono') %Chrono
|
|
|
|
%Plot median values for each DAY of the selected Trace
|
|
%(Gene-Specifics)using single DM of trace
|
|
range=0;
|
|
for trc= 1:Exp(expN).traceN %length(Exp(expN).Trace)
|
|
%trcInd= 0;
|
|
scnt= '['; %Init for Sample Count String
|
|
if isequal(get(Exp(expN).hOL(trc),'Visible'),'on')
|
|
for n=1:length(Exp(expN).Dexp) %LOOP Thru DayExps
|
|
tmp=[];
|
|
try
|
|
%if isequal(get(Exp(expN).hOL(trc),'Visible'),'on')
|
|
|
|
dmSel= Exp(expN).Trace(trc).dmSel;
|
|
if iscell(Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrLvals)
|
|
kFiltrIndx= find((cell2mat(Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrKvals))<= kfiltLim);
|
|
tmp= cell2mat(Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrLvals);
|
|
dayMed(trc,n)= median(tmp(kFiltrIndx)); %median(cell2mat(Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrLvals));
|
|
dayStd(trc,n)= std(tmp(kFiltrIndx)); %std(cell2mat(Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrLvals));
|
|
cnt= length(kFiltrIndx); %length(cell2mat(Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrLvals));
|
|
else
|
|
kFiltrIndx= find(((Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrKvals))<= kfiltLim);
|
|
tmp= (Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrLvals);
|
|
dayMed(trc,n)= median(tmp(kFiltrIndx)); %median(Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrLvals);
|
|
dayStd(trc,n)= std(tmp(kFiltrIndx)); %std(Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrLvals);
|
|
cnt= length(kFiltrIndx); %length(Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrLvals);
|
|
end
|
|
%*************Make LEGEND list ********************************
|
|
%Make Sample Count Label item;
|
|
if n~=length(Exp(expN).Dexp)
|
|
scnt= strcat(scnt,num2str(cnt),',');
|
|
else
|
|
scnt= strcat(scnt,num2str(cnt),']');
|
|
end
|
|
%Get Agar DrugMedia;
|
|
dm= Exp(expN).Trace(trc).dmSel;
|
|
drug= Exp(expN).Dexp(n).DM.drug{dm};
|
|
conc= Exp(expN).Dexp(n).DM.conc{dm};
|
|
media= Exp(expN).Dexp(n).DM.media{dm};
|
|
mod1= Exp(expN).Dexp(n).DM.mod1{dm};
|
|
conc1= Exp(expN).Dexp(n).DM.conc1{dm};
|
|
mod2= Exp(expN).Dexp(n).DM.mod2{dm};
|
|
conc2=Exp(expN).Dexp(n).DM.conc2{dm};
|
|
dmStr= strcat(drug,'_',conc,'_',media,'_',mod1,conc1,mod2,conc2);
|
|
NmLst(trc)= strcat(Exp(expN).Trace(trc).UsrGLB, dmStr,scnt);
|
|
%Determine Actual Exp Day from the ExpDay folder
|
|
loc= strfind(Exp(expN).Dexp(n).ExpFoldr,'_D');
|
|
daystr= Exp(expN).Dexp(n).ExpFoldr((loc+2):end);
|
|
dayNums(n)= str2num(daystr);
|
|
|
|
%trcInd= trcInd+1;
|
|
catch
|
|
end
|
|
try
|
|
upperStd(trc,n)=dayMed(trc,n) + dayStd(trc,n);
|
|
lowerStd(trc,n)=dayMed(trc,n) - dayStd(trc,n);
|
|
catch
|
|
end
|
|
|
|
end %for n=1:length(Exp(expN).Dexp)
|
|
% end %if isequal(get(Exp(1).hOL(trc),'Visible'),'on')
|
|
|
|
%Plot Trend Data
|
|
% if isequal(get(Exp(expN).hOL(trc),'Visible'),'on')
|
|
try
|
|
if iscell(Exp(expN).Trace(trc).Dexp(n).DM(dmSel).UsrLvals)
|
|
hTrendFig=plot(dayNums,dayMed(trc,1:n),'lineWidth',2); hold on
|
|
linecolor(trc)={get(hTrendFig,'color')};
|
|
else
|
|
clear NmLstStr
|
|
if iscell(NmLst(trc)),NmLstStr= cell2mat(NmLst(trc)); else NmLstStr= NmLstStr(trc); end
|
|
if isequal(NmLstStr(4:6),'cmp') ||...
|
|
isequal(NmLstStr(3:6),'cmpG') || ...
|
|
isequal(NmLstStr(3:6),'cmpP'),
|
|
hTrendFig=plot(dayNums,dayMed(trc,1:n),'lineWidth',2); hold on
|
|
linecolor(trc)={get(hTrendFig,'color')};
|
|
else
|
|
hTrendFig=plot(dayNums,dayMed(trc,1:n),'marker','^','lineWidth',2); hold on
|
|
linecolor(trc)={get(hTrendFig,'color')};
|
|
end
|
|
%yTicks= get(gca,'yTickLabel'); Ydelta= max(max(yTicks))-min(min(yTicks));
|
|
%spacing= Ydelta* 0.0034; %line spacing for STD marker
|
|
end
|
|
catch
|
|
hTrendFig=plot(1:n,dayMed(trc,1:n),'lineWidth',2); hold on
|
|
linecolor(trc)={get(hTrendFig,'color')};
|
|
ylabel('Experiment Day Index')
|
|
end %try
|
|
end % if isequal(get(Exp(expN).hOL(trc),'Visible'),'on') approx ln322
|
|
grid on
|
|
|
|
%set(gca,'linewidth',4) %0.5 then 1.5 now 6
|
|
%set(gca,'fontsize',axisFontSz) % 8 to 15 to 21
|
|
|
|
hold all
|
|
try % if isequal(get(Exp(expN).hOL(trc),'Visible'),'on')
|
|
tmpRange= ceil(max(upperStd(trc,1:end))) - floor(min(lowerStd(trc,1:end)));
|
|
range= max(range,tmpRange);
|
|
catch,end
|
|
end %for trc= 1:Exp(expN).traceN approx. ln319
|
|
|
|
%************** Standard Deviation range bars *****************************
|
|
|
|
% range= ceil(max(upperStd(trc,1:end))) - floor(min(lowerStd(trc,1:end)));
|
|
spacing= range*0.0034; %marker splacing for building range bars
|
|
for trc= 1:Exp(expN).traceN %length(Exp(expN).Trace)
|
|
if isequal(get(Exp(expN).hOL(trc),'Visible'),'on')
|
|
for n=1:length(Exp(expN).Dexp) %LOOP Thru DayExps
|
|
if isequal(get(Exp(expN).hOL(trc),'Visible'),'on')
|
|
try
|
|
line(dayNums(n),lowerStd(trc,n):spacing:(dayMed(trc,n)-.05),'marker','^','LineWidth',1,'markerEdgeColor',cell2mat(linecolor(trc))); hold on
|
|
line(dayNums(n),(dayMed(trc,n)+0.05):spacing:upperStd(trc,n),'marker','v','LineWidth',1,'markerEdgeColor',cell2mat(linecolor(trc))); hold on
|
|
catch
|
|
%line(n,lowerStd(trc,n):0.05:(dayMed(trc,n)-.1),'marker','^','LineWidth',1,'markerEdgeColor',cell2mat(linecolor(trc))); hold on
|
|
%line(n,(dayMed(trc,n)+0.1):0.05:upperStd(trc,n),'marker','v','LineWidth',1,'markerEdgeColor',cell2mat(linecolor(trc))); hold on
|
|
end
|
|
end
|
|
end %for n=1:length(Exp(expN).Dexp)
|
|
end % if isequal(get(Exp(expN).hOL(trc),'Visible'),'on')
|
|
end %for trc= 1:Exp(expN).traceN
|
|
|
|
%legName=strrep(NmLst,'_','-');
|
|
mm=1;
|
|
for nn= 1:length(NmLst)
|
|
if iscellstr(NmLst(nn))
|
|
legName(mm)=strrep(NmLst(nn),'_','-');
|
|
mm=mm+1;
|
|
end
|
|
end
|
|
legName =strrep(legName,'/','-');
|
|
hleg=legend((legName),'location','NEO');
|
|
set(hleg,'fontsize',legFontSz)
|
|
|
|
end
|
|
xlabel('Days')
|
|
ylabel('L in Hours')
|
|
title('Chronological Trend Plot with Standard Deviations')
|
|
|
|
hold off
|
|
%***************************************************************
|
|
%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
|
|
%***************************************************************
|
|
%SINGLE or MULTI-Experiment
|
|
|
|
if ~strcmp(Exp(expN).DexpType, 'chrono') %Single or Multi-Experiment
|
|
%Plot median values for each DM of the selected Trace (Gene-DM)
|
|
%(Gene-Specifics)using single DAY of trace
|
|
|
|
for trc= 1:Exp(expN).traceN %length(Exp(expN).Trace)
|
|
trcInd= 0;
|
|
DexpN= Exp(expN).Trace(trc).DexpN;
|
|
expFolder= Exp(expN).Dexp(DexpN).ExpFoldr;
|
|
if ispc
|
|
lastSlash= max(strfind(Exp(expN).Dexp(DexpN).ExpFoldr, '\'));
|
|
else
|
|
lastSlash= max(strfind(Exp(expN).Dexp(DexpN).ExpFoldr, '/'));
|
|
end
|
|
expName= expFolder(lastSlash+1:end);
|
|
if length(expName)>18
|
|
expNm= strcat('-',expName(1:18));
|
|
else
|
|
expNm= strcat('-',expName);
|
|
end
|
|
|
|
scnt= '['; %Init for Sample Count String
|
|
for n=1:length(Exp(expN).Dexp(DexpN).DM.drug) %LOOP Thru Drug-Media perturbations
|
|
tmp=[];
|
|
if isequal(get(Exp(expN).hOL(trc),'Visible'),'on')
|
|
if iscell(Exp(expN).Trace(trc).Dexp(DexpN).DM(n).UsrLvals)
|
|
kFiltrIndx= find((cell2mat(Exp(expN).Trace(trc).Dexp(DexpN).DM(n).UsrKvals))<= kfiltLim);
|
|
tmp= (cell2mat(Exp(expN).Trace(trc).Dexp(DexpN).DM(n).UsrLvals));
|
|
dmMed(trc,n)= median(tmp(kFiltrIndx)); %median(cell2mat(Exp(expN).Trace(trc).Dexp(DexpN).DM(n).UsrLvals));
|
|
dmStd(trc,n)= std(tmp(kFiltrIndx)); %std(cell2mat(Exp(expN).Trace(trc).Dexp(DexpN).DM(n).UsrLvals));
|
|
cnt= length(kFiltrIndx); %length(cell2mat(Exp(expN).Trace(trc).Dexp(DexpN).DM(n).UsrLvals));
|
|
else
|
|
kFiltrIndx= find(((Exp(expN).Trace(trc).Dexp(DexpN).DM(n).UsrKvals))<= kfiltLim);
|
|
tmp= ((Exp(expN).Trace(trc).Dexp(DexpN).DM(n).UsrLvals));
|
|
dmMed(trc,n)= median(tmp(kFiltrIndx)); %median(Exp(expN).Trace(trc).Dexp(DexpN).DM(n).UsrLvals);
|
|
dmStd(trc,n)= std(tmp(kFiltrIndx)); %std(Exp(expN).Trace(trc).Dexp(DexpN).DM(n).UsrLvals);
|
|
cnt= length(kFiltrIndx); %length(Exp(expN).Trace(trc).Dexp(DexpN).DM(n).UsrLvals);
|
|
end
|
|
%*************Make LEGEND list ********************************
|
|
%Make Sample Count Label item
|
|
if n~=length(Exp(expN).Dexp(DexpN).DM.drug)
|
|
scnt= strcat(scnt,num2str(cnt),',');
|
|
else
|
|
scnt= strcat(scnt,num2str(cnt),']');
|
|
end
|
|
%Get Agar DrugMedia
|
|
drug= Exp(expN).Dexp(DexpN).DM.drug{n};
|
|
conc= Exp(expN).Dexp(DexpN).DM.conc{n};
|
|
media= Exp(expN).Dexp(DexpN).DM.media{n};
|
|
mod1= Exp(expN).Dexp(DexpN).DM.mod1{n};
|
|
conc1= Exp(expN).Dexp(DexpN).DM.conc1{n};
|
|
mod2= Exp(expN).Dexp(DexpN).DM.mod2{n};
|
|
conc2=Exp(expN).Dexp(DexpN).DM.conc2{n};
|
|
dmStr= strcat(drug,'_',conc,'_',media,'_',mod1,conc1,mod2,conc2);
|
|
NmLst(trc)= strcat(Exp(expN).Trace(trc).UsrGLB, expNm,scnt);
|
|
|
|
trcInd= trcInd+1;
|
|
upperStd(trc,n)=dmMed(trc,n) + dmStd(trc,n);
|
|
lowerStd(trc,n)=dmMed(trc,n) - dmStd(trc,n);
|
|
end %if isequal(get(Exp(1).hOL(trc),'Visible'),'on')
|
|
|
|
|
|
end %for n=1:length(Exp(expN).Dexp(DexpN).DM.drug) %LOOP Thru Drug-Media perturbations
|
|
|
|
%Plot Trend Data
|
|
if isequal(get(Exp(expN).hOL(trc),'Visible'),'on')
|
|
if iscell(Exp(expN).Trace(trc).Dexp(DexpN).DM(n).UsrLvals)
|
|
hTrendFig=plot(1:n,dmMed(trc,1:n),'lineWidth',2); hold on
|
|
linecolor(trc)={get(hTrendFig,'color')};
|
|
else
|
|
clear NmLstStr
|
|
if iscell(NmLst(trc)),NmLstStr= cell2mat(NmLst(trc)); else NmLstStr= NmLst(trc); end
|
|
if isequal(NmLstStr(4:6),'cmp') ||...
|
|
isequal(NmLstStr(3:6),'cmpG') || ...
|
|
isequal(NmLstStr(3:6),'cmpP'),
|
|
hTrendFig=plot(1:n,dmMed(trc,1:n),'lineWidth',2); hold on
|
|
linecolor(trc)={get(hTrendFig,'color')};
|
|
else
|
|
hTrendFig=plot(1:n,dmMed(trc,1:n),'marker','^','lineWidth',2); hold on
|
|
linecolor(trc)={get(hTrendFig,'color')};
|
|
end
|
|
|
|
end
|
|
% yTicks= get(gca,'yTickLabel'); Ydelta= max(max(yTicks))-min(min(yTicks));
|
|
%spacing= Ydelta* 0.0034; %line spacing for STD marker
|
|
end
|
|
grid on
|
|
|
|
%set(gca,'linewidth',4) %0.5 then 1.5 now 6
|
|
%set(gca,'fontsize',axisFontSz) % 8 to 15 to 21
|
|
|
|
hold all
|
|
end %for trc= 1:Exp(expN).traceN
|
|
|
|
%************** Standard Deviation range bars *****************************
|
|
%range= ceil(max(max(upperStd))) - floor(min(min(lowerStd)));
|
|
range= ceil(max(upperStd(trc,1:end))) - floor(min(lowerStd(trc,1:end)));
|
|
spacing= range*0.0034;
|
|
for trc= 1:Exp(expN).traceN %length(Exp(expN).Trace)
|
|
for n=1:length(Exp(expN).Dexp(DexpN).DM.drug) %LOOP Thru Drug-Media perturbations
|
|
if isequal(get(Exp(expN).hOL(trc),'Visible'),'on')
|
|
try
|
|
line(n,lowerStd(trc,n):spacing:(dmMed(trc,n)-.05),'marker','^','LineWidth',1,'markerEdgeColor',cell2mat(linecolor(trc))); hold on
|
|
line(n,(dmMed(trc,n)+0.05):spacing:upperStd(trc,n),'marker','v','LineWidth',1,'markerEdgeColor',cell2mat(linecolor(trc))); hold on
|
|
catch
|
|
|
|
end
|
|
end
|
|
end %for n=1:length(Exp(expN).Dexp)
|
|
end %for trc= 1:Exp(expN).traceN
|
|
|
|
mm=1;
|
|
for nn= 1:length(NmLst)
|
|
if iscellstr(NmLst(nn))
|
|
legName(mm)=strrep(NmLst(nn),'_','-');
|
|
mm=mm+1;
|
|
end
|
|
end
|
|
legName= strrep(legName,'/','-');
|
|
hleg=legend((legName),'location','NEO');
|
|
set(hleg,'fontsize',legFontSz)
|
|
|
|
xlabel('Drug-Media Index')
|
|
ylabel('L in Hours')
|
|
title('Drug-Media Trend Plot with Standard Deviations')
|
|
hold off
|
|
end %if ~strcmp(Exp(expN).DexpType, 'chrono') %Single or Multi-Experiment 395
|
|
|
|
%***************************************************************
|
|
%+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
%end
|
|
hold off
|
|
end %if userPars.boxplotFlg~=1 %PLOT OVERLAY OF TRENDS 266
|
|
|