Skip to content
Snippets Groups Projects
Commit d987640e authored by Valerio Mariani's avatar Valerio Mariani
Browse files

Improvement to logging system

parent e47c5338
Branches
Tags
No related merge requests found
......@@ -22,11 +22,11 @@
#include <math.h>
#include "filter_clashes.hh"
#include <ost/units.hh>
#include <ost/conop/amino_acids.hh>
namespace {
String bond_string(const ost::mol::AtomView& atom1, const ost::mol::AtomHandle& atom2) {
String atom1_str = atom1.GetName();
String atom2_str = atom2.GetName();
......@@ -76,7 +76,11 @@ void ClashingDistances::SetClashingDistance(const String& ele1,const String& ele
std::pair<Real,Real> ClashingDistances::GetClashingDistance(const String& ele1,const String& ele2) const
{
std::stringstream stkey;
stkey << ele1 << "--" << ele2;
if (ele1<ele2) {
stkey << ele1 << "--" << ele2;
} else {
stkey << ele2 << "--" << ele1;
}
String key=stkey.str();
std::map <String,std::pair<float,float> >::const_iterator find_ci= min_distance_.find(key);
if (find_ci == min_distance_.end()) {
......@@ -150,7 +154,8 @@ EntityView CheckStereoChemistry(const EntityView& ent, const StereoChemicalParam
for (ResidueViewList::iterator i=residues.begin(), e=residues.end(); i!=e; ++i) {
bool remove_sc=false, remove_bb=false;
ResidueView res=*i;
if (ost::conop::ResidueNameToOneLetterCode(res.GetName())=='X') {
std::cout << res.GetOneLetterCode() << std::endl;
if (res.GetOneLetterCode()=='?') {
filtered.AddResidue(res, ViewAddFlag::INCLUDE_ATOMS);
continue;
}
......@@ -292,7 +297,7 @@ EntityView FilterClashes(const EntityView& ent, const ClashingDistances& min_dis
i=residues.begin(), e=residues.end(); i!=e; ++i) {
bool remove_sc=false, remove_bb=false;
ResidueView res=*i;
if (ost::conop::ResidueNameToOneLetterCode(res.GetName())=='X') {
if (res.GetOneLetterCode()=='?') {
filtered.AddResidue(res, ViewAddFlag::INCLUDE_ATOMS);
continue;
}
......@@ -309,8 +314,6 @@ EntityView FilterClashes(const EntityView& ent, const ClashingDistances& min_dis
k=within.begin(), e3=within.end(); k!=e3; ++k) {
AtomView atom2=*k;
if (atom2==atom) {
LOG_VERBOSE("CLASH:" << " " << atom.GetResidue().GetChain() << " " << atom.GetResidue().GetName() << " " << atom.GetResidue().GetNumber() << " " << atom.GetName() << " " << "None" << " " << "None" << " " << "None" << " " << "None" << " " << "None" << " " << "None " << " " << "0.0" << " " << "PASS")
continue;
}
String ele2=atom2.GetElement();
......
......@@ -31,6 +31,8 @@
#include <ost/platform.hh>
#include <ost/log.hh>
#include <ost/conop/rule_based_builder.hh>
#include <ost/dyn_cast.hh>
using namespace ost;
using namespace ost::io;
......@@ -42,12 +44,14 @@ namespace po=boost::program_options;
void FillStereoChemicalParams(const String& header, StereoChemicalParams& table, std::vector<String>& stereo_chemical_props_file)
{
bool found=false;
std::vector<String>::const_iterator line_iter=stereo_chemical_props_file.begin();
while (line_iter!=stereo_chemical_props_file.end()) {
if ((*line_iter).length()!=0) {
StringRef line_string_ref(line_iter->data(),(*line_iter).length());
std::vector<StringRef> line_str_vec = line_string_ref.split();
if (line_str_vec[0].str()==header) {
found=true;
line_iter++;
while ((*line_iter)[0]!='-') {
if ((*line_iter)[0]!='#') {
......@@ -104,17 +108,22 @@ void FillStereoChemicalParams(const String& header, StereoChemicalParams& table,
}
}
line_iter++;
}
}
if (found==false) {
throw Error("Could not find the relevant section in the stereo-chemical parameter file");
};
};
void FillClashingDistances(ClashingDistances& table, std::vector<String>& stereo_chemical_props_file)
{
bool found=false;
std::vector<String>::const_iterator line_iter=stereo_chemical_props_file.begin();
while (line_iter!=stereo_chemical_props_file.end()) {
if ((*line_iter).length()!=0) {
StringRef line_string_ref(line_iter->data(),(*line_iter).length());
std::vector<StringRef> line_str_vec = line_string_ref.split();
if (line_str_vec[0].str()=="Non-bonded") {
found=true;
line_iter++;
while ((*line_iter)[0]!='-') {
if ((*line_iter)[0]!='#') {
......@@ -156,8 +165,11 @@ void FillClashingDistances(ClashingDistances& table, std::vector<String>& stere
}
}
line_iter++;
}
};
}
if (found==false) {
throw Error("Could not find the relevant section in the stereo-chemical parameter file");
}
}
EntityHandle load(const String& file, const IOProfile& profile)
{
......@@ -167,6 +179,15 @@ EntityHandle load(const String& file, const IOProfile& profile)
EntityHandle ent=CreateEntity();
reader.Import(ent);
conop::Conopology& conop_inst=conop::Conopology::Instance();
conop::BuilderP builder=conop::Conopology::Instance().GetBuilder("DEFAULT");
conop::RuleBasedBuilderPtr rbb=dyn_cast<conop::RuleBasedBuilder>(builder);
if (!rbb) {
std::cout << "Nope,not rule-based" << std::endl;
} else {
std::cout << "Yep,rule-based" << std::endl;
}
conop_inst.ConnectAll(conop_inst.GetBuilder(), ent);
return ent;
}
......
......@@ -330,3 +330,16 @@ CG1-CB-CG2 VAL 110.9 1.6
N-CA-C VAL 111.0 2.7
CA-C-O VAL 120.1 2.1
-
Non-bonded distance Minimum Dist Tolerance
C-C 3.4 1.5
C-N 3.25 1.5
C-S 3.5 1.5
C-O 3.22 1.5
N-N 3.1 1.5
N-S 3.35 1.5
N-O 3.07 1.5
O-S 3.32 1.5
O-O 3.04 1.5
S-S 2.03 1.0
-
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment