diff --git a/matlab/+SSF/drawSubsets.m b/matlab/+SSF/drawSubsets.m new file mode 100644 index 0000000000000000000000000000000000000000..eb058607c103b3357a896ddfc05cd19126c4e130 --- /dev/null +++ b/matlab/+SSF/drawSubsets.m @@ -0,0 +1,78 @@ +% andy and layton. jul 3 2023. very preliminary. +kROOT = '/g/leverjs/Olivier/Agne/2022-06-03_48h-depr-transcr-drugs/kymo_combined_downsize_steady_state'; +flist = dir(fullfile(kROOT,'*.LEVER')); +transcr_class = readtable('expDescr-2022-06-03.xlsx'); +steady_state_class = load('../agne_20x_classMap.mat'); + +className = {}; +for ff = 1:length(flist) + cn = regexp(flist(ff).name,'(\d+-\d+-\d+)_.*(\d\d)_ori*','tokens'); + if isempty(cn) + re = regexp(flist(ff).name,'^(\d+)_.*(\d).LEVER','tokens'); + idx = str2double(re{1}{1}); + part = str2double(re{1}{2}); + if part == 1 + className{ff} = ['pre_' transcr_class.Cell_Type{idx}]; + else + className{ff} = ['post_' transcr_class.Cell_Type{idx}]; + end + else + cn = [cn{1}{1} '_' cn{1}{2}]; + className{ff} = steady_state_class.classMap(cn); + end +end + +ssClassList = unique(steady_state_class.classMap.values); +idx = contains(ssClassList,'E17K'); +ssClassList(idx) = []; +idx = contains(ssClassList,'E545K'); +ssClassList(idx) = []; +ssClassList(end+1) = {'pre_ErbB2_overexpr'}; + +idx = cellfun(@(x) any(contains(ssClassList,x)),className,'UniformOutput',false); +idx = find([idx{:}]); + +d2 = d(idx,idx); +className = className(idx); + +A = d2; +K=3; + + + +[idx,Y] = Cluster.SpectralCluster(A,K); +% Y = tsne(Y,'Algorithm','exact','NumDimensions',3); +clf;hold off; +% if size(Y,2) == 3 +% plot3(Y(:,1),Y(:,2),Y(:,3),'.') +% else +% plot(Y(:,1),Y(:,2),'.') +% end +sym = {'ko','cv','m^','r*','gx','<k','b>','gs','bd'}; + + +classList = unique(className); +hx = zeros(size(classList)); +hold on + +for ff=1:size(Y,1) + + idxSym = find(strcmp(classList,className{ff})); + if K==3 + h1 = plot3(Y(ff,1),Y(ff,2),Y(ff,3),sym{idxSym}); + else + h1 = plot(Y(ff,1),Y(ff,2),sym{idxSym},'UserData',ff); + end + if ~hx(idxSym) + hx(idxSym) = h1; + end + % if size(Y,2) == 3 + % text(Y(i,1),Y(i,2),Y(i,3),num2str(i),'FontSize',12) + % + % else + % text(Y(i,1),Y(i,2),num2str(i),'FontSize',12) + % end +end +set(gcf,'color','w') +xlabel('u1');ylabel('u2'),zlabel('u3') +legend(hx(find(hx)),classList(find(hx)),'interpreter','none'); \ No newline at end of file