mailr18861 - /branches/frame_order_testing/auto_analyses/frame_order.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on March 18, 2013 - 15:53:
Author: bugman
Date: Mon Mar 18 15:53:07 2013
New Revision: 18861

URL: http://svn.gna.org/viewcvs/relax?rev=18861&view=rev
Log:
The frame order PDB representation and visualisation script are now created 
after optimisation.

This is for the frame order auto-analysis.  The optimise() method has 
therefore been renamed to
nested_models() as it now does more than just optimisation.


Modified:
    branches/frame_order_testing/auto_analyses/frame_order.py

Modified: branches/frame_order_testing/auto_analyses/frame_order.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_testing/auto_analyses/frame_order.py?rev=18861&r1=18860&r2=18861&view=diff
==============================================================================
--- branches/frame_order_testing/auto_analyses/frame_order.py (original)
+++ branches/frame_order_testing/auto_analyses/frame_order.py Mon Mar 18 
15:53:07 2013
@@ -129,7 +129,7 @@
         # Execute the full protocol.
         try:
             # The nested model optimisation protocol.
-            self.optimise()
+            self.nested_models()
 
             # The final results does not already exist.
             if not self.read_results(model='final', pipe_name='final'):
@@ -150,8 +150,8 @@
                 # Finish.
                 self.interpreter.results.write(file='results', force=True)
 
-            # Results visualisation.
-            self.visualisation()
+            # Visualisation of the final results.
+            self.visualisation(model='final')
 
         # Clean up.
         finally:
@@ -316,7 +316,7 @@
             cdp.cone_theta_y = pipe.cone_theta
 
 
-    def optimise(self):
+    def nested_models(self):
         """Protocol for the nested optimisation of the frame order models."""
 
         # First optimise the rigid model using all data.
@@ -343,6 +343,9 @@
                 # Re-perform model elimination just in case.
                 self.interpreter.eliminate()
 
+                # The PDB representation of the model and visualisation 
script (in case this was not completed correctly).
+                self.visualisation(model=model)
+
                 # Skip to the next model.
                 continue
 
@@ -386,6 +389,9 @@
             # Save the results.
             self.interpreter.results.write(dir=model, force=True)
 
+            # The PDB representation of the model and visualisation script.
+            self.visualisation(model=model)
+
 
     def optimise_rigid(self):
         """Optimise the rigid frame order model.
@@ -406,6 +412,10 @@
 
         # The results file already exists, so read its contents instead.
         if self.read_results(model=model, 
pipe_name=self.pipe_name_dict[model]):
+            # The PDB representation of the model (in case this was not 
completed correctly).
+            self.interpreter.frame_order.pdb_model(dir=model, force=True)
+
+            # Nothing more to do.
             return
 
         # Create the data pipe using the full data set, and switch to it.
@@ -440,6 +450,9 @@
 
         # Save the results.
         self.interpreter.results.write(dir=model, force=True)
+
+        # The PDB representation of the model.
+        self.interpreter.frame_order.pdb_model(dir=model, force=True)
 
 
     def print_results(self):
@@ -557,37 +570,36 @@
         return True
 
 
-    def visualisation(self):
-        """Create visual representations of the frame order results.
+    def visualisation(self, model=None):
+        """Create visual representations of the frame order results for the 
given model.
 
         This includes a PDB representation of the motions (the 'cone.pdb' 
file located in each model directory) together with a relax script for 
displaying the average domain positions together with the cone/motion 
representation in PyMOL (the 'pymol_display.py' file, also created in the 
model directory).
+
+        @keyword model:     The frame order model to visualise.  This should 
match the model of the current data pipe, unless the special value of 'final' 
is used to indicate the visualisation of the final results.
+        @type model:        str
         """
 
-        # Loop over all models.
-        for pipe_name in self.pipe_name_list + ['final']:
-            # Switch to the data pipe.
-            self.interpreter.pipe.switch(pipe_name)
-
-            # The directory to place files into.
-            if pipe_name == 'final':
-                results_dir = pipe_name
-            else:
-                results_dir = cdp.model
-
-            # Create a PDB file representation of the motions.
-            self.interpreter.frame_order.pdb_model(file='frame_order.pdb', 
dist_file='frame_order_distribution.pdb', dir=results_dir, force=True)
-
-            # Create the visualisation script.
-            script = open_write_file(file_name='pymol_display.py', 
dir=results_dir, force=True)
-
-            # Add a comment for the user.
-            script.write("# relax script for displaying the frame order 
results of this '%s' model in PyMOL.\n\n" % results_dir)
-
-            # The script contents.
-            script.write("# PyMOL visualisation.\n")
-            script.write("pymol.view()\n")
-            script.write("pymol.command('show spheres')\n")
-            script.write("pymol.frame_order(file='frame_order.pdb', 
dist_file='frame_order_distribution.pdb')\n")
-
-            # Close the file.
-            script.close()
+        # Sanity check.
+        if model != 'final' and model != cdp.model:
+            raise RelaxError("The model '%s' does not match the model '%s' 
of the current data pipe." % (model, cdp.model))
+
+        # The directory to place files into.
+        results_dir = model
+
+        # The PDB representation of the model.
+        self.interpreter.frame_order.pdb_model(dir=results_dir, force=True)
+
+        # Create the visualisation script.
+        script = open_write_file(file_name='pymol_display.py', 
dir=results_dir, force=True)
+
+        # Add a comment for the user.
+        script.write("# relax script for displaying the frame order results 
of this '%s' model in PyMOL.\n\n" % results_dir)
+
+        # The script contents.
+        script.write("# PyMOL visualisation.\n")
+        script.write("pymol.view()\n")
+        script.write("pymol.command('show spheres')\n")
+        script.write("pymol.frame_order(file='frame_order.pdb', 
dist_file='frame_order_distribution.pdb')\n")
+
+        # Close the file.
+        script.close()




Related Messages


Powered by MHonArc, Updated Mon Mar 18 16:20:02 2013