Skip to content
Snippets Groups Projects
Commit abbbe2f7 authored by ac_fx's avatar ac_fx
Browse files

SSF.drawKymosCondition

parent 84181332
No related branches found
No related tags found
No related merge requests found
% % ROOT = '/g/leverjs/Olivier/Agne/march_2023_20x/';
% ROOT = '/g/leverjs/Olivier/Agne/2022-06-03_48h-depr-transcr-drugs/';
% % ROOT = '/g/leverjs/Olivier/Agne/2023-03-25_DHB-proliferation-setup2/';
% kymo_dir = fullfile(ROOT,'kymo_downsize');
% flist = dir(fullfile(kymo_dir,'*.LEVER'));
%
% % for treatment (tx)
% tblClasses = readtable('../transcr-drugs/expDescr-2022-06-03.xlsx');
% classList = tblClasses.Cell_Type;
% % for steady state (ss)
% % classList = get_ssClasses(flist);
% % for DHB
% % tblClasses = readtable('../DHB/expDescr-2023-03-25.csv');
% % classList = tblClasses.Cell_Type;
%
% % outfile = 'dhb_erk_kymos_condition.pdf';
% outfile = 'tx_erk_kymos_condition.pdf';
%
% cbLabel = 'ERK SSF';
% targetChannels = 1;
function drawKymosCondition(flist,classList,labelNames,outfile,cbLabel,targetChannels,stride)
xClasses = unique(classList);
nKeep = 0;
clipRange = [2.5,97.5];
clipLimits = SSF.getClipLimits(flist,targetChannels,clipRange,nKeep);
xyim = []; % one per flist
for cc = 1:length(xClasses)
idxCC = find(strcmp(classList,xClasses(cc)));
flistCC = flist(idxCC);
clf;imCC = {};
for ff = 1:length(flistCC)
fname = fullfile(flistCC(ff).folder,flistCC(ff).name);
imq = SSF.draw_ssf_kymo(fname,targetChannels,clipLimits,nKeep);
szim(ff,:) = size(imq);
imq(:,1) = 0; imq(:,end) = 0;
imq(1:2,:) = 0; imq(end-1:end,:) = 0;
row = ceil(ff/stride);
col = 1 + mod(ff-1,stride);
if 1 == col
imCC{row} = [];
elseif size(imq,1) ~= size(imCC{row},1)
imq = imresize(imq,[size(imCC{row},1),NaN]);
end
imCC{row} = [ imCC{row}, imq];
end
sz = cellfun(@size,imCC,'UniformOutput',false);
sz = vertcat(sz{:});
if size(sz,1)>1
sz = max(sz);
end
for i = 1:length(imCC)
if size(imCC{i},2) < sz(2)
imCC{i}(end,sz(2)) = 0;
end
end
ccLabels= labelNames(idxCC);
imMontage = vertcat(imCC{:});
clf;imagesc(imMontage) ; hold on
axis off
% label movies
for ff = 1:length(flistCC)
row = ceil(ff/stride);
col = 1 + mod(ff-1,stride);
if 1 == col
x = 1;
end
y = (row-1) * szim(ff,1);
plot([x,x+szim(ff,2)],[y,y],'-k');
plot([x,x+szim(ff,2)],[y+szim(ff,1),y+szim(ff,1)],'-k');
plot([x,x],[y,y+szim(ff,1)],'-k')
% don't draw to your right...
% plot([x+szim(ff,2),x+szim(ff,2)],[y,y+szim(ff,1)],'-k')
text(x,y,ccLabels{ff},'Interpreter','none','FontSize',6,'BackgroundColor',[0.8,0.8,0.8,0.5],...
'VerticalAlignment','top');
x = x + szim(ff,2);
% date_movie = regexp(flistCC(ff).name,'(\d{4}-\d{2}-\d{2}).+_(\d{2})','tokens');
% text(x,y,[date_movie{1}{1} '_' date_movie{1}{2}],'Interpreter','none','FontSize',6,'BackgroundColor',[0.8,0.8,0.8,0.5]);
% plot([x+62,x+62],[y+5,y+size(imq,1)-5],'-r')
% treatment = regexp(tblCC.Treatment{ff},'(.*)\w*(','tokens');
% text(x+30,y+20,[date_movie{1}{1} '_' date_movie{1}{2} ' :: ' treatment{1}{1}],'Interpreter','none','FontSize',6,'BackgroundColor',[0.8,0.8,0.8,0.7]);
end
% set background (index 0, colormap(1)) to white
cm = parula();
cm(1,:) = [1,1,1];
colormap(cm);
axis on
set(gca,'xtick',[]);
set(gca,'ytick',[]);
ylabel('xy \Downarrow x');
xlabel('time');
fx = strfind(flist(ff).name,'.LEVER');
fx = fx(1)-1;
title(xClasses{cc},'Interpreter','none');
tick_labels = round(linspace(clipLimits(1),clipLimits(2),5),2);
cb = colorbar('Ticks',[1,64,128,192,255],'TickLabels',tick_labels);
cb.Label.String = cbLabel;
if 1 == cc
exportgraphics(gcf,outfile);
else
exportgraphics(gcf,outfile,'Append',true);
end
end
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment