mailr24345 - in /branches/frame_order_cleanup/specific_analyses/frame_order: geometric.py uf.py


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

Header


Content

Posted by edward on June 27, 2014 - 16:07:
Author: bugman
Date: Fri Jun 27 16:07:16 2014
New Revision: 24345

URL: http://svn.gna.org/viewcvs/relax?rev=24345&view=rev
Log:
The frame order geometric representation functions are no longer PDB specific.

Instead the format argument is accepted.  This will allow different formats 
to be supported in the
future.  Because of this change, all 
specific_analyses.frame_order.geometric.pdb_*() functions has
been renamed to create_*().


Modified:
    branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py
    branches/frame_order_cleanup/specific_analyses/frame_order/uf.py

Modified: 
branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py?rev=24345&r1=24344&r2=24345&view=diff
==============================================================================
--- branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py   
  (original)
+++ branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py   
  Fri Jun 27 16:07:16 2014
@@ -49,15 +49,17 @@
 from specific_analyses.frame_order.parameters import update_model
 
 
-def pdb_ave_pos(file=None, dir=None, force=False):
+def create_ave_pos(format='PDB', file=None, dir=None, force=False):
     """Create a PDB file of the molecule with the moving domains shifted to 
the average position.
 
-    @keyword file:  The name of the file for the average molecule structure.
-    @type file:     str
-    @keyword dir:   The name of the directory to place the PDB file into.
-    @type dir:      str
-    @keyword force: Flag which if set to True will cause any pre-existing 
file to be overwritten.
-    @type force:    bool
+    @keyword format:    The format for outputting the geometric 
representation.  Currently only the 'PDB' format is supported.
+    @type format:       str
+    @keyword file:      The name of the file for the average molecule 
structure.
+    @type file:         str
+    @keyword dir:       The name of the directory to place the PDB file into.
+    @type dir:          str
+    @keyword force:     Flag which if set to True will cause any 
pre-existing file to be overwritten.
+    @type force:        bool
     """
 
     # Printout.
@@ -78,42 +80,47 @@
     # Then translate the moving domain.
     structure.translate(T=[cdp.ave_pos_x, cdp.ave_pos_y, cdp.ave_pos_z], 
atom_id=domain_moving())
 
-    # Write out the PDB file.
-    file = open_write_file(file_name=file, dir=dir, force=force)
-    structure.write_pdb(file=file)
-    file.close()
-
-
-def pdb_distribution(file=None, dir=None, force=False):
+    # Output to PDB format.
+    if format == 'PDB':
+        file = open_write_file(file_name=file, dir=dir, force=force)
+        structure.write_pdb(file=file)
+        file.close()
+
+
+def create_distribution(format='PDB', file=None, dir=None, force=False):
     """Create a PDB file of a distribution of positions coving the full 
dynamics of the moving domain.
 
-    @keyword file:  The name of the file which will contain multiple models 
spanning the full dynamics distribution of the frame order model.
-    @type file:     str
-    @keyword dir:   The name of the directory to place the PDB file into.
-    @type dir:      str
-    @keyword force: Flag which if set to True will cause any pre-existing 
file to be overwritten.
-    @type force:    bool
+    @keyword format:    The format for outputting the geometric 
representation.  Currently only the 'PDB' format is supported.
+    @type format:       str
+    @keyword file:      The name of the file which will contain multiple 
models spanning the full dynamics distribution of the frame order model.
+    @type file:         str
+    @keyword dir:       The name of the directory to place the PDB file into.
+    @type dir:          str
+    @keyword force:     Flag which if set to True will cause any 
pre-existing file to be overwritten.
+    @type force:        bool
     """
 
     # Printout.
     subsection(file=sys.stdout, text="Creating a PDB file of a distribution 
of positions coving the full dynamics of the moving domain.")
 
 
-def pdb_geometric_rep(file=None, dir=None, size=30.0, inc=36, force=False, 
neg_cone=True):
+def create_geometric_rep(format='PDB', file=None, dir=None, size=30.0, 
inc=36, force=False, neg_cone=True):
     """Create a PDB file containing a geometric object representing the 
frame order dynamics.
 
-    @keyword file:          The name of the file of the PDB representation 
of the frame order dynamics to create.
-    @type file:             str
-    @keyword dir:           The name of the directory to place the PDB file 
into.
-    @type dir:              str
-    @keyword size:          The size of the geometric object in Angstroms.
-    @type size:             float
-    @keyword inc:           The number of increments for the filling of the 
cone objects.
-    @type inc:              int
-    @keyword force:         Flag which if set to True will cause any 
pre-existing file to be overwritten.
-    @type force:            bool
-    @keyword neg_cone:      A flag which if True will cause the negative 
cone to be added to the representation.  This is ignored for the rotor models.
-    @type neg_cone:         bool
+    @keyword format:    The format for outputting the geometric 
representation.  Currently only the 'PDB' format is supported.
+    @type format:       str
+    @keyword file:      The name of the file of the PDB representation of 
the frame order dynamics to create.
+    @type file:         str
+    @keyword dir:       The name of the directory to place the PDB file into.
+    @type dir:          str
+    @keyword size:      The size of the geometric object in Angstroms.
+    @type size:         float
+    @keyword inc:       The number of increments for the filling of the cone 
objects.
+    @type inc:          int
+    @keyword force:     Flag which if set to True will cause any 
pre-existing file to be overwritten.
+    @type force:        bool
+    @keyword neg_cone:  A flag which if True will cause the negative cone to 
be added to the representation.  This is ignored for the rotor models.
+    @type neg_cone:     bool
     """
 
     # Printout.
@@ -330,10 +337,8 @@
     # Create the PDB file.
     ######################
 
-    # Print out.
-    print("\nGenerating the PDB file.")
-
-    # Write the file.
-    pdb_file = open_write_file(file, dir, force=force)
-    structure.write_pdb(pdb_file)
-    pdb_file.close()
+    # Output to PDB format.
+    if format == 'PDB':
+        pdb_file = open_write_file(file, dir, force=force)
+        structure.write_pdb(pdb_file)
+        pdb_file.close()

Modified: branches/frame_order_cleanup/specific_analyses/frame_order/uf.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/specific_analyses/frame_order/uf.py?rev=24345&r1=24344&r2=24345&view=diff
==============================================================================
--- branches/frame_order_cleanup/specific_analyses/frame_order/uf.py    
(original)
+++ branches/frame_order_cleanup/specific_analyses/frame_order/uf.py    Fri 
Jun 27 16:07:16 2014
@@ -46,7 +46,7 @@
 from pipe_control import pipes
 from pipe_control.structure.mass import pipe_centre_of_mass
 from specific_analyses.frame_order.data import domain_moving
-from specific_analyses.frame_order.geometric import pdb_ave_pos, 
pdb_distribution, pdb_geometric_rep
+from specific_analyses.frame_order.geometric import create_ave_pos, 
create_distribution, create_geometric_rep
 from specific_analyses.frame_order.parameters import update_model
 
 
@@ -98,7 +98,7 @@
 
     # Create the average position structure.
     if ave_pos_file:
-        pdb_ave_pos(file=ave_pos_file, dir=dir, force=force)
+        create_ave_pos(file=ave_pos_file, dir=dir, force=force)
 
     # Nothing more to do for the rigid model.
     if cdp.model == 'rigid':
@@ -106,11 +106,11 @@
 
     # Create the geometric representation.
     if rep_file:
-        pdb_geometric_rep(file=rep_file, dir=dir, size=size, inc=inc, 
force=force, neg_cone=neg_cone)
+        create_geometric_rep(file=rep_file, dir=dir, size=size, inc=inc, 
force=force, neg_cone=neg_cone)
 
     # Create the distribution.
     if dist_file:
-        pdb_distribution(file=dist_file, dir=dir, force=force)
+        create_distribution(file=dist_file, dir=dir, force=force)
 
 
 def pivot(pivot=None, order=1, fix=False):




Related Messages


Powered by MHonArc, Updated Fri Jun 27 16:40:02 2014