-
Notifications
You must be signed in to change notification settings - Fork 16
/
run_cluster_similarity.m
executable file
·46 lines (34 loc) · 1.18 KB
/
run_cluster_similarity.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
function [clujacc, cluhyp] = run_cluster_similarity(W, pert_thresh, pert_ampl, prob_thresh, n_reps, method)
edges = (W(W~=0));
% First compute the consensus membership on unperturbed network
[consensus_unperturbed] = consensus_robustness(W, 0, n_reps_agreement, method, consensus_reps, consensus_thresh)
[clujacc,cluhyp] = cluster_similarity(c1,c2);
%
scrsz = get(groot,'ScreenSize');
fig = figure('Position',[1 1 scrsz(3) scrsz(4)]);
colormap(parula);
%% Start plotting things
subplot(1,3,1);
hist(edges,length(unique(edges)));
hold on;
line([pert_thresh pert_thresh],ylim,'Color',[0 1 0],'LineWidth',2);
line([pert_thresh-pert_ampl pert_thresh-pert_ampl], ylim, 'Color', [1 0.2 0], 'LineWidth',1);
line([pert_thresh+pert_ampl pert_thresh+pert_ampl], ylim, 'Color', [1 0.2 0], 'LineWidth',1);
hold off;
title('Weights perturbation');
subplot(1,3,2);
imagesc(clujacc);
col = colorbar;
col.Label.String = 'Jaccard';
xlabel('Orig. comm.');
ylabel('Pert. comm.');
title('Jaccard Similarity');
%%
subplot(1,3,3);
maxlogp = max(cluhyp(:));
imagesc(cluhyp);
col = colorbar;
col.Label.String = strcat('-log_{10}(p)');
xlabel('Orig. comm.');
ylabel('Pert. comm.');
title('p-score similarity (normalized)');