Member Site › Forums › PyRosetta › PyRosetta – General › Residue.set_chi() does not update internal state?
- This topic has 5 replies, 4 voices, and was last updated 10 years, 2 months ago by Anonymous.
-
AuthorPosts
-
-
September 24, 2014 at 4:19 pm #2003Anonymous
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?
Thank you for your help,
Ajasja
-
September 29, 2014 at 8:42 pm #10358Anonymous
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().
-
September 30, 2014 at 8:53 am #10365Anonymous
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.
-
October 1, 2014 at 8:49 pm #10381Anonymous
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:>
Docstring:
residue( (Pose)arg1, (int)seqpos) -> Residue :
Returns the Residue at position(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
ResidueTypeC++ signature :
core::conformation::Residue residue(core::pose::Pose {lvalue},unsigned long)In [5]:
-
October 2, 2014 at 8:32 am #10382Anonymous
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 -
October 6, 2014 at 9:37 pm #10388Anonymous
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.
-
-
AuthorPosts
- You must be logged in to reply to this topic.