123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405 |
- %EZhtMap
- global Exp
- global ghandles
- global adj
- global flip
- if isempty(adj), adj=1.5; flip='T'; end
- load('MyColormap1','modJet1')
- load('MyColormap2','modJet2')
- %load('MyColormap2','modJet0')
- %adj=1.5;
- cleanPallet=zeros(24,16);
- if expN==1,DexpN=(get(handles.DN1,'value')); end
- if expN==2,DexpN=(get(handles.DN2,'value')); end
- if expN==3,DexpN=(get(handles.DN3,'value')); end
- Exp(expN).DexpN=DexpN;
- try
- if expN==1,MPsel=floor(get(ghandles.MPsldr1,'value')); end
- if expN==2,MPsel=floor(get(ghandles.MPsldr2,'value')); end
- if expN==3,MPsel=floor(get(ghandles.MPsldr3,'value')); end
- if expN==1,pertSel=floor(get(ghandles.DMsldr1,'value')); end
- if expN==2,pertSel=floor(get(ghandles.DMsldr2,'value')); end
- if expN==3,pertSel=floor(get(ghandles.DMsldr3,'value')); end
- catch
- MPsel=1;
- pertSel=1;
- end
- if expN==1, expAxes=ghandles.Iaxes1;end
- if expN==2, expAxes=ghandles.Iaxes2;end
- if expN==3, expAxes=ghandles.Iaxes3;end
- dmN=length(Exp(expN).Dexp(DexpN).DM.drug);
- mpSel=Exp(expN).Dexp(DexpN).MPsel;
- dmSel=Exp(expN).Dexp(DexpN).pertSel;
- scnN=dmSel + (dmN*(mpSel-1));
- if expN==1,htTog=Exp(1).htmapPBsel;end
- if expN==2,htTog=Exp(2).htmapPBsel;end
- if expN==3,htTog=Exp(3).htmapPBsel;end
- if htTog==0
- colormap(flipud(modJet1)) % colormap(modJet2)
- L=Exp(expN).Dexp(DexpN).scan(scnN).plate.CFout(:,5);
- L=reshape(L,24,16);
- LpStd=mean(nonzeros(L(:)))+(adj*std(nonzeros(L(:))));
- LnStd=mean(nonzeros(L(:))-(adj*std(nonzeros(L(:)))));
- % Data rescaling for Heatmap display (color range- mean+/std*adjustment)
- for i=1:size(L,1)
- for j=1:size(L,2)
- if L(i,j)>LpStd,
- L4hMap(i,j)=LpStd;
- elseif L(i,j)<LnStd && L(i,j)~=0
- L4hMap(i,j)=LnStd;
- elseif L(i,j)==0
- L4hMap(i,j)=LpStd+0.2*std(L(:));
- else
- L4hMap(i,j)=L(i,j);
- end
- end
- end
- % L4hMap=1-(L4hMap/(max(L4hMap(:))));
- if prntHt==0
- hTogHt=figure;
- h=image(cleanPallet); % hTogHt=image(cleanPallet);
- h=image(L4hMap); % hTogHt=image(L4hMap);
- if isequal(char(flip) , 'T')
- colormap(flipud(modJet1)) %(flipud(hot)) %(jet); % invert heat map for L so that fastgrowth is 'hotter' red
- else
- colormap(modJet2)
- end
- set(h,'CDataMapping','scale') %set(hTogHt,'CDataMapping','scale')
- else
- figure
- h=image(cleanPallet); %hTogHt=image(cleanPallet);
- h=image(L4hMap); %hTogHt=image(L4hMap);
- if isequal(char(flip) , 'T')
- colormap(flipud(modJet1)) %(flipud(hot)) %(jet); % invert heat map for L so that fastgrowth is 'hotter' red
- else
- colormap(modJet2)
- end
- set(h,'CDataMapping','scale')
- end
- % h=image(L);
- % colormap(flipud(hot)) %(jet); % invert heat map for L so that fastgrowth is 'hotter' red
- % set(h,'CDataMapping','scale')
- if expN==1,cla(handles.HtMap1);copyobj(h,ghandles.HtMap1);end
- if expN==2,cla(handles.HtMap2);copyobj(h,ghandles.HtMap2);end
- if expN==3,cla(handles.HtMap3);copyobj(h,ghandles.HtMap3);end
- if prntHt==0
- %if expN==1,cla(handles.HtMap1);copyobj(hTogHt,ghandles.HtMap1);end
- %if expN==2,cla(handles.HtMap2);copyobj(hTogHt,ghandles.HtMap2);end
- %if expN==3,cla(handles.HtMap3);copyobj(hTogHt,ghandles.HtMap3);end
- close(hTogHt)
- else %if clicking to produce a 'printable' save display
- set(gca,'XDir','reverse')
- set(gca,'XTickMode','manual')
- %set(gca,'XTickLabel',{'2';'4';'6';'8';'10';'12';'14';'16'})
- %set(gca,'XTickLabel',{'16';'14';'12';'10';'8';'6';'4';'2'})
- %set(gca,'XTick',{0;2;4;6;8;10;12;14;16;18})
- colorbar
- expLblHtmap=Exp(expN).Dexp.ExpFoldr;
- mediaLBhtmap=char(strcat(', Agar-',Exp(expN).Dexp(DexpN).DM.media{pertSel},' ',...
- Exp(expN).Dexp(DexpN).DM.drug{pertSel},Exp(expN).Dexp(DexpN).DM.conc{pertSel},' ',...
- Exp(expN).Dexp(DexpN).DM.mod1{pertSel},Exp(expN).Dexp(DexpN).DM.conc1{pertSel},' ',...
- Exp(expN).Dexp(DexpN).DM.mod2{pertSel},Exp(expN).Dexp(DexpN).DM.conc2{pertSel}));
- title({strcat('L HeatMap for - ',expLblHtmap),strcat('MP=',num2str(mpSel),' ,DM=',num2str(dmSel),mediaLBhtmap)})
- end
- colormap(modJet1)
- elseif htTog==1
- colormap(modJet1);
- K=Exp(expN).Dexp(DexpN).scan(scnN).plate.CFout(:,3);
- K=reshape(K,24,16);
- %Data rescaling for Heatmap display (color ranged mean+/std*multiplier)
- pStd=mean(nonzeros(K(:)))+(adj*std(nonzeros(K(:))));
- nStd=mean(nonzeros(K(:)))-(adj*std(nonzeros(K(:))));
- for i=1:size(K,1)
- for j=1:size(K,2)
- if K(i,j)>pStd,
- hMap(i,j)=pStd;
- elseif K(i,j)<nStd && K(i,j)~=0
- hMap(i,j)=nStd;
- elseif K(i,j)==0
- hMap(i,j)=nStd-0.2*std(K(:));
- else
- hMap(i,j)=K(i,j);
- end
- end
- end
-
- if prntHt==0
- hTogHt=figure;
- h=image(cleanPallet);
- else
- figure
- h=image(cleanPallet);
- end
- % h=image(cleanPallet);
- h=image(hMap);
- colormap(modJet1); % heat map
- set(h,'CDataMapping','scale')
- if expN==1,cla(handles.HtMap1);copyobj(h,ghandles.HtMap1);end
- if expN==2,cla(handles.HtMap2);copyobj(h,ghandles.HtMap2);end
- if expN==3,cla(handles.HtMap3);copyobj(h,ghandles.HtMap3);end
- if prntHt==0
- close(hTogHt)
- else
- set(gca,'XDir','reverse')
- set(gca,'XTickMode','manual')
- %set(gca,'XTickLabel',{'2';'4';'6';'8';'10';'12';'14';'16'})
- %set(gca,'XTickLabel',{'16';'14';'12';'10';'8';'6';'4';'2'})
- %set(gca,'XTick',{0;2;4;6;8;10;12;14;16;18})
- colorbar
- expLblHtmap=Exp(expN).Dexp.ExpFoldr;
- mediaLBhtmap=char(strcat(', Agar-',Exp(expN).Dexp(DexpN).DM.media{pertSel},' ',...
- Exp(expN).Dexp(DexpN).DM.drug{pertSel},Exp(expN).Dexp(DexpN).DM.conc{pertSel},' ',...
- Exp(expN).Dexp(DexpN).DM.mod1{pertSel},Exp(expN).Dexp(DexpN).DM.conc1{pertSel},' ',...
- Exp(expN).Dexp(DexpN).DM.mod2{pertSel},Exp(expN).Dexp(DexpN).DM.conc2{pertSel}));
- title({strcat('K HeatMap for - ',expLblHtmap),strcat('MP=',num2str(mpSel),' ,DM=',num2str(dmSel),mediaLBhtmap)})
- end
- elseif htTog==2
- colormap(modJet1);
- r=Exp(expN).Dexp(DexpN).scan(scnN).plate.CFout(:,4);
- r=reshape(r,24,16);
- % Data rescaling for Heatmap display (color ranged mean+/std*multiplier)
- pStd=mean(nonzeros(r(:)))+(adj*std(nonzeros(r(:))));
- nStd=mean(nonzeros(r(:)))-(adj*std(nonzeros(r(:))));
- for i=1:size(r,1)
- for j=1:size(r,2)
- if r(i,j)>pStd,
- hMap(i,j)=pStd;
- elseif r(i,j)<nStd && r(i,j)~=0,
- hMap(i,j)=nStd;
- elseif r(i,j)==0
- hMap(i,j)=nStd-0.2*std(r(:));
- else
- hMap(i,j)=r(i,j);
- end
- end
- end
- if prntHt==0
- hTogHt=figure;
- h=image(cleanPallet);
- else
- figure
- h=image(cleanPallet);
- end
- % h=image(cleanPallet);
- h=image(hMap);
- colormap(modJet1); % heat map
- set(h,'CDataMapping','scale')
- if expN==1,cla(handles.HtMap1);copyobj(h,ghandles.HtMap1);end
- if expN==2,cla(handles.HtMap2);copyobj(h,ghandles.HtMap2);end
- if expN==3,cla(handles.HtMap3);copyobj(h,ghandles.HtMap3);end
- if prntHt==0
- close(hTogHt)
- else
- set(gca,'XDir','reverse')
- set(gca,'XTickMode','manual')
- %set(gca,'XTickLabel',{'2';'4';'6';'8';'10';'12';'14';'16'})
- %set(gca,'XTickLabel',{'16';'14';'12';'10';'8';'6';'4';'2'})
- %set(gca,'XTick',{0;2;4;6;8;10;12;14;16;18})
- colorbar
- expLblHtmap=Exp(expN).Dexp.ExpFoldr;
- mediaLBhtmap=char(strcat(', Agar-',Exp(expN).Dexp(DexpN).DM.media{pertSel},' ',...
- Exp(expN).Dexp(DexpN).DM.drug{pertSel},Exp(expN).Dexp(DexpN).DM.conc{pertSel},' ',...
- Exp(expN).Dexp(DexpN).DM.mod1{pertSel},Exp(expN).Dexp(DexpN).DM.conc1{pertSel},' ',...
- Exp(expN).Dexp(DexpN).DM.mod2{pertSel},Exp(expN).Dexp(DexpN).DM.conc2{pertSel}));
- title({strcat('r HeatMap for - ',expLblHtmap),strcat('MP=',num2str(mpSel),' ,DM=',num2str(dmSel),mediaLBhtmap)})
- end
- elseif htTog==3
- RFconfig=Exp(expN).RFconfig; %ZoneRelated
- if htMapTogPBfg==1
- if RFconfig==2,
- QctrlRF='Select Distributed Control RF option: (G)Global, (L)Local';
- QpertRF='Select Distributed Perturbation RF option: (G)Global, (L)Local';
- defaultanswer={'G','L'}; %{'80','60','100','3,4,5','N','39','Y','G','L'};
- try defaultanswer=Exp(expN).htmapRFanswer; catch, defaultanswer={'G','L'};end %ZoneRelated
- end
- if RFconfig==3,
- QctrlRF='Select Control RF option: (F)FullPlate, (G)GlobalDistributed, (L)LocalDistributed';
- QpertRF='Select Perturbation RF option: (F)FullPlate, (G)GlobalDistributed, (L)LocalDistributed';
- defaultanswer={'F','L'}; %{'80','60','100','3,4,5','N','39','Y','F','L'};
- try defaultanswer=Exp(expN).htmapRFanswer; catch, defaultanswer={'F','L'}; end %ZoneRelated
- end
- if RFconfig~=1,
- prompt={QctrlRF,QpertRF};
- name='Interaction User Input';
- numlines=1;
- answer=inputdlg(prompt,name,numlines,defaultanswer);
- if RFconfig==2,
- if ~ismember(answer{1},['g' 'G' 'l' 'L']), answer(1)=defaultanswer(1); end
- if ~ismember(answer{2},['g' 'G' 'l' 'L']), answer(2)=defaultanswer(2); end
- end
- if RFconfig==3,
- if ~ismember(answer{1},['f' 'F' 'g' 'G' 'l' 'L']), answer(1)=defaultanswer(1); end
- if ~ismember(answer{2},['f' 'F' 'g' 'G' 'l' 'L']), answer(2)=defaultanswer(2); end
- end
- answer(1)=strrep(answer(1),'f','F'); answer(1)=strrep(answer(1),'g','G'); answer(1)=strrep(answer(1),'l','L');
- answer(2)=strrep(answer(2),'f','F'); answer(2)=strrep(answer(2),'g','G'); answer(2)=strrep(answer(2),'l','L');
- Exp(expN).htmapRFanswer=answer; %ZoneRelated %store user last selections
- end
- end
- htMapTogPBfg=0;
- answer=Exp(expN).htmapRFanswer; %ZoneRelated
- % for j=1:1 %dmN
- % for m=1:1 %mpN
- j=dmSel;
- DM0=dmSel; DMj=dmSel;
- m=mpSel;
- anN=[1 2];
- % Call subroutine to interpret user RF inputs & det. Rn and Rs values
- EZintRFs
- scnNdm1=1 + (dmN*(m-1))
- scnN=j + (dmN*(m-1)) % 1,6,11..; 2,7,12 ..; 3,8,13..;
- Xn{m,j,1}=[];
- Xln{m,j,1}=[];
- Xhn{m,j,1}=[];
- Xn{m,1,:}=Exp(expN).Dexp(DexpN).scan(scnNdm1).plate(1).CFout(:,5);
- Xln{m,1,:}=Exp(expN).Dexp(DexpN).scan(scnNdm1).plate(1).CFout(:,11); %Exp(expN).Dexp(DexpN).scan(DM{j}(m)).plate(1).CFout(:,11);
- Xhn{m,1,:}=Exp(expN).Dexp(DexpN).scan(scnNdm1).plate(1).CFout(:,12); %Exp(expN).Dexp(DexpN).scan(DM{j}(m)).plate(1).CFout(:,12);
- Xn{m,j,:}=Exp(expN).Dexp(DexpN).scan(scnN).plate(1).CFout(:,5); %Exp(expN).Dexp(DexpN).scan(DM{j}(m)).plate(1).CFout(:,5);
- htmpCpyXn=Xn{m,j,:}'; % Use to find and delineate no growth spots with 999 in text field (infinite interaction) value;
- Xn{m,j,:}(Xn{m,j,:}==0)=1.2*(max(Xn{m,j,:})); %to keep the colormap scale tighter %=140;
- Xln{m,j,:}=Exp(expN).Dexp(DexpN).scan(scnN).plate(1).CFout(:,11); %Exp(expN).Dexp(DexpN).scan(DM{j}(m)).plate(1).CFout(:,11);
- Xhn{m,j,:}=Exp(expN).Dexp(DexpN).scan(scnN).plate(1).CFout(:,12); %Exp(expN).Dexp(DexpN).scan(DM{j}(m)).plate(1).CFout(:,12);
- %intL{m,j,:}=((Xn{m,j,:} - Xn{m,1,:}) - (Rn(j)-Rn(1)));
- intL=((Xn{m,j,:} - Xn{m,1,:}) - (Rn(j)-Rn(1)));
- Exp(expN).HtMpIntN2=intL; %ZoneRelated
- %{
- intL{m,j,:}(Xn{m,j,:}==1.2*(max(Xn{m,j,:})))=100;
- intL{m,j,:}(intL{m,j,:}==0)=-0.0001;
- %}
- percentRs=100;
- RsReduced(j)=percentRs/100* Rs(j);
- deltaRp(j)=(Rn(j)+RsReduced(j))-(Rn(1)+RsReduced(1));
- deltaRn(j)=(Rn(j)-RsReduced(j))-(Rn(1)-RsReduced(1));
- if deltaRp(j)==0, deltaRp(j)=0.0002; end
- if deltaRn(j)==0, deltaRn(j)=0.0002; end
- deltaYp=zeros(1,384); deltaYn=zeros(1,384);
- deltaXRp=zeros(1,384); deltaXRn=zeros(1,384);
- deltaXR{m,j}=zeros(1,384);
- for i=1:384
- % Select lower or upper boundary value based on Yn(1)
- if Xn{m,j}(i) >=(Rn(j)+RsReduced(j));
- deltaYp(i)= Xln{m,j}(i)-Xln{m,1}(i);
- elseif Xn{m,j}(i) < (Rn(j)-RsReduced(j));
- deltaYn(i)= Xhn{m,j}(i)-Xhn{m,1}(i);
- % Insert else
- end
- % Calculate deltaXRp and deltaXRn for each plate based on growth relative to deltaRp or deltaRn
- if deltaYp(i)>=deltaRp(j)
- deltaXRp(i)=deltaYp(i)-deltaRp(j);
- deltaXR{m,j}(i)=deltaXRp(i); %Consoludate into deltaXR{m,j}(i) cell array
- elseif deltaYn(i) < deltaRn(j)
- deltaXRn(i)=deltaYn(i)-deltaRn(j);
- deltaXR{m,j}(i)=deltaXRn(i); %Consoludate into deltaXR{m,j}(i) cell array
- if deltaYn(i)==0, deltaXR{m,j}(i)=0; end
- end
- % Ambiguous results that have delta gene values that are less than the variance of Reference+/-std
- end
- deltaXRl=deltaXR{m,j,:};
- htMpN1Lzeros999=deltaXR{m,j,:};
- deltaXRl(htmpCpyXn==0)=1.2*max(deltaXRl);
- htMpN1Lzeros999(htmpCpyXn==0)=999;
- Exp(expN).HtMpIntN1=htMpN1Lzeros999';
-
- I=reshape(deltaXRl,24,16);
- if prntHt==0
- hTogHt=figure;
- h=image(cleanPallet);
- else
- figure
- h=image(cleanPallet);
- end
- % h=figure;
- h=image(I);
- colormap(jet); % heat map
- set(h,'CDataMapping','scale')
-
- if expN==1,cla(handles.HtMap1);copyobj(h,ghandles.HtMap1);end
- if expN==2,cla(handles.HtMap2);copyobj(h,ghandles.HtMap2);end
- if expN==3,cla(handles.HtMap3);copyobj(h,ghandles.HtMap3);end
- if prntHt==0
- close(hTogHt)
- else
- set(gca,'XDir','reverse')
- set(gca,'XTickMode','manual')
- % set(gca,'XTickLabel',{'2';'4';'6';'8';'10';'12';'14';'16'})
- % set(gca,'XTickLabel',{'16';'14';'12';'10';'8';'6';'4';'2'})
- % set(gca,'XTick',{0;2;4;6;8;10;12;14;16;18})
- colorbar
- expLblHtmap=Exp(expN).Dexp.ExpFoldr;
- mediaLBhtmap=char(strcat(', Agar-',Exp(expN).Dexp(DexpN).DM.media{pertSel},' ',...
- Exp(expN).Dexp(DexpN).DM.drug{pertSel},Exp(expN).Dexp(DexpN).DM.conc{pertSel},' ',...
- Exp(expN).Dexp(DexpN).DM.mod1{pertSel},Exp(expN).Dexp(DexpN).DM.conc1{pertSel},' ',...
- Exp(expN).Dexp(DexpN).DM.mod2{pertSel},Exp(expN).Dexp(DexpN).DM.conc2{pertSel}));
- title({strcat('N1 HeatMap for - ',expLblHtmap),strcat('MP=',num2str(mpSel),' ,DM=',num2str(dmSel),mediaLBhtmap)})
- end
- elseif htTog==4
- answer=Exp(expN).htmapRFanswer; % ZoneRelated
- RFconfig=Exp(expN).RFconfig; % ZoneRelated
- answer=Exp(expN).htmapRFanswer; % ZoneRelated
- j=dmSel;
- DM0=dmSel; DMj=dmSel;
- m=mpSel;
- anN=[1 2];
- EZintRFs % Call subroutine to interpret user RF inputs
- scnNdm1=1 + (dmN*(m-1))
- scnN=j + (dmN*(m-1)) % 1,6,11..; 2,7,12 ..; 3,8,13..;
- Xn{m,j,1}=[];
- Xn{m,1,:}=Exp(expN).Dexp(DexpN).scan(scnNdm1).plate(1).CFout(:,5);
- Xn{m,j,:}=Exp(expN).Dexp(DexpN).scan(scnN).plate(1).CFout(:,5);
- htmpCpyXn=Xn{m,j,:}'; % Use to find and delineate no growth spots with 999 in text field (infinite interaction) value;
- intL=((Xn{m,j,:} - Xn{m,1,:}) - (Rn(j)-Rn(1)));
- Exp(expN).HtMpIntN2=intL; % ZoneRelated
- intL=Exp(expN).HtMpIntN2; % ZoneRelated
- I=reshape(intL,24,16);
-
- if prntHt==0
- hTogHt=figure;
- h=image(cleanPallet);
- elseif
- figure
- h=image(cleanPallet);
- end
- %h=figure
- h=image(I)
- colormap(jet); % heat map
- set(h,'CDataMapping','scale')
- if expN==1,cla(handles.HtMap1);copyobj(h,ghandles.HtMap1);end
- if expN==2,cla(handles.HtMap2);copyobj(h,ghandles.HtMap2);end
- if expN==3,cla(handles.HtMap3);copyobj(h,ghandles.HtMap3);end
-
- if prntHt==0
- close(hTogHt)
- else
- set(gca,'XDir','reverse')
- set(gca,'XTickMode','manual')
- % set(gca,'XTickLabel',{'2';'4';'6';'8';'10';'12';'14';'16'})
- % set(gca,'XTickLabel',{'16';'14';'12';'10';'8';'6';'4';'2'})
- % set(gca,'XTick',{0;2;4;6;8;10;12;14;16;18})
- colorbar
- expLblHtmap=Exp(expN).Dexp.ExpFoldr;
- mediaLBhtmap=char(strcat(', Agar-',Exp(expN).Dexp(DexpN).DM.media{pertSel},' ',...
- Exp(expN).Dexp(DexpN).DM.drug{pertSel},Exp(expN).Dexp(DexpN).DM.conc{pertSel},' ',...
- Exp(expN).Dexp(DexpN).DM.mod1{pertSel},Exp(expN).Dexp(DexpN).DM.conc1{pertSel},' ',...
- Exp(expN).Dexp(DexpN).DM.mod2{pertSel},Exp(expN).Dexp(DexpN).DM.conc2{pertSel}));
- title({strcat('N2 HeatMap for - ',expLblHtmap),strcat('MP=',num2str(mpSel),' ,DM=',num2str(dmSel),mediaLBhtmap)})
- end
- end
- prntHt=0;
- % Update htMapText for location on the first 'roll thru of htMapPB
- EZhtMapText
|