Skip to content

Commit 812f17f

Browse files
author
Alex Smith
committed
Ensure all empty motifs present in motif_usage.npy
1 parent 077c187 commit 812f17f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

vame/analysis/behavior_structure.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,19 @@ def get_network(path_to_file, file, cluster_method, n_cluster):
7575
motif_usage = np.unique(labels, return_counts=True)
7676
cons = consecutive(motif_usage[0])
7777
if len(cons) != 1:
78+
used_motifs = list(motif_usage[0])
7879
usage_list = list(motif_usage[1])
79-
index = cons[0][-1]+1
80-
usage_list.insert(index,0)
80+
81+
for i in range(n_cluster):
82+
if i not in used_motifs:
83+
used_motifs.insert(i, i)
84+
usage_list.insert(i,0)
85+
86+
# for i in range(len(cons)):
87+
# index = cons[i][-1]+1
88+
# usage_list.insert(index,0)
89+
# if index != cons[i+1][-1]+1:
90+
# usage_list.insert(index+1,0)
8191

8292
usage = np.array(usage_list)
8393

0 commit comments

Comments
 (0)