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=''
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:
break
if len(ires) == 0:
+ if chain == '':
+ msg='no CA atoms in this pdb'
+ else:
msg='wrong chain id'
return(msg)
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):
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)
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)
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)
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)
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)
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)
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',
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':