ssbond with 1st res <> 1
[django_unres.git] / django_simple / todo / views.py
index 6f3a75e..37f4dd1 100644 (file)
@@ -34,10 +34,13 @@ def seq_add_x(sequence):
 def from_pdb(file):
     sequence = []
     ssbond = []
+    ires = []
     for line in 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[24:26])
+              ires.append(i)
             if line[0:3] == 'TER':
               sequence.append('XX')
             if line[0:6] == 'SSBOND':
@@ -56,6 +59,9 @@ def from_pdb(file):
     if sequence[-1] != 'G':
             sequence.append('X')
     seq=''.join(sequence)
+    if ires[0] != 1:
+            ssbond=[ [e[0]-ires[0]+1,e[1]-ires[0]+1] for e in ssbond]
+
     return seq,ssbond
 
 
@@ -250,6 +256,7 @@ def add_remd(request,task_id):
              task.md_start=form.cleaned_data["md_start"]
              task.myfile1=form.cleaned_data["file1"]
              task.md_pdbref=form.cleaned_data["md_pdbref"]
+             task.md_ntwx=task.remd_nstex 
 
              task.md_seq=""
              if task.md_start == "pdbstart" or task.md_pdbref:
@@ -313,6 +320,8 @@ def add_remd_a(request,task_id):
              task.md_scal_fric=form.cleaned_data["md_scal_fric"]
              task.remd_nrep=form.cleaned_data["remd_nrep"]
              task.remd_nstex=form.cleaned_data["remd_nstex"]
+             task.md_ntwx=form.cleaned_data["md_ntwx"]             
+             task.md_ntwe=form.cleaned_data["md_ntwe"]
 #             task.remd_traj1file=form.cleaned_data["remd_traj1file"]
 #             task.remd_rest1file=form.cleaned_data["remd_rest1file"]