Creating and exploring Figure 3 % Create fate-map fm = polygon_clusters_slider2(emesh, st4tmesh_pat, 'dist_cut', 0.3); % Cluster #1 for similar triangles fm_ti{1}.elements = find(fm==1); fm_ti{1}.stain = st4tmesh_pat(fm == 1, :); Y=pdist(fm_ti{1}.stain'); Z=linkage(Y); [H, T, perm] = dendrogram(Z,0); for i=1:553, i, unrollmesh(st4tmesh_pat(fm_ti{1}.elements,perm(i)), p_scale, t, 'ypos', i); end fm_ti{1}.bin = st4tmesh_bin(fm == 1, :); Y=pdist(fm_ti{1}.bin', 'jaccard'); Z=linkage(Y); [H, T, perm] = dendrogram(Z,0); % Binarize patterns % Make sure to add java code with javaaddpath.... jmrf = JTImrf2(t_conn); st4tmesh_bpat = zeros(311, 553); for i=1:553, jmrf.twoMesh(2, st4tmesh_pat(:,i), st4tmesh_pat(:,i), 2); st4tmesh_bpat(:,i) = jmrf.getLabels(1); end % Convert MRF to 0=no staining, 1=staining st4tmesh_bin = zeros(311, 553); for i=1:553, if mean(st4tmesh_pat(st4tmesh_bpat(:,i) == 1,i)) < mean(st4tmesh_pat(st4tmesh_bpat(:,i) == 2,i)), st4tmesh_bin(st4tmesh_bpat(:,i) == 1,i) = 1; else st4tmesh_bin(st4tmesh_bpat(:,i) == 2,i) = 1; end; end % Create fm_ti struct for all domains for j=1:max(fm), fm_ti{j}.elements = find(fm==j); fm_ti{j}.stain = st4tmesh_pat(fm == j, :); fm_ti{j}.bin = st4tmesh_bin(fm == j, :); end % Print all genes for each domain for j=1:max(fm), fm_genes = unique(st4usym(st4tpat_sym(find(sum(fm_ti{j}.bin) > length(fm_ti{j}.elements) *0.9 )))); fprintf('Domain %d\n', j); fprintf('%s\n', fm_genes{:}); fprintf('\n'); end % Display domain 1 with composite tool j=1; disp_mcomposites2(emesh, 2, fm == j, find(sum(fm_ti{j}.bin) > length(fm_ti{j}.elements) *0.9 ), 'symbols', {st4usym, st4tpat_sym}, 'source', st4tmesh_pat) % Display domain 1 with overlay tool j=1; disp_moverlay2(emesh, fm == j, find(sum(fm_ti{j}.bin) > length(fm_ti{j}.elements) *0.9 ), 'symbols', {st4usym, st4tpat_sym}, 'source', st4tmesh_pat, 'binary', st4tmesh_bin);