I know this is not a satisfying answer, but I am going to guess the correct answer for how to use BackrubMover in PyRosetta is "not at all". The backrub C++ executable (src/apps/public/backrub.cc) encodes rather a lot of protocol logic at the executable level in a class BackrubProtocol, which is not available in PyRosetta. I don't know how functional the backrub mover (BackrubMover) is all by itself.
If you want to use BackrubMover directly, I can dredge up some C++ examples of where it is used to give an idea of which functions are vital to get it to work. I don't think anyone has used it in python yet. It would help a lot to know more specifically what you wanted to do with it.
He's right. I tried this a while ago, and gave up since the server is so nice. However, looking at the backrub.cc file now that I can read it, there is a whole lot of setup involved. Mostly from commandline. Foldtree, the specific backrub energymethod, task, and a few other interesting things. The main piece of the code is this:
for (int i = 1; i <= option[ backrub::ntrials ]; ++i) {
std::string move_type;
// could use random mover for this...
core::Real move_prob = RG.uniform();
if (move_prob > option[ backrub::sm_prob ] + option[ backrub::sc_prob ]) {
backrubmover_->apply(*pose_copy);
move_type = backrubmover_->type();
} else if (move_prob > sc_prob) {
smallmover_.apply(*pose_copy);
move_type = smallmover_.type();
} else {
sidechainmover_.apply(*pose_copy);
move_type = sidechainmover_.type();
}
mc.boltzmann(*pose_copy, move_type);
You can do this in python. There are a decent amount of functions that are called that I have never seen to be honest. I would just copy them verbatim. If you can read a bit of C++, I think the conversion to python (without all the commandline stuff) should be possible. Not extremely simple, but definitely possible. If you still want to pursue this, let me know and I can help or do the translation for you.
Not really. The top-level logic of the backrub application is still not accessible through PyRosetta (though much of the sub-functionality is). As above, you'd have to recapitulate it in Python.
OK, thanks. If I did translate it to Python, how could I check that it's working correctly? In other words, is there a test data set included with Rosetta (or somewhere else) for which the outcome is known?
Not particularly. We have an "integration test" for the application which is available in the regular Rosetta distribution at Rosetta/main/tests/integration/tests/backrub but that's mainly for testing that the application doesn't undergo any major variations as the Rosetta codebase changes. It's not really suited for testing if a reimplementation of the protocol is functionally identical to the old version.
A better bet is to look at the published paper which uses the backrub protocol and does something similar to what you want to do. You can then re-run the analysis they did in the paper, and check that it performs similarly to what was published.
The class is called BackrubProtocol, the code for it was moved outside the app to enable its use in other C++ apps and PyRosetta. Movemap support was also added where contigous regions will be used as segments. You may have to import the backrub namespace into PyRosetta:
from rosetta.protocols.backrub import *
Main interface for the protocol:
br = BackrubProtocol()
br.set_movemap(my_movemap)
or
br.set_pivot_residues(vector1_of_pivots)
Info::
///@brief Set the pivot residues for backrub.
/// Will use contiguous residues as segments.
/// Within these segments, backrub will occur.
void
set_pivot_residues( utility::vector1<core::Size> pivot_residues);
///@brief Set the movemap for the whole protocol.
/// Uses contiguous backbone regions for backrub to set pivot residues
/// Within these segments, backrub will occur.
void
set_movemap( core::kinematics::MoveMapCOP movemap);
Any other options not seen in the interface can be set via cmd-line options. Documentation for more. As an example during rosetta.init():
I know this is not a satisfying answer, but I am going to guess the correct answer for how to use BackrubMover in PyRosetta is "not at all". The backrub C++ executable (src/apps/public/backrub.cc) encodes rather a lot of protocol logic at the executable level in a class BackrubProtocol, which is not available in PyRosetta. I don't know how functional the backrub mover (BackrubMover) is all by itself.
If you want to use BackrubMover directly, I can dredge up some C++ examples of where it is used to give an idea of which functions are vital to get it to work. I don't think anyone has used it in python yet. It would help a lot to know more specifically what you wanted to do with it.
He's right. I tried this a while ago, and gave up since the server is so nice. However, looking at the backrub.cc file now that I can read it, there is a whole lot of setup involved. Mostly from commandline. Foldtree, the specific backrub energymethod, task, and a few other interesting things. The main piece of the code is this:
for (int i = 1; i <= option[ backrub::ntrials ]; ++i) {
std::string move_type;
// could use random mover for this...
core::Real move_prob = RG.uniform();
if (move_prob > option[ backrub::sm_prob ] + option[ backrub::sc_prob ]) {
backrubmover_->apply(*pose_copy);
move_type = backrubmover_->type();
} else if (move_prob > sc_prob) {
smallmover_.apply(*pose_copy);
move_type = smallmover_.type();
} else {
sidechainmover_.apply(*pose_copy);
move_type = sidechainmover_.type();
}
mc.boltzmann(*pose_copy, move_type);
You can do this in python. There are a decent amount of functions that are called that I have never seen to be honest. I would just copy them verbatim. If you can read a bit of C++, I think the conversion to python (without all the commandline stuff) should be possible. Not extremely simple, but definitely possible. If you still want to pursue this, let me know and I can help or do the translation for you.
Thanks for your reply, I will try it...
Hi,
I'm curious if there has been any progress on this topic. I would also like to use the backrub mover from Python / PyRosetta.
Thanks,
Tobias
Not really. The top-level logic of the backrub application is still not accessible through PyRosetta (though much of the sub-functionality is). As above, you'd have to recapitulate it in Python.
OK, thanks. If I did translate it to Python, how could I check that it's working correctly? In other words, is there a test data set included with Rosetta (or somewhere else) for which the outcome is known?
Not particularly. We have an "integration test" for the application which is available in the regular Rosetta distribution at Rosetta/main/tests/integration/tests/backrub but that's mainly for testing that the application doesn't undergo any major variations as the Rosetta codebase changes. It's not really suited for testing if a reimplementation of the protocol is functionally identical to the old version.
A better bet is to look at the published paper which uses the backrub protocol and does something similar to what you want to do. You can then re-run the analysis they did in the paper, and check that it performs similarly to what was published.
This is now fixed. Woot!
https://carbon.structbio.vanderbilt.edu/mantisbt/view.php?id=321
The class is called BackrubProtocol, the code for it was moved outside the app to enable its use in other C++ apps and PyRosetta. Movemap support was also added where contigous regions will be used as segments. You may have to import the backrub namespace into PyRosetta:
from rosetta.protocols.backrub import *
Main interface for the protocol:
br = BackrubProtocol()
br.set_movemap(my_movemap)
or
br.set_pivot_residues(vector1_of_pivots)
Info::
///@brief Set the pivot residues for backrub.
/// Will use contiguous residues as segments.
/// Within these segments, backrub will occur.
void
set_pivot_residues( utility::vector1<core::Size> pivot_residues);
///@brief Set the movemap for the whole protocol.
/// Uses contiguous backbone regions for backrub to set pivot residues
/// Within these segments, backrub will occur.
void
set_movemap( core::kinematics::MoveMapCOP movemap);
Any other options not seen in the interface can be set via cmd-line options. Documentation for more. As an example during rosetta.init():
rosetta.init(" -ignore_unrecognized_res -ignore_zero_occupancy false -ex1 -ex2 -use_input_sc"
" -antibody:numbering_scheme AHO_Scheme "
" -antibody:cdr_definition North")