From d426909b9fd0d43bedfc3e9945041342f8b095ac Mon Sep 17 00:00:00 2001 From: Paul Bond Date: Thu, 24 Oct 2024 17:14:47 +0100 Subject: [PATCH] v4.0.2 (#50) * Avoid crashing when no residues are built * Updated version --- CHANGELOG.md | 6 ++++++ modelcraft/__init__.py | 2 +- modelcraft/modelcraftxray.py | 10 ++++++++-- setup.py | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8943e35..700c494 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org). +## [4.0.2] - 2024-10-24 + +### Fixed + +- Crash when no residues are built. + ## [4.0.1] - 2024-05-14 ### Fixed diff --git a/modelcraft/__init__.py b/modelcraft/__init__.py index 44d2dfa..e548f96 100644 --- a/modelcraft/__init__.py +++ b/modelcraft/__init__.py @@ -1,4 +1,4 @@ -__version__ = "4.0.1" +__version__ = "4.0.2" from .cell import max_distortion as max_cell_distortion from .cell import remove_scale diff --git a/modelcraft/modelcraftxray.py b/modelcraft/modelcraftxray.py index 4eb7a69..eb081ee 100755 --- a/modelcraft/modelcraftxray.py +++ b/modelcraft/modelcraftxray.py @@ -123,6 +123,8 @@ def run_cycle(self): def run_buccaneer_and_nautilus(self): buccaneer = self.buccaneer() nautilus = self.nautilus() + if buccaneer is None and nautilus is None: + self.terminate(reason="No residues built") if buccaneer is None or nautilus is None: self.update_current_from_refmac_result(buccaneer or nautilus) else: @@ -132,7 +134,7 @@ def run_buccaneer_and_nautilus(self): def buccaneer(self): if not self.args.contents.proteins: - return + return None result = Buccaneer( contents=self.args.contents, fsigf=self.args.fmean, @@ -147,12 +149,14 @@ def buccaneer(self): cycles=3 if self.cycle == 1 else 2, threads=self.args.threads, ).run(self) + if result.structure is None or ModelStats(result.structure).residues == 0: + return None write_mmcif(self.path("current.cif"), result.structure) return self.run_refmac(result.structure, cycles=10) def nautilus(self): if not (self.args.contents.rnas or self.args.contents.dnas): - return + return None result = Nautilus( contents=self.args.contents, fsigf=self.args.fmean, @@ -161,6 +165,8 @@ def nautilus(self): freer=self.args.freer, structure=self.current_structure, ).run(self) + if result.structure is None or ModelStats(result.structure).residues == 0: + return None write_mmcif(self.path("current.cif"), result.structure) return self.run_refmac(result.structure, cycles=10) diff --git a/setup.py b/setup.py index 7164d84..e0c3de1 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="modelcraft", - version="4.0.1", + version="4.0.2", author="Paul Bond", author_email="paul.bond@york.ac.uk", description="Automated model building pipeline for X-ray crystallography",