Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
saramonzon committed Apr 1, 2024
1 parent 8817b27 commit 7aea641
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 32 deletions.
6 changes: 3 additions & 3 deletions taranis/eval_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ def evaluate_clusters(
"alleles_not_found"
]
if len(result_eval["alleles_not_in_cluster"]) > 0:
evaluation_alleles[cluster_id]["alleles_not_in_cluster"] = (
result_eval["alleles_not_in_cluster"]
)
evaluation_alleles[cluster_id][
"alleles_not_in_cluster"
] = result_eval["alleles_not_in_cluster"]
else:
evaluation_alleles[cluster_id]["result"] = "OK"
return self.summary(evaluation_alleles)
58 changes: 29 additions & 29 deletions taranis/seq_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


class SeqCluster:

@classmethod
def __init__(cls, res_start, seed, is_verbose=True):
cls._res_param_start = res_start
Expand Down Expand Up @@ -139,9 +138,9 @@ def _convert_cluster_ptrs(src_cluster_ptrs, last_seq_cluster_ptrs):

for cluster_id in range(np.max(src_cluster_ptrs) + 1):
src_cluster_ids = np.argwhere(src_cluster_ptrs == cluster_id).flatten()
output_seq_cluster_ptrs[np.isin(last_seq_cluster_ptrs, src_cluster_ids)] = (
cluster_id
)
output_seq_cluster_ptrs[
np.isin(last_seq_cluster_ptrs, src_cluster_ids)
] = cluster_id

return output_seq_cluster_ptrs

Expand Down Expand Up @@ -240,9 +239,9 @@ def _bin_src_clusters(
):
if len(src_cluster_bins) == 0:
src_cluster_bins.append([src_cluster_id])
avg_intra_bin_edge_weights[str(src_cluster_id)] = (
global_edge_weight_mtrx[src_cluster_id, src_cluster_id]
)
avg_intra_bin_edge_weights[
str(src_cluster_id)
] = global_edge_weight_mtrx[src_cluster_id, src_cluster_id]
continue

best_bin = None
Expand All @@ -268,16 +267,16 @@ def _bin_src_clusters(

if best_bin is None:
src_cluster_bins.append([src_cluster_id])
avg_intra_bin_edge_weights[str(src_cluster_id)] = (
global_edge_weight_mtrx[src_cluster_id, src_cluster_id]
)
avg_intra_bin_edge_weights[
str(src_cluster_id)
] = global_edge_weight_mtrx[src_cluster_id, src_cluster_id]
else:
del avg_intra_bin_edge_weights["-".join(map(str, best_bin))]
best_bin.append(src_cluster_id)
avg_intra_bin_edge_weights["-".join(map(str, best_bin))] = (
cls._cal_cluster_avg_edge_weight(
global_edge_weight_mtrx, src_cluster_edge_counts, best_bin
)
avg_intra_bin_edge_weights[
"-".join(map(str, best_bin))
] = cls._cal_cluster_avg_edge_weight(
global_edge_weight_mtrx, src_cluster_edge_counts, best_bin
)

return list(map(np.array, src_cluster_bins)), avg_intra_bin_edge_weights
Expand All @@ -298,12 +297,12 @@ def _verify_clusters(

for cluster_id in range(np.max(src_cluster_ptrs) + 1):
src_cluster_bool_ptrs = src_cluster_ptrs == cluster_id
avg_intra_super_cluster_edge_weights[cluster_id] = (
cls._cal_cluster_avg_edge_weight(
global_edge_weight_mtrx,
src_cluster_edge_counts,
src_cluster_bool_ptrs,
)
avg_intra_super_cluster_edge_weights[
cluster_id
] = cls._cal_cluster_avg_edge_weight(
global_edge_weight_mtrx,
src_cluster_edge_counts,
src_cluster_bool_ptrs,
)
else:
src_cluster_ptrs = np.full(candidate_src_cluster_ptrs.size, -1)
Expand All @@ -316,17 +315,18 @@ def _verify_clusters(
if src_cluster_ids.size == 1:
assigned_super_cluster_id = np.max(src_cluster_ptrs) + 1
src_cluster_ptrs[src_cluster_ids] = assigned_super_cluster_id
avg_intra_super_cluster_edge_weights[assigned_super_cluster_id] = (
global_edge_weight_mtrx[src_cluster_ids[0], src_cluster_ids[0]]
)
avg_intra_super_cluster_edge_weights[
assigned_super_cluster_id
] = global_edge_weight_mtrx[src_cluster_ids[0], src_cluster_ids[0]]
continue

qual_src_cluster_bins, avg_intra_bin_edge_weights = (
cls._bin_src_clusters(
src_cluster_ids,
global_edge_weight_mtrx,
src_cluster_edge_counts,
)
(
qual_src_cluster_bins,
avg_intra_bin_edge_weights,
) = cls._bin_src_clusters(
src_cluster_ids,
global_edge_weight_mtrx,
src_cluster_edge_counts,
)

assigned_super_cluster_ids = list()
Expand Down

0 comments on commit 7aea641

Please sign in to comment.