Rosetta get_fa_scorefxn()

Member Site Forums PyRosetta PyRosetta – General Rosetta get_fa_scorefxn()

Viewing 3 reply threads
  • Author
    Posts
    • #3287
      Anonymous

        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?

      • #15038
        Anonymous

          ‘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.

        • #15056
          Anonymous

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

            Trial 1: pose.energies().total_energies()

            Error Message: *** NameError: name ‘fa_atr’ is not defined

            Trial 2: pose.energies().total_energies()

            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?

          • #15058
            Anonymous

              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. 

          Viewing 3 reply threads
          • You must be logged in to reply to this topic.