Author: bugman Date: Wed Nov 21 08:41:46 2012 New Revision: 18013 URL: http://svn.gna.org/viewcvs/relax?rev=18013&view=rev Log: Added some code to allow for results visualisation in the frame order auto-analysis. This creates the 'cone.pdb' file representation of the motion and a relax script for launching the visualisation later on. 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=18013&r1=18012&r2=18013&view=diff ============================================================================== --- branches/frame_order_testing/auto_analyses/frame_order.py (original) +++ branches/frame_order_testing/auto_analyses/frame_order.py Wed Nov 21 08:41:46 2012 @@ -38,6 +38,7 @@ from maths_fns.coord_transform import spherical_to_cartesian from prompt.interpreter import Interpreter from relax_errors import RelaxError +from relax_io import open_write_file from status import Status; status = Status() @@ -138,6 +139,9 @@ # Finish. self.interpreter.results.write(file='results', force=True) + # Results visualisation. + self.visualisation() + # Clean up. finally: # Finish and unlock execution. @@ -499,3 +503,43 @@ # Success. return True + + + def visualisation(self): + """Create visual representations of the frame order results. + + 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). + """ + + # Loop over all models. + for pipe_name in self.models.values() + ['final']: + # The directory to place files into. + if pipe_name == 'final': + results_dir = pipe_name + else: + results_dir = cdp.model + + # Switch to the data pipe. + self.interpreter.pipe.switch(pipe_name) + + # Create a PDB file representation of the motions. + if cdp.model != 'rigid': + self.interpreter.frame_order.cone_pdb(file='cone.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("# Load the relax state file.\n") + script.write("state.load('results')\n") + script.write("\n") + script.write("# PyMOL visualisation.\n") + script.write("pymol.view()\n") + script.write("pymol.command('show spheres')\n") + script.write("pymol.cone_pdb('cone.pdb')\n") + + # Close the file. + script.close()