Skip to content

Commit 9fc667c

Browse files
authored
🐛 handle case where all contigs are clustered in first DBSCAN round. (#105)
1 parent 55c8429 commit 9fc667c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pipeline/recursive_dbscan.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ def normalizeKmers(count_matrix): # list of lists, not a np matrix
551551
subset_table = local_current_table.loc[local_current_table[taxonomic_level] == classification] # COPY of local_current_table
552552

553553
while True:
554-
if len(subset_table.index) < 1:
554+
if subset_table.empty:
555555
break
556556
round_counter += 1
557557
logger.info('Running DBSCAN round ' + str(round_counter))
@@ -574,7 +574,6 @@ def normalizeKmers(count_matrix): # list of lists, not a np matrix
574574
table_indices = local_current_table[local_current_table['contig'] == contig].index.tolist()
575575
master_table.at[table_indices[0], 'cluster'] = new_cluster_name
576576

577-
578577
# Add unclustered_table to combined unclustered dataframe
579578
unclustered_table = unclustered_table.append(local_unclustered_table)
580579

@@ -583,6 +582,8 @@ def normalizeKmers(count_matrix): # list of lists, not a np matrix
583582
else:
584583
for dimensions in [2, 3]:
585584
while True:
585+
if local_current_table.empty:
586+
break
586587
round_counter += 1
587588
logger.info('Running DBSCAN round ' + str(round_counter))
588589

0 commit comments

Comments
 (0)