pdb with alternative conformations
authorCezary Czaplewski <czarek@chem.univ.gda.pl>
Tue, 12 Sep 2017 08:31:57 +0000 (10:31 +0200)
committerCezary Czaplewski <czarek@chem.univ.gda.pl>
Tue, 12 Sep 2017 08:31:57 +0000 (10:31 +0200)
django_simple/todo/views.py

index e39fa68..f4dc960 100644 (file)
@@ -35,7 +35,7 @@ def from_pdb(file):
     sequence = []
     ssbond = []
     ssbond_ch = []
-#    ires = []
+    ires = []
     chain_start = {}
     chain_end = {}
     unres_shift = {}
@@ -52,10 +52,11 @@ def from_pdb(file):
     
             if line[0:6] == 'ATOM  ' and line[13:15] == 'CA':
               aa = three_to_one.get(line[17:20])
-              sequence.append(aa)
               i = int(line[22:26])
-#              ires.append(i)
-              if newchain:
+              if newchain or i!=ires[-1]:
+                sequence.append(aa)
+                ires.append(i)
+                if newchain:
                  chain_start[chain[ichain]]=i
                  newchain = False
             if line[0:3] == 'TER':