def __init__(self, model, params, log): """ model is changed in place params - those in master_phil_str without scope name """ self.model = model self.params = params self.log = log self.outliers = None self.cablam_contours = fetch_peptide_expectations() self.ca_contours = fetch_ca_expectations() self.motif_contours = fetch_motif_contours() self.n_tried_residues = 0 self.n_rotated_residues = 0 self.cablam_fixed_minimized = None if not self.params.enabled: return self.model.process_input_model(make_restraints=True) print("CaBLAM idealization", file=self.log) if self.model.get_hierarchy().models_size() > 1: raise Sorry("Multi-model files are not supported") self.model.search_for_ncs() print(self.model.get_ncs_obj().show_phil_format(), file=self.log) self.outliers_by_chain = self.identify_outliers() # idealization # TODO: verify if outliers by chain is dict for chain, outliers in six.iteritems(self.outliers_by_chain): b_selection = self.model.selection("chain %s" % chain) self.atoms_around = self.model.get_xray_structure( ).selection_within(7, b_selection).iselection() for outlier in outliers: self.fix_cablam_outlier(chain, outlier) if self.params.find_ss_after_fixes: ss_manager = ss_manager_class( pdb_hierarchy=self.model.get_hierarchy(), geometry_restraints_manager=self.model.get_restraints_manager( ).geometry, sec_str_from_pdb_file=None, params=None, mon_lib_srv=self.model.get_mon_lib_srv, verbose=-1, log=self.log) self.model.get_restraints_manager( ).geometry.set_secondary_structure_restraints( ss_manager=ss_manager, hierarchy=self.model.get_hierarchy(), log=self.log) self.model.set_ss_annotation(ann=ss_manager.actual_sec_str) if params.do_gm: self.cablam_fixed_minimized = self._minimize()
def __init__(self, model, params, log): """ model is changed in place params - those in master_phil_str without scope name """ self.model = model self.params = params self.log = log self.outliers = None self.cablam_contours = fetch_peptide_expectations() self.ca_contours = fetch_ca_expectations() self.motif_contours = fetch_motif_contours() self.n_tried_residues = 0 self.n_rotated_residues = 0 # with open("in.pdb",'w') as f: # f.write(self.model.model_as_pdb()) if self.model.get_hierarchy().models_size() > 1: raise Sorry("Multi-model files are not supported") self.outliers_by_chain = self.identify_outliers() # idealization for chain, outliers in self.outliers_by_chain.iteritems(): for outlier in outliers: self.fix_cablam_outlier(chain, outlier) if self.params.find_ss_after_fixes: ss_manager = ss_manager_class( pdb_hierarchy=self.model.get_hierarchy(), geometry_restraints_manager=self.model.get_restraints_manager().geometry, sec_str_from_pdb_file=None, params=None, mon_lib_srv=self.model.get_mon_lib_srv, verbose=-1, log=self.log) self.model.get_restraints_manager().geometry.set_secondary_structure_restraints( ss_manager=ss_manager, hierarchy=self.model.get_hierarchy(), log=self.log) self.model.set_ss_annotation(ann=ss_manager.actual_sec_str) self.cablam_fixed_minimized = None if params.do_gm: self.cablam_fixed_minimized = self._minimize()