From 56f012a1e6d9bd58d7c2330c3f5f254950a4ecdc Mon Sep 17 00:00:00 2001
From: Marco Biasini <marco.biasini@unibas.ch>
Date: Fri, 22 Feb 2013 13:34:44 +0100
Subject: [PATCH] unfail unittests

---
 modules/mol/alg/pymod/wrap_mol_alg.cc     |  3 ++-
 modules/mol/alg/src/consistency_checks.cc | 17 +++--------------
 modules/mol/alg/src/consistency_checks.hh |  5 +++--
 3 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/modules/mol/alg/pymod/wrap_mol_alg.cc b/modules/mol/alg/pymod/wrap_mol_alg.cc
index bdf141aa5..b775b6396 100644
--- a/modules/mol/alg/pymod/wrap_mol_alg.cc
+++ b/modules/mol/alg/pymod/wrap_mol_alg.cc
@@ -167,7 +167,8 @@ BOOST_PYTHON_MODULE(_ost_mol_alg)
   def("PrintGlobalRDMap",&mol::alg::PrintGlobalRDMap);
   def("PrintResidueRDMap",&mol::alg::PrintResidueRDMap);
  
-  def("ResidueNamesMatch",&mol::alg::ResidueNamesMatch);
+  def("ResidueNamesMatch",&mol::alg::ResidueNamesMatch,
+      (arg("probe"), arg("reference"), arg("log_as_error")=false));
 
  
 }
diff --git a/modules/mol/alg/src/consistency_checks.cc b/modules/mol/alg/src/consistency_checks.cc
index 8cafbe6ba..bdc0ab646 100644
--- a/modules/mol/alg/src/consistency_checks.cc
+++ b/modules/mol/alg/src/consistency_checks.cc
@@ -24,19 +24,8 @@
 
 namespace ost { namespace mol { namespace alg {
   
-/// \brief Checks that residue types with the same ResNum in the two structures match
-///
-/// Requires a reference structure and a probe structure. The function checks that all the 
-/// residues in the reference structure that appear in the probe structure (i.e., that have the 
-/// same ResNum) are of the same residue type. Chains are paired by index, not by chain name
-/// (i.e., the first chain of the reference will be compared with the first chain of the probe,
-/// the second with the second, etc.)
-
-
-
-
-
-bool ResidueNamesMatch (const mol::EntityView& probe, const mol::EntityView& reference, bool consistency_checks)
+bool ResidueNamesMatch(const EntityView& probe, const EntityView& reference, 
+                       bool log_as_error)
 {
   bool return_value = true;
   ChainViewList ref_chains = reference.GetChainList();
@@ -51,7 +40,7 @@ bool ResidueNamesMatch (const mol::EntityView& probe, const mol::EntityView& ref
         if (probe_residue.IsValid()) {
           if (probe_residue.GetName()!=rri->GetName()) {
             return_value = false;
-            if (consistency_checks==true) {
+            if (log_as_error) {
               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 5da6a281f..34eb4568b 100644
--- a/modules/mol/alg/src/consistency_checks.hh
+++ b/modules/mol/alg/src/consistency_checks.hh
@@ -31,8 +31,9 @@ namespace ost { namespace mol { namespace alg {
 /// same ResNum) are of the same residue type. Chains are comapred by order, not by chain name 
 /// (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 consistency_checks);
+bool DLLEXPORT_OST_MOL_ALG ResidueNamesMatch(const EntityView& probe, 
+                                             const EntityView& reference, 
+                                             bool log_as_error=false);
   
 }}}
 
-- 
GitLab