Questions of Cartesian_ddG calculation in PyRosetta

Member Site Forums PyRosetta PyRosetta – General Questions of Cartesian_ddG calculation in PyRosetta

Viewing 1 reply thread
  • Author
    Posts
    • #3896
      Anonymous

        Dear All,

        I am new to PyRosetta and I am trying to calculate the ddG after point-mutation. The calculation logic is like the following:

        1) clean the pdb file and use cartesian relax to minimize its energy

        2) perform the point mutation with mutate_residue() function

        3) calculate the score before and after the mutation to gain the ddG

        However, the ddG data I got was always positive values and have large differences from the benchmark.

        Can someone give me some help? Which part of my code is wrong? Thank you guys so much for your input and suggestions!!


        from pyrosetta import *
        from pyrosetta.rosetta import *
        from pyrosetta.toolbox import *
        init("-ignore_unrecognized_res 1 -ex1 -ex2 -flip_HNQ -relax:cartesian -nstruct 200 -crystal_refine -optimization:default_max_cycles 200")


        testPose= Pose()
        testPose = pose_from_pdb("1BNI.clean.pdb")

        from pyrosetta.rosetta.protocols.relax import FastRelax
        scorefxn = pyrosetta.create_score_function("ref2015_cart")
        relax = pyrosetta.rosetta.protocols.relax.FastRelax()
        relax.constrain_relax_to_start_coords(True)
        relax.coord_constrain_sidechains(True)
        relax.ramp_down_constraints(False)
        relax.cartesian(True)
        #relax.min_type("dfpmin_armijo_nonmonotone")
        relax.min_type("lbfgs_armijo_nonmonotone")#for non-Cartesian scorefunctions use'dfpmin_armijo_nonmonotone'
        relax.set_scorefxn(scorefxn)
        s0=scorefxn(testPose)
        relax.apply(testPose)
        s1=scorefxn(testPose)
        testPose.dump_pdb('1BNI.relax.pdb')
        AA=
        ddG=[]
        mp=Pose()
        for i in AA:
        mp.assign(testPose)
        mutate_residue(mp,52,i)
        s2=scorefxn(mp)
        dg=s2-s1
        ddG.append(dg)

        print(ddG)

         

         Best regards

      • #16095
        Anonymous

          Hi,

          I would relax or minimise after the mutation. Not sure `mutate_residue` does this allready. I would have a flexible backbone around the mutation (i.e. 8 Angs), but keep everything else fixed. 

          Here is one implementation of ddg https://github.com/Kortemme-Lab/ddg

          And another: https://www.rosettacommons.org/docs/latest/cartesian-ddG

          And the newest one in the rosetta_scripts directory (not sure it’s been released yet):

          rosetta_scripts_scripts/scripts/public/stabilize_proteins_pm_mc/

          Best,

          Ajasja

          PS: also what’s the diffrence between s0 and s1? Does relax take into account the coord constraints? I would use two diffrent scoring functions one for relax and one for scoring, so there would be no doubt if constraints are on.

          • #16096
            Anonymous

              Hi Ajasja,

              Thank you so so much for your kindly reply. First of all, I would like to say sorry that I am new to both Rosetta and PyRosetta so you may find my questions are a bit silly. I checked the reference you sent to me but seems that both of them are only suitable for Rosetta, while I want to do the job in PyRosetta.

              Regarding the questions in your PS section. I found that the energy before and after the relax was different. s0 is a positive number while s1 is a negative number. I don’t know whether in my python code the relax takes into account the coord constraints, but according to the official tutorial the command “relax.constrain_relax_to_start_coords(True)” helps me do it? Also, may I ask you what do you mean by “using two different scoring functions?”, do you mean that I can set up a scorefxn1=”ref2015_cart” for cartesian_relax, while setting up another scorefxn2=’ref2015′ for the scoring calculation?

              For your suggestion, May I ask how you keep everything else fixed while having a flexible backbone around the mutation? Do I have to do the minimization for the mutated pose? The “mutate_residue()” function is attached below, does the “Packer help me do the job already?

              Really sorry to bother you again and again, looking forward to hearing from you!

              Best,

              Kai San


              def mutate_residue(
              pack_or_pose, mutant_position, mutant_aa, pack_radius=0., pack_scorefxn=None
              ):
              """Replace the residue at a single position in a Pose with a new amino acid
              and repack any residues within user-defined radius of selected residue's
              center using.
              Args:
              pack_or_pose (pyrosetta.rosetta.core.pose.Pose OR pyrosetta.distributed.packed_pose.PackedPose):
              the `Pose` instance to use.
              mutant_position (int): Pose-numbered position of the residue to mutate.
              mutant_aa (str): The single letter name for the desired amino acid.
              pack_radius (float): Radius used to define neighboring residues.
              pack_scorefxn (pyrosetta.ScoreFunction): `ScoreFunction` to use when repacking the `Pose`.
              Defaults to the standard `ScoreFunction`.
              """
              import pyrosetta
              import pyrosetta.distributed.packed_pose as packed_pose

              wpose = packed_pose.to_pose(pack_or_pose)

              if not wpose.is_fullatom():
              raise IOError("mutate_residue only works with fullatom poses")

              # create a standard scorefxn by default
              if not pack_scorefxn:
              pack_scorefxn = pyrosetta.get_score_function()

              # the numbers 1-20 correspond individually to the 20 proteogenic amino acids
              from pyrosetta.rosetta.core.chemical import aa_from_oneletter_code

              mutant_aa = int(aa_from_oneletter_code(mutant_aa))
              aa_bool = pyrosetta.Vector1([aa == mutant_aa for aa in range(1, 21)])

              # mutation is performed by using a PackerTask with only the mutant
              # amino acid available during design
              task = pyrosetta.standard_packer_task(wpose)
              task.nonconst_residue_task(mutant_position).restrict_absent_canonical_aas(aa_bool)

              # prevent residues from packing by setting the per-residue "options" of the PackerTask
              task = restrict_non_nbrs_from_repacking(wpose, mutant_position, task, pack_radius)

              # apply the mutation and pack nearby residues
              from pyrosetta.rosetta.protocols.minimization_packing import PackRotamersMover

              packer = PackRotamersMover(pack_scorefxn, task)
              packer.apply(wpose)

               

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