You are here

How To Read PyRosetta Documentation - GenericMonteCarloMover as example

3 posts / 0 new
Last post
How To Read PyRosetta Documentation - GenericMonteCarloMover as example
#1

Dear All,

Is it possible to explain how to read these PyRosetta documents? it seems they show what each function takes, but it is not clear what are these arguments specifically and where to get them from.
URL: http://graylab.jhu.edu/PyRosetta.documentation/rosetta.protocols.simple_moves.html#GenericMonteCarloMover-apply


I managed to understand that this:
apply(self: pyrosetta.rosetta.protocols.simple_moves.GenericMonteCarloMover, pose: pyrosetta.rosetta.core.pose.Pose) -> None
means it takes only a pose such as:
MC = GenericMonteCarloMover()
MC.apply(pose)

And if there is only self: means it takes nothing such as GenericMonteCarloMover() and it should be constructed as MC = GenericMonteCarloMover()

but what does  -> None mean? and sometimes I see --> void or -> bool what do they mean? are they crucial?

 

More importantly what does this mean?
add_filter(self: pyrosetta.rosetta.protocols.simple_moves.GenericMonteCarloMover, filter: pyrosetta.rosetta.protocols.filters.Filter, adaptive: bool, temp: float, sample_type: str, rank_by: bool) -> None
it takes a filter (I want to use rosetta.protocols.simple_filters.PackStatFilter() but i am not sure if it takes it or not or how to set it up) , then adaptive: bool? (what does this mean?) , then temperature usually = 1.0 , then sample_type: str for string such as 'high' , then rank_by: bool? (what does this mean?)

i tried to use this function as follows:
MC = GenericMonteCarloMover()
MC.add_filter(rosetta.protocols.simple_filters.PackStatFilter() , 0 , 1.0 , 'high' , 0)
MC.apply(pose)

But I get an error:
TypeError: add_filter(): incompatible function arguments. The following argument types are supported:
    1. (self: rosetta.protocols.simple_moves.GenericMonteCarloMover, filter: rosetta.protocols.filters.Filter, adaptive: bool, temp: float, sample_type: str) -> None
    2. (self: rosetta.protocols.simple_moves.GenericMonteCarloMover, filter: rosetta.protocols.filters.Filter, adaptive: bool, temp: float, sample_type: str, rank_by: bool) -> None
Invoked with: <rosetta.protocols.simple_moves.GenericMonteCarloMover object at 0x7fa67ff7d0d8>, <rosetta.protocols.simple_filters.PackStatFilter object at 0x7fa67ea1c378>, 0, 1.0, 'high', 0

 

Figuring out how to read these documents will help me independently understand how to use each mover.

 

 

Category: 
Post Situation: 
Wed, 2017-07-05 09:08
ac.research

The "-> None" and such after the function tells you what sort of return value there is. If it's "-> None", there's no return value. (Technically, you'll always get the Python `None` object.) That's equivalent to the C++ level "-> void".  If it's "-> bool", you'll get back a Boolean (True/False) value. Likewise with "-> float" you'll get back a Python float (like a C++ level `double`). Correspondingly with something like "-> pyrosetta.rosetta.core.pose.Pose" you'll be getting back a Pose object. -- For what exactly those bool/float/Poses mean, you'll have to read the rest of the documentation and hope that it's mentioned (or at the very least obvious from the function name.)

Regarding what the parameters mean, unfortunately the (Py)Rosetta documentation often leaves much to be desired. It's often helpful to search around for example cases and other overview documentation to see what the parameters might mean. For example, the RosettaScripts documentation has information about GenericMonteCarloMover (https://www.rosettacommons.org/docs/latest/scripting_documentation/RosettaScripts/Movers/movers_pages/GenericMonteCarloMover) which talks a bit about "adaptive" and "rank". (Often there's "advanced" parameters which you can ignore/turn-off without substantial issues.)

Regarding your error, I'm guessing it's that you're passing `0` as opposed to `False`, and the interface layer is refusing to autoconvert for you.

Thu, 2017-07-06 09:00
rmoretti

rmoretti,

 

Thank you very much, that explains a lot.

Thu, 2017-07-06 11:09
ac.research