newbie question re pose syntax

Member Site Forums PyRosetta PyRosetta – General newbie question re pose syntax

Viewing 4 reply threads
  • Author
    Posts
    • #3120
      Anonymous

        Hello :

        I am learning the basics of pyrosetta from this tutorial 

        https://graylab.jhu.edu/pyrosetta/downloads/documentation/PyRosetta_Manual.pdf

        but when I enter the code verbatim I get an error.

        is  something wrong with the syntax they give?  trying to do this:

         

        2.1 Exploring the Pose object To load a PDB file you have to first create an empty pose object, and then assign a PDB structure to that pose: >>my_pose = Pose() >>pose_from_pdb( my_pose, “test.pdb” )

         

         

        but i get this error:

         

         

        In [3]: my_pose = Pose()                                                                 

        In [4]: pose_from_pdb( my_pose, “coords.pdb” )                                           


        TypeError                                 Traceback (most recent call last)

        <ipython-input-4-80299edb3231> in <module>

        —-> 1 pose_from_pdb( my_pose, “coords.pdb” )

        TypeError: pose_from_pdb() takes 1 positional argument but 2 were given

         

        Have I not set up python or pyrosetta correctly?

         

        thank you!  – Amy

         

         

         

         

      • #14659
        Anonymous

          Hi, 

           

          Yes, this has indeed changed.  The version of docs you showed is a very very old version, did google pull it up? I would use the tutorials as they are much more up-to-date.

          http://www.pyrosetta.org/tutorials

           

          • #14661
            Anonymous

              thank you!

          • #14669
            Anonymous

              What version of python are you using?

               

              As for the secstruct – for some reason that function has been removed, unfortunately. You can access the same information using the DSSPMover:

               


              DSSP = pyrosetta.rosetta.protocols.moves.DsspMover()
              DSSP.apply(pose) # populates the pose's Pose.secstruct
              ss = pose.secstruct()

              • #14670
                Anonymous

                  I am using python3, but 2.7 is also installed.  Is there a more current tutorial/manual available?  sincere thanks, Amy

                   

                  root@e8ffeae28685:/opt/PyRosetta4.Release.python36.ubuntu.release-213# python –version

                  Python 2.7.15rc1

                  root@e8ffeae28685:/opt/PyRosetta4.Release.python36.ubuntu.release-213# python3 –version

                  Python 3.6.7

                  root@e8ffeae28685:/opt/PyRosetta4.Release.python36.ubuntu.release-213#

                   

                   

                  python2.x doesn’t even import pyrosetta :

                   

                  Traceback (most recent call last):

                   File “<stdin>”, line 1, in <module>

                   File “pyrosetta/__init__.py”, line 15, in <module>

                     import pyrosetta.rosetta as rosetta

                  ImportError: pyrosetta/rosetta.so: undefined symbol: PyInstanceMethod_Type

                  >>>

                   

                   

                   

                • #14672
                  Anonymous

                    If you are using python3, the print statement is different – you need to do print(“something”), instead of print “something.”.  The tutorials are all written for python2.

                     

                    We have a new set of in-depth lectures and tutorials from our first Rosetta Code School this past January that will eventually go onto the PyRosetta website. Hopefully next year they will also be recorded and go on youtube.  Till then, you can find them here: https://drive.google.com/drive/folders/1cF48qvjqKxwuAaizLYx9uFLG1wDf1I-I?usp=sharing

                    Note that the parellelization labs may be out of date and these may not reflect your own current working environment, but can be used as a general guide. The PyRosetta notebooks are for python3.

                  • #14673
                    Anonymous

                      thank you so much! – Amy

                  • #14674
                    Anonymous

                      ipython3 can at least import pyrosetta, python 2.x  will not even load 

                       

                      root@e8ffeae28685:/opt/PyRosetta4.Release.python36.ubuntu.release-213# python

                      Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15)  

                      [GCC 7.3.0] on linux2

                      Type “help”, “copyright”, “credits” or “license” for more information.

                      >>> from pyrosetta import *

                      Traceback (most recent call last):

                       File “<stdin>”, line 1, in <module>

                       File “pyrosetta/__init__.py”, line 15, in <module>

                         import pyrosetta.rosetta as rosetta

                      ImportError: pyrosetta/rosetta.so: undefined symbol: PyInstanceMethod_Type

                      >>> from rosetta import *

                      __main__:1: UserWarning: Import of ‘rosetta’ as a top-level module is deprecated and may

                      be removed in 2018, import via ‘pyrosetta.rosetta’.

                      Traceback (most recent call last):

                       File “<stdin>”, line 1, in <module>

                       File “rosetta/__init__.py”, line 21, in <module>

                         import pyrosetta.rosetta

                       File “pyrosetta/__init__.py”, line 15, in <module>

                         import pyrosetta.rosetta as rosetta

                      ImportError: pyrosetta/rosetta.so: undefined symbol: PyInstanceMethod_Type

                      >>>

                       

                      • #14677
                        Anonymous

                          Yes, a different python version requires a different version of PyRosetta.  On the website, you can choose between python3 or python2 PyRosetta binaries.

                      • #14666
                        Anonymous

                          more syntax issues :  the tutorial you mentioned has been helpful except :  when I do this

                          4. Examine the protein using a variety of query functions: print pose

                          print pose.sequence() print “Protein has”, pose.total_residue(), “residues.” print pose.residue(500).name()

                           

                          I have to use print(pose) getting :

                           

                          In [9]: print pose

                           File “<ipython-input-9-153cd38136af>”, line 1

                             print pose

                                      ^

                          SyntaxError: Missing parentheses in call to ‘print’. Did you mean print(pose)?

                          which works

                           

                          In [10]: print (pose)

                          PDB file name: coords.clean.pdb

                          Total residues:460

                          Sequence: KLPPSPPGWLPVIGHAHLMKNLLHRTLYDFSQKLGPIFSIRFGSRLVVVVSSSSLVEECFTKYDIVLANRPQASVDRR

                          SLGFSTTSVIGAPYGDHWRNLRKLCDLEVFAPTRLASFLSIRLDERDRMISALYKISSAGFAKVNLEAKIVELTFNNIMRMVAAKRYY

                          GEEAEDDEEAKRTSPEKIDLNEGSGITLPKAKTLEAMCKPR

                          Fold tree:

                          FOLD_TREE  EDGE 1 460 -1

                           

                           

                          but then i get:

                           

                          In [11]: print pose.sequence()

                           File “<ipython-input-11-0b1e6b8f7d13>”, line 1

                             print pose.sequence()

                                      ^

                          SyntaxError: invalid syntax

                           

                          thanks in advance for your kind assistance

                           

                          also my sequence has 506 amino acids, and I get 460 reported by rosetta?

                           

                          also… this isn’t working either

                           

                          In [22]: from pyrosetta.toolbox import get_secstruct


                          ImportError                               Traceback (most recent call last)

                          <ipython-input-22-0b79146a0f8b> in <module>()

                          —-> 1 from pyrosetta.toolbox import get_secstruct

                          ImportError: cannot import name ‘get_secstruct’

                           

                           

                           

                           

                           

                           

                           

                           

                          • #14678
                            Anonymous

                              If you are on python3 – ALL print statements will have parenthesis.  This is the major change from Python2 to python3.  

                               

                              As for the get_secstruct(), I’m not sure exactly what happened to it and I’ve asked other developers who would know.  In the meantime, you can use syntax described here: https://www.rosettacommons.org/node/10473

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