From 2ac198854ea99ec977cf68be9bc83c29a9978a52 Mon Sep 17 00:00:00 2001
From: Gabriel Studer <gabriel.studer@unibas.ch>
Date: Tue, 22 Aug 2017 11:08:50 +0200
Subject: [PATCH] don't assume the bb_list to have valid peptide bonds to
 enforce consistency with DSSP

---
 scoring/src/ss_agreement_env_listener.cc | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/scoring/src/ss_agreement_env_listener.cc b/scoring/src/ss_agreement_env_listener.cc
index 19d885f4..7456098a 100644
--- a/scoring/src/ss_agreement_env_listener.cc
+++ b/scoring/src/ss_agreement_env_listener.cc
@@ -130,10 +130,9 @@ void SSAgreementEnvListener::ClearEnvironment(const BackboneScoreEnv& base_env,
       env_data_[*i + 1].valid_h_pos = false;
     }
 
-    // we call FindOptimalDonors for the deleted residues.
-    // the only thing that will happen: 
-    // according donor_for_one_ / donor_for_two_ gets set to -1
-    FindOptimalDonors(*i);
+    // its no donor anymore
+    donor_for_one_[*i] = -1;
+    donor_for_two_[*i] = -1;
   }  
 
   std::set<int> stuff_to_update;
@@ -155,7 +154,6 @@ void SSAgreementEnvListener::SetTemporaryInteractions(
   temp_start_idx_ = start_idx;
   temp_size_ = bb_list.size();
 
-
   // lets first copy over all the data from the bb_list, as well as one before
   // and one after
   int idx = std::max(0, temp_start_idx_ - 1);
@@ -204,9 +202,13 @@ void SSAgreementEnvListener::SetTemporaryInteractions(
     connected_to_next_[temp_start_idx_-1] = 0;
   }
 
-  // the bb_list is assumed to be connected
+  // connection of bb_list itself
   for(int i = 0; i < temp_size_ - 1; ++i) {
-    connected_to_next_[temp_start_idx_+1] = 1;
+    if(geom::Length2(bb_list.GetC(i) - bb_list.GetN(i+1)) <= 6.25) {
+      connected_to_next_[temp_start_idx_+i] = 1;
+    } else {
+      connected_to_next_[temp_start_idx_+i] = 0;
+    } 
   }
 
   // lets see whether the last residue is connected
@@ -220,8 +222,8 @@ void SSAgreementEnvListener::SetTemporaryInteractions(
     connected_to_next_[temp_start_idx_+temp_size_-1] = 0;
   }
 
-  // let's finally update the hydrogen positions of all bb_list residues
-  // and the one residue after
+  // set h positions of all loop residues, as well as the one
+  // residue after (if present)
   idx = temp_start_idx_;
   end = temp_start_idx_ + temp_size_;
   if(static_cast<uint>(end) < idx_handler_->GetNumResidues()) ++end;
-- 
GitLab