From 3619149f4ada475c08cc168e312a651fdd408591 Mon Sep 17 00:00:00 2001
From: Rafal Gumienny <r.gumienny@unibas.ch>
Date: Thu, 19 Apr 2018 11:34:36 +0200
Subject: [PATCH] fix: SCHWED-3121 Do not exit when PDBs cannot be saved

---
 actions/ost-compare-structures | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/actions/ost-compare-structures b/actions/ost-compare-structures
index fc3b814bf..e91457d68 100644
--- a/actions/ost-compare-structures
+++ b/actions/ost-compare-structures
@@ -466,7 +466,7 @@ def _ReadStructureFile(path):
                 _RevertChainNames(entity)
                 entities.append(entity)
             elif len(cif_info.biounits) > 1:
-                for i, biounit in enumerate(cif_info.biounits):
+                for i, biounit in enumerate(cif_info.biounits, 1):
                     entity = biounit.PDBize(tmp_entity, min_polymer_size=0)
                     if not entity.IsValid():
                         raise IOError(
@@ -730,15 +730,21 @@ def _Main():
                     reference_name + opts.dump_suffix)
                 ost.LogInfo("Saving cleaned up reference to %s" %
                             ref_output_path)
-                SavePDB(qs_scorer.qs_ent_1.ent,
-                        ref_output_path)
+                try:
+                    SavePDB(qs_scorer.qs_ent_1.ent,
+                            ref_output_path)
+                except Exception as ex:
+                    ost.LogError("Cannot save reference: %s" % str(ex))
                 mdl_output_path = os.path.join(
                     os.path.dirname(opts.model),
                     model_name + opts.dump_suffix)
                 ost.LogInfo("Saving cleaned up reference to %s" %
                             mdl_output_path)
-                SavePDB(qs_scorer.qs_ent_2.ent,
-                        mdl_output_path)
+                try:
+                    SavePDB(qs_scorer.qs_ent_2.ent,
+                            mdl_output_path)
+                except Exception as ex:
+                    ost.LogError("Cannot save model: %s" % str(ex))
         result["result"][model_name] = model_results
 
     if opts.output is not None:
-- 
GitLab