def __init__(self, processed_pdb_file, reference_hierarchy_list=None, reference_file_list=None, mon_lib_srv=None, ener_lib=None, has_hd=False, params=None, selection=None, log=None): assert [reference_hierarchy_list, reference_file_list].count(None) == 1 if (log is None): log = sys.stdout self.params = params self.selection = selection self.mon_lib_srv = mon_lib_srv self.ener_lib = ener_lib self.pdb_hierarchy = processed_pdb_file.all_chain_proxies.pdb_hierarchy self.pdb_hierarchy.reset_i_seq_if_necessary() sites_cart = self.pdb_hierarchy.atoms().extract_xyz() if self.selection is None: self.selection = flex.bool(len(sites_cart), True) if reference_hierarchy_list is None: reference_hierarchy_list = \ utils.process_reference_files( reference_file_list=reference_file_list, log=log) if reference_file_list is None: reference_file_list = \ ["ref%d" % x for x in range(len(reference_hierarchy_list))] # # this takes 20% of constructor time. self.dihedral_proxies_ref = utils.get_reference_dihedral_proxies( reference_hierarchy_list=reference_hierarchy_list, reference_file_list=reference_file_list, mon_lib_srv=self.mon_lib_srv, ener_lib=self.ener_lib, log=log) self.i_seq_name_hash = utils.build_name_hash( pdb_hierarchy=self.pdb_hierarchy) #reference model components self.sites_cart_ref = {} self.pdb_hierarchy_ref = {} self.i_seq_name_hash_ref = {} self.reference_dihedral_hash = {} self.reference_file_list = reference_file_list #triage reference model files for file, hierarchy in zip(reference_file_list, reference_hierarchy_list): self.sites_cart_ref[file] = hierarchy.atoms().extract_xyz() self.pdb_hierarchy_ref[file] = hierarchy self.i_seq_name_hash_ref[file] = \ utils.build_name_hash( pdb_hierarchy=hierarchy) self.reference_dihedral_hash[file] = \ self.build_dihedral_hash( dihedral_proxies=self.dihedral_proxies_ref[file], sites_cart=self.sites_cart_ref[file], pdb_hierarchy=hierarchy, include_hydrogens=self.params.hydrogens, include_main_chain=self.params.main_chain, include_side_chain=self.params.side_chain) self.match_map = None self.proxy_map = None self.build_reference_dihedral_proxy_hash() # # This takes 80% of constructor time!!! self.residue_match_hash = {} # {key_model: ('file_name', key_ref)} self.match_map = {} # {'file_name':{i_seq_model:i_seq_ref}} if params.use_starting_model_as_reference: self.get_matching_from_self() else: self.get_matching_from_ncs(log=log) if self.match_map == {}: # making empty container new_ref_dih_proxies = self.reference_dihedral_proxies = \ cctbx.geometry_restraints.shared_dihedral_proxy() else: new_ref_dih_proxies = self.get_reference_dihedral_proxies( processed_pdb_file=processed_pdb_file)
def __init__(self, processed_pdb_file, reference_hierarchy_list=None, reference_file_list=None, mon_lib_srv=None, ener_lib=None, has_hd=False, params=None, selection=None, log=None): assert [reference_hierarchy_list, reference_file_list].count(None) == 1 if(log is None): log = sys.stdout self.params = params self.selection = selection self.mon_lib_srv = mon_lib_srv self.ener_lib = ener_lib self.pdb_hierarchy = processed_pdb_file.all_chain_proxies.pdb_hierarchy self.pdb_hierarchy.reset_i_seq_if_necessary() sites_cart = self.pdb_hierarchy.atoms().extract_xyz() if self.selection is None: self.selection = flex.bool(len(sites_cart), True) if reference_hierarchy_list is None: reference_hierarchy_list = \ utils.process_reference_files( reference_file_list=reference_file_list, log=log) if reference_file_list is None: reference_file_list = \ ["ref%d" % x for x in range(len(reference_hierarchy_list))] # # this takes 20% of constructor time. self.dihedral_proxies_ref = utils.get_reference_dihedral_proxies( reference_hierarchy_list=reference_hierarchy_list, reference_file_list=reference_file_list, mon_lib_srv=self.mon_lib_srv, ener_lib=self.ener_lib, log=log) self.i_seq_name_hash = utils.build_name_hash( pdb_hierarchy=self.pdb_hierarchy) #reference model components self.sites_cart_ref = {} self.pdb_hierarchy_ref = {} self.i_seq_name_hash_ref = {} self.reference_dihedral_hash = {} self.reference_file_list = reference_file_list #triage reference model files for file, hierarchy in zip(reference_file_list, reference_hierarchy_list): self.sites_cart_ref[file] = hierarchy.atoms().extract_xyz() self.pdb_hierarchy_ref[file] = hierarchy self.i_seq_name_hash_ref[file] = \ utils.build_name_hash( pdb_hierarchy=hierarchy) self.reference_dihedral_hash[file] = \ self.build_dihedral_hash( dihedral_proxies=self.dihedral_proxies_ref[file], sites_cart=self.sites_cart_ref[file], pdb_hierarchy=hierarchy, include_hydrogens=self.params.hydrogens, include_main_chain=self.params.main_chain, include_side_chain=self.params.side_chain) self.match_map = None self.proxy_map = None self.build_reference_dihedral_proxy_hash() # # This takes 80% of constructor time!!! self.residue_match_hash = {} # {key_model: ('file_name', key_ref)} self.match_map = {} # {'file_name':{i_seq_model:i_seq_ref}} if params.use_starting_model_as_reference: self.get_matching_from_self() else: self.get_matching_from_ncs(log=log) if self.match_map == {}: # making empty container new_ref_dih_proxies = self.reference_dihedral_proxies = \ cctbx.geometry_restraints.shared_dihedral_proxy() else: new_ref_dih_proxies = self.get_reference_dihedral_proxies( processed_pdb_file=processed_pdb_file)