In the protocol of ClassicAbinito,stage4 finished Abinitio,why we needed a stage5 to really finish Abinitio?
And if I want to input a series of dihedral angles(or a pdb file),use Rosetta to calculate the score3,then output the score information of score3. How to write the code?I just know general usage of ClassicAbinitio ,but don't know how to let Rosetta(or object) use the input information.Is there any example code I can learn?
I try to write some code,but there are many errors in my code.
Here I list the commands:
main( int argc, char * argv  )
using namespace basic::options;
using namespace basic::options::OptionKeys;
core::scoring::ScoreFunctionOP scorefxn( NULL );
scorefxn=core::scoring::ScoreFunctionFactory::create_score_function( "score3" );
core::import_pose::pose_from_pdb(*pose1,option[ in::file::s ]() );
I create an object of pose,and set the score_function,read the input file,then calculate the energies and show.This is the first time I write code using Rosetta,there must be many foolish errors,hope you can help me to correct them.Thank you.
Stage5 appears to be a "light" version of Relax - it appears to be a polishing step.
If you want to write your own Rosetta code, there are a few things I'd try first. One, PyRosetta is probably a simpler environment for protocols-level code (which is what you're writing). It's a little hard to write deep code like rotamer repacking in python, but creating a pose and scoring it, and really calling any of the existing C++ functions, is very easy within PyRosetta. http://www.pyrosetta.org/tutorials Do you know C++? python is generally considered an easier language to learn, if not.
As for the code you have, there are several problems. The first two can be solved by taking an existing application and removing most of its code (leaving a shell to work in). Here, some of the problems are:
1) no try-catch wrapper (Rosetta executables need try-catch for exception handling; this is a minor problem)
2) no initialization of the options system with a call to devel::init at the top of main (this is a MAJOR problem - your option system calls won't work)
3) "pose1" has no type (it is implied to be a PoseOP, but implied types aren't legal in C++), but should be a core::pose::Pose
4) pose_from_pdb is usually used with a Pose&, not a PoseOP
5) ScoreFunction::operator() takes a Pose& not PoseOP (would be fine if you fixed problem 3)
I can return to you "fixed" code that does what you want, but I assume you are in it for the learning experience. You are aware that you can do all this from command line, without writing any code, with the score_jd2 application?
Thank you!I have done it by PyRosetta. Then I will try to write C++ code in Rosetta.
Can I do it with the score_jd2 application?I ran the demo in rosetta_tests/integration/tests/score_jd2,and got the trpcage.out. How should I change the flags if I want to get the score3 information. I haven't found the document about score_jd2 application.
The flag -score:weights (weightsfile) will instruct score_jd2 to use the supplied weights. You'd pass it the score3 weights (database/scoring/weights/score3.wts).
Your input PDB needs to be centroid; if it isn't, try -in:file:centroid.
Rosetta will not execute the command if there is an output file.What should I do if I want to get a result file each time I run the command without delete the old output file?
Which output file are you referring to?
score_jd2 should simply concatenate the results onto the end of the specified scorefile. If you want to change which scorefile it outputs to, there are commandline flags for that. (I think the one for score_jd2 is -out:file:scorefile.)
If you're talking about output PDBs (the only file I'm aware of where Rosetta won't overwrite), then score_jd2 shouldn't produce output PDBs by default. But for any Rosetta protocol that outputs PDBs, you can add a prefix/suffix for particular runs with the -out:prefix and -out:suffix options. - Though for more complex things, I'd recommend using separate directories, instead.
I want to call score_jd2 many times in the external C++ program,and use C++ program to change the input pdb files,then get many scorefiles rather than overwrite them. Can I achieve this by changing flags?
Sure. Just use the -out:file:scorefile option (I just tested it, and it should work with score_jd2). For example:
score_jd2.linuxgccrelease -s MyProtein1.pdb -out:file:scorefile MyScore1.sc
score_jd2.linuxgccrelease -s MyProtein2.pdb -out:file:scorefile MyScore2.sc
Does Rosetta have the interface that can transform a series of dihedral angles to a pdb file(x,y,z coordinates)? Can we use it easily? I can't find it in the user guides,so ask you for help.
I'm not aware of an existing one in the command line version.
It's easy enough to do with PyRosetta, though. Just load/create a pose with the appropriate sequence (at this point it doesn't matter what the coordinates are). - You can use the core.pose.make_pose_from_sequence() function if you have a single-chain sequence as a string. - Then you would use the set_phi(), set_psi(), set_omega() and set_chi() functions to set the backbone and sidechain dihedral angles. If you then try to access the xyz coordinates (or just output it as a PDB), the coordinates will represent the dihedrals which you set.
If you're willing to do some simple C++ coding and compiling, the same can be done with "standard" Rosetta by making a new (purpose-built) application.
Regarding the user guide, you can get there by clicking the "Manual" link in the upper right corner of most RosettaCommons pages (like this one). The links to the version specific guides are on the left. For PyRosetta, just go to http://www.pyrosetta.org/documentation - Other documentation exists, too, but those are the main webpages for Rosetta manuals.
It's easier to read code if you include it as an attached file (saved as a .txt) - that will maintain spacing.
pose.set_chi's function signature (in the underlying C++):
int const chino,
Size const seqpos,
Real const setting
So, the first argument is which chi (for example, lysine has 4 chi angles), the second is which residue, and the last is what value to set to. (If you want to randomize ALL the chi angles, use code that first queries the number of chi angles (pose.residue(N).nchi()), then iterate through that many chi).
Finally, the error is almost certainly due to shallow copying - you think you have 20 poses in a list, but you have 20 POINTERS to the same pose in the list. Notice that the -60.6121318652 value occurs as the 20th and final of the first iteration, then is copied for the second set of manual iterations. This is a common python/C++ interface problem. I'm not sure what the best solution is (I don't use PyRosetta), but I think you need to run pose_from_sequence twenty times instead of just once.
You will want to use the pose.assign(new_pose) function, or put the sequence= pose_from_sequence within the for loop, appending to your list:
Like Steven said, your syntax is shallow copying the pose 20 times in your list. So, when you change one, they all change.
poses = 
for i in range(0, 20):
sequence_pose = pose_from_sequence(...)
This is my script:>>> from rosetta import *
I may be misunderstanding your question, but stage 5 shouldn't be running by default with classic abinitio. The stage with score3 should be the last one to run. You have to explicitly use the flag "-abinitio:include_stage5" in your flags file/commandline in order to have it be active.
I got it.Thank you.