You are here

Rosetta get_fa_scorefxn()

4 posts / 0 new
Last post
Rosetta get_fa_scorefxn()
#1

I am using PyRosetta to minimize several complexes and obtain the rosetta calculated energy values. In order to obtain all the rosetta scoring terms, I am using the get_fa_scorefxn function. Whereas I want to retain all the scoring terms, the only option that seems available to see all of them is with the following lines:

scorefxn = get_fa_scorefxn()

pose = pose_from_pdb(<minimized_complex_pdb>)

scorefxn.show(pose)

HOWEVER, the scorefxn.show(pose) prints the terms to the terminal and I am not able to extract the terms within my python code. I tried 'pose.energies().total_energies()[fa_atr]' as is recommended in the pyrosetta documentation appendix A here, but that gives me a type error.  I even tried to reassign stdout to a file so scorefxn.show(pose) prints to it, but it doesn't. What is a way around this or am I missing something?

Category: 
Post Situation: 
Thu, 2019-10-31 10:18
israeldesta

'pose.energies().total_energies()[fa_atr]'  is the way to do it. You can also try 'pose.energies().total_energies().get(fa_atr)', though I don't know why that would work  when the former doesn't.

When you say it give you a type error, what's the exact error message you get? Is it complaining about the fa_atr? That should be the score type value from rosetta.core.scoring -- If you're accidentally pulling it from somewhere else, it might not work well.

Mon, 2019-11-04 12:51
rmoretti

Here are the commands I am entering and the error messages I am getting:

Trial 1: pose.energies().total_energies()['fa_atr']

Error Message: *** NameError: name 'fa_atr' is not defined

Trial 2: pose.energies().total_energies()['fa_atr']

Error Message: *** TypeError: __getitem__(): incompatible function arguments. The following argument types are supported:

Error Message (continued): 1. (self: pyrosetta.rosetta.core.scoring.EMapVector, st: pyrosetta.rosetta.core.scoring.ScoreType) -> float

Error Message (continued): Invoked with: <pyrosetta.rosetta.core.scoring.EMapVector object at 0x7f78ebe06f10>, 'fa_atr'

Trial 3:

fa_atr = rosetta.core.scoring

pose.energies().total_energies().get(fa_atr)

Error Message:

*** TypeError: get(): incompatible function arguments. The following argument types are supported:
    1. (self: pyrosetta.rosetta.core.scoring.EMapVector, st: pyrosetta.rosetta.core.scoring.ScoreType) -> float

Invoked with: <pyrosetta.rosetta.core.scoring.EMapVector object at 0x7f78ebe06f80>, <module 'pyrosetta.rosetta.core.scoring' (built-in)>

So maybe i should define fa_atr differently?

Wed, 2019-11-13 14:11
israeldesta

Its not a string, it's an enum.  Basically a named number. Its a specific type and reduces passing around raw strings. 

 

First do this:

from pyrosetta.rosetta.core.scoring import *

 

Then just pass fa_atr instead of with the string. 

Thu, 2019-11-14 15:33
jadolfbr