Writing out individual residues to a pdbfile

Member Site Forums PyRosetta PyRosetta – General Writing out individual residues to a pdbfile

Viewing 6 reply threads
  • Author
    Posts
    • #2544
      Anonymous

        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.

         

      • #12006
        Anonymous

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

           

        • #12527
          Anonymous

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

             

          • #13048
            Anonymous

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

               

            • #12007
              Anonymous

                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.

              • #12528
                Anonymous

                  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.

                • #13049
                  Anonymous

                    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.

                  • #12008
                    Anonymous

                      Thanks Jared,

                      Much appreciated!

                    • #12529
                      Anonymous

                        Thanks Jared,

                        Much appreciated!

                      • #13050
                        Anonymous

                          Thanks Jared,

                          Much appreciated!

                      Viewing 6 reply threads
                      • You must be logged in to reply to this topic.