Member Site Forums PyRosetta PyRosetta – General Fragment Quality

Viewing 6 reply threads
  • Author
    Posts
    • #2701
      Anonymous

        Dear All,

         

        I am trying to measure the quality of the 9-mer fragment file in order to debug the Abinitio fold of a structure I have designed. I am trying to do it in PyRosetta.

         

        This is my script so far:


        #Choose Fragment
        fragset = ConstantLengthFragSet(9)
        fragset.read_fragment_file('9-mer')

        #Setup Calculator
        calc = FragQualCalculator(fragset , 1.0 , 30.0)

        Am I in the right track?

        What should I do next? FragQualCalculator() does not have an .apply() method.

         

         

         

      • #13594
        Anonymous

           FragQualCalculator is a PoseMetricCalculator, not a mover. The main interface to that isn’t an apply() function, but rather a get() function.

          There’s two versions. The easiest is probably a `get(  key, Pose )` interface, which returns the value as a string. The `key` parameter is a string which tells the calculator what type of value you’re looking for. (Which values this can take depends on the calculator.) For the FragQualCalculator, the key is either “num_goodfrag” (” number of fragments within rmsd cutoff”) or “coverage” (“ratio of the region where good fragments are included more than XXX%”)

           

        • #13596
          Anonymous

            ok,

             

            my final code:


            #Choose Fragment
            fragset = ConstantLengthFragSet(9)
            fragset.read_fragment_file('9-mer')

            #Run Calculator
            calc = FragQualCalculator(fragset , 1.0 , 30.0)
            frags = calc.get('num_goodfrag' , pose)
            print(frags)

             

            so I get this result: 184

            Is this correct? is this the output i should expect? so does this mean that i have 184 fragments that are below 1Å?

            • #13603
              Anonymous

                I don’t have extensive experience with the FragQualCalculator, but from what I can see, that seems to be the correct interpretation.

                I might suggest playing around with different parameters (e.g. varying the cutoff and which residue you’re interested in) and seeing if the changes match what you would expect. (e.g. tightening the cutoff should reduce the number of fragments passing, and you should get variation in the number based on where in the protein you’re looking. E.g. you’ll get more fragments passing the cutoff for helicies and possibly sheets than you would for loop regions.)

            • #13605
              Anonymous

                I understand,

                 

                I got it working just fine. Thank you

                 

                I do have another question regarding fragments, this time using the ClassicFragmentMover()

                When i use the mover it inserts fragments randomly, i.e every time i .apply(pose) i get a fragment inserted at a different location. my question is: how can i control which fragment at which position gets inserted? I found this method .choose_fragment() but i am not sure how it works, is it the correct one? i think i need a FrameList? how do i set it up?


                pose_copy = Pose()
                pose_copy.assign(pose)

                fragset = ConstantLengthFragSet(9)
                fragset.read_fragment_file('aat000_09_05.200_v1_3')

                movemap = MoveMap()
                movemap.set_bb(True)

                mover = ClassicFragmentMover(fragset, movemap)
                mover.choose_fragment(???? , pose , 1 , 1) #<
                problem here
                mover.apply(pose_copy)

                RMSD = rosetta.core.scoring.CA_rmsd(pose , pose_copy)
                print(RMSD)

                 

                 

                For a start i want to insert only first fragment of first position.

                 


                UPATE


                I kept on working on the script and added the FrameList() method that seems to get me closer to making it work, but not there yet. I end up with a segmentation fault (core dumped)


                pose_copy = Pose()
                pose_copy.assign(pose)

                fragset = ConstantLengthFragSet(9)
                fragset.read_fragment_file('aat000_09_05.200_v1_3')

                movemap = MoveMap()
                movemap.set_bb(True)

                frame = FrameList()
                frame.resize(9) #<
                Maybe it does not like this?

                mover = ClassicFragmentMover(fragset, movemap)
                mover.choose_fragment(frame , pose , 1 , 1)
                mover.apply(pose_copy)

                RMSD = rosetta.core.scoring.CA_rmsd(pose , pose_copy)
                print(RMSD)



                #>>>> Output is Segmentation fault (core dumped)

                 

                 

                Any idea what i am missing?

                 

                 

                • #13610
                  Anonymous

                    Three options you might try.

                    The first is that there’s a `apply(pose, pos)` function on ClassicFragmentMover, which looks like it applies fragments at a given position.

                    Another option is to use the `define_start_window(pos)` method of ClassicFragmentMover to define a window start. (Basically where the fragment is being inserted.)

                    The third is to use the `set_movemap( mm )` method to set a movemap for your pose. Only regions where the movemap lists the backbone torsions as being mobile will be sampled.

                     

                    If you can get away with it, I’d probably recommend the last (the MoveMap). However, if you make the MoveMap too restrictive (e.g. only one fragment within a large protein), the internal error accounting in ClassicFragmentMover might not be able to handle it and you’d get some spurious errors. (Basically, it will try random fragment insertion, and will skip inserting if the Movemap tells it not to. If that happens too often, it will give up.)

                     

                • #13612
                  Anonymous

                    the `apply(pose, pos)` seems straight forward, insert fragment at position 1, but there are 200 fragment for position 1, how can i choose (for example) spesifically fragment 3 to be inserted at position 1? instead of randmoly choose one of the 200 fragments at position 1?

                     

                    just to be clear about my intentions: I am trying to measure the RMSD for each fragment at every position. which is why i don’t want the randomness and want to control which gets measured (go down the list of fragments), and that is why the MoveMap will not work because i do need it to be restrictive.

                    • #13613
                      Anonymous

                        Ah, then you probably want to bypass the ClassicFragmentMover altogether, as the point of the ClassicFragmentMover is to do a random sampling.

                        Instead, I’d go directly to the functions which ClassicFragmentMover is using to apply the fragment insertion. Specifically, this is 


                        Frame.apply( movemap, frag_num, pose )

                        The tricky bit is how to construct the Frame object which does the apply. If you have a FragSet already, that’s somewhat straightforward. Something like the following might work (Caution – I haven’t tested this, so there may be some debugging needed):


                        fragset = ConstantLengthFragSet(9)
                        fragset.read_fragment_file('aat000_09_05.200_v1_3')

                        frames = FrameList()
                        fragset.frames( respos, frames )

                        for frame in frames:
                        for frag_num in range( 1, frame.nr_frags() + 1 ):
                        frame.apply( movemap, frag_num, pose )
                        # Do your calculations here

                         

                         

                    • #13614
                      Anonymous

                        ok,

                         

                        I ran the code, but i did not understand this line:

                        fragset.frames(respos , frames)

                        What is respos? am i supposed to make a copy of my pose? or is it my pose? or is it something else?

                         

                        the rest of the code seems to be fine, when i run it without the line i just told you about, no errors come back, (but of course not reult either)

                        so just clarify what is the respos, and i hope this will work.

                      • #13615
                        Anonymous

                          it is residue position, i figured it out. ;-)

                           

                          the script works perfectly, thank you :-)

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