Relax with constraints in PyRosetta

Member Site Forums PyRosetta PyRosetta – General Relax with constraints in PyRosetta

Viewing 1 reply thread
  • Author
    Posts
    • #2805
      Anonymous

        Hello everyone,

         

        I am trying to relax a structure while also applying constraints on spesific locations in order to force these locations to be a spesific distance appart.

        so far my code is as follows:


        constraints = pyrosetta.rosetta.protocols.simple_moves.ConstraintSetMover()
        constraints.constraint_file('constraints.cst')
        constraints.add_constraints(True)
        constraints.apply(pose)

        scorefxn = get_fa_scorefxn()
        relax = pyrosetta.rosetta.protocols.relax.FastRelax()
        relax.set_scorefxn(scorefxn)
        relax.constrain_relax_to_start_coords(True)
        relax.constrain_coords(True)
        relax.apply(pose)

        pose.dump_pdb('structure.pdb')

         

        I think what I wrote is complete non-sense because it is not working at all. Can someone guide me to the correct way to preform relax with constraints in PyRosetta?

      • #13917
        Anonymous

          I believe the thing you’re missing is that you’re running with a scorefunction which has the constraint weights turned to zero. You both need to set the constraints in the pose *and* enable the constraint terms in the scorefunction. You can check this with the show() function of the ScoreFunction object. It should show the scoreterms with non-zero weights. If the constraint terms aren’t there, you’ll need to enable them.

          To do this, you can use the _cst version of whichever scorefunction you’re using. (e.g. ‘talaris2014_cst’ or ‘ref2015_cst’). You can’t use the conveince function for this, but you can call the scorefunction factory directly:


          scorefxn = pyrosetta.rosetta.core.scoring.ScoreFunctionFactory.create_score_function('ref2015_cst')

           

          Alternatively, you can set the appropriate weights (atom_pair_constraint, angle_constraint,  coordinate_constraint, dihedral_constraint, and res_type_constraint) to 1.0 using the scorefxn.set_weight() function — note that this uses a core.scoring.ScoreType object (found under the `core.scoring` namespace), rather than a string.

      Viewing 1 reply thread
      • You must be logged in to reply to this topic.