rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
print >> f, 'LIBTBX_DISPATCHER_NAME="%s"' % os.path.basename(target_file)
print >> f, 'LIBTBX_DISPATCHER_NAME="%s"' % op.basename(target_file)
def write_bin_sh_dispatcher(self, source_file, target_file): f = open(target_file, "w") if (source_file is not None): print >> f, '#! /bin/sh' print >> f, '# LIBTBX_DISPATCHER DO NOT EDIT' else: print >> f, '# LIBTBX_DISPATCHER_HEAD DO NOT EDIT' print >> f, '#' print >> f, '# This file is intended to be sourced from ot...
pyexe_dirname, pyexe_basename = os.path.split(self.python_exe)
pyexe_dirname, pyexe_basename = op.split(self.python_exe)
def write_bin_sh_dispatcher(self, source_file, target_file): f = open(target_file, "w") if (source_file is not None): print >> f, '#! /bin/sh' print >> f, '# LIBTBX_DISPATCHER DO NOT EDIT' else: print >> f, '# LIBTBX_DISPATCHER_HEAD DO NOT EDIT' print >> f, '#' print >> f, '# This file is intended to be sourced from ot...
elif (source_file is None or not os.path.isfile(source_file)):
elif (source_file is None or not op.isfile(source_file)):
def write_bin_sh_dispatcher(self, source_file, target_file): f = open(target_file, "w") if (source_file is not None): print >> f, '#! /bin/sh' print >> f, '# LIBTBX_DISPATCHER DO NOT EDIT' else: print >> f, '# LIBTBX_DISPATCHER_HEAD DO NOT EDIT' print >> f, '#' print >> f, '# This file is intended to be sourced from ot...
dispatcher_name=os.path.splitext(os.path.basename(target_file))[0]))
dispatcher_name=op.splitext(op.basename(target_file))[0]))
def write_win32_dispatcher(self, source_file, target_file): open(target_file, "wb").write( self.windows_dispatcher( command_path=source_file, dispatcher_name=os.path.splitext(os.path.basename(target_file))[0]))
if (not os.path.isfile(reg)):
if (not op.isfile(reg)):
def write_dispatcher(self, source_file, target_file): reg = self._dispatcher_registry.setdefault(target_file, source_file) if (reg != source_file): if (not os.path.isfile(reg)): self._dispatcher_registry[target_file] = source_file elif (os.path.isfile(source_file) and ( not hasattr(os.path, "samefile") or not os.path...
elif (os.path.isfile(source_file)
elif (op.isfile(source_file)
def write_dispatcher(self, source_file, target_file): reg = self._dispatcher_registry.setdefault(target_file, source_file) if (reg != source_file): if (not os.path.isfile(reg)): self._dispatcher_registry[target_file] = source_file elif (os.path.isfile(source_file) and ( not hasattr(os.path, "samefile") or not os.path...
or not os.path.samefile(reg, source_file)) and self.abs_path_short(abs_path=reg) != self.abs_path_short(abs_path=source_file)):
or not op.samefile(reg, source_file)) and op.normcase(self.abs_path_short(abs_path=reg)) != op.normcase(self.abs_path_short(abs_path=source_file))):
def write_dispatcher(self, source_file, target_file): reg = self._dispatcher_registry.setdefault(target_file, source_file) if (reg != source_file): if (not os.path.isfile(reg)): self._dispatcher_registry[target_file] = source_file elif (os.path.isfile(source_file) and ( not hasattr(os.path, "samefile") or not os.path...
if (os.path.isfile(os.path.join(path, script_name))):
if (op.isfile(op.join(path, script_name))):
def write_SConstruct(self): f = open_info(self.under_build("SConstruct")) write_do_not_edit_please_re_run_libtbx_configure_py(f=f) print >> f, 'SConsignFile()' for path in self.repository_paths: print >> f, 'Repository(r"%s")' % path for module in self.module_list: name,path = list(module.name_and_dist_path_pairs())[-...
if (os.path.isfile("Makefile")):
if (op.isfile("Makefile")):
def write_Makefile(self): if (os.path.isfile("Makefile")): os.rename("Makefile", "Makefile.old") # make cja seems to get confused if the file is simply overwritten f = open_info(self.under_build("Makefile")) lsj = './bin/libtbx.scons -j "`./bin/libtbx.show_number_of_processors`"' f.write("""\
if (os.path.isdir(path)):
if (op.isdir(path)):
def process_exe(self): for path in [self.exe_path, self.under_build("exe_dev")]: if (os.path.isdir(path)): print 'Processing: "%s"' % path for file_name in os.listdir(path): if (file_name.startswith(".")): continue target_file = file_name if (os.name == "nt"): fnl = file_name.lower() if (fnl.endswith(".exe.manifest")):...
d, b = os.path.split(self.python_exe) pythonw_exe = os.path.join(d, b.replace("python", "pythonw")) if (os.path.isfile(pythonw_exe)):
d, b = op.split(self.python_exe) pythonw_exe = op.join(d, b.replace("python", "pythonw")) if (op.isfile(pythonw_exe)):
def write_python_and_show_path_duplicates(self): module_names = [] for module in self.module_list: if ( len(module.command_line_directory_paths()) != 0 or len(module.assemble_pythonpath()) != 0): module_names.append(module.name) for module_name in module_names: self._write_dispatcher_in_bin( source_file=self.python_e...
source_file = os.path.join(self.bin_path, file_name)
source_file = op.join(self.bin_path, file_name)
def write_command_version_duplicates(self): if (self.command_version_suffix is None): return suffix = "_" + self.command_version_suffix for file_name in os.listdir(self.bin_path): if (file_name.startswith(".")): continue source_file = os.path.join(self.bin_path, file_name) if (os.name == "nt" and file_name.lower().ends...
if (os.path.isfile(libtbx_cvs_root)):
if (op.isfile(libtbx_cvs_root)):
def is_development_environment(self): libtbx_cvs_root = self.under_dist("libtbx", "CVS/Root") if (os.path.isfile(libtbx_cvs_root)): try: libtbx_cvs_root = open(libtbx_cvs_root).read() except IOError: pass else: if (libtbx_cvs_root.lower().find("ccp") >= 0): return False for module in self.module_list: if (module.has_to...
file_name = os.path.join(self.build_path, ".sconsign.dblite") if (os.path.isfile(file_name)):
file_name = op.join(self.build_path, ".sconsign.dblite") if (op.isfile(file_name)):
def clear_scons_memory(self): file_name = os.path.join(self.build_path, ".sconsign.dblite") if (os.path.isfile(file_name)): os.remove(file_name) dir_name = os.path.join(self.build_path, ".sconf_temp") if (os.path.isdir(dir_name)): from distutils.dir_util import remove_tree remove_tree(dir_name)
dir_name = os.path.join(self.build_path, ".sconf_temp") if (os.path.isdir(dir_name)):
dir_name = op.join(self.build_path, ".sconf_temp") if (op.isdir(dir_name)):
def clear_scons_memory(self): file_name = os.path.join(self.build_path, ".sconsign.dblite") if (os.path.isfile(file_name)): os.remove(file_name) dir_name = os.path.join(self.build_path, ".sconf_temp") if (os.path.isdir(dir_name)): from distutils.dir_util import remove_tree remove_tree(dir_name)
is_completed_file_name = os.path.join(
is_completed_file_name = op.join(
def refresh(self): is_completed_file_name = os.path.join( self.build_path, "libtbx_refresh_is_completed") if (os.path.exists(is_completed_file_name)): os.remove(is_completed_file_name) assert not os.path.exists(is_completed_file_name) self.assemble_pythonpath() self.show_build_options_and_module_listing() self.reset_di...
if (os.path.exists(is_completed_file_name)):
if (op.exists(is_completed_file_name)):
def refresh(self): is_completed_file_name = os.path.join( self.build_path, "libtbx_refresh_is_completed") if (os.path.exists(is_completed_file_name)): os.remove(is_completed_file_name) assert not os.path.exists(is_completed_file_name) self.assemble_pythonpath() self.show_build_options_and_module_listing() self.reset_di...
assert not os.path.exists(is_completed_file_name)
assert not op.exists(is_completed_file_name)
def refresh(self): is_completed_file_name = os.path.join( self.build_path, "libtbx_refresh_is_completed") if (os.path.exists(is_completed_file_name)): os.remove(is_completed_file_name) assert not os.path.exists(is_completed_file_name) self.assemble_pythonpath() self.show_build_options_and_module_listing() self.reset_di...
if (not os.path.isdir(self.bin_path)):
if (not op.isdir(self.bin_path)):
def refresh(self): is_completed_file_name = os.path.join( self.build_path, "libtbx_refresh_is_completed") if (os.path.exists(is_completed_file_name)): os.remove(is_completed_file_name) assert not os.path.exists(is_completed_file_name) self.assemble_pythonpath() self.show_build_options_and_module_listing() self.reset_di...
if (os.path.normcase(name).endswith(os.path.normcase(mate_suffix))):
if (op.normcase(name).endswith(op.normcase(mate_suffix))):
def __init__(self, env, name, dist_path=None, mate_suffix="adaptbx"): self.env = env self.mate_suffix = mate_suffix mate_suffix = "_" + mate_suffix if (os.path.normcase(name).endswith(os.path.normcase(mate_suffix))): self.name = name[:-len(mate_suffix)] self.names = [self.name, name] if (dist_path is not None): self.di...
if (not os.path.isfile(path)):
if (not op.isfile(path)):
def process_libtbx_config(self): self.python_paths = [] self.required_for_build = [] self.required_for_use = [] self.optional = [] self.exclude_from_binary_bundle = [] dist_paths = [] for dist_path in self.dist_paths: if (dist_path is not None): while True: path = libtbx.path.norm_join(dist_path, "libtbx_config") if (n...
new_dist_path = os.path.expandvars(redirection) if (not os.path.isabs(new_dist_path)):
new_dist_path = op.expandvars(redirection) if (not op.isabs(new_dist_path)):
def process_libtbx_config(self): self.python_paths = [] self.required_for_build = [] self.required_for_use = [] self.optional = [] self.exclude_from_binary_bundle = [] dist_paths = [] for dist_path in self.dist_paths: if (dist_path is not None): while True: path = libtbx.path.norm_join(dist_path, "libtbx_config") if (n...
if (not os.path.isdir(new_dist_path)):
if (not op.isdir(new_dist_path)):
def process_libtbx_config(self): self.python_paths = [] self.required_for_build = [] self.required_for_use = [] self.optional = [] self.exclude_from_binary_bundle = [] dist_paths = [] for dist_path in self.dist_paths: if (dist_path is not None): while True: path = libtbx.path.norm_join(dist_path, "libtbx_config") if (n...
path = os.path.normpath(dist_path + "/pythonpath") if (os.path.isdir(path)):
path = op.normpath(dist_path + "/pythonpath") if (op.isdir(path)):
def assemble_pythonpath(self): result = [] for dist_path in self.dist_paths_active(): path = os.path.normpath(dist_path + "/pythonpath") if (os.path.isdir(path)): result.append(path) for sub_dir in ["", "/"+self.name]: sub_file = sub_dir + "/__init__.py" path = os.path.normpath(dist_path + sub_file) if (os.path.isfile(...
path = os.path.normpath(dist_path + sub_file) if (os.path.isfile(path)): result.append(os.path.dirname(os.path.dirname(path)))
path = op.normpath(dist_path + sub_file) if (op.isfile(path)): result.append(op.dirname(op.dirname(path)))
def assemble_pythonpath(self): result = [] for dist_path in self.dist_paths_active(): path = os.path.normpath(dist_path + "/pythonpath") if (os.path.isdir(path)): result.append(path) for sub_dir in ["", "/"+self.name]: sub_file = sub_dir + "/__init__.py" path = os.path.normpath(dist_path + sub_file) if (os.path.isfile(...
if (os.path.isdir(os.path.join(dist_path, directory_name))):
if (op.isdir(op.join(dist_path, directory_name))):
def has_top_level_directory(self, directory_name): for dist_path in self.dist_paths_active(): if (os.path.isdir(os.path.join(dist_path, directory_name))): return True return False
if (not os.path.isfile(source_file)): return
if (not op.isfile(source_file)): return
def write_dispatcher(self, source_dir, file_name, suppress_warning, target_file_name_infix="", scan_for_libtbx_set_dispatcher_name=False): assert target_file_name_infix == "" or not scan_for_libtbx_set_dispatcher_name if (len(file_name) == 0): return source_file = libtbx.path.norm_join(source_dir, file_name) if (not os...
ext = os.path.splitext(file_name_lower)[1]
ext = op.splitext(file_name_lower)[1]
def write_dispatcher(self, source_dir, file_name, suppress_warning, target_file_name_infix="", scan_for_libtbx_set_dispatcher_name=False): assert target_file_name_infix == "" or not scan_for_libtbx_set_dispatcher_name if (len(file_name) == 0): return source_file = libtbx.path.norm_join(source_dir, file_name) if (not os...
target_file += "." + os.path.splitext(file_name)[0]
target_file += "." + op.splitext(file_name)[0]
def write_dispatcher(self, source_dir, file_name, suppress_warning, target_file_name_infix="", scan_for_libtbx_set_dispatcher_name=False): assert target_file_name_infix == "" or not scan_for_libtbx_set_dispatcher_name if (len(file_name) == 0): return source_file = libtbx.path.norm_join(source_dir, file_name) if (not os...
if (os.path.isdir(path)):
if (op.isdir(path)):
def command_line_directory_paths(self): result = [] for dist_path in self.dist_paths_active(): for sub_dir in ["command_line", self.name+"/command_line"]: path = libtbx.path.norm_join(dist_path, sub_dir) if (os.path.isdir(path)): result.append(path) return result
if (os.path.isfile(custom_refresh)):
if (op.isfile(custom_refresh)):
def process_libtbx_refresh_py(self): for dist_path in self.dist_paths_active(): custom_refresh = libtbx.path.norm_join(dist_path, "libtbx_refresh.py") if (os.path.isfile(custom_refresh)): print 'Processing: "%s"' % custom_refresh execfile(custom_refresh, {}, {"self": self})
if (os.path.isfile(path)): result.append(path)
if (op.isfile(path)): result.append(path)
def collect_test_scripts(self, file_names=["run_tests.py", "run_examples.py"]): result = [] for dist_path in self.dist_paths_active(): for file_name in file_names: path = libtbx.path.norm_join(dist_path, file_name) if (os.path.isfile(path)): result.append(path) return result
self._boost_dir_name = os.path.basename(path).lower()
self._boost_dir_name = op.basename(path).lower()
def set_boost_dir_name(self, path): self._boost_dir_name = os.path.basename(path).lower()
and os.path.basename(path).lower() == self._boost_dir_name):
and op.basename(path).lower() == self._boost_dir_name):
def scan_flag(self, path): if (not self._scan_boost and os.path.basename(path).lower() == self._boost_dir_name): if (not path in self._had_message): print "libtbx.scons: implicit dependency scan disabled for directory", print path self._had_message[path] = 1 return False return True
if (not os.path.isdir(value)):
if (not op.isdir(value)):
def option_repository(self, option, opt, value, parser): if (not os.path.isdir(value)): raise Sorry("Not a directory: --repository %s" % show_string(value)) self.repository_paths.append(value)
dirname, basename = os.path.split(sys.prefix) if (os.path.samefile(build_path, dirname)): new_prefix = os.path.join(build_path, basename) if (os.path.samefile(new_prefix, sys.prefix)): p = os.path.normpath(os.path.normcase(sys.prefix))
dirname, basename = op.split(sys.prefix) if (op.samefile(build_path, dirname)): new_prefix = op.join(build_path, basename) if (op.samefile(new_prefix, sys.prefix)): p = op.normpath(op.normcase(sys.prefix))
def set_preferred_sys_prefix_and_sys_executable(build_path): if (not hasattr(os.path, "samefile")): return dirname, basename = os.path.split(sys.prefix) if (os.path.samefile(build_path, dirname)): new_prefix = os.path.join(build_path, basename) if (os.path.samefile(new_prefix, sys.prefix)): p = os.path.normpath(os.path...
e = os.path.normpath(os.path.normcase(sys.executable))
e = op.normpath(op.normcase(sys.executable))
def set_preferred_sys_prefix_and_sys_executable(build_path): if (not hasattr(os.path, "samefile")): return dirname, basename = os.path.split(sys.prefix) if (os.path.samefile(build_path, dirname)): new_prefix = os.path.join(build_path, basename) if (os.path.samefile(new_prefix, sys.prefix)): p = os.path.normpath(os.path...
if (os.path.samefile(new_executable, sys.executable)):
if (op.samefile(new_executable, sys.executable)):
def set_preferred_sys_prefix_and_sys_executable(build_path): if (not hasattr(os.path, "samefile")): return dirname, basename = os.path.split(sys.prefix) if (os.path.samefile(build_path, dirname)): new_prefix = os.path.join(build_path, basename) if (os.path.samefile(new_prefix, sys.prefix)): p = os.path.normpath(os.path...
r = os.path.dirname(os.path.dirname(args[0])) b = os.path.basename(r)
r = op.dirname(op.dirname(args[0])) b = op.basename(r)
def cold_start(args): cwd_was_empty_at_start = True for file_name in os.listdir("."): if (not file_name.startswith(".")): cwd_was_empty_at_start = False break default_repositories = [] r = os.path.dirname(os.path.dirname(args[0])) b = os.path.basename(r) if (b.lower().startswith("cctbx_project")): default_repositories....
default_repositories.append(os.path.dirname(r))
default_repositories.append(op.dirname(r))
def cold_start(args): cwd_was_empty_at_start = True for file_name in os.listdir("."): if (not file_name.startswith(".")): cwd_was_empty_at_start = False break default_repositories = [] r = os.path.dirname(os.path.dirname(args[0])) b = os.path.basename(r) if (b.lower().startswith("cctbx_project")): default_repositories....
if (not os.path.isabs(build_path)):
if (not op.isabs(build_path)):
def cold_start(args): cwd_was_empty_at_start = True for file_name in os.listdir("."): if (not file_name.startswith(".")): cwd_was_empty_at_start = False break default_repositories = [] r = os.path.dirname(os.path.dirname(args[0])) b = os.path.basename(r) if (b.lower().startswith("cctbx_project")): default_repositories....
if (not os.path.isdir(build_path)):
if (not op.isdir(build_path)):
def cold_start(args): cwd_was_empty_at_start = True for file_name in os.listdir("."): if (not file_name.startswith(".")): cwd_was_empty_at_start = False break default_repositories = [] r = os.path.dirname(os.path.dirname(args[0])) b = os.path.basename(r) if (b.lower().startswith("cctbx_project")): default_repositories....
if (not os.path.samefile(build_path, os.getcwd())):
if (not op.samefile(build_path, os.getcwd())):
def cold_start(args): cwd_was_empty_at_start = True for file_name in os.listdir("."): if (not file_name.startswith(".")): cwd_was_empty_at_start = False break default_repositories = [] r = os.path.dirname(os.path.dirname(args[0])) b = os.path.basename(r) if (b.lower().startswith("cctbx_project")): default_repositories....
libtbx_env = open(os.path.join(build_path, "libtbx_env"), "rb")
libtbx_env = open(op.join(build_path, "libtbx_env"), "rb")
def unpickle(): build_path = os.environ["LIBTBX_BUILD"] set_preferred_sys_prefix_and_sys_executable(build_path=build_path) libtbx_env = open(os.path.join(build_path, "libtbx_env"), "rb") env = pickle.load(libtbx_env) if (env.python_version_major_minor != sys.version_info[:2]): env.raise_python_version_incompatible() # ...
if (params is not None) :
if (params is None) :
def run2 (args, log=sys.stdout, check_params=True, params=None) : import iotbx.pdb.fetch parameter_interpreter = libtbx.phil.command_line.argument_interpreter( master_phil=master_phil, home_scope="") pdb_file = None cif_file = None sources = [] for arg in args : if os.path.isfile(arg) : if iotbx.pdb.is_pdb_file(arg) : ...
if params.input.pdb_id is not None :
if (params.input.pdb_id is not None) :
def run2 (args, log=sys.stdout, check_params=True, params=None) : import iotbx.pdb.fetch parameter_interpreter = libtbx.phil.command_line.argument_interpreter( master_phil=master_phil, home_scope="") pdb_file = None cif_file = None sources = [] for arg in args : if os.path.isfile(arg) : if iotbx.pdb.is_pdb_file(arg) : ...
self._label2_font.SetStyle(wx.FONTSTYLE_ITALIC)
if not ((wx.VERSION[0] == 2) and (wx.VERSION[1] == 9)) : self._label2_font.SetStyle(wx.FONTSTYLE_ITALIC)
def __init__ (self, parent, id_=wx.ID_ANY, label='', label2='', bmp=None, pos=wx.DefaultPosition, size=wx.DefaultSize, style=MB_STYLE_DEFAULT, name=wx.ButtonNameStr, start_color=(218,218,218), gradient_percent=15.0, highlight_color=(230,230,230), label_size=13, caption_size=11, button_margin=2, disable_after_click=0): ...
if temperature < -20: d += 0.01 elif temperature < -70: d += 0.02
if temperature < -70: d += 0.02 elif temperature < -20: d += 0.01
def ideal_bond_length(self, pivot, temperature): pivot_element = pivot.scattering_type d = self.room_temperature_bond_length.get(pivot_element) if d is None: raise InvalidConstraint( "Invalid %s constraint involving %s:" " ideal bond length not defined to atom type %s" %( self.__class__.__name__, pivot.label, pivot_ele...
"$D/examples/pdb_tardy_conf_sampling_simple",
"$D/examples/pdb_tardy_conf_sampling_simple.py",
def run(): tst_list = ( "$D/tst_wildcard.py", "$D/tst_simple_parser.py", "$D/tst_phil.py", "$D/ranges.py", "$D/tst_crystal_symmetry_from_any.py", "$D/kriber/tst_strudat.py", "$D/cif/tests/tst_lex_parse_build.py", "$D/cif/tests/tst_model.py", "$D/cif/tests/tst_validation.py", "$D/cif/tests/tst_xray_structure.py", "$D/sh...
if (pivot != other.pivot or pivot_neighbour != other.pivot_neghbour\
if (self.pivot != other.pivot or pivot_neighbour != other.pivot_neghbour\
def __eq__(self, other): if (pivot != other.pivot or pivot_neighbour != other.pivot_neghbour\ or self.indices != other.indices): return False return True
if ( id_tok.value in intrinsics.extra_set_lower and id_tok.value in intrinsics.set_lower):
if ( id_tok.value in intrinsics.extra_set_lower or id_tok.value in intrinsics.set_lower):
def search_for_id_tokens_callback(id_tok, next_tok): followed_by_parenthesis = ( next_tok is not None and next_tok.is_parentheses()) tf = O.fdecl_by_identifier.get(id_tok.value) if (tf is None): if (not followed_by_parenthesis): tf = make_fdecl(id_tok=id_tok, var_type=vt_used) elif (id_tok.value in intrinsics.set_lower...
Sorry.reset_module()
if e.__class__.__module__ == "Boost.Python" : e = RuntimeError("Boost.Python.%s: %s" % (e.__class__.__name__, str(e))) elif hasattr(e, "reset_module") : e.reset_module()
def run (self) : old_stdout = sys.stdout sys.stdout = stdout_redirect(self) import libtbx.callbacks libtbx.call_back.register_handler(self.callback_wrapper) try : return_value = self.target() except Abort : self.callback_abort() except Exception, e : Sorry.reset_module() traceback_str = "\n".join(traceback.format_tb(sy...
output_text, summary_line, output_list = self.analyze_pdb(pdb_io, filename, outliers_only=self.params.cbetadev.outliers_only)
output_text, summary_line, output_list = self.analyze_pdb( filename=filename, pdb_io=pdb_io, outliers_only=self.params.cbetadev.outliers_only)
def run(self, args, out=sys.stdout, quiet=False): master_phil = get_master_phil() import iotbx.utils input_objects = iotbx.utils.process_command_line_inputs( args=args, master_phil=master_phil, input_types=("pdb",)) work_phil = master_phil.fetch(sources=input_objects["phil"]) work_params = work_phil.extract() assert le...
filename = pdb_io
self.beta_ideal = {} assert [pdb_io, hierarchy].count(None) == 1
def analyze_pdb(self, filename=None, pdb_io=None, hierarchy=None, outliers_only=False): relevant_atom_names = { " CA ": None, " N ": None, " C ": None, " CB ": None} # FUTURE: set analysis = 'pdb:alt:res:chainID:resnum:dev:dihedralNABB:Occ:ALT:\n' output_list = [] cbetadev_ctr = 0 self.num_outliers = 0 self.expected_...
pdb_io = iotbx.pdb.input(file_name = pdb_io)
def analyze_pdb(self, filename=None, pdb_io=None, hierarchy=None, outliers_only=False): relevant_atom_names = { " CA ": None, " N ": None, " C ": None, " CB ": None} # FUTURE: set analysis = 'pdb:alt:res:chainID:resnum:dev:dihedralNABB:Occ:ALT:\n' output_list = [] cbetadev_ctr = 0 self.num_outliers = 0 self.expected_...
base1 = bases[0][1:10] base2 = bases[1][1:10]
base1 = bases[0][0:10] base2 = bases[1][0:10]
def get_base_pairs(pdb_hierarchy, probe_flags=None): #db = mmtbx.base_pairing.pair_database() if probe_flags is None: probe_flags = "-Both -Unformated -NOCLASHOUT -NOVDWOUT \"BASE\" \"BASE\"" probe_out = run_probe(pdb_hierarchy=pdb_hierarchy, flags=probe_flags) hbond_hash={} pair_hash={} reduced_pair_hash={} probe_iter...
bases = (pair[:9], pair[9:]) base_pair = pair[6:9].strip()+pair[15:18].strip()
bases = (pair[:10], pair[10:]) base_pair = pair[7:10].strip()+pair[17:20].strip()
def get_base_pairs(pdb_hierarchy, probe_flags=None): #db = mmtbx.base_pairing.pair_database() if probe_flags is None: probe_flags = "-Both -Unformated -NOCLASHOUT -NOVDWOUT \"BASE\" \"BASE\"" probe_out = run_probe(pdb_hierarchy=pdb_hierarchy, flags=probe_flags) hbond_hash={} pair_hash={} reduced_pair_hash={} probe_iter...
}""" % (bases[0][0], segid_extra, bases[0][1:5], bases[1][0], segid_extra, bases[1][1:5], pair_type))
}""" % (chains[0], segid_extra, bases[0][2:6], chains[1], segid_extra, bases[1][2:6], pair_type))
def get_phil_base_pairs (pdb_hierarchy, probe_flags=None, prefix=None, log=sys.stderr, add_segid=None) : print >> log, " Running PROBE to identify base pairs" base_pair_list = get_base_pairs(pdb_hierarchy, probe_flags) if len(base_pair_list) == 0 : return None phil_strings = [] segid_extra = "" if add_segid is not Non...
opt4 = " ordered_solvent.mode=every_macro_cycle --quiet "
opt4 = " ordered_solvent.mode=every_macro_cycle main.nqh_flips=False --quiet "
def exercise_1(pdb_file): pdb = libtbx.env.find_in_repositories( relative_path="phenix_regression/pdb/"+pdb_file, test=os.path.isfile) hkl = libtbx.env.find_in_repositories( relative_path="phenix_regression/reflection_files/lysozyme.pdb_fcalc_fft_wk1995_resolution_1.8.cv", \ test=os.path.isfile) print pdb,hkl new_pdb =...
if su < 2:
if round(su,1) < 2:
def format_float_with_standard_uncertainty(value, standard_uncertainty): precision = -int(round(math.log10(standard_uncertainty))) if precision > -1: su = standard_uncertainty * math.pow(10, precision) if su < 2: su *= 10 precision += 1 fmt_str = "%%.%if(%%i)" %precision return fmt_str %(value, su) else: precision += 1...
return fmt_str %(value, su)
return fmt_str %(value, round(su))
def format_float_with_standard_uncertainty(value, standard_uncertainty): precision = -int(round(math.log10(standard_uncertainty))) if precision > -1: su = standard_uncertainty * math.pow(10, precision) if su < 2: su *= 10 precision += 1 fmt_str = "%%.%if(%%i)" %precision return fmt_str %(value, su) else: precision += 1...
else: sites_cart_start = sites_cart
else: sites_cart_start = sites_cart site_labels = None
def run_coordinate_refinement( geometry_restraints_manager, selection_variable, density_map, real_space_gradients_delta, work_params, pdb_atoms=None, sites_cart=None, home_restraints_list=[], work_scatterers=None, unit_cell=None, d_min=None, write_pdb_callback=None, log=None): assert [pdb_atoms, sites_cart].count(None)...
if(log is not None): print >> log, "Before coordinate refinement:" grmp.energies_sites(sites_cart=sites_cart_start).show(f=log) print >> log log.flush()
print >> log, "Before coordinate refinement:" grmp.energies_sites(sites_cart=sites_cart_start).show(f=log) print >> log log.flush()
def run_coordinate_refinement( geometry_restraints_manager, selection_variable, density_map, real_space_gradients_delta, work_params, pdb_atoms=None, sites_cart=None, home_restraints_list=[], work_scatterers=None, unit_cell=None, d_min=None, write_pdb_callback=None, log=None): assert [pdb_atoms, sites_cart].count(None)...
if(log is not None): print >> log, "After coordinate refinement" \ " with real-space target weight %.1f:" % rstw grmp.energies_sites(sites_cart=refined.sites_cart).show(f=log)
print >> log, "After coordinate refinement" \ " with real-space target weight %.1f:" % rstw grmp.energies_sites(sites_cart=refined.sites_cart).show(f=log)
def run_coordinate_refinement( geometry_restraints_manager, selection_variable, density_map, real_space_gradients_delta, work_params, pdb_atoms=None, sites_cart=None, home_restraints_list=[], work_scatterers=None, unit_cell=None, d_min=None, write_pdb_callback=None, log=None): assert [pdb_atoms, sites_cart].count(None)...
if(log is not None): bond_proxies.show_sorted( by_value="residual", sites_cart=refined.sites_cart, site_labels=site_labels, f=log, prefix=" ", max_items=3) print >> log print >> log, " number_of_function_evaluations:", \ refined.number_of_function_evaluations print >> log, " real+geo target start: %.6g" % refined.f_...
bond_proxies.show_sorted( by_value="residual", sites_cart=refined.sites_cart, site_labels=site_labels, f=log, prefix=" ", max_items=3) print >> log print >> log, " number_of_function_evaluations:", \ refined.number_of_function_evaluations print >> log, " real+geo target start: %.6g" % refined.f_start print >> log, "...
def run_coordinate_refinement( geometry_restraints_manager, selection_variable, density_map, real_space_gradients_delta, work_params, pdb_atoms=None, sites_cart=None, home_restraints_list=[], work_scatterers=None, unit_cell=None, d_min=None, write_pdb_callback=None, log=None): assert [pdb_atoms, sites_cart].count(None)...
if(log is not None): print >> log, " Bond RMSD: %.3f" % bond_rmsd
print >> log, " Bond RMSD: %.3f" % bond_rmsd
def run_coordinate_refinement( geometry_restraints_manager, selection_variable, density_map, real_space_gradients_delta, work_params, pdb_atoms=None, sites_cart=None, home_restraints_list=[], work_scatterers=None, unit_cell=None, d_min=None, write_pdb_callback=None, log=None): assert [pdb_atoms, sites_cart].count(None)...
if(log is not None): print >> log
print >> log
def run_coordinate_refinement( geometry_restraints_manager, selection_variable, density_map, real_space_gradients_delta, work_params, pdb_atoms=None, sites_cart=None, home_restraints_list=[], work_scatterers=None, unit_cell=None, d_min=None, write_pdb_callback=None, log=None): assert [pdb_atoms, sites_cart].count(None)...
if(log is not None): print >> log, "Table of real-space target weights vs. bond RMSD:" print >> log, " weight RMSD" for w,d in zip(rstw_list, bond_rmsd_list): print >> log, " %6.1f %5.3f" % (w,d) print >> log, "Best real-space target weight: %.1f" % best_info.rstw print >> log, \ "Associated refined final value: %...
print >> log, "Table of real-space target weights vs. bond RMSD:" print >> log, " weight RMSD" for w,d in zip(rstw_list, bond_rmsd_list): print >> log, " %6.1f %5.3f" % (w,d) print >> log, "Best real-space target weight: %.1f" % best_info.rstw print >> log, \ "Associated refined final value: %.6g" % best_info.refi...
def run_coordinate_refinement( geometry_restraints_manager, selection_variable, density_map, real_space_gradients_delta, work_params, pdb_atoms=None, sites_cart=None, home_restraints_list=[], work_scatterers=None, unit_cell=None, d_min=None, write_pdb_callback=None, log=None): assert [pdb_atoms, sites_cart].count(None)...
else: sites_cart = refined.sites_cart
def run_coordinate_refinement( geometry_restraints_manager, selection_variable, density_map, real_space_gradients_delta, work_params, pdb_atoms=None, sites_cart=None, home_restraints_list=[], work_scatterers=None, unit_cell=None, d_min=None, write_pdb_callback=None, log=None): assert [pdb_atoms, sites_cart].count(None)...
if(log is not None): print >> log, "As previously obtained with target weight %.1f:" \ % best_info.rstw grmp.energies_sites(sites_cart=refined.sites_cart).show( f=log, prefix=" ") print >> log, "Finishing refinement to idealize geometry:" print >> log, " number of function" print >> log, " weight eva...
print >> log, "As previously obtained with target weight %.1f:" \ % best_info.rstw grmp.energies_sites(sites_cart=refined.sites_cart).show( f=log, prefix=" ") print >> log, "Finishing refinement to idealize geometry:" print >> log, " number of function" print >> log, " weight evaluations cycle R...
def run_coordinate_refinement( geometry_restraints_manager, selection_variable, density_map, real_space_gradients_delta, work_params, pdb_atoms=None, sites_cart=None, home_restraints_list=[], work_scatterers=None, unit_cell=None, d_min=None, write_pdb_callback=None, log=None): assert [pdb_atoms, sites_cart].count(None)...
if(log is not None): print >> log, " %6.1f %10d %6.3f" % (
print >> log, " %6.1f %10d %6.3f" % (
def run_coordinate_refinement( geometry_restraints_manager, selection_variable, density_map, real_space_gradients_delta, work_params, pdb_atoms=None, sites_cart=None, home_restraints_list=[], work_scatterers=None, unit_cell=None, d_min=None, write_pdb_callback=None, log=None): assert [pdb_atoms, sites_cart].count(None)...
if(log is not None): print >> log, "After %d refinements to idealize geometry:" % ( number_of_fgm_cycles) grmp.energies_sites(sites_cart=fgm_refined.sites_cart).show( f=log, prefix=" ")
print >> log, "After %d refinements to idealize geometry:" % ( number_of_fgm_cycles) grmp.energies_sites(sites_cart=fgm_refined.sites_cart).show( f=log, prefix=" ")
def run_coordinate_refinement( geometry_restraints_manager, selection_variable, density_map, real_space_gradients_delta, work_params, pdb_atoms=None, sites_cart=None, home_restraints_list=[], work_scatterers=None, unit_cell=None, d_min=None, write_pdb_callback=None, log=None): assert [pdb_atoms, sites_cart].count(None)...
if(log is not None): print >> log, " Associated region correlation: %.4f" % fgm_region_cc if(log is not None): print >> log
print >> log, " Associated region correlation: %.4f" % fgm_region_cc print >> log
def run_coordinate_refinement( geometry_restraints_manager, selection_variable, density_map, real_space_gradients_delta, work_params, pdb_atoms=None, sites_cart=None, home_restraints_list=[], work_scatterers=None, unit_cell=None, d_min=None, write_pdb_callback=None, log=None): assert [pdb_atoms, sites_cart].count(None)...
else: best_info.sites_cart = fgm_refined.sites_cart
best_info.sites_cart = fgm_refined.sites_cart
def run_coordinate_refinement( geometry_restraints_manager, selection_variable, density_map, real_space_gradients_delta, work_params, pdb_atoms=None, sites_cart=None, home_restraints_list=[], work_scatterers=None, unit_cell=None, d_min=None, write_pdb_callback=None, log=None): assert [pdb_atoms, sites_cart].count(None)...
assert (len(non_compliant) == 0)
def try_as_seq (self) : from iotbx.bioinformatics import any_sequence_format try : objects, non_compliant = any_sequence_format(self.file_name) except Exception, e : print e raise assert (objects is not None) #assert (len(non_compliant) == 0) self.file_object = objects
isel = selection_cache.iselection selection_i_seqs = list( isel("(name ' CA ' or name ' P ') and (altloc 'A' or altloc ' ')")) last_atom = None bonds = shared.stl_set_unsigned(pdb_hierarchy.atoms().size()) for atom in pdb_hierarchy.atoms_with_labels() : if atom.i_seq in selection_i_seqs : if last_atom is not None : if...
vertices = selection_cache.selection( "(name ' CA ' or name ' P ') and (altloc 'A' or altloc ' ')") last_i_seq = None last_labels = None atoms = pdb_hierarchy.atoms() bonds = shared.stl_set_unsigned(atoms.size()) for i_seq, atom in enumerate(atoms) : labels = atom.fetch_labels() if vertices[i_seq] : if last_i_seq is n...
def extract_trace (pdb_hierarchy, selection_cache=None) : if selection_cache is None : selection_cache = pdb_hierarchy.atom_selection_cache() last_atom = None isel = selection_cache.iselection selection_i_seqs = list( isel("(name ' CA ' or name ' P ') and (altloc 'A' or altloc ' ')")) last_atom = None bonds = shar...
check_nl = [2.3370760050376607e-05, 0.0, 1.1145167882067956e-05, 1.1552795255443502e-05, 0.0, 0.0, 7.2474025554586763e-06, 2.3917327527551719e-05, 4.2203807328102694e-05]
check_nl = [2.3370760050376607e-05, 2.1910087547227873e-07, 1.1145167882067956e-05, 1.1552795255443502e-05, 1.8332528001413832e-07, 2.7291537694166531e-07, 7.2474025554586763e-06, 2.3917327527551719e-05, 4.2203807328102694e-05]
def tst_moments(nmax,np): grid_obj = tst_grid(nmax,np) mom_obj = math.zernike_moments(grid_obj, nmax) moments = mom_obj.moments() Fnl= mom_obj.fnl() Fnn= mom_obj.fnn() Fnnl= mom_obj.fnnl() eps = 1e-8 check_nl = [2.3370760050376607e-05, 0.0, 1.1145167882067956e-05, 1.1552795255443502e-05, 0.0, 0.0, 7.2474025554586763e...
__slots__ = ["options", "dynamic_parameters"]
__slots__ = ["options", "dynamic_parameters", "n_calls"]
def write_only_if_safe(file_name, text): from libtbx.str_utils import show_string import os op = os.path if (op.exists(file_name)): if (not op.isfile(file_name)): raise RuntimeError( "Not a regular file: %s" % show_string(file_name)) stat = check_fingerprint(file_name=file_name) if (stat is None or not stat): raise Run...
if (len(file_names) != 0):
if (len(file_names) != 0 and opts.compile):
def __call__(O, file_names): import sys opts = O.options lines = fable.cout.process( file_names=file_names, top_unit_name=opts.top_unit_name, dynamic_parameters=O.dynamic_parameters, fem_do_safe=not opts.no_fem_do_safe, arr_nd_size_max=opts.arr_nd_size_max, inline_all=opts.inline_all, common_equivalence_simple=set(opts...
if (len(file_names) != 0 and opts.compile):
def __call__(O, file_names): import sys opts = O.options lines = fable.cout.process( file_names=file_names, top_unit_name=opts.top_unit_name, dynamic_parameters=O.dynamic_parameters, fem_do_safe=not opts.no_fem_do_safe, arr_nd_size_max=opts.arr_nd_size_max, inline_all=opts.inline_all, common_equivalence_simple=set(opts...
print
def __call__(O, file_names): import sys opts = O.options lines = fable.cout.process( file_names=file_names, top_unit_name=opts.top_unit_name, dynamic_parameters=O.dynamic_parameters, fem_do_safe=not opts.no_fem_do_safe, arr_nd_size_max=opts.arr_nd_size_max, inline_all=opts.inline_all, common_equivalence_simple=set(opts...
self.clash_guard()
if not self.for_dihedral_reference: self.clash_guard()
def note_geo(): print >> self.log, """\
elif ((params.output.file_name is not None) and (os.path.isdir(params.output.file_name))) :
elif ((params.modify.output.file_name is not None) and (os.path.isdir(params.modify.output.file_name))) :
def validate_params (params, callback=None) : if (len(params.input.pdb.file_name) == 0) : raise Sorry("No PDB file(s) specified.") elif ((params.output.file_name is not None) and (os.path.isdir(params.output.file_name))) : raise Sorry("The specified output file is a currently existing directory.") return True
procedure_preferences.distl_aggressive["force_outer_resolution"] = 3.6 procedure_preferences.distl_highres_limit = 3.6
if outer_resolution != None: procedure_preferences.distl_aggressive["force_outer_resolution"] = outer_resolution procedure_preferences.distl_highres_limit = outer_resolution
def common_parameters(outer_resolution): from labelit.preferences import procedure_preferences procedure_preferences.distl_aggressive["force_outer_resolution"] = 3.6 procedure_preferences.distl_highres_limit = 3.6 procedure_preferences.phil.distl_force_binning = False procedure_preferences.phil.distl_permit_binning = ...
do_main(filepath, force_binning, host, port)
do_main(filepath, host, port)
def do_main(filepath, host, port): absfile = os.path.abspath(filepath) get_spotfinder_url(absfile,host,port)
miller_array=new_r_free_array,
miller_array=output_array,
def __init__ (self, params, input_files=None, log=sys.stderr, accumulation_callback=None, symmetry_callback=None) : adopt_init_args(self, locals()) if len(params.mtz_file.miller_array) == 0 : raise Sorry("No Miller arrays have been selected for the output file.") elif len(params.mtz_file.miller_array) > 25 : raise Sorr...
def __init__(self, xray_structure, name='??', **kwds):
distance_cutoff = None bonding="covalent" def __init__(self, xray_structure, name='??', **kwds):
def __init__(self, xray_structure_viewer): qttbx.widget_control_mixin.__init__(self, xray_structure_viewer, None, Qt.Tool) self.move(0,50) self.view.set_labels_type(self.labels.currentText()) self.labels.currentIndexChanged[str].connect(self.view.set_labels_type) self.labelFontSize.setValue(self.view.label_font.pointSi...
sites = self.sites_cart = xs.sites_cart()
sites_cart = self.sites_cart = xs.sites_cart()
def __init__(self, xray_structure, name='??', **kwds): self.xray_structure = xs = xray_structure super(xray_structure_viewer, self).__init__( unit_cell=xray_structure.unit_cell(), orthographic=True, light_position=(-1, 1, 1, 0), **kwds) self.setWindowTitle("%s in %s" % (name, xs.space_group().type().hall_symbol())) sit...
sites,
sites_cart,
def __init__(self, xray_structure, name='??', **kwds): self.xray_structure = xs = xray_structure super(xray_structure_viewer, self).__init__( unit_cell=xray_structure.unit_cell(), orthographic=True, light_position=(-1, 1, 1, 0), **kwds) self.setWindowTitle("%s in %s" % (name, xs.space_group().type().hall_symbol())) sit...
self.label_font = QtGui.QFont("Princetown LET", pointSize=22) radii = [ covalent_radii.table(elt).radius() for elt in xs.scattering_type_registry().type_index_pairs_as_dict() ] buffer_thickness = max(radii) + self.covalent_bond_tolerance asu_mappings = xs.asu_mappings(buffer_thickness=buffer_thickness) bond_table = cr...
self.label_font = QtGui.QFont("Arial Black", pointSize=18) if self.bonding == "covalent": radii = [ covalent_radii.table(elt).radius() for elt in xs.scattering_type_registry().type_index_pairs_as_dict() ] buffer_thickness = 2*max(radii) + self.covalent_bond_tolerance asu_mappings = xs.asu_mappings(buffer_thickness=buf...
def __init__(self, xray_structure, name='??', **kwds): self.xray_structure = xs = xray_structure super(xray_structure_viewer, self).__init__( unit_cell=xray_structure.unit_cell(), orthographic=True, light_position=(-1, 1, 1, 0), **kwds) self.setWindowTitle("%s in %s" % (name, xs.space_group().type().hall_symbol())) sit...
x0 = self.sites_cart[i]
x0 = sites_cart[i]
def __init__(self, xray_structure, name='??', **kwds): self.xray_structure = xs = xray_structure super(xray_structure_viewer, self).__init__( unit_cell=xray_structure.unit_cell(), orthographic=True, light_position=(-1, 1, 1, 0), **kwds) self.setWindowTitle("%s in %s" % (name, xs.space_group().type().hall_symbol())) sit...
x1 = self.sites_cart[j]
x1 = sites_cart[j]
def __init__(self, xray_structure, name='??', **kwds): self.xray_structure = xs = xray_structure super(xray_structure_viewer, self).__init__( unit_cell=xray_structure.unit_cell(), orthographic=True, light_position=(-1, 1, 1, 0), **kwds) self.setWindowTitle("%s in %s" % (name, xs.space_group().type().hall_symbol())) sit...
name = sys.argv[1]
name = os.path.expanduser(sys.argv[1])
def set_font_size(self, s): self.label_font.setPointSize(s) self.updateGL()
"$D/refinement/tst_reference_model.py",
def run(): tst_list = ( "$D/tst_map_type_parser.py", "$D/tst_fmodel_cmdlinetool.py", "$D/rsr/tst.py", "$D/polygon/tst.py", "$D/polygon/tst_gui.py", "$D/chemical_components/tst.py", "$D/regression/tst_add_h_to_water.py", "$D/rotamer/rotamer_eval.py", "$D/wwpdb/tst_standard_geometry_cif.py", "$D/tst_pdbtools.py", "$D/rea...
if isinstance(file_name, list) :
if (file_name is None) : return [] elif isinstance(file_name, list) :
def get_param_files (self, file_param_name) : file_name = self._param_files.get(file_param_name) if isinstance(file_name, list) : return file_name else : return [ file_name ]
if sys.argv[1:]: n_runs = int(sys.argv[1]) refinement_test.ls_cycle_repeats = n_runs else: n_runs = 1
from libtbx.option_parser import option_parser command_line = (option_parser() .option(None, "--fix_random_seeds", action="store_true", default=False) .option(None, "--runs", type='int', default=1) ).process(args=sys.argv[1:]) if command_line.options.fix_random_seeds: flex.set_random_seed(1) random.seed(2) n_runs = com...
def run(): libtbx.utils.show_times_at_exit() import sys if sys.argv[1:]: n_runs = int(sys.argv[1]) refinement_test.ls_cycle_repeats = n_runs else: n_runs = 1 special_positions_test(n_runs).run() exercise_normal_equations()
exercise_normal_equations()
def run(): libtbx.utils.show_times_at_exit() import sys if sys.argv[1:]: n_runs = int(sys.argv[1]) refinement_test.ls_cycle_repeats = n_runs else: n_runs = 1 special_positions_test(n_runs).run() exercise_normal_equations()
scale_factor = f_obs.scale_factor( f_model, weights=1/flex.pow2(f_obs.sigmas()))
if f_obs.sigmas() is not None: weights = weights=1/flex.pow2(f_obs.sigmas()) else: weights = None scale_factor = f_obs.scale_factor(f_model, weights=weights)
def modified_structure_factors(self): """Subtracts the solvent contribution from the observed structure factors to obtain modified structure factors, suitable for refinement with other refinement programs such as ShelXL""" assert self._f_mask is not None f_obs = self.observations.as_amplitude_array() f_mask = self.f_ma...
self.buffer_thickness = max(radii) + self.covalent_bond_tolerance
self.buffer_thickness = 2*max(radii) + self.covalent_bond_tolerance
def __init__(self, structure, geometrical_constraints, **kwds): """ Construct for the given instance of xray.structure subject to the given sequence of constraints. Each constraint instance shall understand: constraint.add_to(self). That method shall perform 2 tasks:
assert not absd(get("add_strings.f"), tail_off(10), """\
assert not absd(get("add_strings.f"), tail_off(17), """\
def get( file_name, top_procedures=None, data_specializations=True, arr_nd_size_max=None, inline_all=False): if (verbose): print "exercise_simple:", file_name file_names = [op.join(t_dir, file_name)] common_report_stringio = StringIO() return cout.process( file_names=file_names, top_procedures=top_procedures, data_spec...