From 1ebfa77cbb0d5ecf83abcb7e036f49ba711fa85b Mon Sep 17 00:00:00 2001
From: Gerardo Tauriello <gerardo.tauriello@unibas.ch>
Date: Fri, 7 Jul 2017 16:50:51 +0200
Subject: [PATCH] Include _ and - in QSscoreEntity.removed_chains

---
 modules/mol/alg/pymod/qsscoring.py | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/modules/mol/alg/pymod/qsscoring.py b/modules/mol/alg/pymod/qsscoring.py
index e234b61bf..f63fb7c98 100644
--- a/modules/mol/alg/pymod/qsscoring.py
+++ b/modules/mol/alg/pymod/qsscoring.py
@@ -925,7 +925,9 @@ def _CleanInputEntity(ent):
   removed_chains = []
   for ch in ent.chains:
     # we remove chains if they are small-peptides or if the contain no aa
-    if not ch.name in '-_':
+    if ch.name in ['-', '_']:
+      removed_chains.append('"%c"' % ch.name)
+    else:
       without_aa = not any(r.chem_type.IsAminoAcid() for r in ch.residues)
       if ch.residue_count < 20 or without_aa:
         if ch.name == ' ':
@@ -941,10 +943,12 @@ def _CleanInputEntity(ent):
           removed_chains.append(ch.name)
 
   # remove them from *ent*
-  view = ent.Select('cname!=%s' \
-                    % ','.join(['"-"','"_"'] + list(set(removed_chains))))
-  ent_new = mol.CreateEntityFromView(view,True)
-  ent_new.SetName(ent.GetName())
+  if removed_chains:
+    view = ent.Select('cname!=%s' % ','.join(set(removed_chains)))
+    ent_new = mol.CreateEntityFromView(view, True)
+    ent_new.SetName(ent.GetName())
+  else:
+    ent_new = ent
 
   # check if CA only
   calpha_only = False
-- 
GitLab