From 6fbe9955e8cb037956d4cc20f1283d520aee8bf9 Mon Sep 17 00:00:00 2001
From: Xavier Robin <xavier.robin@unibas.ch>
Date: Mon, 29 Jul 2024 18:01:18 +0200
Subject: [PATCH] Penalize added model contacts by default in lDDT-PLI

---
 CHANGELOG.txt                                   |  5 +++++
 actions/ost-compare-ligand-structures           | 17 ++++++++++++-----
 modules/mol/alg/pymod/ligand_scoring_lddtpli.py |  8 +++++---
 3 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index ef6d7297c..fd3b597bf 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,3 +1,8 @@
+Changes in Release 2.9.0
+--------------------------------------------------------------------------------
+ 
+ * lDDT-PLI now penalizes added model contacts by default.
+
 Changes in Release 2.8.0
 --------------------------------------------------------------------------------
 
diff --git a/actions/ost-compare-ligand-structures b/actions/ost-compare-ligand-structures
index 05bed460c..112f8deaa 100644
--- a/actions/ost-compare-ligand-structures
+++ b/actions/ost-compare-ligand-structures
@@ -299,11 +299,18 @@ def _ParseArgs():
         help=("lDDT inclusion radius for lDDT-PLI."))
 
     parser.add_argument(
-        "--lddt-pli-amc",
-        dest="lddt_pli_amc",
-        default=False,
+        "--lddt-pli-add-mdl-contacts",
+        dest="lddt_pli_add_mdl_contacts",
+        default=True,
         action="store_true",
-        help=("Add model contacts (amc) when computing lDDT-PLI."))
+        help=("Add model contacts when computing lDDT-PLI."))
+
+    parser.add_argument(
+        "--no-lddt-pli-add-mdl-contacts",
+        dest="lddt_pli_add_mdl_contacts",
+        default=True,
+        action="store_false",
+        help=("DO NOT add model contacts when computing lDDT-PLI."))
 
     # arguments relevant for rmsd
 
@@ -483,7 +490,7 @@ def _SetupLDDTPLIScorer(model, model_ligands, reference, reference_ligands, args
                                                 substructure_match = args.substructure_match,
                                                 coverage_delta = args.coverage_delta,
                                                 lddt_pli_radius = args.lddt_pli_radius,
-                                                add_mdl_contacts = args.lddt_pli_amc)
+                                                add_mdl_contacts = args.lddt_pli_add_mdl_contacts)
 
 def _SetupSCRMSDScorer(model, model_ligands, reference, reference_ligands, args):
     return ligand_scoring_scrmsd.SCRMSDScorer(model, reference,
diff --git a/modules/mol/alg/pymod/ligand_scoring_lddtpli.py b/modules/mol/alg/pymod/ligand_scoring_lddtpli.py
index 5ba88920d..be245c63f 100644
--- a/modules/mol/alg/pymod/ligand_scoring_lddtpli.py
+++ b/modules/mol/alg/pymod/ligand_scoring_lddtpli.py
@@ -1,6 +1,6 @@
 import numpy as np
 
-from ost import LogWarning
+from ost import LogWarning, LogInfo
 from ost import geom
 from ost import mol
 from ost import seq
@@ -84,7 +84,7 @@ class LDDTPLIScorer(ligand_scoring_base.LigandScorer):
     :type max_symmetries: :class:`int`
     :param lddt_pli_radius: lDDT inclusion radius for lDDT-PLI.
     :type lddt_pli_radius: :class:`float`
-    :param add_mdl_contacts: Whether to add mdl contacts.
+    :param add_mdl_contacts: Whether to penalize added model contacts.
     :type add_mdl_contacts: :class:`bool`
     :param lddt_pli_thresholds: Distance difference thresholds for lDDT.
     :type lddt_pli_thresholds: :class:`list` of :class:`float`
@@ -103,7 +103,7 @@ class LDDTPLIScorer(ligand_scoring_base.LigandScorer):
                  resnum_alignments=False, rename_ligand_chain=False,
                  substructure_match=False, coverage_delta=0.2,
                  max_symmetries=1e5, lddt_pli_radius=6.0,
-                 add_mdl_contacts=False,
+                 add_mdl_contacts=True,
                  lddt_pli_thresholds = [0.5, 1.0, 2.0, 4.0],
                  lddt_pli_binding_site_radius=None):
 
@@ -141,10 +141,12 @@ class LDDTPLIScorer(ligand_scoring_base.LigandScorer):
         """ Implements interface from parent
         """
         if self.add_mdl_contacts:
+            LogInfo("Computing lDDT-PLI with added model contacts")
             result = self._compute_lddt_pli_add_mdl_contacts(symmetries,
                                                              target_ligand,
                                                              model_ligand)
         else:
+            LogInfo("Computing lDDT-PLI without added model contacts")
             result = self._compute_lddt_pli_classic(symmetries,
                                                     target_ligand,
                                                     model_ligand)
-- 
GitLab