Skip to content
Snippets Groups Projects
Commit 902ae38f authored by Studer Gabriel's avatar Studer Gabriel
Browse files

Make disulfid score more flexible

The disulfid score evluates a simple geometric expression based on
ca, cb, and sg pos of two rotamers. So far it expected exactly one
particle in case of an RRMRotamer and exactly three particles in case
of an FRMRotamer, all being gamma sulfurs. The new implementation
iterates over all particles of the rotamers and searches for
particles with name "SG". In case of RRMRotamer it expects exactly
one gamma sulfur per rotamer. In case of FRMRotamer there can be
an arbitrary number of gamma sulfurs per rotamer. All possible
combinations of the gamma sulfurs get then evaluated and the minimum
score gets returned.
parent d87e9ced
No related branches found
No related tags found
No related merge requests found
......@@ -8,15 +8,45 @@ a disulfid bond, one would get an unfavourable energy due to "clashes" between
the sulfur atoms. It is possible to improve performance in sidechain
reconstruction regarding cysteins when finding and separately handle
disulfid bonds. PROMOD3 implements a simple geometrical description
[canutescu2003b]_ .
[canutescu2003b]_ . The paper proposes two rotamers to be in a disulfid
bonded state, if the resulting disulfid score plus the self energies of the
involved rotamers is below 45.
Two methods are implemented to evaluate this disulfid score on either rigid of
flexible rotamers. The above paper proposes two rotamers to be in a disulfid
bonded state, if the resulting score is below 45.
.. method:: DisulfidRawScore(ca_pos_one, cb_pos_one, sg_pos_one, \
ca_pos_two, cb_pos_two, sg_pos_two)
Evaluates the geometric expression based on the input positions
:param ca_pos_one: The CA position of first rotamer
:param cb_pos_one: The CB position of first rotamer
:param sg_pos_one: The gamma sulfur position of first rotamer
:param ca_pos_two: The CA position of second rotamer
:param cb_pos_two: The CB position of second rotamer
:param sg_pos_two: The gamma sulfur position of second rotamer
:type ca_pos_one: :class:`ost.geom.Vec3`
:type cb_pos_one: :class:`ost.geom.Vec3`
:type sg_pos_one: :class:`ost.geom.Vec3`
:type ca_pos_two: :class:`ost.geom.Vec3`
:type cb_pos_two: :class:`ost.geom.Vec3`
:type sg_pos_two: :class:`ost.geom.Vec3`
:returns: The result of the raw score
.. method:: DisulfidScore(rotamer_one, rotamer_two, ca_pos_one, cb_pos_one, \
ca_pos_two, cb_pos_two)
Directly extracts the positions of the gamma sulfurs from the rotamers by
searching for particles with the name "SG". In case of :class:`RRMRotamer`
It expects exactly one gamma sulfur per rotamer. In case of
:class:`FRMRotamer` there can be an arbitrary number of gamma sulfurs per
rotamer (at least one), it then evaluates the score for all possible
combinations of gamma sulfurs and takes the minimum score.
To get a final DisulfidScore, it finally adds the self energies of the
rotamers to the result of the geometric expression.
:param rotamer_one: First rotamer
:param rotamer_two: Second rotamer
:param ca_pos_one: CA position of first rotamer
......@@ -32,11 +62,10 @@ bonded state, if the resulting score is below 45.
:type cb_pos_two: :class:`ost.geom.Vec3`
:raises: :exc:`~exceptions.RuntimeError` if given rotamers do not contain
exactly one particle representing the gamma sulfur.
exactly (in case of :class:`RRMRotamer`) or at least (in case of
:class:`FRMRotamer`) one particle representing the gamma sulfur.
:returns: The disulfid score based on geometric features. In case
of :class:`FRMRotamer` as input, the minimal score
between all possible subrotamer combinations gets
returned.
:returns: The result of the raw score plus the self energies of
the input rotamers
.. [canutescu2003b] Canutescu AA, Shelenkov AA, Dunbrack RL Jr. (2003). A graph-theory algorithm for rapid protein side-chain prediction. Protein Sci (2003).
......@@ -34,6 +34,13 @@ Real WrapDisulfidTwo(FRMRotamerPtr rot_one, FRMRotamerPtr rot_two,
void export_Disulfid(){
def("DisulfidRawScore", &DisulfidRawScore, (arg("ca_pos_one"),
arg("cb_pos_one"),
arg("sg_pos_one"),
arg("ca_pos_two"),
arg("cb_pos_two"),
arg("sg_pos_two")));
def("DisulfidScore",&WrapDisulfidOne,(arg("rotamer_one"),arg("rotamer_two"),
arg("ca_pos_one"),arg("cb_pos_one"),
arg("ca_pos_two"),arg("cb_pos_two")));
......
#include <promod3/sidechain/disulfid.hh>
#include <promod3/sidechain/rotamer.hh>
#include <promod3/sidechain/particle.hh>
#include <vector>
namespace{
Real RawScore(const geom::Vec3& ca_pos_one, const geom::Vec3& cb_pos_one,
const geom::Vec3& sg_pos_one, const geom::Vec3& ca_pos_two,
const geom::Vec3& cb_pos_two, const geom::Vec3& sg_pos_two){
template <typename T>
void ExtractCYSSG(T rot_one, T rot_two,
std::vector<geom::Vec3>& pos_one,
std::vector<geom::Vec3>& pos_two){
for(promod3::sidechain::Particle* i = rot_one->begin();
i != rot_one->end(); ++i){
if(i->GetName() == "SG"){
pos_one.push_back(i->GetCenter());
}
}
for(promod3::sidechain::Particle* i = rot_two->begin();
i != rot_two->end(); ++i){
if(i->GetName() == "SG"){
pos_two.push_back(i->GetCenter());
}
}
}
}
namespace promod3{ namespace sidechain{
Real DisulfidRawScore(const geom::Vec3& ca_pos_one,
const geom::Vec3& cb_pos_one,
const geom::Vec3& sg_pos_one,
const geom::Vec3& ca_pos_two,
const geom::Vec3& cb_pos_two,
const geom::Vec3& sg_pos_two){
Real d = geom::Distance(sg_pos_one,sg_pos_two);
Real a1 = geom::Angle(cb_pos_one-sg_pos_one, sg_pos_two-sg_pos_one);
......@@ -27,56 +58,52 @@ Real RawScore(const geom::Vec3& ca_pos_one, const geom::Vec3& cb_pos_one,
+ std::abs(x3-Real(M_PI)/2) / Real(0.34907);
}
}
namespace promod3{ namespace sidechain{
Real DisulfidScore(RRMRotamerPtr rot_one, RRMRotamerPtr rot_two,
const geom::Vec3& ca_pos_one, const geom::Vec3& cb_pos_one,
const geom::Vec3& ca_pos_two, const geom::Vec3& cb_pos_two){
if(rot_one->size() != 1 || rot_two->size() != 1){
std::stringstream ss;
ss << "Expect rigid rotamers to have exactly one particle ";
ss << "representing the gamma sulfur";
throw promod3::Error(ss.str());
}
std::vector<geom::Vec3> sg_pos_one, sg_pos_two;
ExtractCYSSG(rot_one, rot_two, sg_pos_one, sg_pos_two);
geom::Vec3 sg_pos_one = (*rot_one)[0]->GetCenter();
geom::Vec3 sg_pos_two = (*rot_two)[0]->GetCenter();
if(sg_pos_one.size() != 1 || sg_pos_two.size() != 1){
throw promod3::Error("Expect rigid rotamers to have exactly one gamma "
"sulfur particle!");
}
return RawScore(ca_pos_one,cb_pos_one,sg_pos_one,ca_pos_two,cb_pos_two,sg_pos_two) +
rot_one->GetSelfEnergy() + rot_two->GetSelfEnergy();
Real raw_score = DisulfidRawScore(ca_pos_one, cb_pos_one, sg_pos_one[0],
ca_pos_two, cb_pos_two, sg_pos_two[0]);
Real self_energy = rot_one->GetSelfEnergy() + rot_two->GetSelfEnergy();
return raw_score + self_energy;
}
Real DisulfidScore(FRMRotamerPtr rot_one, FRMRotamerPtr rot_two,
const geom::Vec3& ca_pos_one, const geom::Vec3& cb_pos_one,
const geom::Vec3& ca_pos_two, const geom::Vec3& cb_pos_two){
if(rot_one->size() != 3 || rot_two->size() != 3){
std::stringstream ss;
ss << "Expect flexible rotamers to have exactly three particles ";
ss << "representing the gamma sulfur.";
throw promod3::Error(ss.str());
std::vector<geom::Vec3> sg_pos_one, sg_pos_two;
ExtractCYSSG(rot_one, rot_two, sg_pos_one, sg_pos_two);
if(sg_pos_one.empty() || sg_pos_two.empty()){
throw promod3::Error("Expect flexible rotamers to have at least one gamma "
"sulfur particle!");
}
Real min_raw_score = std::numeric_limits<Real>::max();
geom::Vec3 sg_pos_one, sg_pos_two;
for(uint i = 0; i < 3; ++i){
for(uint j = 0; j < 3; ++j){
sg_pos_one = (*rot_one)[i]->GetCenter();
sg_pos_two = (*rot_two)[j]->GetCenter();
for(uint i = 0; i < sg_pos_one.size(); ++i){
for(uint j = 0; j < sg_pos_two.size(); ++j){
min_raw_score = std::min(RawScore(ca_pos_one,cb_pos_one,sg_pos_one,ca_pos_two,cb_pos_two,sg_pos_two)
,min_raw_score);
min_raw_score = std::min(DisulfidRawScore(ca_pos_one,cb_pos_one,
sg_pos_one[i], ca_pos_two,
cb_pos_two,sg_pos_two[j])
,min_raw_score);
}
}
return min_raw_score + rot_one->GetSelfEnergy() + rot_two->GetSelfEnergy();
Real self_energy = rot_one->GetSelfEnergy() + rot_two->GetSelfEnergy();
return min_raw_score + self_energy;
}
}} //ns
......@@ -10,6 +10,13 @@
namespace promod3{ namespace sidechain{
Real DisulfidRawScore(const geom::Vec3& ca_pos_one,
const geom::Vec3& cb_pos_one,
const geom::Vec3& sg_pos_one,
const geom::Vec3& ca_pos_two,
const geom::Vec3& cb_pos_two,
const geom::Vec3& sg_pos_two);
Real DisulfidScore(RRMRotamerPtr rot_one, RRMRotamerPtr rot_two,
const geom::Vec3& ca_pos_one, const geom::Vec3& cb_pos_one,
const geom::Vec3& ca_pos_two, const geom::Vec3& cb_pos_two);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment