Changing constraints code and compiling

5 posts / 0 new
Changing constraints code and compiling
#1

Dear Rosetta community,

after reading a lot of helpful posts I managed to compile Rosetta 3.4 on Ubuntu 11.04 in a virtual machine on Windows 7. It runs without any problems and abinitio folding actually works.
I wanted to add a new constraint function (just to test some weird idea, don't ask), unfortunately I neither speak C++, nor understand how the inner organs of Rosetta work.
What I need/want is a constraint function which is identical to the existing BOUNDED function but returns -1 instead of 0 when the constraint is fulfilled. Initially I tried to copy the BoundConstraint.cc/hh/fwd.hh files in the core/scoring/constraints directory, renamed them and changed the code ("delta = 0" was replaced by "delta = -1" in all instances). I then copied the lines where BoundFunction/BoundConstraint is mentioned in the funcfactory.cc file and changed the names to my filenames. When trying to compile it with under the same conditions which previously worked I got the following error "undefined reference to vtable for".

I then tried to change the BoundConstraint files itself, thereby replacing the the BOUND function but after successful compiling it still returns 0 instead of -1.

Anybody who can guide me how to properly add the new function or how to change the existing function?
"Go, learn C++ and study the Rosetta code!" is also an appropriate answer....

Thanks!

Post Situation:
Sat, 2013-07-06 05:13
Ashafix

The first thing I would recommend is to learn Python and PyRosetta instead. Also not easy, but worth it if you want to extend and tweak things. You could easily define a function or a class that got the constraint score from a scorefunction and if zero, would return -1. This would be the easiest option, but then you wouldn't really be able to do Abinitio in PyRosetta, unfortunately. You could, however, analyze your resultant folds from C++ application by this method.

If your looking to get information on the number of constraints satisfied vs the number of ones unsatisfied, you can access the constraint_set of a pose in PyRosetta, and get a score for each constraint in the set. If 0, you would give it -1, loop through all the constraints, and return your new score that your looking for. There is also a function show_violations of class constraint, which prints out detailed info on each constraint you could use.

The error your getting from vtable is because you have to tell scons about your filename. To do this, you would need to change src/core.3.src.settings where bound constraint is mentioned to your filename.

Unfortunatley, looking through the code, its not obvious to me why changing delta to -1 didn't work besides how the combo of func + constraint_type may effect the score. What constraint type are you using?

-Jared

Sun, 2013-07-07 18:59
jadolfbr

The first thing I would recommend is to learn Python and PyRosetta instead.
This is what I did, easier than installing Linux and Rosetta on a Windows PC. The "abinitio" code I wrote in PyRosetta with the custom made constraint function worked but PyRosetta can't compete in terms of speed with Rosetta, so I was trying to implement it into Rosetta.

The error your getting from vtable is because you have to tell scons about your filename. To do this, you would need to change src/core.3.src.settings where bound constraint is mentioned to your filename.
Thanks! I'll have a look at this file and see if it fixes the problem. The results will be posted later.

What constraint type are you using?
I'm not sure what do you mean. The constraint function I was using in the constraint file is "BOUNDED". The sample in my file looks something like that (sorry, different computer, don't have the file handy):
AtomPair CA 1 CA 2 BOUNDED 3 10 1

Mon, 2013-07-08 08:33
Ashafix

If the only difference is that you want the function to range from -1 to infinity instead of 0 to infinity, you may want to just add an additional constant offset to your atom pair in your constraint file (You can have multiple constraints to the same degrees of freedom.)

So instead of something like

AtomPair CA 1 CA 2 BOUNDED 3 10 0.5 tag

(You need the tag with bounded constraints, and having the third number be anything but 0.5 is mathematically unstable.)

You would have

AtomPair CA 1 CA 2 BOUNDED 3 10 0.5 tag AtomPair CA 1 CA 2 CONSTANTFUNC -1

This will effectively shift the value of the constraint down by a constant -1.

Why you would want to do this escapes me at the moment, but that's probably the easiest way to do it.

Mon, 2013-07-08 11:17
rmoretti

The error your getting from vtable is because you have to tell scons about your filename. To do this, you would need to change src/core.3.src.settings where bound constraint is mentioned to your filename.
I added a line in the "core/scoring/constraints" section and it compiled without any problems. Many thanks!

This will effectively shift the value of the constraint down by a constant -1.
Why you would want to do this escapes me at the moment, but that's probably the easiest way to do it.

Thanks, this also worked. Would have been much easier than to compile everything from scratch but at least now I know how to do it.

Wed, 2013-07-10 12:42
Ashafix