257 lines
10 KiB
Matlab
Executable File
257 lines
10 KiB
Matlab
Executable File
% 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
|
|
% Called when Composite_ toggle button is clicked.
|
|
% Data stored for printable Trend Plot production (click [L] in DNLaxes )
|
|
|
|
global ghandles
|
|
global Exp
|
|
global exDlst
|
|
|
|
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
|
|
patrndash=strfind(selGnOrf{1},'-');
|
|
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')
|
|
usrGeneSearch=selStrNm(1:3);
|
|
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);
|
|
usrGnSp=strcat(usrGene,',',{trimUspec});
|
|
else
|
|
trimUspec=usrSpec;
|
|
usrGnSp=strcat(usrGene,',',{trimUspec});
|
|
end
|
|
|
|
% 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
|
|
% 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,
|
|
Exp(expN).Dexp(DexpN).MP(mp).genename{1}(ind384)={'OCT1_'};
|
|
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(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
|
|
catch
|
|
msgBadGeneName=strcat('check genename at mp=',num2str(mp),' indx=',num2str(ind384))
|
|
end
|
|
end
|
|
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 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;
|
|
vvL(chgIndx(mm):(chgIndx(mm+1)-1))=Exp(expN).Dexp(DexpN).scan(usrScNdisp).plate(1).CFout(NZusrIndx,5);
|
|
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
|
|
|
|
% 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));
|
|
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
|
|
|
|
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
|
|
|
|
% 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);
|
|
r=median(cell2mat((Usrrvals(dmSel)))); rs=num2str(r); rstd=std(cell2mat((Usrrvals(dmSel)))); rstdStr=num2str(rstd);
|
|
l=median(cell2mat((UsrLvals(dmSel)))); Ls=num2str(l); Lstd=std(cell2mat((UsrLvals(dmSel)))); LstdStr=num2str(Lstd);
|
|
Kl=K - Kstd; %std(UsrKvals(dmSel));
|
|
Ku=K + Kstd; %std(UsrKvals(dmSel));
|
|
rl=r - rstd; %std(Usrrvals(dmSel));
|
|
ru=r + rstd; %std(UsrKvals(dmSel));
|
|
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
|
|
|
|
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;
|
|
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;
|
|
Exp(expN).Trace(traceN).DexpN=DexpN;
|
|
for d=1:length(Exp(expN).Dexp(DexpN).DM.drug) %LOOP Thru DrugMedias
|
|
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
|
|
|
|
% 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
|
|
catchissue='Ln141 EZlstBoxExt'
|
|
msg='Error'
|
|
end
|