X-Git-Url: http://mmka.chem.univ.gda.pl/gitweb/?a=blobdiff_plain;f=django_simple%2Ftodo%2Fforms.py;h=c0b16674c71c0d85a51d89389083242d888c214b;hb=a6e111e381a874bd15dd6dcb33fdeb18079e3286;hp=5eb67fb088e649d2f82efeeb71dcc1f3b012c661;hpb=18720bfd2db199afb2ebf034b3206fc07f16c1ad;p=django_unres.git diff --git a/django_simple/todo/forms.py b/django_simple/todo/forms.py index 5eb67fb..c0b1667 100644 --- a/django_simple/todo/forms.py +++ b/django_simple/todo/forms.py @@ -7,6 +7,14 @@ from .models import FF_CHOICE import json import urllib +def code_2d(line): + msg='' + set ='HEC-' + line2 = ''.join([c for c in line if c in set]) + if line2 != line: + msg='use only H,E,C or - letters' + return(msg) + def pdb_missing_res(file): msg='' newchain = True @@ -230,6 +238,11 @@ class TaskForm_md_a(forms.Form): 'field is ignored when uploading starting/reference PDB file', required=False, widget=forms.Textarea(attrs={'cols': 70, 'rows': 2})) + md_2d = forms.CharField(label='Secondary structure restraints', + help_text='single letter code: H - helix, E - extended/beta, C or - no restraints', + required=False, + widget=forms.Textarea(attrs={'cols': 70, 'rows': 2})) + file1 = forms.FileField(label='Upload a PDB file',required=False, help_text='starting structure for pdbstart/reference structure') pdbid = forms.CharField(min_length=4,max_length=4,required=False, @@ -254,6 +267,7 @@ class TaskForm_md_a(forms.Form): help_text='coupling to the thermal bath (Berendsen)') md_scal_fric = forms.FloatField(label='scal_froc',initial=0.02, help_text='scaling of the friction coefficients (Langevin)') + md_respa = forms.BooleanField(required=False,initial=True,label='RESPA') md_mdpdb = forms.BooleanField(required=False,label='trajectory as PDB') boxx = forms.FloatField(label='Box X',initial=1000.0, @@ -271,6 +285,7 @@ class TaskForm_md_a(forms.Form): pdbid = cleaned_data.get("pdbid") md_seq = cleaned_data.get("md_seq") md_pdbref = cleaned_data.get("md_pdbref") + md_2d = cleaned_data.get("md_2d") if md_start == 'pdbstart' and not (file1 or pdbid): msg = 'pdbstart with no PDB file or code' @@ -300,7 +315,11 @@ class TaskForm_md_a(forms.Form): msg=pdb_missing_res(file1) if msg != '': self.add_error('file1',msg) - + + if md_2d: + msg=code_2d(md_2d) + if msg != '': + self.add_error('md_2d',msg) class TaskForm_remd(forms.Form): name = forms.CharField(max_length=20) @@ -373,6 +392,10 @@ class TaskForm_remd_a(forms.Form): 'field is ignored when uploading starting/reference PDB file', required=False, widget=forms.Textarea(attrs={'cols': 70, 'rows': 2})) + md_2d = forms.CharField(label='Secondary structure restraints', + help_text='single letter code: H - helix, E - extended/beta, C or - no restraints', + required=False, + widget=forms.Textarea(attrs={'cols': 70, 'rows': 2})) file1 = forms.FileField(label='Upload a PDB file',required=False, help_text='starting structure for pdbstart/reference structure') pdbid = forms.CharField(min_length=4,max_length=4,required=False, @@ -403,6 +426,8 @@ class TaskForm_remd_a(forms.Form): # remd_traj1file = forms.BooleanField(required=False,label='single trajectory file',initial='true') # remd_rest1file = forms.BooleanField(required=False,label='single restart file',initial='true') + md_respa = forms.BooleanField(required=False,initial=True,label='RESPA') + boxx = forms.FloatField(label='Box X',initial=1000.0, help_text='box x dimension') boxy = forms.FloatField(label='Box Y',initial=1000.0, @@ -429,6 +454,7 @@ class TaskForm_remd_a(forms.Form): pdbid = cleaned_data.get("pdbid") md_seq = cleaned_data.get("md_seq") md_pdbref = cleaned_data.get("md_pdbref") + md_2d = cleaned_data.get("md_2d") if md_start == 'pdbstart' and not (file1 or pdbid): msg = 'pdbstart with no PDB file or code' @@ -459,6 +485,11 @@ class TaskForm_remd_a(forms.Form): if msg != '': self.add_error('file1',msg) + if md_2d: + msg=code_2d(md_2d) + if msg != '': + self.add_error('md_2d',msg) + class TaskForm_list(forms.Form):