From 32f28d903c65f1611e715582cc05e1b4f0e52bf0 Mon Sep 17 00:00:00 2001 From: Cezary Czaplewski Date: Tue, 9 Jan 2018 23:27:32 +0100 Subject: [PATCH] reading SSBOND corrected --- TODO | 3 ++- django_simple/todo/templates/changelog.html | 5 ++++- django_simple/todo/templates/input.html | 4 +--- django_simple/todo/views.py | 22 ++++++++-------------- 4 files changed, 15 insertions(+), 19 deletions(-) diff --git a/TODO b/TODO index 91e3c61..7cd4ad6 100644 --- a/TODO +++ b/TODO @@ -28,7 +28,8 @@ homology restraints input other restrains input -SAXS input +# SAXS input +# done automatic secondary structure restrains (psipred) diff --git a/django_simple/todo/templates/changelog.html b/django_simple/todo/templates/changelog.html index 49d1e6b..885d7fc 100644 --- a/django_simple/todo/templates/changelog.html +++ b/django_simple/todo/templates/changelog.html @@ -10,11 +10,14 @@
Autorefresh added to job status page and job index page.
-
Changelog page added.
+
10.01.2018
+
+ Reading SSBOND from multichain pdb corrected. +
diff --git a/django_simple/todo/templates/input.html b/django_simple/todo/templates/input.html index 431ca85..1509f69 100644 --- a/django_simple/todo/templates/input.html +++ b/django_simple/todo/templates/input.html @@ -21,10 +21,8 @@ external software or online servers (for example Modeller software, Modloop server).
  • Disulfide bonds are read from PDB based on SSBOND records and for multichain -protein COMPND record with propers CHAIN: tokens listing all chains in the -PDB file. See example: +protein proper chain records are necessary. See example:
    -COMPND   3 CHAIN: A, B, C, D;
     SSBOND   1 CYS C  107    CYS C  138
     SSBOND   2 CYS C  124    CYS C  139
     SSBOND   3 CYS C  137    CYS C  149
    diff --git a/django_simple/todo/views.py b/django_simple/todo/views.py
    index a29ae69..6a244b0 100644
    --- a/django_simple/todo/views.py
    +++ b/django_simple/todo/views.py
    @@ -47,32 +47,24 @@ def from_pdb(file):
         chain_start = {}
         chain_end = {}
         unres_shift = {}
    -    chain=[]
    -    ichain=0
    +    chain_sorted=[]
         newchain = True
         
         for line in file:
    -            if line[0:6] == 'COMPND' and line[11:17] == 'CHAIN:':
    -              tmp=line[18:]
    -              chain_=tmp.split(', ')
    -              chain_[-1]=chain_[-1][0]
    -              chain.extend(chain_)
    -    
                 if line[0:6] == 'ATOM  ' and line[13:15] == 'CA':
                   aa = three_to_one.get(line[17:20])
                   i = int(line[22:26])
    +              ch = line[21:22]
                   if newchain or i!=ires[-1]:
                     sequence.append(aa)
                     ires.append(i)
                     if newchain:
    -                 if len(chain)>0:
    -                  chain_start[chain[ichain]]=i
    +                 chain_start[ch]=i
    +                 chain_sorted.extend(ch)
                      newchain = False
                 if line[0:3] == 'TER':
                   sequence.append('XX')
    -              if len(chain)>0:
    -               chain_end[chain[ichain]]=i
    -              ichain=ichain+1
    +              chain_end[ch]=i
                   newchain = True
                 if line[0:6] == 'SSBOND':
                   b=[]
    @@ -85,6 +77,8 @@ def from_pdb(file):
                   ssbond_ch.append(c)                                                                      
                 if line[0:3] == 'END':
                   break
    +    if not sequence[-1] == 'XX':
    +            chain_end[ch]=i
         while sequence[-1] == 'XX':
                 del sequence[-1]
         if sequence[0] != 'G':
    @@ -96,7 +90,7 @@ def from_pdb(file):
     #    if ires[0] != 1:
     #            ssbond=[ [e[0]-ires[0]+1,e[1]-ires[0]+1] for e in ssbond]
         i=0
    -    for c in chain:
    +    for c in chain_sorted:
           unres_shift[c]=i+chain_start[c]
           i=i-(chain_end[c]-chain_start[c])-3
         ssbond=[ [e[0]-unres_shift[c[0]]+1,e[1]-unres_shift[c[1]]+1] for e,c in zip(ssbond,ssbond_ch)]     
    -- 
    1.7.9.5