Author: bugman Date: Tue Jul 1 18:08:30 2014 New Revision: 24385 URL: http://svn.gna.org/viewcvs/relax?rev=24385&view=rev Log: Started to redesign the frame_order.pdb_model user function. Instead of having the positive and negative representations in different PDB models, and the Monte Carlo simulations in different molecules, these will now all be shifted into separate files. For this to be possible, the file root rather than file names must now be supplied to the frame_order.pdb_model user function. To allow for different file compression, the compress_type argument is now used. The backend code correctly handles the file root change, but the multiple files are not created yet. Modified: branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py branches/frame_order_cleanup/specific_analyses/frame_order/uf.py branches/frame_order_cleanup/user_functions/frame_order.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=24385&r1=24384&r2=24385&view=diff ============================================================================== --- branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py (original) +++ branches/frame_order_cleanup/specific_analyses/frame_order/geometric.py Tue Jul 1 18:08:30 2014 @@ -365,17 +365,19 @@ rotor(structure=structure, rotor_angle=rotor_angle[i], axis=axis[i], axis_pt=pivot[i], label=label[i], centre=com[i], span=span[i], blade_length=5e-10, staggered=staggered[i]) -def create_ave_pos(format='PDB', file=None, dir=None, force=False): +def create_ave_pos(format='PDB', file=None, dir=None, compress_type=0, force=False): """Create a PDB file of the molecule with the moving domains shifted to the average position. - @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 + @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 compress_type: The compression type. The integer values correspond to the compression type: 0, no compression; 1, Bzip2 compression; 2, Gzip compression. + @type compress_type: int + @keyword force: Flag which if set to True will cause any pre-existing file to be overwritten. + @type force: bool """ # Printout. @@ -398,43 +400,47 @@ # Output to PDB format. if format == 'PDB': - file = open_write_file(file_name=file, dir=dir, force=force) + file = open_write_file(file_name=file+'.pdb', dir=dir, compress_type=compress_type, force=force) structure.write_pdb(file=file) file.close() -def create_distribution(format='PDB', file=None, dir=None, force=False): +def create_distribution(format='PDB', file=None, dir=None, compress_type=0, force=False): """Create a PDB file of a distribution of positions coving the full dynamics of the moving domain. - @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 + @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 compress_type: The compression type. The integer values correspond to the compression type: 0, no compression; 1, Bzip2 compression; 2, Gzip compression. + @type compress_type: int + @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 create_geometric_rep(format='PDB', file=None, dir=None, size=30.0, inc=36, force=False): +def create_geometric_rep(format='PDB', file=None, dir=None, compress_type=0, size=30.0, inc=36, force=False): """Create a PDB file containing a geometric object representing the frame order dynamics. - @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 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 compress_type: The compression type. The integer values correspond to the compression type: 0, no compression; 1, Bzip2 compression; 2, Gzip compression. + @type compress_type: int + @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 """ # Printout. @@ -463,6 +469,6 @@ # Create the PDB file. if format == 'PDB': - pdb_file = open_write_file(file, dir, force=force) + pdb_file = open_write_file(file+'.pdb', dir, compress_type=compress_type, 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=24385&r1=24384&r2=24385&view=diff ============================================================================== --- branches/frame_order_cleanup/specific_analyses/frame_order/uf.py (original) +++ branches/frame_order_cleanup/specific_analyses/frame_order/uf.py Tue Jul 1 18:08:30 2014 @@ -53,17 +53,19 @@ cdp.num_int_pts = num -def pdb_model(ave_pos_file="ave_pos.pdb", rep_file="frame_order.pdb", dist_file="domain_distribution.pdb", dir=None, size=30.0, inc=36, force=False): +def pdb_model(ave_pos="ave_pos", rep="frame_order", dist="domain_distribution", dir=None, compress_type=0, size=30.0, inc=36, force=False): """Create 3 different PDB files for representing the frame order dynamics of the system. - @keyword ave_pos_file: The name of the file for the average molecule structure. - @type ave_pos_file: str or None - @keyword rep_file: The name of the file of the PDB representation of the frame order dynamics to create. - @type rep_file: str or None - @keyword dist_file: The name of the file which will contain multiple models spanning the full dynamics distribution of the frame order model. - @type dist_file: str or None + @keyword ave_pos: The file root for the average molecule structure. + @type ave_pos: str or None + @keyword rep: The file root of the PDB representation of the frame order dynamics to create. + @type rep: str or None + @keyword dist: The file root which will contain multiple models spanning the full dynamics distribution of the frame order model. + @type dist: str or None @keyword dir: The name of the directory to place the PDB file into. @type dir: str + @keyword compress_type: The compression type. The integer values correspond to the compression type: 0, no compression; 1, Bzip2 compression; 2, Gzip compression. + @type compress_type: int @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. @@ -73,27 +75,27 @@ """ # Check that at least one PDB file name is given. - if not ave_pos_file and not rep_file and not dist_file: + if not ave_pos and not rep and not dist: raise RelaxError("Minimally one PDB file name must be supplied.") # Test if the current data pipe exists. pipes.test() # Create the average position structure. - if ave_pos_file: - create_ave_pos(file=ave_pos_file, dir=dir, force=force) + if ave_pos: + create_ave_pos(file=ave_pos, dir=dir, compress_type=compress_type, force=force) # Nothing more to do for the rigid model. if cdp.model == 'rigid': return # Create the geometric representation. - if rep_file: - create_geometric_rep(file=rep_file, dir=dir, size=size, inc=inc, force=force) + if rep: + create_geometric_rep(file=rep, dir=dir, compress_type=compress_type, size=size, inc=inc, force=force) # Create the distribution. - if dist_file: - create_distribution(file=dist_file, dir=dir, force=force) + if dist: + create_distribution(file=dist, dir=dir, compress_type=compress_type, force=force) def pivot(pivot=None, order=1, fix=False): Modified: branches/frame_order_cleanup/user_functions/frame_order.py URL: http://svn.gna.org/viewcvs/relax/branches/frame_order_cleanup/user_functions/frame_order.py?rev=24385&r1=24384&r2=24385&view=diff ============================================================================== --- branches/frame_order_cleanup/user_functions/frame_order.py (original) +++ branches/frame_order_cleanup/user_functions/frame_order.py Tue Jul 1 18:08:30 2014 @@ -49,34 +49,34 @@ uf.title = "Create a PDB file representation of the frame order dynamics." uf.title_short = "Frame order dynamics PDB representation." uf.add_keyarg( - name = "ave_pos_file", - default = "ave_pos.pdb", - py_type = "str", - arg_type = "file sel", - desc_short = "average structure file name", - desc = "The name of the 3D structure PDB file for the molecular structure with the moving domains shifted to the average position.", + name = "ave_pos", + default = "ave_pos", + py_type = "str", + arg_type = "str", + desc_short = "average structure file root", + desc = "The file root of the 3D structure PDB file for the molecular structure with the moving domains shifted to the average position.", wiz_filesel_wildcard = WILDCARD_STRUCT_PDB_ALL, wiz_filesel_style = FD_SAVE, can_be_none = True ) uf.add_keyarg( - name = "rep_file", - default = "frame_order.pdb", - py_type = "str", - arg_type = "file sel", - desc_short = "PDB representation file name", - desc = "The name of the PDB file for the geometric object representation of the frame order dynamics.", + name = "rep", + default = "frame_order", + py_type = "str", + arg_type = "str", + desc_short = "PDB representation file root", + desc = "The file root of the PDB file for the geometric object representation of the frame order dynamics.", wiz_filesel_wildcard = WILDCARD_STRUCT_PDB_ALL, wiz_filesel_style = FD_SAVE, can_be_none = True ) uf.add_keyarg( - name = "dist_file", - default = "domain_distribution.pdb", - py_type = "str", - arg_type = "file sel", - desc_short = "distribution file name", - desc = "The name of the file which will contain multiple models spanning the full dynamics distribution of the frame order model.", + name = "dist", + default = "domain_distribution", + py_type = "str", + arg_type = "str", + desc_short = "distribution file root", + desc = "The file root of the file which will contain multiple models spanning the full dynamics distribution of the frame order model.", wiz_filesel_wildcard = WILDCARD_STRUCT_PDB_ALL, wiz_filesel_style = FD_SAVE, can_be_none = True @@ -88,6 +88,25 @@ desc_short = "directory name", desc = "The directory where the file is to be located.", can_be_none = True +) +uf.add_keyarg( + name = "compress_type", + default = 0, + py_type = "int", + desc_short = "file compression", + desc = "The type of compression to use when creating the files.", + wiz_element_type = "combo", + wiz_combo_choices = [ + "No compression", + "bzip2 compression", + "gzip compression" + ], + wiz_combo_data = [ + 0, + 1, + 2 + ], + wiz_read_only = True ) uf.add_keyarg( name = "size", @@ -113,7 +132,8 @@ ) # Description. uf.desc.append(Desc_container()) -uf.desc[-1].add_paragraph("This function creates a PDB file containing an artificial geometric structure representing the Frame Order cone models.") +uf.desc[-1].add_paragraph("This function creates a set of PDB files for representing the frame order cone models. This includes a file for the average position of the molecule, a file containing a geometric representation of the frame order motions, and a file containing a distribution of structures which sample the motional modes.") +uf.desc[-1].add_paragraph("The three files are specified via the file root whereby the extensions '.pdb', '.pdb.gz', etc. should not be provided. This is important for the geometric representation whereby different files are created for the positive and negative representations (due to symmetry in the NMR data, these cannot be differentiated), and for the Monte Carlo simulations. For example if the file root is 'frame_order', the positive and negative representations will be placed in the 'frame_order_pos.pdb.gz' and 'frame_order_neg.pdb.gz' files and the Monte Carlo simulations in the 'frame_order_sim_pos.pdb.gz' and 'frame_order_sim_neg.pdb.gz' files. For models where there is no difference in representation between the positive and negative directions, the files 'frame_order.pdb.gz' and 'frame_order_sim.pdb.gz' will be produced.") uf.desc[-1].add_paragraph("There are four different types of residue within the PDB. The pivot point is represented as as a single carbon atom of the residue 'PIV'. The cone consists of numerous H atoms of the residue 'CON'. The cone axis vector is presented as the residue 'AXE' with one carbon atom positioned at the pivot and the other x Angstroms away on the cone axis (set by the geometric object size). Finally, if Monte Carlo have been performed, there will be multiple 'MCC' residues representing the cone for each simulation, and multiple 'MCA' residues representing the multiple cone axes.") uf.desc[-1].add_paragraph("To create the diffusion in a cone PDB representation, a uniform distribution of vectors on a sphere is generated using spherical coordinates with the polar angle defined by the cone axis. By incrementing the polar angle using an arccos distribution, a radial array of vectors representing latitude are created while incrementing the azimuthal angle evenly creates the longitudinal vectors. These are all placed into the PDB file as H atoms and are all connected using PDB CONECT records. Each H atom is connected to its two neighbours on the both the longitude and latitude. This creates a geometric PDB object with longitudinal and latitudinal lines representing the filled cone.") uf.backend = pdb_model