From 7b5b82a3710bf488f1f299e584d392af833fd35a Mon Sep 17 00:00:00 2001 From: Gerardo Tauriello <gerardo.tauriello@unibas.ch> Date: Thu, 25 Aug 2016 10:44:53 +0200 Subject: [PATCH] SCHWED-1316: remove conflicting atoms when building raw model. --- modelling/src/model.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/modelling/src/model.cc b/modelling/src/model.cc index 404b5b13..95fbcc63 100644 --- a/modelling/src/model.cc +++ b/modelling/src/model.cc @@ -46,8 +46,25 @@ bool CheckBackboneAtoms(ResidueView res) return true; } +void CleanupAtomConflicts(ResidueView& res) { + // remove atoms which are on top of any other atoms in the tpl entity + EntityView tpl = res.GetEntity(); + AtomViewList atom_views = res.GetAtomList(); + for (uint i = 0; i < atom_views.size(); ++i) { + AtomViewList on_top_atoms = tpl.FindWithin(atom_views[i].GetPos(), 0.0); + if (on_top_atoms.size() > 1) { + res.RemoveAtom(atom_views[i]); + // report + std::stringstream ss; + ss << "residue " << res.GetQualifiedName() << " has conflicting atom " + << atom_views[i].GetName() << " - skipping atom."; + LOG_WARNING(ss.str()); + } + } } +} // anon ns + int CountEnclosedGaps(ModellingHandle& mhandle, const StructuralGap& gap, bool insertions_only) { @@ -541,6 +558,8 @@ void BuildRawChain(const ost::seq::AlignmentHandle& aln, src_res.GetOneLetterCode() << "'"; throw promod3::Error(ss.str()); } + // remove atoms with conflicting positions (i.e. on top of each other) + CleanupAtomConflicts(src_res); // check for complete backbone, or in case of Calpha only model building, // if the src_res has a Calpha atom if(!CheckBackboneAtoms(src_res)){ -- GitLab