Skip to content

Commit

Permalink
Fall back to euclidean distance upon ValueError sorting table
Browse files Browse the repository at this point in the history
  • Loading branch information
sminot committed Feb 16, 2024
1 parent 8b78dee commit 07b0353
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions bin/plot_metagenomes.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@ def sort_index(self, df: pd.DataFrame, metric="cosine", method="average"):
)
)
]
except ValueError as e:
if metric != "euclidean":
logger.info("Falling back to euclidean distance")
return self.sort_index(df, metric="euclidean", method=method)
else:
logger.info("Error encountered while sorting table:")
self.log_df(df)
raise e
except Exception as e:
logger.info("Error encountered while sorting table:")
self.log_df(df)
Expand Down

0 comments on commit 07b0353

Please sign in to comment.