From 51f330b8e53ecce038332aa09360ad7a0c512a39 Mon Sep 17 00:00:00 2001 From: Paul Bond Date: Thu, 21 Sep 2023 16:10:50 +0100 Subject: [PATCH] Version 3.4.0 (#36) --- CHANGELOG.md | 6 ++++++ modelcraft/__init__.py | 2 +- modelcraft/arguments.py | 14 +++++++++++--- modelcraft/modelcraftem.py | 5 ++++- modelcraft/tests/ccp4/test_buccaneer.py | 9 +++++++++ modelcraft/tests/ccpem/test_em.py | 10 +++++++++- setup.py | 2 +- 7 files changed, 41 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 53bfabe..4355f23 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). +## [3.4.0] - 2023-09-21 + +### Added + +- Option --mask to provide a custom mask in EM mode instead of using EMDA mapmask + ## [3.3.0] - 2023-08-01 ### Changed diff --git a/modelcraft/__init__.py b/modelcraft/__init__.py index ccbb567..4fbbb94 100644 --- a/modelcraft/__init__.py +++ b/modelcraft/__init__.py @@ -1,4 +1,4 @@ -__version__ = "3.3.0" +__version__ = "3.4.0" from .cell import max_distortion as max_cell_distortion from .cell import remove_scale diff --git a/modelcraft/arguments.py b/modelcraft/arguments.py index e650bcc..ff627a0 100644 --- a/modelcraft/arguments.py +++ b/modelcraft/arguments.py @@ -237,12 +237,20 @@ metavar="X", help=( "Either two half-maps or a single map in MRC format. " - "Input maps will be trimmed using Servalcat " - "and a mask calculated by EMDA mapmask. " + "Input maps will be trimmed using Servalcat. " "If two half-maps are provided then Servalcat will be used to calculate " "a normalised expected (NE) map for model building." ), ) +_GROUP.add_argument( + "--mask", + metavar="X", + help=( + "Mask with the same grid size and dimensions as the input map(s). " + "Servalcat will use this mask when trimming the maps. " + "If a mask is not provided then EMDA mapmask will be used to create one." + ), +) _GROUP.add_argument( "--resolution", type=float, @@ -289,7 +297,7 @@ def _basic_check(args: argparse.Namespace): def _check_paths(args: argparse.Namespace): - for arg in ("contents", "data", "map", "model", "restraints"): + for arg in ("contents", "data", "map", "mask", "model", "restraints"): if hasattr(args, arg): attr = getattr(args, arg) if isinstance(attr, str): diff --git a/modelcraft/modelcraftem.py b/modelcraft/modelcraftem.py index 77b80ff..e78e6c4 100755 --- a/modelcraft/modelcraftem.py +++ b/modelcraft/modelcraftem.py @@ -60,7 +60,10 @@ def run(self): def _process_input_maps(self): maps = [read_map(path) for path in self.args.map] - mask = EmdaMapMask(maps[0]).run(self).mask + if self.args.mask is not None: + mask = read_map(self.args.mask) + else: + mask = EmdaMapMask(maps[0]).run(self).mask trimmed = ServalcatTrim(mask, maps).run(self) self.args.map = trimmed.maps if len(maps) == 2: diff --git a/modelcraft/tests/ccp4/test_buccaneer.py b/modelcraft/tests/ccp4/test_buccaneer.py index 0103748..911feeb 100644 --- a/modelcraft/tests/ccp4/test_buccaneer.py +++ b/modelcraft/tests/ccp4/test_buccaneer.py @@ -22,6 +22,15 @@ def test_insulin(): freer=freer, cycles=1, ).run() + assert buccaneer.completeness_res > 0 + assert buccaneer.completeness_chn > 0 + assert buccaneer.chains_built > 0 + assert buccaneer.fragments_built > 0 + assert buccaneer.residues_built > 0 + assert buccaneer.residues_sequenced > 0 + assert buccaneer.residues_unique > 0 + assert buccaneer.longest_fragment > 0 + assert buccaneer.seconds > 0 stats = ModelStats(buccaneer.structure) assert stats.residues > 0 diff --git a/modelcraft/tests/ccpem/test_em.py b/modelcraft/tests/ccpem/test_em.py index 31a7425..707c18d 100644 --- a/modelcraft/tests/ccpem/test_em.py +++ b/modelcraft/tests/ccpem/test_em.py @@ -3,7 +3,14 @@ import pytest from modelcraft.scripts.modelcraft import main from ..ccp4 import in_temp_directory -from . import density_path, sequence_path, halfmap1_path, halfmap2_path, structure_path +from . import ( + density_path, + halfmap1_path, + halfmap2_path, + mask_path, + sequence_path, + structure_path, +) @in_temp_directory @@ -29,6 +36,7 @@ def test_3488_halfmaps(): args = ["em"] args += ["--contents", sequence_path()] args += ["--map", halfmap1_path(), halfmap2_path()] + args += ["--mask", mask_path()] args += ["--resolution", "3.2"] args += ["--cycles", "1"] with pytest.raises(SystemExit): diff --git a/setup.py b/setup.py index dfb7485..1d09485 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="modelcraft", - version="3.3.0", + version="3.4.0", author="Paul Bond", author_email="paul.bond@york.ac.uk", description="Automated model building pipeline for X-ray crystallography",