Files
hartman-server/workflow/apps/matlab/ezview/EZlstBoxExt.m
2024-07-29 12:31:26 -04:00

308 lines
13 KiB
Matlab
Executable File

%EZlstBoxExt.m
%Calls either EZdestComp.m
%or if 'Chrono' EZmDayPlotUCmp.m and EZmDayTrend.m and if ghandles.CompositeTog_,EZmDayPlotUcomposite
%or by EZviewGui.m (listboxGnOrf_Callback)
%Replace get(ghandles.CompositeTog1,'value')==1 ... with get(handles....
if expN==1 && get(handles.CompositeTog1,'value')==1 ||...
expN==2 && get(handles.CompositeTog2,'value')==1 ||...
expN==3 && get(handles.CompositeTog3,'value')==1
CompositeTrendFlg=1; else CompositeTrendFlg=0;
end
Exp(expN).cLmdEven= 0; %Added for Cummulative Median and Mean 'C' plot
RFDMflg=0;
if zoneSel==1,DexpN= (get(handles.DN1,'value')); end
if zoneSel==2,DexpN= (get(handles.DN2,'value')); end
if zoneSel==3,DexpN= (get(handles.DN3,'value')); end
try
p1=cell2mat(strfind(selGnOrf,'('));
p2= cell2mat(strfind(selGnOrf,')'));
dmNum= str2num(selGnOrf{1}(p1+1:p2-1));
inDM= selGnOrf{1}(p1+1:p2-1);
if (~isempty(dmNum)&& isnumeric(dmNum)),RFDMflg=1; end
catch
end
if RFDMflg, Exp(zoneSel).Dexp(DexpN).pertSel=dmNum; end %pertSel=pert;
inMP=selGnOrf{1}((LBdlims{:,:}(1))+1:(LBdlims{:,:}(2))-1)
%LBmp=str2double(inMP);
sgdInfoOnly=get(handles.InfoToggle,'value');
if sgdInfoOnly==1
%***************
EZviewInfoBox %*
%***************
else % Runs to end of EZlstBoxExt.m within this else condition
if zoneSel==1
Max=floor(get(handles.MPsldr1,'max'));
Min=floor(get(handles.MPsldr1,'min'));
if str2num(inMP) >= Min && str2num(inMP) <= Max
set(handles.MPed1,'string',inMP)
set(handles.MPsldr1,'value',str2double(inMP));
else
if str2num(inMP) >= Max, set(handles.MPsldr1,'value',Max); set(handles.MPed1,'string',num2str(Max));end
if str2num(inMP) <= Min, set(handles.MPsldr1,'value',Min),set(handles.MPed1,'string',num2str(Min));end
end
end
if zoneSel==2
Max=floor(get(handles.MPsldr2,'max'));
Min=floor(get(handles.MPsldr2,'min'));
if str2num(inMP) >= Min && str2num(inMP) <= Max
set(handles.MPed2,'string',inMP)
set(handles.MPsldr2,'value',str2double(inMP));
else
if str2num(inMP) >= Max, set(handles.MPsldr2,'value',Max); set(handles.MPed2,'string',num2str(Max));end
if str2num(inMP) <= Min, set(handles.MPsldr2,'value',Min),set(handles.MPed2,'string',num2str(Min));end
end
end
if zoneSel==3
Max=floor(get(handles.MPsldr3,'max'));
Min=floor(get(handles.MPsldr3,'min'));
if str2num(inMP) >= Min && str2num(inMP) <= Max
set(handles.MPed3,'string',inMP)
set(handles.MPsldr3,'value',str2double(inMP));
else
if str2num(inMP) >= Max, set(handles.MPsldr3,'value',Max); set(handles.MPed3,'string',num2str(Max));end
if str2num(inMP) <= Min, set(handles.MPsldr3,'value',Min),set(handles.MPed3,'string',num2str(Min));end
end
end
if RFDMflg,
if zoneSel==1
Max=floor(get(handles.DMsldr1,'max'));
Min=floor(get(handles.DMsldr1,'min'));
if str2num(inDM) >= Min && str2num(inDM) <= Max
set(handles.DMed1,'string',inDM)
set(handles.DMsldr1,'value',str2double(inDM));
else
if str2num(inDM) >= Max, set(handles.DMsldr1,'value',Max); set(handles.DMed1,'string',num2str(Max));end
if str2num(inDM) <= Min, set(handles.DMsldr1,'value',Min),set(handles.DMed1,'string',num2str(Min));end
end
end
if zoneSel==2
Max=floor(get(handles.DMsldr2,'max'));
Min=floor(get(handles.DMsldr2,'min'));
if str2num(inDM) >= Min && str2num(inDM) <= Max
set(handles.DMed2,'string',inDM)
set(handles.DMsldr2,'value',str2double(inDM));
else
if str2num(inDM) >= Max, set(handles.DMsldr2,'value',Max); set(handles.DMed2,'string',num2str(Max));end
if str2num(inDM) <= Min, set(handles.DMsldr2,'value',Min),set(handles.DMed2,'string',num2str(Min));end
end
end
if zoneSel==3
Max=floor(get(handles.DMsldr3,'max'));
Min=floor(get(handles.DMsldr3,'min'));
if str2num(inDM) >= Min && str2num(inDM) <= Max
set(handles.DMed3,'string',inDM)
set(handles.DMsldr3,'value',str2double(inDM));
else
if str2num(inDM) >= Max, set(handles.DMsldr3,'value',Max); set(handles.DMed3,'string',num2str(Max));end
if str2num(inDM) <= Min, set(handles.DMsldr3,'value',Min),set(handles.DMed3,'string',num2str(Min));end
end
end
end
%**************************************************************************
EZVimDisplay %**
%**************************************************************************
%17_111 If CompositeTog_ set, Routine called to find all gene replicates and produce composite values
if CompositeTrendFlg==1
if strcmp(Exp(expN).DexpType, 'chrono')
%***********************
EZmDayPlotUcmp %*
%***********************
else
%***********************
EZplotUcmp %*
%***********************
end
%*******************************************************************
%***********PLOT Selected Gene/Orf Spot ******************************************
% if non-Composite ("normal") then - ...
elseif CompositeTrendFlg~=1
destPerMP= Exp(zoneSel).Dexp(DexpN).destPerMP; %length(gS.DM1.drug);
pertSel=Exp(zoneSel).Dexp(DexpN).pertSel; %floor(get(handles.DMsldr1,'value'));
plateNum=(LBmp-1)*destPerMP + pertSel;
indx=((LBr-1)*24) +LBc
MP=Exp(zoneSel).Dexp(DexpN).MP;
try
K=scan(1,plateNum).plate(1).CFout(indx,3); Ks= num2str(K);
r=scan(1,plateNum).plate(1).CFout(indx,4); rs= num2str(r);
l=scan(1,plateNum).plate(1).CFout(indx,5); Ls= num2str(l);
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
Kl=scan(1,plateNum).plate(1).CFout(indx,7);
Ku=scan(1,plateNum).plate(1).CFout(indx,8);
rl=scan(1,plateNum).plate(1).CFout(indx,9);
ru=scan(1,plateNum).plate(1).CFout(indx,10);
lfast=scan(1,plateNum).plate(1).CFout(indx,11);
lslow=scan(1,plateNum).plate(1).CFout(indx,12);
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
tser=(scan(1,plateNum).plate(1).t0Series(:));
rawData= scan(1,plateNum).plate(1).intens(indx,:)/scan(1,plateNum).plate(1).Ag(indx);
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;
traceN=Exp(1).traceN;
end
if zoneSel==2, plotAxes=ghandles.Paxes2; OLaxes=ghandles.OLaxes2;Daxes=ghandles.Daxes2;
Dlaxes=ghandles.Dlaxes2;Dkaxes=ghandles.Dkaxes2;Draxes=ghandles.Draxes2;
Exp(2).traceN=Exp(2).traceN+1;
traceN=Exp(2).traceN;
end
if zoneSel==3, plotAxes=ghandles.Paxes3; OLaxes=ghandles.OLaxes3;Daxes=ghandles.Daxes3;
Dlaxes=ghandles.Dlaxes3;Dkaxes=ghandles.Dkaxes3;Draxes=ghandles.Draxes3;
Exp(3).traceN=Exp(3).traceN+1;
traceN=Exp(3).traceN;
end
plot(plotAxes,t,g);hold (plotAxes,'on');plot(plotAxes,tser,rawData,'g*');
plot(plotAxes,t,gSlow,'y');plot(plotAxes,t,gFast,'r');hold (plotAxes,'off');
%************CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC**************************************
%Store L R and K valves for 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
Exp(zoneSel).hOL(traceN)=plot(OLaxes,t,g);hold on;
set(Exp(zoneSel).hOL(traceN),'color',[1 0 0])
Exp(zoneSel).hOLb(traceN)=plot(OLaxes,tser,rawData,'g*');
catch
catchissue='Ln100 EZlstBoxExt'
end %trycatch
%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
if isequal(selGnOrf{1}(1:3),'RF1')
gene= {selGnOrf{1}(1:p2)};
geneOrfstr= strcat(gene,'_','m',num2str(LBmp),'r',num2str(LBr),'c',num2str(LBc),'_',tPtStr);
grfgenestr= strcat(gene,'_','m',num2str(LBmp),'r',num2str(LBr),'c',num2str(LBc));
else
gene=MP(1,LBmp).genename{1,1}(indx); orf=MP(1,LBmp).orf{1,1}(indx);
geneOrfstr= strcat(gene,'_',orf,'_','m',num2str(LBmp),'r',num2str(LBr),'c',num2str(LBc),'_',tPtStr);
grfgenestr= strcat(gene,'_',orf,'_','m',num2str(LBmp),'r',num2str(LBr),'c',num2str(LBc));
end
spec=MP(1,LBmp).specifics{1,1}(indx); %orfrep=MP(1,plateNum).orfRep{1,1}(indx);
tPtStr=strcat('T=', num2str(scan(1,plateNum).plate(1).t0Series(tPtSel)));
graphStr=strcat(grfgenestr,'_','L=',Lstr,'_','r=',rstr,'_','K=',Kstr);
spotDescrip=strcat(graphStr,'->',DMstr);
xp=char(Exp(zoneSel).Dexp(DexpN).resDir);
if ispc,
slashPos=strfind(char(Exp(zoneSel).Dexp(DexpN).resDir),'\');
else
slashPos=strfind(char(Exp(zoneSel).Dexp(DexpN).resDir),'/');
end
startPos=slashPos(length(slashPos)-1) +1;
endPos=slashPos(length(slashPos)) -1
expStr= {xp(startPos:endPos)}
Exp(zoneSel).hOLname(traceN)= spotDescrip; %graphStr; %ghandles.Exp(zoneSel).hOLname(traceN)= graphStr;
Exp(zoneSel).hOLexpNm(traceN)= expStr; %ghandles.Exp(expN).hOLexpNm(traceN)= expStr;
Exp(zoneSel).hOLresDir(traceN)= {Exp(zoneSel).Dexp(DexpN).resDir};
Exp(zoneSel).hOLplateNum(traceN)= plateNum;
%traceData= vertcat(get(Exp(OLay).hOL(traceN),'XData'),get(ghandles.Exp(OLay).hOL(traceN),'YData'));
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
if zoneSel==1,set(ghandles.graphStrLoc1,'string',spotDescrip);end %graphStr);end % Displays the value.
if zoneSel==2,set(ghandles.graphStrLoc2,'string',spotDescrip);end %graphStr);end
if zoneSel==3,set(ghandles.graphStrLoc3,'string',spotDescrip);end %graphStr);end
catch
catchissue='Ln141 EZlstBoxExt'
msg='Error'
end % trycatch zoneSel<4 datatip selection from Image (not from an OverLay Plot)
end %if get(ghandles.CompositeTog1,'value')==1
%**************Write Spot and Exp Info to OLay title areas****************************************************************************
if zoneSel==1, %&& get(ghandles.rotPB1,'value')~=1
if length(char(Exp(zoneSel).hOLname(traceN)))>40,set(ghandles.OLay1,'FontSize',8);end
set(ghandles.OLay1,'string', Exp(zoneSel).hOLname(traceN));
if length(char(Exp(zoneSel).hOLexpNm(traceN)))>40,set(ghandles.OLexp1,'FontSize',8);end
set(ghandles.OLexp1,'string',Exp(zoneSel).hOLexpNm(traceN));
end
if zoneSel==2 %&& get(ghandles.rotPB2,'value') ~=1
if length(char(Exp(zoneSel).hOLname(traceN)))>40,set(ghandles.OLay2,'FontSize',8);end
set(ghandles.OLay2,'string', Exp(zoneSel).hOLname(traceN));
if length(char(Exp(zoneSel).hOLexpNm(traceN)))>40,set(ghandles.OLexp2,'FontSize',8);end
set(ghandles.OLexp2,'string',Exp(zoneSel).hOLexpNm(traceN));
end
if zoneSel==3 %&& get(ghandles.rotPB3,'value') ~=1
if length(char(Exp(zoneSel).hOLname(traceN)))>40,set(ghandles.OLay3,'FontSize',8);end
set(ghandles.OLay3,'string', Exp(OLay).hOLname(traceN));
if length(char(Exp(zoneSel).hOLexpNm(traceN)))>40,set(ghandles.OLexp3,'FontSize',8);end
set(ghandles.OLexp3,'string',Exp(OLay).hOLexpNm(traceN));
end
%*****************Highlight gene/orf select Spot on Image*********
tPtSel=Exp(zoneSel).Dexp(DexpN).tPtSel;
Rim= 16-(LBr-1); Cim =LBc;
spotCoor=Exp(zoneSel).Dexp(DexpN).FexpScanSpots{1,plateNum}{Cim,Rim,tPtSel};
if zoneSel==1, expAxes=ghandles.Iaxes1;end
if zoneSel==2, expAxes=ghandles.Iaxes2;end
if zoneSel==3, expAxes=ghandles.Iaxes3;end
%axes(ghandles.Iaxes1)
plot(expAxes,(spotCoor(2)+24),(spotCoor(1)+24),'.y')
%***********************GraphicDestinationPerturbationComparison**15_0821************************************************
EZdatatip=0; %**
if strcmp((Exp(expN).DexpType),'single')||...
strcmp((Exp(expN).DexpType),'multi')
%****************
EZdestComp %**
%****************
elseif strcmp((Exp(expN).DexpType),'chrono')
%************
EZmDayTrend %**
%************
end
%***********************************************************************************************************************
%*********************HeatMap Text Field*********************************
try
ll=num2str(l);
if length(ll)>5,htl= ll(1:5);else htl=ll;end
catch
htl=' ';
end
try
n1= num2str(Exp(expN).Dexp(DexpN).HtMpIntN1(indx));
if length(n1)>5,N1= n1(1:5);else N1=n1; end
htN1=strcat('_N1=',N1);
catch,
htN1=' ';
end
try
htmapStr=strcat('L= ',htl, htN1)
if expN==1,set(ghandles.HtMapVals1,'string',htmapStr);end
if expN==2,set(ghandles.HtMapVals2,'string',htmapStr);end
if expN==3,set(ghandles.HtMapVals3,'string',htmapStr);end
catch
end
end %if sgdInfoOnly==1