mailr6176 - /1.3/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 May 20, 2008 - 22:38:
Author: bugman
Date: Tue May 20 22:30:56 2008
New Revision: 6176

URL: http://svn.gna.org/viewcvs/relax?rev=6176&view=rev
Log:
Renamed __generate_object_from_pdb() to __fill_object_from_pdb() and changed 
its behaviour.

The method no longer returns a Structure_container instance but simply fills 
out the one
corresponding to the model.


Modified:
    1.3/generic_fns/structure/internal.py

Modified: 1.3/generic_fns/structure/internal.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/generic_fns/structure/internal.py?rev=6176&r1=6175&r2=6176&view=diff
==============================================================================
--- 1.3/generic_fns/structure/internal.py (original)
+++ 1.3/generic_fns/structure/internal.py Tue May 20 22:30:56 2008
@@ -47,29 +47,29 @@
     id = 'internal'
 
 
-    def __generate_object_from_pdb(self, records):
+    def __fill_object_from_pdb(self, records, model=None):
         """Method for generating a complete Structure_container object from 
the given PDB records.
 
         @param records:     A list of structural PDB records.
         @type records:      list of str
-        @return:            The structural object containing all the atomic 
information in the PDB
-                            records.
-        @rtype:             Structure_container instance
-        """
-
-        # Initialise the structural object.
-        str_obj = Structure_container()
-
-        # Loop over the records.
-        for record in records:
-            # Parse the record.
-            record = self.__parse_pdb_record(record)
-
-            # Add the atom.
-            self.atom_add(pdb_record=record[0], atom_name=record[2], 
res_name=record[4], chain_id=record[5], res_num=record[6], pos=[record[8], 
record[9], record[10]], segment_id=record[13], element=record[14])
-
-        # Return the structural object.
-        return str_obj
+        @keyword model:     The model to add the data to.  If not supplied 
and multiple models
+                            exist, then the data will be added to all models.
+        @type model:        None or int
+        """
+
+        # Loop over the models.
+        for struct in self.structural_data:
+            # Skip non-matching models.
+            if model != None and model != struct.model:
+                continue
+
+            # Loop over the records.
+            for record in records:
+                # Parse the record.
+                record = self.__parse_pdb_record(record)
+
+                # Add the atom.
+                self.atom_add(pdb_record=record[0], atom_name=record[2], 
res_name=record[4], chain_id=record[5], res_num=record[6], pos=[record[8], 
record[9], record[10]], segment_id=record[13], element=record[14], 
model=model)
 
 
     def __get_chemical_name(self, hetID):
@@ -411,11 +411,9 @@
             if model != None and model != model_num:
                 continue
 
-            # Generate the structural data object.
-            str_obj = self.__generate_object_from_pdb(records)
-
-            # Place the structure in 'self.structural_data'.
-            self.structural_data.append(str_obj)
+            # Initialise and fill the structural data object.
+            self.structural_data.append(Structure_container())
+            self.__fill_object_from_pdb(records, model_num)
 
 
     def terminate(self, model=None):




Related Messages


Powered by MHonArc, Updated Tue May 20 22:40:18 2008