You are here

Residue.set_chi() does not update internal state?

6 posts / 0 new
Last post
Residue.set_chi() does not update internal state?
#1

Under Residue.chi() there is a warning

CAUTION: This function does not cause updating to any internal coordinate data. See Residue::set_chi() and Residue::set_all_chi() functions for versions which handle coordinate updates.

But in code it seems that Residue::set_chi() and Residue::set_all_chi()  (at least in pyrosetta) do not update internal data as well. Is this a bug or a feature?

Also, can I update the internal state manually?

An example notebook is here.

Thank you for your help,
Ajasja

Category: 
Post Situation: 
Wed, 2014-09-24 09:19
ajasja

Scoring information is stored in Pose along with the Conformation. One is never meant to set anything in a Conformation's Residue object directly, but only through Pose or Conformation. The function you are looking for is Pose.set_chi().

Mon, 2014-09-29 13:42
Labonte

Would it be possible to add a warning »Caution: …« to the documentation of  Residue::set_chi() and Residue::set_all_chi() as well? I'm sure that would be helpful to future users.

Tue, 2014-09-30 01:53
ajasja

So the documentation is OK in newer versions - read only access. I'm surprised that PyRosetta didn't balk when you tried to use the set function. You can access a non-const version of conformation through pose and it looks like you can use set_torsion to set the particular torsion you need.

In [4]: p.residue(1)?
Type: instancemethod
String Form:<bound method Pose.residue of <rosetta.core.pose.Pose object at 0x969e6e0>>
Docstring:
residue( (Pose)arg1, (int)seqpos) -> Residue :
Returns the Residue at position <seqpos> (read access)
Note: this method will trigger a refold if either the
torsions or the coordinates are out-of-date
example(s):
pose.residue(4)
See also:
Pose
Pose.sequence
Pose.total_residue
Residue
ResidueType

C++ signature :
core::conformation::Residue residue(core::pose::Pose {lvalue},unsigned long)

In [5]:

Wed, 2014-10-01 13:49
jadolfbr

I'm sorry, I don't see in the documentation where it says that set_chi and set_chi_all have read-only access?
Or is it the residue that is supposed to be read only?

My code is now working perfectly using pose.set_chi. But I was a bit perplexed that pose.residue(1).set_chi does not have the intended effect.

Thank you & best regards,
Ajasja

Thu, 2014-10-02 01:32
ajasja

One of the issues that you're running into is that Rosetta has to be able to work back-and-forth between internal coordinate representation (bond lengths, angles and dihedrals) and a Cartesian representation. There's various internal optimizations to make sure that this conversion is done efficiently, and you don't needlessly recalculate things that would be wasted. The problem is that the optimization works best when done through the Pose interface - it's the Pose that's keeping track of the updates. To a limited extent the Residue object itself can keep track of its own conversions, but it doesn't know about the Pose's optimizations and the various things that are being tracked on the pose-level.

So if you were working with an isolated Residue object, you could work with the residue.set_chi() functions, and all would be well. The issue you ran into was you were updating a Residue which was within a Pose, and then using Pose-level access (scoring the pose). This means that the Pose optimizations weren't appropriately advised of the updates to the Residue coordinates, resulting in them not being properly updated for the movement.

You're right that the documentation for those functions probably should be more forthcoming about not being recommended for use with a Residue within a Pose.

Mon, 2014-10-06 14:37
rmoretti