T0882 example in advanced MREMD, checking of residue names in pdb
authorCezary Czaplewski <czarek@chem.univ.gda.pl>
Tue, 23 Jan 2018 22:23:53 +0000 (23:23 +0100)
committerCezary Czaplewski <czarek@chem.univ.gda.pl>
Tue, 23 Jan 2018 22:23:53 +0000 (23:23 +0100)
django_simple/todo/forms.py
django_simple/todo/models.py
django_simple/todo/templates/tutorial.html
django_simple/todo/views.py

index 6d47368..22aef8d 100644 (file)
@@ -7,6 +7,13 @@ from .models import FF_CHOICE
 import json
 import urllib
 
+aa_3letter = [
+     'DPR','DLY','DAR','DHI','DAS','DGL','DSG','DGN','DSN','DTH',
+     'DYY','DAL','DTY','DTR','DVA','DLE','DIL','DPN','MED','DCY',
+     'CYS','MET','PHE','ILE','LEU','VAL','TRP','TYR','ALA','GLY','THR',
+     'SER','GLN','ASN','GLU','ASP','HIS','ARG','LYS','PRO']
+
+
 def pdb_code_chain(pdbid):
 
     msg=''
@@ -33,6 +40,9 @@ def pdb_missing_res_chain(file,chain):
       if line[0:6] == 'ATOM  ' and line[13:15] == 'CA' and (line[21] == chain or chain==''):
                i = int(line[22:26])
                ch = line[21]
+               if line[17:20] not in aa_3letter:
+                 msg='residue '+line[17:20]+' '+str(i)+' not recognized'
+                 return(msg)
                if ires and i==ires[-1]:
                  continue
                if newchain or i==ires[-1]+1:
@@ -49,6 +59,9 @@ def pdb_missing_res_chain(file,chain):
                break
    
    if len(ires) == 0:
+        if chain == '':
+               msg='no CA atoms in this pdb'
+        else:
                msg='wrong chain id'
    return(msg)
 
@@ -61,29 +74,6 @@ def code_2d(line):
     msg='use only H,E,C or - letters'
    return(msg)
 
-def pdb_missing_res(file):
-   msg=''
-   newchain = True
-   ires=[]
-   for line in file:
-      if line[0:6] == 'ATOM  ' and line[13:15] == 'CA':
-               i = int(line[22:26])
-               if ires and i==ires[-1]:
-                 continue
-               if newchain or i==ires[-1]+1:
-                 ires.append(i)
-                 newchain = False
-               else:
-                 msg = 'chain breaks between residues '+\
-                   str(ires[-1])+' and '+str(i)+\
-                   ', server cannot add missing residues to PDB file - please repair the structure using e.g. Modeller'
-                 break
-      if line[0:3] == 'TER':
-               newchain = True
-      if line[0:3] == 'END':
-               break
-   
-   return(msg)
 
 class MultiWidgetBasic(forms.MultiWidget):
     def __init__(self, count, attrs=None):
@@ -144,7 +134,7 @@ class TaskForm_min(forms.Form):
                    self.add_error('pdbid',msg)
                
              if file1:
-                 msg=pdb_missing_res(file1)
+                 msg=pdb_missing_res_chain(file1,'')
                  if msg != '':
                    self.add_error('file1',msg)
 
@@ -193,7 +183,7 @@ class TaskForm_min_a(forms.Form):
                    self.add_error('pdbid',msg)
                
              if file1:
-                 msg=pdb_missing_res(file1)
+                 msg=pdb_missing_res_chain(file1,'')
                  if msg != '':
                    self.add_error('file1',msg)
 
@@ -249,7 +239,7 @@ class TaskForm_md(forms.Form):
                    self.add_error('pdbid',msg)
                
              if file1:
-                 msg=pdb_missing_res(file1)
+                 msg=pdb_missing_res_chain(file1,'')
                  if msg != '':
                    self.add_error('file1',msg)
 
@@ -334,7 +324,7 @@ class TaskForm_md_a(forms.Form):
                    self.add_error('pdbid',msg)
                
              if file1:
-                 msg=pdb_missing_res(file1)
+                 msg=pdb_missing_res_chain(file1,'')
                  if msg != '':
                    self.add_error('file1',msg)
              
@@ -391,7 +381,7 @@ class TaskForm_remd(forms.Form):
                    self.add_error('pdbid',msg)
                
              if file1:
-                 msg=pdb_missing_res(file1)
+                 msg=pdb_missing_res_chain(file1,'')
                  if msg != '':
                    self.add_error('file1',msg)
 
@@ -491,7 +481,7 @@ class TaskForm_remd_a(forms.Form):
                    self.add_error('pdbid',msg)
                
              if file1:
-                 msg=pdb_missing_res(file1)
+                 msg=pdb_missing_res_chain(file1,'')
                  if msg != '':
                    self.add_error('file1',msg)
 
index bc2fac6..1c07a2c 100644 (file)
@@ -95,6 +95,7 @@ class Task(models.Model):
     owner = models.ForeignKey(User,default=1)
     created_date = models.DateTimeField(default=timezone.now)
     jobdirname = models.CharField(max_length=100,default='')
+    example = models.CharField(max_length=10,default='')
     
     def __str__(self):
         if self.done:
index 9fd8fdf..e073eb7 100644 (file)
@@ -134,10 +134,12 @@ and refined. PDB files can be downloaded by clicking on the picture.
 </div>
 <hr>
 Advanced mode allows for changes of more parameters of each type of
-simulation. Separate examples are provided: minimization of 1EI0 with
+simulation. Separate examples are provided (use <i>Load example data</i> button as
+in Basic mode): minimization of 1EI0 with
 dissulfide bonds, MD simulations of 1L2Y starting from extended chain
-and replica exchange simulations of 1E0G starting form extended chain 
-using new UNRES force field and Berendsen thermostat.
+and multiplexed replica exchange simulations of 5G3Q:B (CASP12 target T0882) 
+starting form extended chain with secondary structure restraints predicted
+by PSIPRED and Berendsen thermostat.
 
 <hr>
 <h4><li>
index 7045a7c..31c5976 100644 (file)
@@ -464,10 +464,12 @@ def add_remd_a(request,task_id):
     task = get_object_or_404(Task, id=task_id)
     if request.method == 'POST':
      if '_example' in request.POST:
-        data= {'name':task.name,'pdbid':'1E0G','md_pdbref':True,
-         'md_nstep':500000,'md_lang':'berendsen','unres_ff':'opt-wtfsa-2',
-         'remd_cluter_temp':280}
-        form = TaskForm_remd_a(initial=data)     
+        data= {'name':task.name,'pdbid':'5G3Q:B','md_pdbref':True,
+         'md_nstep':2000000,'md_lang':'berendsen','unres_ff':'FF2',
+         'remd_cluter_temp':290,'md_2d':'--EEEEEEE------EEEEEE------EEEEEE------HHHHHHHHHHH---HHHHHHHHHHHHHHHHHHHHHHH---'}
+        form = TaskForm_remd_a(initial=data)    
+        task.example='casp12'
+        task.save() 
      elif '_example_saxs' in request.POST:
         data= {'name':task.name,'pdbid':'5UJQ','md_pdbref':True,
          'md_nstep':200000,'md_lang':'langevin','unres_ff':'FF2',
@@ -594,7 +596,13 @@ def addmlist(request,task_id):
              else:
               return redirect('/')
     else:
-      if task.unres_ff == 'FF2':
+      if task.example == 'casp12':
+        data= {'name':task.name,'nrep':task.remd_nrep,'multiplexing':
+        '["2", "2", "2", "2", "2", "2", "2", "2"]',
+        'temperatures':
+        '["270", "280", "290", "300", "310", "320", "330", "340"]'
+        }
+      elif task.unres_ff == 'FF2':
         data= {'name':task.name,'nrep':task.remd_nrep,'multiplexing':
         '["1", "1", "1", "1", "1", "1", "1", "1"]',
         'temperatures':