You are here

usage of score3

17 posts / 0 new
Last post
usage of score3
#1

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?

Post Situation: 
Sat, 2013-09-28 02:06
Run

I try to write some code,but there are many errors in my code.
Here I list the commands:
int
main( int argc, char * argv [] )
{
using namespace basic::options;
using namespace basic::options::OptionKeys;
using std::string;
using utility::vector1;
pose1=new core::pose::Pose;
core::scoring::ScoreFunctionOP scorefxn( NULL );
scorefxn=core::scoring::ScoreFunctionFactory::create_score_function( "score3" );
core::import_pose::pose_from_pdb(*pose1,option[ in::file::s ]() );
scorefxn(pose1);
pose1.energies().show();

return 0;
}
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.

Sun, 2013-09-29 06:48
Run

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?

Sun, 2013-09-29 09:55
smlewis

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.

Mon, 2013-09-30 03:25
Run

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.

Mon, 2013-09-30 08:24
smlewis

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?

Tue, 2013-10-08 00:07
Run

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.

Tue, 2013-10-08 08:13
rmoretti

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?

Wed, 2013-10-09 06:01
Run

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

Wed, 2013-10-09 07:24
rmoretti

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.

Thu, 2013-10-10 06:50
Run

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.

Thu, 2013-10-10 07:48
rmoretti
Thank you very much.I have done it with PyRosetta.But I found a strange problem in my code. This is my code: sequence=pose_from_sequence("EQVNELKEKGNKALSVGNIDDALQCYSEAIKLDPHNHVLYSNRSAAYAKKGDYQKAYEDGCKTVDLKPDWGKGYSRKAAALEFLNRFEEAKRTYEEGLKHEANNPQLKEGLQNMEAR","centroid") pose=[sequence for num_pdbs in range(20)] scorefxn=create_score_function("score3") for i in range(0,20): ``````` for j in range(1,118): ````````````` pose[i].set_psi(j,random.uniform(-180,180)) ````````````` pose[i].set_phi(j,random.uniform(-180,180)) ````````````` pose[i].set_omega(j,random.uniform(-180,180)) ``````` ````` if j==44: ``````` ```````` print pose[i].psi(j) point 1 print pose[0].psi(44) print pose[1].psi(44) print pose[2].psi(44) print pose[3].psi(44) print pose[4].psi(44) print pose[5].psi(44) print pose[6].psi(44) print pose[7].psi(44) print pose[8].psi(44) print pose[9].psi(44) print pose[10].psi(44) print pose[11].psi(44)】 point 2 There are two points.They are the same variables,but there are different outputs. output:-93.0426166962 0.48963564042 -115.391766549 10.6383081878 -19.7441685937 21.9069586589 34.7727646045 -54.7475080459 -90.5475965485 129.341335104 78.9491708396 -57.3951992042 -87.2219873956 61.0604848777 -32.7689023039 78.1184514456 -114.185788343 -147.137974361 32.5144320936 -60.6121318652 -60.6121318652 -60.6121318652 -60.6121318652 -60.6121318652 -60.6121318652 -60.6121318652 -60.6121318652 -60.6121318652 -60.6121318652 -60.6121318652 -60.6121318652 -60.6121318652 I don't know the reason,Is it syntax error?Or I fell into the trap?I just learned python for one day,and I'm a C programmer,so I'm not clear. Another question is pose.set_chi(arg1,arg2,arg3).what's the meaning of the arg1?How should I set it as I set psi(phi,omega)?
Mon, 2013-10-14 03:05
Run

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++):

void
set_chi(
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.

Mon, 2013-10-14 07:35
smlewis

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(...)
poses.append(sequence_pose)

Mon, 2013-10-14 08:19
jadolfbr

This is my script:>>> from rosetta import *
>>> init()
>>> cen=SwitchResidueTypeSetMover("centroid")
>>> scorefxn=create_score_function("score3")
>>> pose1=pose_from_pdb("s.pdb")
>>> cen.apply(pose1)
>>> scorefxn(pose1)
28.65617607796841
>>> pose1.energies().show()

Mon, 2013-09-30 04:26
Run

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.

Sun, 2013-09-29 20:24
rmoretti

I got it.Thank you.

Mon, 2013-09-30 03:26
Run