From a96b7f73f7773b09c0dcf3fb91c992c6273bb586 Mon Sep 17 00:00:00 2001
From: Xavier Robin <xavalias-github@xavier.robin.name>
Date: Tue, 23 Jan 2024 10:11:21 +0100
Subject: [PATCH] fix: IndexError when the data contains NaN values

---
 modules/mol/alg/pymod/ligand_scoring.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/mol/alg/pymod/ligand_scoring.py b/modules/mol/alg/pymod/ligand_scoring.py
index 5b0a87da7..29897cfc1 100644
--- a/modules/mol/alg/pymod/ligand_scoring.py
+++ b/modules/mol/alg/pymod/ligand_scoring.py
@@ -854,7 +854,7 @@ class LigandScorer:
                 if np.any(alternative_matches):
                     # Get the scores of these matches
                     LogVerbose("Found match with lower coverage but better score")
-                    min_mat1 = np.min(mat1[alternative_matches])
+                    min_mat1 = np.nanmin(mat1[alternative_matches])
                     max_i_trg, max_i_mdl = _get_best_match(min_mat1, min_coverage - coverage_delta)
 
                 # Disable row and column
-- 
GitLab