mailr2665 - in /branches/tensor_pdb: generic_fns/pdb.py prompt/pdb.py


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

Header


Content

Posted by edward on October 26, 2006 - 07:44:
Author: bugman
Date: Thu Oct 26 07:44:07 2006
New Revision: 2665

URL: http://svn.gna.org/viewcvs/relax?rev=2665&view=rev
Log:
Created the user function 'pdb.create_tensor_pdb()'.

This is in response to the thread stating at
https://mail.gna.org/public/relax-devel/2006-10/msg00136.html (Message-id:
<7f080ed10610252045r3dcbba38q58aa53142af96e5a@xxxxxxxxxxxxxx>).

This new user function creates a PDB file of artificial structures to 
represent the diffusion
tensor.  The prompt interface function has been completed and the shell of 
the function
'self.create_tensor_pdb()' has been added to the file 'generic_fns/pdb.py'.  
This second function
solely tests that the run exists, that a PDB structure has been loaded, that 
the sequence has been
loaded, and then opens and then closes the PDB file.  Hence an empty file is 
created by the user
function.


Modified:
    branches/tensor_pdb/generic_fns/pdb.py
    branches/tensor_pdb/prompt/pdb.py

Modified: branches/tensor_pdb/generic_fns/pdb.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/tensor_pdb/generic_fns/pdb.py?rev=2665&r1=2664&r2=2665&view=diff
==============================================================================
--- branches/tensor_pdb/generic_fns/pdb.py (original)
+++ branches/tensor_pdb/generic_fns/pdb.py Thu Oct 26 07:44:07 2006
@@ -35,6 +35,34 @@
 
         # Print flag.
         self.print_flag = 1
+
+
+    def create_tensor_pdb(self, run=None, file=None, dir=None, force=0):
+        """The pdb loading function."""
+
+        # Arguments.
+        self.run = run
+        self.file = file
+        self.dir = dir
+        self.force = force
+
+        # Test if the run exists.
+        if not run in self.relax.data.run_names:
+            raise RelaxNoRunError, run
+
+        # Test if PDB data corresponding to the run already exists.
+        if not self.relax.data.pdb.has_key(self.run):
+            raise RelaxNoPdbError, self.run
+
+        # Test if sequence data is loaded.
+        if not self.load_seq and not len(self.relax.data.res[self.run]):
+            raise RelaxNoSequenceError, self.run
+
+        # Open the PDB file for writing.
+        tensor_pdb_file = self.relax.IO.open_write_file(self.file, self.dir, 
self.force)
+
+        # Close the PDB file.
+        tensor_pdb_file.close()
 
 
     def load_structures(self):

Modified: branches/tensor_pdb/prompt/pdb.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/tensor_pdb/prompt/pdb.py?rev=2665&r1=2664&r2=2665&view=diff
==============================================================================
--- branches/tensor_pdb/prompt/pdb.py (original)
+++ branches/tensor_pdb/prompt/pdb.py Thu Oct 26 07:44:07 2006
@@ -36,6 +36,60 @@
 
         # Place relax in the class namespace.
         self.__relax__ = relax
+
+
+    def create_tensor_pdb(self, run=None, file='tensor.pdb', dir=None, 
force=0):
+        """Create a PDB file to represent the diffusion tensor.
+
+        Keyword Arguments
+        ~~~~~~~~~~~~~~~~~
+
+        run:  The run to assign the structure to.
+
+        file:  The name of the PDB file.
+
+        dir:  The directory where the file is located.
+
+        force:  A flag which, if set to 1, will overwrite the any 
pre-existing file.
+
+
+        Description
+        ~~~~~~~~~~~
+
+        This function creates a PDB file containing artificial structures 
which represent the
+        diffusion tensor.  A structure must have previously been read.  The 
diffusion tensor is
+        represented by an ellipsoidal, spheroidal, or spherical geometric 
centered at the center of
+        mass.  This diffusion tensor PDB file can subsequently read into any 
molecular viewer.
+
+        """
+
+        # Function intro text.
+        if self.__relax__.interpreter.intro:
+            text = sys.ps3 + "pdb.create_tensor_pdb("
+            text = text + "run=" + `run`
+            text = text + ", file=" + `file`
+            text = text + ", dir=" + `dir`
+            text = text + ", force=" + `force` + ")"
+            print text
+
+        # The run argument.
+        if type(run) != str:
+            raise RelaxStrError, ('run', run)
+
+        # File name.
+        if type(file) != str:
+            raise RelaxStrError, ('file name', file)
+
+        # Directory.
+        if dir != None and type(dir) != str:
+            raise RelaxNoneStrError, ('directory name', dir)
+
+        # The force flag.
+        if type(force) != int or (force != 0 and force != 1):
+            raise RelaxBinError, ('force flag', force)
+
+        # Execute the functional code.
+        self.__relax__.generic.pdb.create_tensor_pdb(run=run, file=file, 
dir=dir, force=force)
 
 
     def read(self, run=None, file=None, dir=None, model=None, load_seq=1):




Related Messages


Powered by MHonArc, Updated Thu Oct 26 08:00:32 2006