From 40485d763c5d034afc828e4b9848f69ce8d67f37 Mon Sep 17 00:00:00 2001
From: Valerio Mariani <valerio.mariani@unibas.ch>
Date: Thu, 14 Feb 2013 17:36:23 +0100
Subject: [PATCH] Changed logging logic of consistency checks

---
 modules/mol/alg/src/consistency_checks.cc | 10 +++++++---
 modules/mol/alg/src/consistency_checks.hh |  2 +-
 modules/mol/alg/src/lddt.cc               |  6 +++---
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/modules/mol/alg/src/consistency_checks.cc b/modules/mol/alg/src/consistency_checks.cc
index 371f3c37b..8cafbe6ba 100644
--- a/modules/mol/alg/src/consistency_checks.cc
+++ b/modules/mol/alg/src/consistency_checks.cc
@@ -36,7 +36,7 @@ namespace ost { namespace mol { namespace alg {
 
 
 
-bool ResidueNamesMatch (const mol::EntityView& probe, const mol::EntityView& reference)
+bool ResidueNamesMatch (const mol::EntityView& probe, const mol::EntityView& reference, bool consistency_checks)
 {
   bool return_value = true;
   ChainViewList ref_chains = reference.GetChainList();
@@ -51,8 +51,12 @@ bool ResidueNamesMatch (const mol::EntityView& probe, const mol::EntityView& ref
         if (probe_residue.IsValid()) {
           if (probe_residue.GetName()!=rri->GetName()) {
             return_value = false;
-            LOG_VERBOSE("Name mismatch for residue " << probe_residue.GetNumber() << " in chain " << rci);
-            LOG_VERBOSE("In reference: " << rri->GetName() << ", in compared structure: " << probe_residue.GetName());
+            if (consistency_checks==true) {
+              LOG_ERROR("Name mismatch for residue " << probe_residue.GetNumber() << ": in the reference structure(s) is " << rri->GetName() << ", in the model " << probe_residue.GetName());
+            } else {
+              LOG_WARNING("Name mismatch for residue " << probe_residue.GetNumber() << ": in the reference structure(s) is " << rri->GetName() << ", in the model " << probe_residue.GetName());
+            }
+
           } 
         }            
       }
diff --git a/modules/mol/alg/src/consistency_checks.hh b/modules/mol/alg/src/consistency_checks.hh
index 77cffda1c..5da6a281f 100644
--- a/modules/mol/alg/src/consistency_checks.hh
+++ b/modules/mol/alg/src/consistency_checks.hh
@@ -32,7 +32,7 @@ namespace ost { namespace mol { namespace alg {
 /// (i.e.: the first chain of the reference will be compared with the first chain of the probe 
 /// structure, etc.)
 
-bool DLLEXPORT_OST_MOL_ALG ResidueNamesMatch (const mol::EntityView& probe, const mol::EntityView& reference);
+bool DLLEXPORT_OST_MOL_ALG ResidueNamesMatch (const mol::EntityView& probe, const mol::EntityView& reference, bool consistency_checks);
   
 }}}
 
diff --git a/modules/mol/alg/src/lddt.cc b/modules/mol/alg/src/lddt.cc
index 22902b1d1..ca171dbc8 100644
--- a/modules/mol/alg/src/lddt.cc
+++ b/modules/mol/alg/src/lddt.cc
@@ -314,13 +314,13 @@ int main (int argc, char **argv)
     EntityView outv=model.GetChainList()[0].Select("peptide=true");
     for (std::vector<EntityView>::const_iterator ref_list_it = ref_list.begin();
          ref_list_it != ref_list.end(); ++ref_list_it) {
-      bool cons_check = ResidueNamesMatch(v,*ref_list_it);
+      bool cons_check = ResidueNamesMatch(v,*ref_list_it,consistency_checks);
       if (cons_check==false) {
         if (consistency_checks==true) {
-          LOG_ERROR("Residue names in model: " << files[i] << " are inconsistent with one or more references");
+          LOG_ERROR("Residue names in model: " << files[i] << " and in reference structure(s) are inconsistent.");
           exit(-1);            
         } else {
-          LOG_WARNING("Residue names in model: " << files[i] << " are inconsistent with one or more references");
+          LOG_WARNING("Residue names in model: " << files[i] << " and in reference structure(s) are inconsistent.");
         }   
       } 
     }
-- 
GitLab