From db5f48e26f71abf214bad84b986f22b9b968e000 Mon Sep 17 00:00:00 2001 From: dcliebschner Date: Mon, 11 Nov 2024 13:57:32 -0800 Subject: [PATCH] Xtrapol8: create command line tool phenix.development.xtrapol8 --- mmtbx/command_line/xtrapol8.py | 8 +++++ mmtbx/programs/xtrapol8.py | 53 ++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 mmtbx/command_line/xtrapol8.py create mode 100644 mmtbx/programs/xtrapol8.py diff --git a/mmtbx/command_line/xtrapol8.py b/mmtbx/command_line/xtrapol8.py new file mode 100644 index 0000000000..d91b72f9e6 --- /dev/null +++ b/mmtbx/command_line/xtrapol8.py @@ -0,0 +1,8 @@ +# LIBTBX_SET_DISPATCHER_NAME phenix.development.xtrapol8 +from __future__ import absolute_import, division, print_function + +from iotbx.cli_parser import run_program +from mmtbx.programs import xtrapol8 + +if __name__ == '__main__': + run_program(program_class=xtrapol8.Program) diff --git a/mmtbx/programs/xtrapol8.py b/mmtbx/programs/xtrapol8.py new file mode 100644 index 0000000000..925f6805ae --- /dev/null +++ b/mmtbx/programs/xtrapol8.py @@ -0,0 +1,53 @@ +from __future__ import absolute_import, division, print_function +from phenix.program_template import ProgramTemplate +from libtbx.utils import Sorry + +master_phil_str = ''' +include scope libtbx.phil.interface.tracking_params +n_alpha = 10 + .type = int + .help = number of alpha values to test +''' + +# ============================================================================= + +class Program(ProgramTemplate): + + description = """ +Run xtrapol8. + + phenix.xtrapol8 reference_model.pdb reference.mtz triggered.mtz +""" + + datatypes = ['model', 'phil', 'miller_array', 'restraint'] + + master_phil_str = master_phil_str + + # --------------------------------------------------------------------------- + + def validate(self): + print('Validate inputs:', file = self.logger) + self.data_manager.has_models( + raise_sorry = True, + expected_n = 1, + exact_count = True) + fs = self.data_manager.has_miller_arrays( + raise_sorry = False, + expected_n = 2, + exact_count = True) + if (len(self.data_manager.get_miller_array_names()) != 2): + raise Sorry('Exactly 2 reflection files are expected.') + + print(' ...all good.', file = self.logger) + + # --------------------------------------------------------------------------- + + def run(self): + + print('Using model file:', self.data_manager.get_default_model_name(), + file=self.logger) + print('Using reflection file(s):', self.data_manager.get_miller_array_names(), + file=self.logger) + + hkls = self.data_manager.get_miller_array_names() + model = self.data_manager.get_model()