Squashed initial commit
This commit is contained in:
251
qhtcp-workflow/apps/matlab/ezview/EZmDayPlotUcmp.m
Executable file
251
qhtcp-workflow/apps/matlab/ezview/EZmDayPlotUcmp.m
Executable file
@@ -0,0 +1,251 @@
|
||||
% 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
|
||||
|
||||
traceN=Exp(expN).traceN;
|
||||
DexpN=Exp(expN).DexpN; % Temp input for development
|
||||
patrnN=strfind(selGnOrf{1},':'); %Extract Gene-Orf Name
|
||||
patrndash=strfind(selGnOrf{1},'-');
|
||||
selStrNm=char(selGnOrf)
|
||||
if strcmpi(selStrNm(1:3),'RF-')
|
||||
usrGene=selStrNm(4:(patrndash(2)-1));
|
||||
else
|
||||
usrGene=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);
|
||||
usrGnSp=strcat(usrGene,',',{trimUspec});
|
||||
else
|
||||
trimUspec=usrSpec;
|
||||
usrGnSp=strcat(usrGene,',',{trimUspec});
|
||||
end
|
||||
|
||||
for n=1:Exp(expN).DexpLength % LOOP Thru DayExps
|
||||
|
||||
MPnum=length(Exp(expN).Dexp(n).MP);
|
||||
DMnum=length(Exp(expN).Dexp(n).DM.drug);
|
||||
%Extract expDay from ExpName string
|
||||
dayNpos=max(strfind(Exp(expN).Dexp(n).ExpFoldr, '_D'))
|
||||
dayLbl=Exp(expN).Dexp(n).ExpFoldr(dayNpos+1:end);
|
||||
dRF1indx=0;
|
||||
usrSp=usrSpec; %user entry of Specifics for Ref selection
|
||||
|
||||
for mp=1:length(Exp(expN).Dexp(n).MP)
|
||||
for ind384=1:384
|
||||
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(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)={mp}; drfMP(dRF1indx,mp)=mp;
|
||||
drf(dRF1indx,3)={ind384}; drfPindx(dRF1indx,mp)=ind384;
|
||||
%drf(dRF1indx,7)=(Exp(expN).Dexp(n).MP(mp).specifics{1}(ind384));
|
||||
end
|
||||
catch
|
||||
msgBadGeneName=strcat('check genename at mp=',num2str(mp),' indx=',num2str(ind384))
|
||||
end
|
||||
end % end associated with for ind384=1:384
|
||||
mp
|
||||
end
|
||||
|
||||
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;
|
||||
clear chgIndx
|
||||
chgIndx(1)=1;
|
||||
for j=1:length(drf(:,3))
|
||||
if j>1
|
||||
if cell2mat(drf(j,2))~=cell2mat(drf((j-1),2)), chgIndx(i)=j; i=i+1; end
|
||||
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 mm=1:length(dMPs) % length(chgIndx)
|
||||
usrScNdisp=((dMPs(mm)-1)*DMnum)+(dmSel);
|
||||
NZusrIndx=drfPindx((find(drfPindx(:,dMPs(mm)))),dMPs(mm)); medianIndxDisp=NZusrIndx;
|
||||
vvL(chgIndx(mm):(chgIndx(mm+1)-1))=Exp(expN).Dexp(n).scan(usrScNdisp).plate(1).CFout(NZusrIndx,5);
|
||||
% For Global Ref Composite 17_1009
|
||||
vvK(chgIndx(mm):(chgIndx(mm+1)-1))=Exp(expN).Dexp(n).scan(usrScNdisp).plate(1).CFout(NZusrIndx,3);
|
||||
vvr(chgIndx(mm):(chgIndx(mm+1)-1))=Exp(expN).Dexp(n).scan(usrScNdisp).plate(1).CFout(NZusrIndx,4);
|
||||
end
|
||||
|
||||
% Calc. Global Mean, Std, And Median For Distributed References
|
||||
for d=dmSel:dmSel
|
||||
NZusrIndxG=[];
|
||||
NZusrIndxG=find(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{n}=vvL(NZusrIndxG);
|
||||
UsrKvals{n}=vvK(NZusrIndxG);
|
||||
Usrrvals{n}=vvr(NZusrIndxG);
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if ~exist('drf','var'),
|
||||
errordlg('Gene-Specifics combination not found. Check spelling of Specifics entry.','Entry Warning');
|
||||
break;
|
||||
end
|
||||
|
||||
NoGrowthflg=0;
|
||||
if isempty(vvL),
|
||||
warndlg('No Growth condition found for Gene-Specifics combination. . ','No Growth warning');
|
||||
NoGrowthflg=1;
|
||||
end
|
||||
|
||||
%Exp(expN).UgeneCnt=Exp(expN).UgeneCnt +1;
|
||||
%Exp(expN).UgeneSpLst(Exp(expN).UgeneCnt)=usrGnSp;
|
||||
% Plot Values Selected Gene-Specifics Composite
|
||||
if NoGrowthflg==0
|
||||
smpSz=size(NZusrIndxG,1);
|
||||
K=median(cell2mat((UsrKvals(DexpN)))); Ks=num2str(K); Kstd=std(cell2mat((UsrKvals(DexpN)))); KstdStr=num2str(Kstd);
|
||||
r=median(cell2mat((Usrrvals(DexpN)))); rs=num2str(r); rstd=std(cell2mat((Usrrvals(DexpN)))); rstdStr=num2str(rstd);
|
||||
l=median(cell2mat((UsrLvals(DexpN)))); Ls=num2str(l); Lstd=std(cell2mat((UsrLvals(DexpN)))); LstdStr=num2str(Lstd);
|
||||
Kl=K - Kstd; %std(UsrKvals(DexpN));
|
||||
Ku=K + Kstd; %std(UsrKvals(DexpN));
|
||||
rl=r - rstd; %std(Usrrvals(DexpN));
|
||||
ru=r + rstd; %std(UsrKvals(DexpN));
|
||||
lfast=l - Lstd;
|
||||
lslow=l + Lstd;
|
||||
elseif NoGrowth==1 %if all data is zero (NoGrowth)
|
||||
smpSz=size(NZusrIndxG,1);
|
||||
K=0; Ks=num2str(K); Kstd=0; KstdStr=num2str(0);
|
||||
r=0; rs=num2str(r); rstd=0; rstdStr=num2str(0);
|
||||
l=0; Ls=num2str(l); Lstd=0; LstdStr=num2str(0);
|
||||
Kl=K - Kstd;
|
||||
Ku=K + Kstd;
|
||||
rl=r - rstd;
|
||||
ru=r + rstd;
|
||||
lfast=l - Lstd;
|
||||
lslow=l + Lstd;
|
||||
end
|
||||
|
||||
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;
|
||||
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');
|
||||
Exp(expN).Trace(traceN).UsrGLB=usrGnSp;
|
||||
Exp(expN).Trace(traceN).dmSel=dmSel;
|
||||
for n=1:Exp(expN).DexpLength % Loop Thru DayExps
|
||||
Exp(expN).Trace(traceN).Dexp(n).DM(dmSel).UsrLvals=UsrLvals(n);
|
||||
Exp(expN).Trace(traceN).Dexp(n).DM(dmSel).UsrKvals=UsrKvals(n);
|
||||
Exp(expN).Trace(traceN).Dexp(n).DM(dmSel).Usrrvals=Usrrvals(n);
|
||||
end
|
||||
|
||||
% 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
|
||||
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,'_');
|
||||
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;
|
||||
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
|
||||
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
|
||||
msg='Error'
|
||||
end
|
||||
Reference in New Issue
Block a user