You are here

Design constraints on pairs of residues

4 posts / 0 new
Last post
Design constraints on pairs of residues


I'm wondering if there is a way to constrain the packer based on pairs of residues.  As a simple example, say I would like to penalize designs that place an Asn and a Ser at positions i and i+2.  In this case, I might think that this would inadvertantly introduce a glycosylation site, and so I'd like to penalize their occurence.  I know there are residue type constraints where I can assign a penalty/bonus to individual residue types at a position, but is there a way to set up constraints for pairs of residues at specific positions?  This is just a simple example, but I'd rather not just filter out designs.

If I'm unable to set up constraints for the packer, is there a way in rosetta scripts to set up penalties on whole structure energies?

Thanks in advance,


Post Situation: 
Mon, 2017-10-02 07:25

There is indeed a residue pair constraint type, called `ResidueTypeLinkingConstraint`.  There's unfortunately no way to invoke it from a constraint file, though, nor from RosettaScripts. (The FavorSymmetricSequence mover uses it, but not in any sort of generalizable way.) You should be able to use it from PyRosetta, though.

There's also a way to specify a global sequence composition (, but I can't see how to use that to define positional dependence.


I'm not understanding your last sentence ("is there a way in rosetta scripts to set up penalties on whole structure energies?")


Tue, 2017-10-10 09:40

Thanks Rocco,

I took a look at the C++ code for ResidueTypeLinkingConstraint, and it's not clear to me that it's doing what I need (I'm looking at the "score" function).

ResidueTypeLinkingConstraint::score( func::XYZ_Func const & xyz_func, EnergyMap const & weights, EnergyMap & emap ) const
    Real const weight(weights[ this->score_type() ] );
    // std::cout << "res_type_linking_cst weight " << weight << std::endl;

    if ( weight == 0 ) return; // what's the point?

    conformation::Residue const & rsd1( xyz_func.residue(seqpos1_) );
    conformation::Residue const & rsd2( xyz_func.residue(seqpos2_) );
    if ( rsd1.aa() != rsd2.aa() ) {
        emap[ this->score_type() ] += bonus_;
        //std::cout << "res_type_linking_cst " << seqpos1_ << " " << seqpos2_ << " aa1 " << rsd1.type().name3() << " aa2 " << rsd2.type().name3() << " " << emap[ this->score_type() ] << std::endl;
    }// no match, don't adjust score


Here it looks like they are simply checking whether residue1 and residue2 have the same amino acid type and penalizing them if they don't.  This is a bit strange since the constructor for the class does allow the user to specify amino acid types for residue1 and residue2 (which is what I would want).  

Am I missing something?

As to your question "I'm not understanding your last sentence ("is there a way in rosetta scripts to set up penalties on whole structure energies?")", I was asking whether there's a way in rosetta-scripts to essentially set up a user-defined scoring function that is derived from the "WholeStructureEnergy" class.  The reason for asking this is that I have set up my own custom function in pyrosetta to penalize residues at positions i and i+2 (as in the original question), and this function makes use of the ContextIndependentTwoBodyEnergy term.  This works, but it's REALLY slow in pyrosetta (even using a trivial test scoring function), with repacking of a small protein taking about 10X as long as without the pyrosetta function.  I was wondering, therefore, if there's a way in rosetta-scripts to just assign a penalty for residues at the i and i+2 position based on their amino acids.  Hope that makes sense.


Mon, 2017-10-16 07:46


I'm assuming that the "ResidueTypeLinkingConstraint", as it currently is written, won't fit my needs (as outlined in my post above) (but if this is not correct, please let me know).  I'm assuming then, that I'll have to write my own function.  Couple questions before I take the time to write the function:

1) What's the different between writing my function (essentially a bonus/penalty on amino acid types at specific positions) as a constraint vs. an energy method?  Is there a reason to favor writing it as a constraint (as was done for ResidueTypeLinkingConstraint)?

2) I'd like to be able to access this code from pyrosetta.  Are there any special steps that I'll need to take to make sure the new class is recognized when recompiling pyrosetta (or should it be fairly seamless)?

Thanks in advance.

Mon, 2017-11-13 11:44