You are here

non canonical aa mutations/force fields/pyrosetta

13 posts / 0 new
Last post
non canonical aa mutations/force fields/pyrosetta

Hi all,

I'm new to PyRosetta and just had a quick question !
I have a protein and need to compute the energy, then to acetylate certain Lys, repack after the replacement and recompute the energy. I am wondering how is the score function name (is it mm_std?) and also where can i find non canonical aa codes. THANKS!

Post Situation: 
Wed, 2013-06-19 01:51

The scorefunction would be mm_std or score12prime with fa_pair (statistical electrostatic) term changed to 0 weight and hack_elec (coulombic electrostatic term) changed to .49 weight (essentially replacing fa_pair with the same weight.

You can use this GUI:

to do the mutation, repacking, and recomputing the energy, as well as find any non-canonical aa codes. If you, instead, want to do this within python code, it will be something like this (variant for acetylation is "ACETYLATION"). The code read by Rosetta for Lys acetylation is ALY:

add_variant_type_to_pose_residue(pose, variant, resnum)

task = TaskFactory.create_packer_task(pose)
task.temporarily_set_pack_residue(resnum, True)
pack_mover = PackRotamersMover(scorefxn, task)
print self.score_class.score(self.pose)
print self.score_class.score(self.pose)

print "Variant type added + Packed"


Wed, 2013-06-19 08:16

In code, you will also need to import the function into PyRosetta, as I don't believe it's exposed:

from rosetta.core.pose import add_variant_type_to_pose_residue

Wed, 2013-06-19 08:17

Hi Jared! Thanks so much!!

I am afraid i have to ask more :)

I attached the script, that i guess is completely wrong, could you please look at it and tell me:

my_scorefxn(prot) gives me 0 if i use mm_std and 94.01 if i use score12prime, i guess mm_std is not loading correctly? but no errors appear.

somehow i have the following error, when i try to mutate LYS to ALY:
In [190]: add_variant_type_to_pose_residue(prot, 'ALY', 16)

ERROR: unable to find desired variant residue: LYS LYS ALY
ERROR:: Exit from: src/core/chemical/ line: 527

and finally :

In [195]: print self.score_class.score(self.pose)
NameError Traceback (most recent call last)
in ()
----> 1 print self.score_class.score(self.pose)

NameError: name 'self' is not defined

Sorry for being so long, but you are my hope :)
Thanks a lot,

Thu, 2013-06-20 06:09

Hi Anouk: Instead of 'ALY', you will need to provide 'ACETYLATION'.

I don't know why mm_std is giving 0. I'll see if I can find something. For now, using score12prime with hack_elec should be fine.
As for the 'self' keyword, you can take them off. They are for python classes. The code I pasted was from a class in the GUI (I tried to remove all of the 'self' references, but I guess I forgot one.)

Hope this helps


Thu, 2013-06-20 07:37

Hi Jared,

Thank you!!!

Now the last (hopefully :)

I have probs at:
In [364]: task.restrict_to_repacking()


and at:

In [368]: print score_class.score(pose)
NameError Traceback (most recent call last)
in ()
----> 1 print score_class.score(pose)

NameError: name 'score_class' is not defined

In [369]: pack_mover.apply(pose)
core.pack.interaction_graph.interaction_graph_factory: Instantiating DensePDInteractionGraph
core.pack.pack_rotamers: built 193 rotamers at 1 positions.
core.pack.pack_rotamers: IG: 1560 bytes

In [370]: print score_class.score(pose)
NameError Traceback (most recent call last)
in ()
----> 1 print score_class.score(pose)

NameError: name 'score_class' is not defined

However it seems like the energy is calculated (coz at least it's different before and after acetylation)...

Similarly, for the 3Methylation, which is the syntax?

Best regards and thanks a lot!

Thu, 2013-06-20 09:09

Hi Anouk,

Some how the forum ate my comment. For score_class, replace any of them with scorefxn. Sorry for this, I must have copied the code from the GUI hastily.

To mutate to tri methylation state, the variant name is 'TRIMETHYLATION'

You can find more information on patches and NCAA either through the GUI or in the directory pyrosetta/rosetta_database/chemical/residue_type_sets/fa_standard

Have you been through the PyRosetta tutorials?
Are you running on windows platform or linux/mac?


Thu, 2013-06-20 11:02

I believe that "score_class" should be the scorefunction object you wish to use. (So it would be "print scorefxn.score(pose)" instead). Those print lines aren't really necessary to get the protocol to run, though, and are just there to give you information on how the pose is scoring before and after packing.

Regarding lysine trimethylation, the variant type is "TRIMETHYLATION" instead of "ACETYLATION". (Likewise DIMETHYLATION and METHYLATION for single and dimethylated lysine. - If you can deal with the poorly documented syntax, the relevant files defining the residue modifications are found in rosetta_database/chemical/residue_type_sets/fa_standard/patches/ )

Thu, 2013-06-20 11:20


Thu, 2013-06-20 12:10

I believe the answer to your "?" is that I started composing my response before you submitted yours.

Thu, 2013-06-20 13:45

Haha, I see. Thanks Rocco!

Fri, 2013-06-21 07:18

H Jared and rmoretti !

Jared! I am running Pyrosetta on Mac.Thanks a lot for the help!!!

rmoretti! i am really desperate in finding some info from the documentation,- i get lost in it without actually any success :) Thanks for the tips!

Thu, 2013-06-20 15:40


Since your on Mac, the GUI will work. (The current mac/linux PyRosetta versions are newer than the current windows version). One of the things it does is parse all of the fa_standard files to make it easier to explore. Its in pyrosetta/GUIs/pyrosetta_toolkit with documentation here:

Did the mutation/packing work now?

Fri, 2013-06-21 07:27