mailr18872 - /trunk/generic_fns/structure/internal.py


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

Header


Content

Posted by edward on March 19, 2013 - 11:35:
Author: bugman
Date: Tue Mar 19 11:35:11 2013
New Revision: 18872

URL: http://svn.gna.org/viewcvs/relax?rev=18872&view=rev
Log:
Created the internal structural object _pdb_chain_id_to_mol_index() method.

This will be used to convert PDB chain IDs, which are used to indicate 
different molecules in the
PDB, into molecule indices for the internal structural object.


Modified:
    trunk/generic_fns/structure/internal.py

Modified: trunk/generic_fns/structure/internal.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/generic_fns/structure/internal.py?rev=18872&r1=18871&r2=18872&view=diff
==============================================================================
--- trunk/generic_fns/structure/internal.py (original)
+++ trunk/generic_fns/structure/internal.py Tue Mar 19 11:35:11 2013
@@ -26,7 +26,7 @@
 from numpy import array, dot, float64, linalg, zeros
 import os
 from os import F_OK, access
-from string import digits
+from string import digits, uppercase
 from warnings import warn
 
 # relax module imports.
@@ -2169,6 +2169,26 @@
         return fields
 
 
+    def _pdb_chain_id_to_mol_index(self, chain_id=None):
+        """Convert the PDB chain ID into the molecule index in a regular way.
+
+        @keyword chain_id:  The PDB chain ID string.
+        @type chain_id:     str
+        @return:            The corresponding molecule index.
+        @rtype:             int
+        """
+
+        # Initialise.
+        mol_index = 0
+
+        # Convert to the molecule index.
+        if chain_id:
+            mol_index = uppercase.index(chain_id)
+
+        # Return the index.
+        return mol_index
+
+
     def atom_add(self, atom_name=None, res_name=None, res_num=None, 
pos=[None, None, None], element=None, atom_num=None, chain_id=None, 
segment_id=None, pdb_record=None):
         """Method for adding an atom to the structural data object.
 




Related Messages


Powered by MHonArc, Updated Tue Mar 19 11:40:02 2013