591 lines
29 KiB
Matlab
Executable File
591 lines
29 KiB
Matlab
Executable File
% User find and build composite of Selected Gene Composite and
|
|
% Plot it on OLay Plot and Trend plot DNLaxles
|
|
% For Chonological Studies (multi Day 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
|
|
|
|
tracN=Exp(expN).traceN;
|
|
n=Exp(expN).DexpN; % Temp input for development
|
|
% UmDayaa=cell(3,n); UmDaybb=cell(3,n);
|
|
patrnN=strfind(selGnOrf{1},':'); % Extract Gene-Orf Name
|
|
selStrNm=char(selGnOrf)
|
|
usrGene=selStrNm(1:(patrnN(1)-1))
|
|
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);
|
|
% usrGene=cell2mat(answer(1));
|
|
usrSpec=answer(1);
|
|
usrGnSp=strcat(usrGene,usrSpec);
|
|
if strcmpi(usrSpec,'None'), usrGnSp={strcat(usrGene,'-')}; end
|
|
|
|
% if strfind(Exp(expN).UgeneSpLst,usrGnSp), break; end
|
|
Exp(expN).Dexp(n).UsrmdPLB={[]};
|
|
Exp(expN).Dexp(n).UsrMedianG=[];
|
|
Exp(expN).Dexp(n).UsrminG=[];
|
|
Exp(expN).Dexp(n).UsrmaxG=[];
|
|
Exp(expN).Dexp(n).UsrstdG=[];
|
|
Exp(expN).Dexp(n).UsrmeanG=[];
|
|
Exp(expN).Dexp(n).UsrCmpGL=[]; % For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrCmpGK=[]; % For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrCmpGr=[]; % For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrGLB={};
|
|
|
|
for n=1:Exp(expN).DexpLength % Loop Thru Dayexps
|
|
MPnum=length(Exp(expN).Dexp(n).MP);
|
|
DMnum=length(Exp(expN).Dexp(n).DM.drug);
|
|
tPtsSize=size(Exp(expN).Dexp(n).FexpScanBMtp{1,1},(3));
|
|
% lstindx=size(aa,1);
|
|
% lstindxOrf=size(bb,1);
|
|
spN=0;
|
|
rfcnt=0;
|
|
dRF1indx=0;
|
|
% usrGene=cell2mat(usrGene); %user entry of Specifics for Ref selection
|
|
usrSp=cell2mat(usrSpec); %user entry of Specifics for Ref selection
|
|
|
|
for mp=1:length(Exp(expN).Dexp(n).MP)
|
|
% RF1fullPlate=0;
|
|
for ind384=1:384
|
|
spN=spN+1;
|
|
try
|
|
r=ceil(ind384/24);
|
|
if rem(ind384,24)==0, c=24; else c=rem(ind384,24); end
|
|
% 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(n).MP(mp).genename{1}(ind384))==38991
|
|
Exp(expN).Dexp(n).MP(mp).genename{1}(ind384)={'OCT1_'};
|
|
elseif isnumeric(cell2mat(Exp(expN).Dexp(n).MP(mp).genename{1}(ind384)))
|
|
Exp(expN).Dexp(n).MP(mp).genename{1}(ind384)={' '};
|
|
end
|
|
|
|
% DISPersed REFerence capture and find Medians
|
|
if ( ((strcmpi((Exp(expN).Dexp(n).MP(mp).genename{1}(ind384)),usrGene) ...
|
|
&& strcmpi((Exp(expN).Dexp(n).MP(mp).specifics{1}(ind384)),usrSp))) ...
|
|
|| ((strcmpi((Exp(expN).Dexp(n).MP(mp).genename{1}(ind384)),usrGene) ...
|
|
&& strcmpi(usrSp,'None'))) )
|
|
dRF1indx=dRF1indx+1;
|
|
Exp(expN).Dexp(n).MP(mp).genename{1}(ind384)=strrep((Exp(expN).Dexp(n).MP(mp).genename{1}(ind384)),':',' ');
|
|
drf(dRF1indx,1)=(Exp(expN).Dexp(n).MP(mp).genename{1}(ind384));
|
|
drf(dRF1indx,2)={strcat(':',num2str(mp),':',num2str(r),':',num2str(c))};
|
|
drf(dRF1indx,3)={mp}; drfMP(dRF1indx,mp)=mp;
|
|
drf(dRF1indx,4)={r}; drfr(dRF1indx,mp)=r;
|
|
drf(dRF1indx,5)={c}; drfc(dRF1indx,mp)=c;
|
|
drf(dRF1indx,6)={ind384}; drfPindx(dRF1indx,mp)=ind384;
|
|
%drf(dRF1indx,7)=(Exp(expN).Dexp(n).MP(mp).specifics{1}(ind384));
|
|
end
|
|
catch
|
|
error='EZexpSel lineAfter 24 EZmultiGeneLst.m'
|
|
mp %Disable in future to prevent a bomb out OR put into a nested TryCatch
|
|
ind384 %Disable in future to prevent a bomb out OR put into a nested TryCatch
|
|
msgBadGeneName=strcat('check genename at mp=',num2str(mp),' indx=',num2str(ind384))
|
|
end
|
|
end
|
|
mp
|
|
end
|
|
|
|
% Exp(expN).Dexp(n).UsrmdPindx=[];
|
|
% Exp(expN).Dexp(n).UsrmdPpltN=[];
|
|
if exist('drf','var')
|
|
% Det. index of change from one MP to the next
|
|
i=2;
|
|
clear chgIndx
|
|
chgIndx(1)=1;
|
|
for j=1:length(drf(:,3))
|
|
if j>1
|
|
if cell2mat(drf(j,3))~=cell2mat(drf((j-1),3)), chgIndx(i)=j; i=i+1; end
|
|
end
|
|
end
|
|
chgIndx(length(chgIndx)+1)=length(drf)+1;
|
|
uu=zeros(size(drf,1),4);
|
|
uu(:,1:4)=cell2mat(drf(:,3:6));
|
|
vv=zeros(length(drf),1 ); % DMnum);
|
|
dMPs=unique(cell2mat(drf(:,3)));
|
|
|
|
for mm=1:length(dMPs) % length(chgIndx)
|
|
usrScNdisp=((dMPs(mm)-1)*DMnum)+(dmSel);
|
|
NZrefIndxP=drfPindx((find(drfPindx(:,dMPs(mm)))),dMPs(mm)); medianIndxDisp=NZrefIndxP;
|
|
vv(chgIndx(mm):(chgIndx(mm+1)-1),dmSel)=Exp(expN).Dexp(n).scan(usrScNdisp).plate(1).CFout(NZrefIndxP,5);
|
|
% For Global Ref Composite 17_1009
|
|
vvK(chgIndx(mm):(chgIndx(mm+1)-1),dmSel)=Exp(expN).Dexp(n).scan(usrScNdisp).plate(1).CFout(NZrefIndxP,3);
|
|
vvr(chgIndx(mm):(chgIndx(mm+1)-1),dmSel)=Exp(expN).Dexp(n).scan(usrScNdisp).plate(1).CFout(NZrefIndxP,4);
|
|
end % for mm=1:length(dMPs)
|
|
% Calc. Global Mean, Std, And Median For Distributed References
|
|
uu=horzcat(uu,vv);
|
|
for d=dmSel:dmSel
|
|
medianIndxG=[];
|
|
NZusrIndxG=[];
|
|
minG=min(nonzeros(vv(:,d)));
|
|
maxG=max(nonzeros(vv(:,d)));
|
|
usrmeanG=mean(nonzeros(vv(:,d)));
|
|
usrStdG=std(nonzeros(vv(:,d)));
|
|
NZusrIndxG=find(vv(:,d));
|
|
if isempty(usrmeanG)
|
|
nonZeroCntD=0 % medianIndxDisp=RFmeanG(d);
|
|
else
|
|
nonZeroCntD=length(nonzeros(vv(:,d)));
|
|
end
|
|
% Calc. of median value for composite doesn't require and odd number of Indx items
|
|
medianIndxG=NZusrIndxG(:);
|
|
if ~isempty(NZusrIndxG) && length(medianIndxG) > 0 %(.15*size(drf,1)) %To calc. a median, more than 15% of spots must be nonZero
|
|
Exp(expN).Dexp(n).UsrGLB(d)=usrGnSp; % strcat(aa(lstindx,1),aa(lstindx,2));
|
|
Exp(expN).Dexp(n).UsrLvals=vv(medianIndxG);
|
|
Exp(expN).Dexp(n).UsrKvals=vvK(medianIndxG);
|
|
Exp(expN).Dexp(n).Usrrvals=vvr(medianIndxG);
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
Exp(expN).UgeneCnt=Exp(expN).UgeneCnt +1;
|
|
Exp(expN).UgeneSpLst(Exp(expN).UgeneCnt)=usrGnSp;
|
|
|
|
% PLOT Values Selected Gene-Specifics Composite
|
|
smpSz=size(medianIndxG,1);
|
|
K=median(vvK(medianIndxG,dmSel)); Ks=num2str(K); Kstd=std(vvK(medianIndxG,dmSel)); KstdStr=num2str(Kstd);
|
|
r=median(vvr(medianIndxG,dmSel)); rs=num2str(r); rstd=std(vvr(medianIndxG,dmSel)); rstdStr=num2str(rstd);
|
|
l=median(vv(medianIndxG,dmSel)); Ls=num2str(l); Lstd=std(vv(medianIndxG,dmSel)); LstdStr=num2str(Lstd);
|
|
Kl=K - std(vvK(medianIndxG,dmSel)); %K - Exp(expN).Dexp(DexpN).RFcmpK(RFnum).dm(inDM).std;
|
|
Ku=K + std(vvK(medianIndxG,dmSel)); %K + Exp(expN).Dexp(DexpN).RFcmpK(RFnum).dm(inDM).std;
|
|
rl=r - std(vvr(medianIndxG,dmSel)); %r - Exp(expN).Dexp(DexpN).RFcmpr(RFnum).dm(inDM).std;
|
|
ru=r + std(vvr(medianIndxG,dmSel)); %r + Exp(expN).Dexp(DexpN).RFcmpr(RFnum).dm(inDM).std;
|
|
lfast=l - std(vv(medianIndxG,dmSel)); %l - Exp(expN).Dexp(DexpN).RFcmpL(RFnum).dm(inDM).std;
|
|
lslow=l + std(vv(medianIndxG,dmSel)); %l + Exp(expN).Dexp(DexpN).RFcmpL(RFnum).dm(inDM).std;
|
|
|
|
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
|
|
|
|
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
|
|
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;
|
|
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,t,gSlow,'y');plot(plotAxes,t,gFast,'r');hold (plotAxes,'off');
|
|
% 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])
|
|
catch
|
|
catchissue='Ln100 EZlstBoxExt'
|
|
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,'_');
|
|
|
|
% 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);
|
|
graphStr=strcat(usrGnSp,'_','L=',Lstr,'_','Ls=',LstdStr,'_','r=',rstr,'_','rs=',rstdStr,'_','K=',Kstr,'Ks=',KstdStr);
|
|
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 ME
|
|
msg='ME.message';
|
|
end % trycatch zoneSel<4 datatip selection from Image (not from an OverLay Plot)
|
|
|
|
|
|
% Deprecated functions
|
|
%{
|
|
% If a specific spot median is ever needed
|
|
%Calc. of EXACT median specific culture requires an odd number of indx items
|
|
if ~isempty(NZusrIndxG) && mod(nonZeroCntD,2)==0, medianIndxOdd= NZusrIndxG(1:(size(NZusrIndxG,1)-1)); end
|
|
if ~isempty(NZusrIndxG) && mod(nonZeroCntD,2)~=0, medianIndxOdd=NZusrIndxG(:); end
|
|
mvalsDG=median(vv(medianIndxOdd,d)); %(nonzeros(vv(:,d)));
|
|
nzPosIndxDG=find(mvalsDG==vv(:,d));
|
|
Exp(expN).Dexp(n).UsrMedianG(d)=mvalsDG;
|
|
Exp(expN).Dexp(n).UsrminG(d)=minG;
|
|
Exp(expN).Dexp(n).UsrmaxG(d)=maxG;
|
|
Exp(expN).Dexp(n).UsrstdG(d)=usrStdG;
|
|
Exp(expN).Dexp(n).UsrmeanG(d)=usrmeanG;
|
|
%}
|
|
%{
|
|
Exp(expN).Dexp(n).UsrCmpGL.dm(d).med=median(vv(medianIndxP,d)); %For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrCmpGL.dm(d).mean=mean(vv(medianIndxP,d)); %For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrCmpGL.dm(d).std=std(vv(medianIndxP,d)); %For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrCmpGL.dm(d).min=min(vv(medianIndxP,d)); %For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrCmpGL.dm(d).max=max(vv(medianIndxP,d)); %For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrCmpGK.dm(d).med=median(vvK(medianIndxP,d)); %For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrCmpGK.dm(d).mean=mean(vvK(medianIndxP,d)); %For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrCmpGK.dm(d).std=std(vvK(medianIndxP,d)); %For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrCmpGK.dm(d).min=min(vvK(medianIndxP,d)); %For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrCmpGK.dm(d).max=max(vvK(medianIndxP,d)); %For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrCmpGr.dm(d).med=median(vvr(medianIndxP,d)); %For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrCmpGr.dm(d).mean=mean(vvr(medianIndxP,d)); %For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrCmpGr.dm(d).std=std(vvr(medianIndxP,d)); %For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrCmpGr.dm(d).min=min(vvr(medianIndxP,d)); %For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrCmpGr.dm(d).max=max(vvr(medianIndxP,d)); %For Ref Composite 17_1026
|
|
%}
|
|
|
|
|
|
%{
|
|
for mm=1:length(dMPs) % length(chgIndx)
|
|
|
|
for d=selDM:selDM %1:(DMnum)
|
|
medianIndxDisp=[];
|
|
NZrefIndxP=[];
|
|
nonZeroValsP=[];
|
|
medValLstDisp=[];
|
|
usrScNdisp=((dMPs(mm)-1)*DMnum)+(d);
|
|
|
|
try % Determine the dispersed User Gene median mean and std if such exist
|
|
NZrefIndxP=drfPindx((find(drfPindx(:,dMPs(mm)))),dMPs(mm)); medianIndxDisp=NZrefIndxP
|
|
vv(chgIndx(mm):(chgIndx(mm+1)-1),d)=Exp(expN).Dexp(n).scan(usrScNdisp).plate(1).CFout(NZrefIndxP,5);
|
|
%For Global Ref Composite 17_1009 %**************************************************************************
|
|
vvK(chgIndx(mm):(chgIndx(mm+1)-1),d)=Exp(expN).Dexp(n).scan(usrScNdisp).plate(1).CFout(NZrefIndxP,3);
|
|
vvr(chgIndx(mm):(chgIndx(mm+1)-1),d)=Exp(expN).Dexp(n).scan(usrScNdisp).plate(1).CFout(NZrefIndxP,4);
|
|
%*****************************************************************************************************
|
|
%{
|
|
nonZeroValsP=nonzeros(Exp(expN).Dexp(n).scan(usrScNdisp).plate(1).CFout(NZrefIndxP,5));
|
|
std1Disp=std(nonZeroValsP);
|
|
mean1Disp=mean(nonZeroValsP);
|
|
minDisp=min(nonZeroValsP);
|
|
maxDisp=max(nonZeroValsP);
|
|
drfVals=Exp(expN).Dexp(n).scan(usrScNdisp).plate(1).CFout(NZrefIndxP,5);
|
|
|
|
%nzValsAcc(mm).DM(d,:)=nonZeroValsP;
|
|
|
|
%MEDIAN Determination for PLATES with Dispersed RFs
|
|
%NZrefIndxP=NZrefIndxP %find(Exp(expN).Dexp(n).scan(usrScNdisp).plate(1).CFout(NZrefIndxP,5));
|
|
if isempty(NZrefIndxP), nonZeroCntDisp=0, medianIndxDisp=NZrefIndxP;
|
|
else nonZeroCntDisp=length(NZrefIndxP);
|
|
end
|
|
if ~isempty(NZrefIndxP) && mod(nonZeroCntDisp,2)==0, medianIndxDisp= NZrefIndxP(1:nonZeroCntDisp-1); end
|
|
if ~isempty(NZrefIndxP) && mod(nonZeroCntDisp,2)~=0, medianIndxDisp=NZrefIndxP; end
|
|
%}
|
|
if ~isempty(NZrefIndxP) && length(medianIndxDisp) > 0 %(.15*384) %To calc. a median, more than 15% of spots must be nonZero
|
|
medValLstDisp=Exp(expN).Dexp(n).scan(usrScNdisp).plate(1).CFout(medianIndxDisp,5);
|
|
mval1Disp=median(medValLstDisp);
|
|
nzMedPosIndx=find(mval1Disp==nonZeroValsP);
|
|
medianIndxP=NZrefIndxP(nzMedPosIndx);
|
|
%UsrmdlocP(1)=ceil(medianIndxP/24); %calc r value
|
|
%UsrmdlocP(2)=medianIndxP - ((UsrmdlocP(1)-1)*24); %calc c value
|
|
|
|
meanKval=mean(nonzeros((Exp(expN).Dexp(n).scan(usrScNdisp).plate(1).CFout(NZrefIndxP,3))));
|
|
meanrval=mean(nonzeros((Exp(expN).Dexp(n).scan(usrScNdisp).plate(1).CFout(NZrefIndxP,4))));
|
|
else
|
|
% Need to set L r K values to zeros or pick the first spot with zeros
|
|
%Spot 1 could be other than zero as the median isn't calculated if fewer than some percent are nonzero
|
|
medianCalcFailedD='To Few nonZero spots for valid median RF1 selection'
|
|
firstZeroDindx=find(((Exp(expN).Dexp(n).scan(usrScNdisp).plate(1).CFout(NZrefIndxP,5))==0),1,'first');
|
|
firstZeroD=drfPindx((firstZeroDindx),dMPs(mm));
|
|
%Exp(expN).Dexp(n).UsrmdPindx(d,dMPs(mm))=firstZeroD;
|
|
%Exp(expN).Dexp(n).UsrmdPpltN(d,dMPs(mm))=dMPs(mm); %RF1mp; %Is this supposed to be the MP number or the ScanPlate number???
|
|
|
|
|
|
end %~isempty(NZrefIndxP) && length(medianIndxPisp) > 3 ln584
|
|
catch %try ln565
|
|
medianCalcTryFailed1D='Failed! Failed! {Dispersed RF1s}'
|
|
try
|
|
firstZeroindxD=find(vv((chgIndx(d):chgIndx(d+1)-1),5)==0,1,'first');
|
|
firstZeroPindx=uu(firstZeroindxD,4);
|
|
catch
|
|
end
|
|
end %try ~ln565
|
|
end %for d=0:DMnum
|
|
end %for mm=1:length(dMPs)
|
|
%}
|
|
|
|
%{
|
|
%Code Template taken from EZlstBoxCmpExt.m
|
|
try
|
|
%if RFcmpGFlg==0
|
|
smpSz=size(medianIndxP,1);
|
|
K=median(vvK(medianIndxP,dmSel)); Ks=num2str(K); Kstd=std(vvK(medianIndxP,dmSel)); KstdStr=num2str(Kstd);
|
|
r=median(vvr(medianIndxP,dmSel)); rs=num2str(r); rstd=std(vvr(medianIndxP,dmSel)); rstdStr=num2str(rstd);
|
|
l=median(vv(medianIndxP,dmSel)); Ls=num2str(l); Lstd=std(vv(medianIndxP,dmSel)); LstdStr=num2str(Lstd);
|
|
Kl=K - std(vvK(medianIndxP,dmSel)); %K - Exp(expN).Dexp(DexpN).RFcmpK(RFnum).dm(inDM).std;
|
|
Ku=K + std(vvK(medianIndxP,dmSel)); %K + Exp(expN).Dexp(DexpN).RFcmpK(RFnum).dm(inDM).std;
|
|
rl=r - std(vvr(medianIndxP,dmSel)); %r - Exp(expN).Dexp(DexpN).RFcmpr(RFnum).dm(inDM).std;
|
|
ru=r + std(vvr(medianIndxP,dmSel)); %r + Exp(expN).Dexp(DexpN).RFcmpr(RFnum).dm(inDM).std;
|
|
lfast=l - std(vv(medianIndxP,dmSel)); %l - Exp(expN).Dexp(DexpN).RFcmpL(RFnum).dm(inDM).std;
|
|
lslow=l + std(vv(medianIndxP,dmSel)); %l + Exp(expN).Dexp(DexpN).RFcmpL(RFnum).dm(inDM).std;
|
|
|
|
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
|
|
|
|
|
|
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).lstd(traceN)=std(vv(medianIndxP,dmSel)); %Exp(expN).Dexp(DexpN).RFcmpL(RFnum).dm(inDM).std;
|
|
Exp(expN).kstd(traceN)=std(vvK(medianIndxP,dmSel)); %Exp(expN).Dexp(DexpN).RFcmpK(RFnum).dm(inDM).std;
|
|
Exp(expN).rstd(traceN)=std(vvr(medianIndxP,dmSel)); %Exp(expN).Dexp(DexpN).RFcmpr(RFnum).dm(inDM).std;
|
|
|
|
|
|
Exp(expN).lslow(traceN)=lslow; Exp(expN).lfast(traceN)=lfast;
|
|
Exp(expN).lKl(traceN)=Kl; Exp(expN).Ku(traceN)=Ku;
|
|
Exp(expN).lrl(traceN)=rl; Exp(expN).Ku(traceN)=ru;
|
|
%************************************************************************
|
|
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*'); %No Raw Data, Ref Composite 17_1009
|
|
catch
|
|
catchissue='Ln68 EZlstBoxCmpExt'
|
|
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
|
|
DMstr=num2str(dmSel);
|
|
|
|
%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(usrGnSp,'_','L=',Lstr,'_','Lstd=',LstdStr,'_','r=',rstr,'_','rstd=',rstdStr,'_','K=',Kstr,'Kstd=',KstdStr);
|
|
graphStr=strcat(usrGnSp,'_','L=',Lstr,'_','Lstd=',LstdStr,'_','r=',rstr,'_','rstd=',rstdStr,'_','K=',Kstr,'Kstd=',KstdStr);
|
|
spotDescrip=strcat(graphStr,'DMS->',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)=usrGnSp; %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='Ln33 EZlstBoxCmpExt'
|
|
msg='Error'
|
|
end % trycatch zoneSel<4 datatip selection from Image (not from an OverLay Plot)
|
|
%**************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
|
|
%}
|
|
%**********************************************************************
|
|
|
|
%{
|
|
%elseif RFcmpGFlg==1
|
|
K=Exp(expN).Dexp(DexpN).RFcmpGK.dm(inDM).med; Ks=num2str(K);
|
|
r=Exp(expN).Dexp(DexpN).RFcmpGr.dm(inDM).med; rs=num2str(r);
|
|
l=Exp(expN).Dexp(DexpN).RFcmpGL.dm(inDM).med; Ls=num2str(l);
|
|
Kl=K - Exp(expN).Dexp(DexpN).RFcmpGK.dm(inDM).std;
|
|
Ku=K + Exp(expN).Dexp(DexpN).RFcmpGK.dm(inDM).std;
|
|
rl=r - Exp(expN).Dexp(DexpN).RFcmpGr.dm(inDM).std;
|
|
ru=r + Exp(expN).Dexp(DexpN).RFcmpGr.dm(inDM).std;
|
|
lfast=l - Exp(expN).Dexp(DexpN).RFcmpGL.dm(inDM).std;
|
|
lslow=l + Exp(expN).Dexp(DexpN).RFcmpGL.dm(inDM).std;
|
|
end
|
|
%}
|
|
%Exp(expN).Dexp(n).UsrmdPindx=[];
|
|
%Exp(expN).Dexp(n).UsrmdPpltN=[];
|
|
%Exp(expN).Dexp(n).UsrmdPscanN=[];
|
|
%Exp(expN).Dexp(n).UsrMedianP=[];
|
|
%Exp(expN).Dexp(n).stdP=[];
|
|
%Exp(expN).Dexp(n).meanP=[];
|
|
%Exp(expN).Dexp(n).minP=[];
|
|
%Exp(expN).Dexp(n).maxP=[];
|
|
|
|
%Exp(expN).Dexp(n).RFmdGLB={[]};
|
|
%Exp(expN).Dexp(n).RFmdGindx=[];
|
|
%Exp(expN).Dexp(n).RFmdGpltN=[];
|
|
%Exp(expN).Dexp(n).RFmdGscanN=[];
|
|
|
|
%UsrmdDGloc(d,1)=uu(nzPosIndxDG,1); %MP of distributedGlobal Median value
|
|
%UsrmdDGloc(d,2)=uu(nzPosIndxDG,2); %calc r value
|
|
%UsrmdDGloc(d,3)=uu(nzPosIndxDG,3); %calc c value
|
|
%lstindx=lstindx+1;
|
|
%lstindxOrf=lstindxOrf+1;
|
|
%{
|
|
usrGLbl=strcat(usrGnSp,'UmdG('); %accomodate User Ref Selection
|
|
aa(lstindx,1)=strcat(usrGLbl,num2str(d),')'); %remove string2cell brackets {...}
|
|
aa(lstindx,2)={strcat(':',num2str(UsrmdDGloc(d,1)),':',num2str(UsrmdDGloc(d,2)),':',num2str(UsrmdDGloc(d,3)))}; %,'std_',num2str(std2))};
|
|
bb(lstindxOrf,1)=strcat(usrGLbl,num2str(d),')'); %remove string2cell brackets {...}
|
|
bb(lstindxOrf,2)={strcat(':',num2str(UsrmdDGloc(d,1)),':',num2str(UsrmdDGloc(d,2)),':',num2str(UsrmdDGloc(d,3)))}; %,'std_',num2str(std2))};
|
|
%Composite Reference Amalgum Plot ******************
|
|
lstindx=lstindx+1;
|
|
lstindxOrf=lstindxOrf+1;
|
|
aa(lstindx,1)=strcat(usrGnSp,'UcmpG(',num2str(d),')');
|
|
aa(lstindx,2)={''};
|
|
bb(lstindxOrf,1)=strcat(usrGnSp,'UcmpG(',num2str(d),')');
|
|
bb(lstindxOrf,2)={''};
|
|
%*****************************************************
|
|
%}
|
|
%{
|
|
lstindx=lstindx+1;
|
|
lstindxOrf=lstindxOrf+1;
|
|
usrPLbl=strcat(usrGnSp,'UmdP('); %accomodate User Ref Selection
|
|
aa(lstindx,1)=strcat(usrPLbl,num2str(d),')');
|
|
aa(lstindx,2)={strcat(':',num2str(dMPs(mm)),':',num2str(UsrmdlocP(1)),':',num2str(UsrmdlocP(2)))};
|
|
bb(lstindxOrf,1)=strcat(usrPLbl,num2str(d),')'); %remove string2cell brackets {...}
|
|
bb(lstindxOrf,2)={strcat(':',num2str(dMPs(mm)),':',num2str(UsrmdlocP(1)),':',num2str(UsrmdlocP(2)))};
|
|
|
|
Exp(expN).Dexp(n).UsrmdPLB(d,dMPs(mm))=strcat(aa(lstindx,1),aa(lstindx,2));
|
|
Exp(expN).Dexp(n).UsrmdPindx(d,dMPs(mm))=medianIndxP;
|
|
Exp(expN).Dexp(n).UsrmdPpltN(d,dMPs(mm))=dMPs(mm); %This is a storage of the MasterPlate used NOT the ScanPlate? WeMight wish to store the ScanPlateNumber also???
|
|
Exp(expN).Dexp(n).UsrmdPscanN(d,dMPs(mm))=usrScNdisp;
|
|
Exp(expN).Dexp(n).UsrMedianP(d,dMPs(mm))=mval1Disp;
|
|
Exp(expN).Dexp(n).stdP(d,dMPs(mm))=std1Disp;
|
|
Exp(expN).Dexp(n).meanP(d,dMPs(mm))=mean1Disp;
|
|
Exp(expN).Dexp(n).minP(d,dMPs(mm))=minDisp;
|
|
Exp(expN).Dexp(n).maxP(d,dMPs(mm))=maxDisp;
|
|
|
|
Exp(expN).Dexp(n).UsrCmpPL.dm(d).med=mval1Disp; %For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrCmpPL.dm(d).mean=mean1Disp; %For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrCmpPL.dm(d).std=std1Disp; %For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrCmpPL.dm(d).min=minDisp; %For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrCmpPL.dm(d).max=maxDisp; %For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrCmpPK.dm(d).med=median(nonzeros((Exp(expN).Dexp(n).scan(usrScNdisp).plate(1).CFout(NZrefIndxP,3)))); %For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrCmpPK.dm(d).mean=mean(nonzeros((Exp(expN).Dexp(n).scan(usrScNdisp).plate(1).CFout(NZrefIndxP,3)))); %For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrCmpPK.dm(d).std=std(nonzeros((Exp(expN).Dexp(n).scan(usrScNdisp).plate(1).CFout(NZrefIndxP,3)))); %For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrCmpPK.dm(d).min=min(nonzeros((Exp(expN).Dexp(n).scan(usrScNdisp).plate(1).CFout(NZrefIndxP,3)))); %For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrCmpPK.dm(d).max=max(nonzeros((Exp(expN).Dexp(n).scan(usrScNdisp).plate(1).CFout(NZrefIndxP,3)))); %For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrCmpPr.dm(d).med=median(nonzeros((Exp(expN).Dexp(n).scan(usrScNdisp).plate(1).CFout(NZrefIndxP,4)))); %For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrCmpPr.dm(d).mean=mean(nonzeros((Exp(expN).Dexp(n).scan(usrScNdisp).plate(1).CFout(NZrefIndxP,4)))); %For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrCmpPr.dm(d).std=std(nonzeros((Exp(expN).Dexp(n).scan(usrScNdisp).plate(1).CFout(NZrefIndxP,4)))); %For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrCmpPr.dm(d).min=min(nonzeros((Exp(expN).Dexp(n).scan(usrScNdisp).plate(1).CFout(NZrefIndxP,4)))); %For Ref Composite 17_1026
|
|
Exp(expN).Dexp(n).UsrCmpPr.dm(d).max=max(nonzeros((Exp(expN).Dexp(n).scan(usrScNdisp).plate(1).CFout(NZrefIndxP,4)))); %For Ref Composite 17_1026
|
|
%}
|
|
%Exp(expN).Dexp(n).UsrmdGindx(d)=nzPosIndxDG;
|
|
%Exp(expN).Dexp(n).UsrmdGpltN(d)=UsrmdDGloc(d,1);
|
|
%Exp(expN).Dexp(n).UsrmdGscanN(d)=uu(nzPosIndxDG,4);
|
|
%{
|
|
try
|
|
firstZeroindxD=find(vv((chgIndx(d):chgIndx(d+1)-1),5)==0,1,'first');
|
|
firstZeroPindx=uu(firstZeroindxD,4);
|
|
%Exp(expN).Dexp(n).UsrmdPpltN(d,dMPs(mm))=dMPs(mm);
|
|
%Exp(expN).Dexp(n).UsrmdPindx(d,dMPs(mm))=firstZeroPindx;
|
|
|
|
catch
|
|
catchissue='try at Ln565'
|
|
%Exp(expN).Dexp(n).UsrmdPpltN(d,dMPs(mm))=dMPs(mm);
|
|
%Exp(expN).Dexp(n).UsrmdPindx(d,dMPs(mm))=384; %if crapout,Then use spot384 as default to keep going
|
|
end
|
|
try
|
|
% Exp(expN).Dexp(n).UsrmdPpltN=dMPs(mm);
|
|
catch
|
|
catchissue='Ln619'
|
|
%Exp(expN).Dexp(n).UsrmdPpltN=1; %This might keep from breaking BUT ???
|
|
end
|
|
error='EZexpSel lineAfter 565'
|
|
end %try ~ln565
|
|
%}
|
|
|