mailr11514 - /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 August 15, 2010 - 13:12:
Author: bugman
Date: Sun Aug 15 13:12:02 2010
New Revision: 11514

URL: http://svn.gna.org/viewcvs/relax?rev=11514&view=rev
Log:
Better identification of the molecule end in the internal PDB reader.

HETATMs after a TER are now considered part of the same molecule, as they 
should be.


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=11514&r1=11513&r2=11514&view=diff
==============================================================================
--- 1.3/generic_fns/structure/internal.py (original)
+++ 1.3/generic_fns/structure/internal.py Sun Aug 15 13:12:02 2010
@@ -307,15 +307,28 @@
         # Init.
         mol_num = 1
         mol_records = []
+        end = False
 
         # Loop over the data.
-        for record in records:
+        for i in range(len(records)):
             # A PDB termination record.
-            if search('^END', record):
+            if search('^END', records[i]):
                 break
 
-            # A molecule termination record.
-            if search('^TER', record):
+            # A model termination record.
+            if search('^ENDMDL', records[i]):
+                end = True
+
+            # A molecule termination record with no trailing HETATM.
+            elif i < len(records)-1 and search('^TER', records[i]) and not 
search('^HETATM', records[i+1]):
+                end = True
+
+            # A HETATM followed by an ATOM record.
+            elif i < len(records)-1 and search('^HETATM', records[i]) and 
search('^ATOM', records[i+1]):
+                end = True
+
+            # End.
+            if end:
                 # Yield the info.
                 yield mol_num, mol_records
 
@@ -325,11 +338,14 @@
                 # Increment the molecule number.
                 mol_num = mol_num + 1
 
+                # Reset the flag.
+                end = False
+
                 # Skip the rest of this loop.
                 continue
 
             # Append the line as a record of the molecule.
-            mol_records.append(record)
+            mol_records.append(records[i])
 
         # If records is not empty then there is only a single molecule, so 
yield the lot.
         if len(mol_records):




Related Messages


Powered by MHonArc, Updated Sun Aug 15 13:20:02 2010