Skip to content

Commit

Permalink
Xtrapol8: create command line tool phenix.development.xtrapol8
Browse files Browse the repository at this point in the history
  • Loading branch information
dcliebschner committed Nov 11, 2024
1 parent b6aec6b commit db5f48e
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mmtbx/command_line/xtrapol8.py
Original file line number Diff line number Diff line change
@@ -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)
53 changes: 53 additions & 0 deletions mmtbx/programs/xtrapol8.py
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit db5f48e

Please sign in to comment.