Skip to content
Snippets Groups Projects
Commit b476635d authored by BIOPZ-Johner Niklaus's avatar BIOPZ-Johner Niklaus
Browse files

Added possibility to keep all polar hydrogens after sidechain reconstruction

parent ba73ccf1
Branches
Tags
No related merge requests found
......@@ -133,6 +133,8 @@ void export_Frame()
.def("__init__",make_constructor(&WrapFrameResidueInit))
.def("__len__", &FrameResidue::size)
.def("__getitem__", &WrapGetItem, (arg( "index" )))
.def("ApplyOnResidue",&FrameResidue::ApplyOnResidue)
.def("GetResidueIndex",&FrameResidue::GetResidueIndex)
;
register_ptr_to_python<FrameResiduePtr>();
......
......@@ -3,7 +3,7 @@ from ost import geom
def Reconstruct(ent, keep_sidechains = False, build_disulfids = True,
rotamer_model = "frm", consider_hbonds = True,
rotamer_library = None):
rotamer_library = None,add_all_polar_hydrogens=False):
name_id_mapper = dict()
name_id_mapper["ARG"] = sidechain.ARG
......@@ -320,3 +320,11 @@ def Reconstruct(ent, keep_sidechains = False, build_disulfids = True,
except:
print "there is a backbone atom missing... ",prot.residues[i].GetQualifiedName()
if add_all_polar_hydrogens:
for r in frame_residues:
i=r.GetResidueIndex()
if i==100000:continue#These are cysteins that were already handled
rh=prot.residues[i].GetHandle()
r.ApplyOnResidue(rh,True)
......@@ -37,6 +37,21 @@ FrameResiduePtr FrameResidue::GetTransformedCopy(const geom::Transform& t, uint
}
void FrameResidue::ApplyOnResidue(ost::mol::ResidueHandle& res, bool consider_hydrogens) const{
ost::mol::XCSEditor ed = res.GetEntity().EditXCS(ost::mol::BUFFERED_EDIT);
for(uint i = 0; i < n_particles_; ++i){
Particle p=particles_[i];
String particle_name =p.GetName();
if(particle_name[0] == 'H' && !consider_hydrogens) continue;
ost::mol::AtomHandle a=res.FindAtom(particle_name);
if (a.IsValid()){
ed.SetAtomPos(a,p.GetPos());
}
else {
ed.InsertAtom(res,p.GetName(),p.GetPos(),particle_name.substr(0,1));
}
}
}
Frame::Frame(const std::vector<FrameResiduePtr>& frame_residues,
const std::vector<geom::Transform>& rt_operators):
......
......@@ -46,6 +46,7 @@ public:
iterator end() const { return particles_ + n_particles_; }
uint GetResidueIndex() const { return residue_index_; }
void ApplyOnResidue(ost::mol::ResidueHandle& res, bool consider_hydrogens) const;
private:
Particle* particles_;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment