From a3fa5e4ac02909469ec7563d0e6006965c50680c Mon Sep 17 00:00:00 2001
From: Gabriel Studer <gabriel.studer@unibas.ch>
Date: Fri, 26 May 2023 13:17:54 +0200
Subject: [PATCH] Improve error handling in compare-structures

CAD score computation requires residue numbers in model and reference
to match. This raises an error in the Scorer object otherwise.
Catch this early on and raise an error specific to compare-structures
action with instructions on how to get rid of it.
---
 actions/ost-compare-structures | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/actions/ost-compare-structures b/actions/ost-compare-structures
index f2b9a5856..cc145d048 100644
--- a/actions/ost-compare-structures
+++ b/actions/ost-compare-structures
@@ -654,6 +654,11 @@ def _Main():
 
     args = _ParseArgs()
     try:
+        compute_cad = args.cad_score or args.local_cad_score
+        if compute_cad and not args.residue_number_alignment:
+            raise RuntimeError("Only support CAD score when residue numbers in "
+                               "model and reference match. Use -rna flag if "
+                               "this is the case.")
         reference = _LoadStructure(args.reference,
                                    sformat=args.reference_format,
                                    bu_idx=args.reference_biounit,
-- 
GitLab