You are here

How to use SAXS energy score in PyRosetta

6 posts / 0 new
Last post
How to use SAXS energy score in PyRosetta
#1

Hi,

I am trying to import SAXS energy function in PyRosetta, However, I failed to call it in python. The code I tried is: 

>>> from rosetta import *
>>> rosetta.init()

>>> from toolbox import cleanATOM

>>> cleanATOM("1YY8.pdb")

>>> pose = pose_from_pdb("1YY8.clean.pdb")

>>> ### try saxs
>>> scorefxn2 = ScoreFunction()
>>> scorefxn2.set_weight(fastsaxs, 1.0)
>>> print scorefxn2(pose)
core.scoring.saxs.FastSAXSEnergy: Loading SAXS spectrum
core.scoring.saxs.FastSAXSEnergy: [ ERROR ] No SAXS spectrum specified!

I got warning message: 

core.scoring.saxs.FastSAXSEnergy: Loading SAXS spectrum
core.scoring.saxs.FastSAXSEnergy: [ ERROR ] No SAXS spectrum specified!

So I want try to import SAXS spectrum file, but when I tried 

>>> rosetta.core.scoring.saxs

I got error message:

>>> rosetta.core.scoring.saxs
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'saxs'

 

However, I can see the python main file under PyRosetta.ScientificLinux-r55981.64Bit/rosetta/core/scoring/saxs/, how can I call import saxs data file and  saxs energy function in PyRosetta. 

The PyRosetta version I used is: PyRosetta.ScientificLinux-r55981.64Bit

 

Thanks.

Category: 
Post Situation: 
Mon, 2016-09-05 08:31
Jie Hou

A large number of the protocols in Rosetta are build around the assumption that they'll be accessed from the commandline. We're trying to move away from that, but a number of these assumptions remain.

In this case, the FastSAXSEnergy object is expecting that the SAXS spectum data will be provided by the "-score:saxs:ref_spectrum" commandline option. There's ways to set the option system from within PyRosetta, but they're not necessarily as clean as one would like.

Mon, 2016-09-05 10:04
rmoretti

The easiest way to set options in PyRosetta is to pass a string of the options during init.   I just updated the PyRosetta FAQ with this info.  For example:

rosetta.init( "-ex1 -ex2 -include_sugars -write_pdb_link_records" )

Mon, 2016-09-05 20:03
jadolfbr

Dear jadolfbr,

 

Thanks for the info. I tested it, and it works pretty well. Could you help check my new question about how to apply SAXS fitting energy on centroid pose?  I couldn't get SAXS energy score after converting pose into centroid type. 

 

thanks

Wed, 2016-09-07 12:56
Jie Hou

Dear rmoretti,

 

thanks for the help. I successfully import SAXS profile and get the saxs energy score from pose by 

rosetta.basic.options.set_file_option('score:saxs:ref_spectrum', 'test.dat')

scorefxn = ScoreFunction()
scorefxn.set_weight(fastsaxs, 1.0)

print scorefxn(pose)

 

Another question: I found the fastsaxs energy term only works for full atom pose, but failed in centroid pose during Monte Carlo sampling, for example, when I tried to convert the pose to centroid Mover type as:

to_centroid = SwitchResidueTypeSetMover('centroid')

to_fullatom = SwitchResidueTypeSetMover('fa_standard')
 

to_centroid.apply(pose)

print scorefxn(pose)

I will get energy as:  nan

But when I converted it to full atom:

to_fullatom.apply(pose)

print scorefxn(pose)

Then I will get energy term 35.6

 

Does this mean I can not apply fastsaxs energy on centroid pose?

Thanks

 

Wed, 2016-09-07 12:52
Jie Hou

Yes, it does look like the fast_saxs scoreterm is fullatom-specific.

There's another score term which is centroid-specific, though, and that is "saxs_score" (aka "saxs_cen_score").  (There's also a related "saxs_fa_score" for full atom poses.)

 

Mon, 2016-11-14 13:21
rmoretti