diff --git a/actions/ost-compare-structures b/actions/ost-compare-structures index b12ceedf5119c524504dd9f11d2b6c851dbf9e2d..405e8e20884c79b95999637b63494b27185450d5 100644 --- a/actions/ost-compare-structures +++ b/actions/ost-compare-structures @@ -740,12 +740,9 @@ def _Main(): "single_chain_lddt": list() } lddt_settings = lDDTSettings( - bond_tolerance=opts.bond_tolerance, - angle_tolerance=opts.angle_tolerance, radius=opts.inclusion_radius, sequence_separation=opts.sequence_separation, sel="", - structural_checks=False, # These are performed elsewhere consistency_checks=False, # These are performed elsewhere label="lddt") ost.LogInfo("lDDT settings: ") @@ -760,7 +757,8 @@ def _Main(): lddt_scorer.references[0].chains[0].GetName() if skip_score: ost.LogInfo( - " --> Skipping single chain lDDT because consistency check failed") + " --> Skipping single chain lDDT because " + "consistency check failed") lddt_results["single_chain_lddt"].append({ "status": "FAILURE", "error": "Consistency check failed.", @@ -824,7 +822,8 @@ def _Main(): # perform oligo lddt scoring if skip_score: ost.LogInfo( - " --> Skipping oligomeric lDDT because consistency check failed") + " --> Skipping oligomeric lDDT because consistency " + "check failed") lddt_results["oligo_lddt"] = { "status": "FAILURE", "error": "Consistency check failed.", @@ -847,7 +846,8 @@ def _Main(): "global_score": 0.0} if skip_score: ost.LogInfo( - " --> Skipping weighted lDDT because consistency check failed") + " --> Skipping weighted lDDT because consistency " + "check failed") lddt_results["weighted_lddt"] = { "status": "FAILURE", "error": "Consistency check failed.", diff --git a/modules/mol/alg/pymod/wrap_mol_alg.cc b/modules/mol/alg/pymod/wrap_mol_alg.cc index 419dc042795b6d71ae27e7cc7591f1b6cd3e00a5..449a03543346667596b9a4d56b897b5714d10a4f 100644 --- a/modules/mol/alg/pymod/wrap_mol_alg.cc +++ b/modules/mol/alg/pymod/wrap_mol_alg.cc @@ -123,18 +123,6 @@ object lDDTSettingsInitWrapper(tuple args, dict kwargs){ object self = args[0]; args = tuple(args.slice(1,_)); - Real bond_tolerance = 12.0; - if(kwargs.contains("bond_tolerance")){ - bond_tolerance = extract<Real>(kwargs["bond_tolerance"]); - kwargs["bond_tolerance"].del(); - } - - Real angle_tolerance = 12.0; - if(kwargs.contains("angle_tolerance")){ - angle_tolerance = extract<Real>(kwargs["angle_tolerance"]); - kwargs["angle_tolerance"].del(); - } - Real radius = 15.0; if(kwargs.contains("radius")){ radius = extract<Real>(kwargs["radius"]); @@ -153,12 +141,6 @@ object lDDTSettingsInitWrapper(tuple args, dict kwargs){ kwargs["sel"].del(); } - bool structural_checks = true; - if(kwargs.contains("structural_checks")){ - structural_checks = extract<bool>(kwargs["structural_checks"]); - kwargs["structural_checks"].del(); - } - bool consistency_checks = true; if(kwargs.contains("consistency_checks")){ consistency_checks = extract<bool>(kwargs["consistency_checks"]); @@ -190,18 +172,15 @@ object lDDTSettingsInitWrapper(tuple args, dict kwargs){ std::stringstream ss; ss << "Invalid keywords observed when setting up lDDTSettings! "; ss << "Or did you pass the same keyword twice? "; - ss << "Valid keywords are: bond_tolerance, angle_tolerance, radius, "; - ss << "sequence_separation, sel, parameter_file_path, structural_checks, "; + ss << "Valid keywords are: radius, "; + ss << "sequence_separation, sel, parameter_file_path, "; ss << "consistency_checks, cutoffs, label!"; throw std::invalid_argument(ss.str()); } - return self.attr("__init__")(bond_tolerance, - angle_tolerance, - radius, + return self.attr("__init__")(radius, sequence_separation, sel, - structural_checks, consistency_checks, cutoffs, label); @@ -405,17 +384,14 @@ BOOST_PYTHON_MODULE(_ost_mol_alg) class_<mol::alg::lDDTSettings>("lDDTSettings", no_init) .def("__init__", raw_function(lDDTSettingsInitWrapper)) - .def(init<Real, Real, Real, int, String, bool, bool, std::vector<Real>&, String>()) + .def(init<Real, int, String, bool, std::vector<Real>&, String>()) .def("ToString", &mol::alg::lDDTSettings::ToString) .def("PrintParameters", &mol::alg::lDDTSettings::PrintParameters) .def("__repr__", &mol::alg::lDDTSettings::ToString) .def("__str__", &mol::alg::lDDTSettings::ToString) - .def_readwrite("bond_tolerance", &mol::alg::lDDTSettings::bond_tolerance) - .def_readwrite("angle_tolerance", &mol::alg::lDDTSettings::angle_tolerance) .def_readwrite("radius", &mol::alg::lDDTSettings::radius) .def_readwrite("sequence_separation", &mol::alg::lDDTSettings::sequence_separation) .def_readwrite("sel", &mol::alg::lDDTSettings::sel) - .def_readwrite("structural_checks", &mol::alg::lDDTSettings::structural_checks) .def_readwrite("consistency_checks", &mol::alg::lDDTSettings::consistency_checks) .def_readwrite("cutoffs", &mol::alg::lDDTSettings::cutoffs) .def_readwrite("label", &mol::alg::lDDTSettings::label); diff --git a/modules/mol/alg/src/lddt.cc b/modules/mol/alg/src/lddt.cc index 19c24c01882d5bcb9fc3fcea09d779fbd81a16c1..6fb9210937300fab2b80282318aeaf2d372cc173 100644 --- a/modules/mol/alg/src/lddt.cc +++ b/modules/mol/alg/src/lddt.cc @@ -158,7 +158,9 @@ int main (int argc, char **argv) String version = OST_VERSION_STRING; lDDTSettings settings; String parameter_file_path; - settings.structural_checks=false; + bool structural_checks = false; + Real bond_tolerance = 12.0; + Real angle_tolerance = 12.0; // creates the required loading profile IOProfile profile; // parses options @@ -215,7 +217,7 @@ int main (int argc, char **argv) profile.calpha_only=true; } if (vm.count("structural-checks")) { - settings.structural_checks=true; + structural_checks=true; } if (vm.count("ignore-consistency-checks")) { settings.consistency_checks=false; @@ -226,7 +228,7 @@ int main (int argc, char **argv) if (vm.count("parameter-file")) { parameter_file_path=vm["parameter-file"].as<String>(); - } else if (settings.structural_checks==true) { + } else if (structural_checks==true) { std::cout << "Please specify a stereo-chemical parameter file" << std::endl; exit(-1); } @@ -249,10 +251,10 @@ int main (int argc, char **argv) Logger::Instance().PushVerbosityLevel(ost_verbosity_level); if (vm.count("bond_tolerance")) { - settings.bond_tolerance=vm["bond_tolerance"].as<Real>(); + bond_tolerance=vm["bond_tolerance"].as<Real>(); } if (vm.count("angle_tolerance")) { - settings.angle_tolerance=vm["angle_tolerance"].as<Real>(); + angle_tolerance=vm["angle_tolerance"].as<Real>(); } if (vm.count("inclusion_radius")) { settings.radius=vm["inclusion_radius"].as<Real>(); @@ -305,7 +307,7 @@ int main (int argc, char **argv) // prints out parameters used in the lddt calculation std::cout << "Verbosity level: " << verbosity_level << std::endl; settings.PrintParameters(); - if (settings.structural_checks) { + if (structural_checks) { LOG_INFO("Log entries format:"); LOG_INFO("BOND INFO FORMAT: Chain Residue ResNum Bond Min Max Observed Z-score Status"); LOG_INFO("ANGLE INFO FORMAT: Chain Residue ResNum Angle Min Max Observed Z-score Status"); @@ -334,7 +336,7 @@ int main (int argc, char **argv) String filestring=BFPathToString(pathstring); std::cout << "File: " << files[i] << std::endl; - if (settings.structural_checks) { + if (structural_checks) { StereoChemicalProps stereochemical_params; try { stereochemical_params = ost::io::ReadStereoChemicalPropsFile(parameter_file_path, true); @@ -348,8 +350,8 @@ int main (int argc, char **argv) stereochemical_params.bond_table, stereochemical_params.angle_table, stereochemical_params.nonbonded_table, - settings.bond_tolerance, - settings.angle_tolerance); + bond_tolerance, + angle_tolerance); } catch (std::exception& e) { std::cout << e.what() << std::endl; exit(-1); @@ -362,8 +364,8 @@ int main (int argc, char **argv) // prints the residue-by-residue statistics std::vector<lDDTLocalScore> local_scores; EntityView outview = model.GetChainList()[0].Select("peptide=true"); - local_scores = GetlDDTPerResidueStats(outview, glob_dist_list, settings.structural_checks, settings.label); - PrintlDDTPerResidueStats(local_scores, settings.structural_checks, settings.cutoffs.size()); + local_scores = GetlDDTPerResidueStats(outview, glob_dist_list, structural_checks, settings.label); + PrintlDDTPerResidueStats(local_scores, structural_checks, settings.cutoffs.size()); } return 0; } diff --git a/modules/mol/alg/src/local_dist_diff_test.cc b/modules/mol/alg/src/local_dist_diff_test.cc index 4e4545f4579232d29f4b227c5cda38294f10ded9..597e84c857c2b55a105de2b306c792a6eff2681e 100644 --- a/modules/mol/alg/src/local_dist_diff_test.cc +++ b/modules/mol/alg/src/local_dist_diff_test.cc @@ -403,12 +403,9 @@ StereoChemicalProps::StereoChemicalProps( nonbonded_table(init_nonbonded_table), is_valid(true) {} -lDDTSettings::lDDTSettings(): bond_tolerance(12.0), - angle_tolerance(12.0), - radius(15.0), +lDDTSettings::lDDTSettings(): radius(15.0), sequence_separation(0), sel(""), - structural_checks(true), consistency_checks(true), label("localldt") { cutoffs.push_back(0.5); @@ -417,41 +414,24 @@ lDDTSettings::lDDTSettings(): bond_tolerance(12.0), cutoffs.push_back(4.0); } -lDDTSettings::lDDTSettings(Real init_bond_tolerance, - Real init_angle_tolerance, - Real init_radius, +lDDTSettings::lDDTSettings(Real init_radius, int init_sequence_separation, String init_sel, - bool init_structural_checks, bool init_consistency_checks, std::vector<Real>& init_cutoffs, - String init_label): - bond_tolerance(init_bond_tolerance), - angle_tolerance(init_angle_tolerance), + String init_label): radius(init_radius), sequence_separation(init_sequence_separation), sel(init_sel), - structural_checks(init_structural_checks), consistency_checks(init_consistency_checks), cutoffs(init_cutoffs), label(init_label) {} std::string lDDTSettings::ToString() { std::ostringstream rep; - if (structural_checks) { - rep << "Stereo-chemical and steric clash checks: On \n"; - } else { - rep << "Stereo-chemical and steric clash checks: Off \n"; - } - rep << "Inclusion Radius: " << radius << "\n"; rep << "Sequence separation: " << sequence_separation << "\n"; rep << "Cutoffs: " << vector_to_string(cutoffs) << "\n"; - - if (structural_checks) { - rep << "Tolerance in stddevs for bonds: " << bond_tolerance << "\n"; - rep << "Tolerance in stddevs for angles: " << angle_tolerance << "\n"; - } rep << "Residue properties label: " << label << "\n"; return rep.str(); @@ -547,25 +527,6 @@ void lDDTScorer::_Init(){ _global_score = -1.0; CleanlDDTReferences(references_view); _PrepareGlobalRDMap(); - if (settings.structural_checks) { - if (!stereochemical_params.is_valid) { - throw std::runtime_error( - "Please provide stereochemical_params to enable structural_checks."); - } - try { - CheckStructure(model_view, - stereochemical_params.bond_table, - stereochemical_params.angle_table, - stereochemical_params.nonbonded_table, - settings.bond_tolerance, - settings.angle_tolerance); - } catch (std::exception& e) { - std::cout << e.what() << std::endl; - std::stringstream errstr; - errstr << "Structure check failed: " << e.what(); - throw std::runtime_error(errstr.str()); - } - } if (settings.consistency_checks) { _CheckConsistency(); } @@ -604,7 +565,7 @@ void lDDTScorer::PrintPerResidueStats(){ _GetLocallDDT(); } PrintlDDTPerResidueStats(_local_scores, - settings.structural_checks, + false, settings.cutoffs.size()); } @@ -684,7 +645,7 @@ void lDDTScorer::_GetLocallDDT(){ } _local_scores = GetlDDTPerResidueStats(model_view, glob_dist_list, - settings.structural_checks, + false, // do not print structural checks settings.label); _has_local_scores = true; } diff --git a/modules/mol/alg/src/local_dist_diff_test.hh b/modules/mol/alg/src/local_dist_diff_test.hh index c48627203fc247b56ed8526d634ddd8e6bc1ae49..5e3a8d4df33dff93ca765d7ca25eddb31df41e7d 100644 --- a/modules/mol/alg/src/local_dist_diff_test.hh +++ b/modules/mol/alg/src/local_dist_diff_test.hh @@ -41,23 +41,17 @@ struct StereoChemicalProps }; struct lDDTSettings { - Real bond_tolerance; - Real angle_tolerance; Real radius; int sequence_separation; String sel; - bool structural_checks; bool consistency_checks; std::vector<Real> cutoffs; String label; lDDTSettings(); - lDDTSettings(Real init_bond_tolerance, - Real init_angle_tolerance, - Real init_radius, + lDDTSettings(Real init_radius, int init_sequence_separation, String init_sel, - bool init_structural_checks, bool init_consistency_checks, std::vector<Real>& init_cutoffs, String init_label);