Member Site › Forums › PyRosetta › PyRosetta – General › Writing out individual residues to a pdbfile
- This topic has 9 replies, 2 voices, and was last updated 8 years, 1 month ago by Anonymous.
-
AuthorPosts
-
-
December 8, 2016 at 3:33 pm #2544Anonymous
I’ve recently changed to a more recent version of pyrosetta (upgraded from rosetta_src_2016.18.58680_bundle to rosetta_src_2016.46.59086_bundle). One of my scripts no longer works,as it seems I can no longer find the function “dump_pdb_residue”. This function still looks like it exists in the C++ code:
In [1]: from rosetta.core.io.pdb import dump_pdb
In [2]: from rosetta.core.io.pdb import dump_pdb_residue
ImportError Traceback (most recent call last)
<ipython-input-2-5f068187bf26> in <module>()
—-> 1 from rosetta.core.io.pdb import dump_pdb_residue
ImportError: cannot import name dump_pdb_residue
Any ideas as to how to get access to this function? I’m trying to write out specific, multiple rotamers to a pdbfile.
Another issue I’ve run into is that, in my old code, dump_pdb_residue required me to pass in a rosetta.utility.OStringStream() object as the std:ostream argument. This function doesn’t seem to be availabe in the newer pyrosetta. What’s the recommended way to call this function now?
Thanks in advance.
-
December 8, 2016 at 4:58 pm #12006Anonymous
Hi,
This function did indeed get moved and completely refactored in the last chemical XRW where we rewrote the whole IO of PDB files in Rosetta and added mmCIF support.
Unfortunately, it doesn’t look like the function is eposed for some reason. It is in the same file as dump_pdb, and should be accessible. I tried it locally as well to know availe. Perhaps Sergey can comment on this.
In the meantime, what you might be able to do is copy the residue into a new Pose for each residue and output that.
/// @brief partial copy constructor
Pose( Pose const & src, Size residue_begin, Size residue_end);So, then you should be able to make the pose and copy the residue into the new pose:
p = pose_from_pdb("my_pose.pdb")
for i in range(1, p.total_residue()+1):
new_p = Pose(p, i, i)
new_p.dump_pdb("pose_residue_{}.pdb".format(i)) -
December 8, 2016 at 4:58 pm #12527Anonymous
Hi,
This function did indeed get moved and completely refactored in the last chemical XRW where we rewrote the whole IO of PDB files in Rosetta and added mmCIF support.
Unfortunately, it doesn’t look like the function is eposed for some reason. It is in the same file as dump_pdb, and should be accessible. I tried it locally as well to know availe. Perhaps Sergey can comment on this.
In the meantime, what you might be able to do is copy the residue into a new Pose for each residue and output that.
/// @brief partial copy constructor
Pose( Pose const & src, Size residue_begin, Size residue_end);So, then you should be able to make the pose and copy the residue into the new pose:
p = pose_from_pdb("my_pose.pdb")
for i in range(1, p.total_residue()+1):
new_p = Pose(p, i, i)
new_p.dump_pdb("pose_residue_{}.pdb".format(i)) -
December 8, 2016 at 4:58 pm #13048Anonymous
Hi,
This function did indeed get moved and completely refactored in the last chemical XRW where we rewrote the whole IO of PDB files in Rosetta and added mmCIF support.
Unfortunately, it doesn’t look like the function is eposed for some reason. It is in the same file as dump_pdb, and should be accessible. I tried it locally as well to know availe. Perhaps Sergey can comment on this.
In the meantime, what you might be able to do is copy the residue into a new Pose for each residue and output that.
/// @brief partial copy constructor
Pose( Pose const & src, Size residue_begin, Size residue_end);So, then you should be able to make the pose and copy the residue into the new pose:
p = pose_from_pdb("my_pose.pdb")
for i in range(1, p.total_residue()+1):
new_p = Pose(p, i, i)
new_p.dump_pdb("pose_residue_{}.pdb".format(i)) -
December 8, 2016 at 8:19 pm #12007Anonymous
Sergey pointed out that one of the new arguments to the functio could not be wrapped and that the solution to that is to use strings instead of the std::ostream &. So, the function will instead return a string that you can write out to a file or parse or do whatever you want with.
I’m implementing that now and it should be in the next PyRosetta release.
-
December 8, 2016 at 8:19 pm #12528Anonymous
Sergey pointed out that one of the new arguments to the functio could not be wrapped and that the solution to that is to use strings instead of the std::ostream &. So, the function will instead return a string that you can write out to a file or parse or do whatever you want with.
I’m implementing that now and it should be in the next PyRosetta release.
-
December 8, 2016 at 8:19 pm #13049Anonymous
Sergey pointed out that one of the new arguments to the functio could not be wrapped and that the solution to that is to use strings instead of the std::ostream &. So, the function will instead return a string that you can write out to a file or parse or do whatever you want with.
I’m implementing that now and it should be in the next PyRosetta release.
-
December 8, 2016 at 9:10 pm #12008Anonymous
Thanks Jared,
Much appreciated!
-
December 8, 2016 at 9:10 pm #12529Anonymous
Thanks Jared,
Much appreciated!
-
December 8, 2016 at 9:10 pm #13050Anonymous
Thanks Jared,
Much appreciated!
-
-
AuthorPosts
- You must be logged in to reply to this topic.