From: Cezary Czaplewski Date: Tue, 4 Feb 2020 15:59:19 +0000 (+0100) Subject: docking working version X-Git-Url: http://mmka.chem.univ.gda.pl/gitweb/?a=commitdiff_plain;h=09ac4e3f826a0db6a950fe125bbea6c5286fbe27;p=django_unres.git docking working version --- diff --git a/django_simple/todo/forms.py b/django_simple/todo/forms.py index 0feee49..04de3b2 100644 --- a/django_simple/todo/forms.py +++ b/django_simple/todo/forms.py @@ -554,6 +554,91 @@ class TaskForm_dock(forms.Form): if msg != '': self.add_error('file2',msg) +class TaskForm_dock_a(forms.Form): + name = forms.CharField(max_length=40,widget=forms.TextInput(attrs={'size':40, 'maxlength':40})) + + file1 = forms.FileField(label='Upload a PDB file1',required=False, + help_text='starting structure for chain1') + pdbid = forms.CharField(min_length=4,max_length=6,required=False, + widget=forms.TextInput(attrs={'size':6, 'maxlength':6, 'title':'PDB code or PDB code:chain id'}), + label='or PDB code (:chain)') + + + file2 = forms.FileField(label='Upload a PDB file2',required=False, + help_text='starting structure for chain2') + pdbid2 = forms.CharField(min_length=4,max_length=6,required=False, + widget=forms.TextInput(attrs={'size':6, 'maxlength':6, 'title':'PDB code or PDB code:chain id'}), + label='or PDB code (:chain)') + + + md_nstep = forms.IntegerField(label='NSTEP',initial=200000, + help_text='total number of steps', max_value=10000000) + md_seed = forms.IntegerField(label='SEED',initial=-39912345, + help_text='seed for random number generator') + + + unres_ff = forms.ChoiceField(choices=FF_CHOICE,widget=forms.RadioSelect, + label='Force Field',initial='FF2') + + md_ntwe = forms.IntegerField(label='NTWE',initial=1000, + help_text='write statfile every ntwe steps') + md_dt = forms.FloatField(label='DT',initial=0.2, + help_text='time step [mtu = 48.9 fs]') + md_lang = forms.ChoiceField(choices=MD_LANG,label='thermostat') + md_tau = forms.FloatField(label='tau_bath',initial=1.0, + 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)') + min_maxfun = forms.IntegerField(label='MAXFUN',initial=5000, + help_text='preminim maximum number of function evaluations
'+ + 'used for start from pdb or random start') + remd_nrep = forms.IntegerField(label='NREP',initial=8, + help_text='number of replicas') + remd_nstex = forms.IntegerField(label='NSTEX',initial=1000, + help_text='exchange and write trajectory every nstex steps') + md_ntwx = forms.IntegerField(label='NTWX',initial=1000,min_value=100, + help_text='write trajectory every ntwx steps') + remd_cluter_temp = forms.FloatField(label='TEMPER', + help_text='temperature for cluster analysis',initial=280) + + + def clean(self): + cleaned_data = super(TaskForm_dock_a, self).clean() + + file1 = cleaned_data.get("file1") + pdbid = cleaned_data.get("pdbid") + file2 = cleaned_data.get("file2") + pdbid2 = cleaned_data.get("pdbid2") + + + if not (file1 or pdbid): + msg = 'no PDB file or code for chain1' + self.add_error('file1', msg) + + if not (file2 or pdbid2): + msg = 'no PDB file or code for chain2' + self.add_error('file2', msg) + + if pdbid: + msg=pdb_code_chain(pdbid) + if msg != '': + self.add_error('pdbid',msg) + + if file1: + msg=pdb_missing_res_chain(file1,'') + if msg != '': + self.add_error('file1',msg) + + if pdbid2: + msg=pdb_code_chain(pdbid2) + if msg != '': + self.add_error('pdbid2',msg) + + if file2: + msg=pdb_missing_res_chain(file2,'') + if msg != '': + self.add_error('file2',msg) + class TaskForm_list(forms.Form): name = forms.CharField(max_length=40,disabled=True,required=False) diff --git a/django_simple/todo/jobfiles.py b/django_simple/todo/jobfiles.py index e38d7ae..9855b31 100644 --- a/django_simple/todo/jobfiles.py +++ b/django_simple/todo/jobfiles.py @@ -272,7 +272,7 @@ CUTOFF=7.00000 WCORR4=0.00000""" if instance.type == 'min' or instance.md_start == 'pdbstart': if instance.type == 'dock': - f.write('model01.pdb\n') + f.write('plik1ter.pdb\n') else: f.write('plik.pdb\n') f.write(write_ssbond(instance.ssbond)) @@ -408,7 +408,10 @@ CUTOFF=7.00000 WCORR4=0.00000""" f2.write(line.replace('$ssbond',tmp_ss)) elif 'cd $PBS_O_WORKDIR' in line and instance.type == 'dock': f2.write(line) - f2.write('../files/generator_v7 plik.pdb plik2.pdb\n') + f2.write('../files/generator_v12a plik.pdb plik2.pdb 0 \n') + f2.write("sed '/END/q' plik.pdb |grep ATOM > plik1ter.pdb \n") + f2.write("echo TER >> plik1ter.pdb \n") + f2.write("sed '/END/q' plik2.pdb |grep ATOM >> plik1ter.pdb \n") else: tmp1=json.loads(instance.remd_multi_t) f2.write(line.replace('$temperatures','"'+" ".join(tmp1)+'" '+str(nreplicas))) @@ -497,7 +500,10 @@ CUTOFF=7.00000 WCORR4=0.00000""" f.write('file_MD000\n') if instance.md_pdbref: f.write('pdbref\n') - f.write('plik.pdb\n') + if instance.type == 'dock': + f.write('plik1ter.pdb\n') + else: + f.write('plik.pdb\n') with open(instance.jobdirname+'/file_cluster.inp','w') as f: diff --git a/django_simple/todo/templates/changelog.html b/django_simple/todo/templates/changelog.html index dc129c1..6edd189 100644 --- a/django_simple/todo/templates/changelog.html +++ b/django_simple/todo/templates/changelog.html @@ -71,6 +71,12 @@ The scale-consistent NEWCT-9P force field added in advanced mode.
+
4.02.2020
+
+ A beta version of docking of two proteins with random starting orientations + added.
+
+ diff --git a/django_simple/todo/templates/edit.html b/django_simple/todo/templates/edit.html index 626cccb..9e7ce80 100644 --- a/django_simple/todo/templates/edit.html +++ b/django_simple/todo/templates/edit.html @@ -6,7 +6,9 @@

Choose type of simulation:  

- +
+
+
{% if basic_adv %}
{% csrf_token %} @@ -73,7 +75,7 @@ {% endif %} - +

diff --git a/django_simple/todo/views.py b/django_simple/todo/views.py index 092b9bd..6e8b105 100644 --- a/django_simple/todo/views.py +++ b/django_simple/todo/views.py @@ -718,7 +718,7 @@ def add_dock(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':'1L2Y','md_seed':-39912345} + data= {'name':task.name,'pdbid':'1BON:A','pdbid2':'1BON:B','md_seed':-12396738,'md_nstep':500000} form = TaskForm_dock(initial=data) else: form = TaskForm_dock(request.POST,request.FILES) @@ -746,6 +746,7 @@ def add_dock(request,task_id): task.md_ntwx=task.remd_nstex task.md_start="pdbstart" + task.remd_multi_m='["3", "3", "3", "3", "3", "3", "3", "3"]' task.md_pdbref=True task.md_respa=False task.ssbond="" @@ -768,6 +769,7 @@ def add_dock(request,task_id): task.md_seed=form.cleaned_data["md_seed"] task.md_nstep=form.cleaned_data["md_nstep"] + task.md_total_steps=task.md_nstep if any(c.islower() for c in seq): task.md_respa=False @@ -795,13 +797,12 @@ def add_dock_a(request,task_id): if request.method == 'POST': if '_example' in request.POST: data= {'name':task.name,'pdbid':'1L2Y','md_pdbref':True,'md_seed':-39912345} - form = TaskForm_remd(initial=data) + form = TaskForm_dock_a(initial=data) else: - form = TaskForm_remd(request.POST,request.FILES) + form = TaskForm_dock_a(request.POST,request.FILES) if form.is_valid(): task.name=form.cleaned_data["name"] - task.type="remd" - task.md_start=form.cleaned_data["md_start"] + task.type="dock" basename = str(task.owner) suffix = datetime.datetime.now().strftime("%y%m%d_%H%M%S") @@ -813,23 +814,52 @@ def add_dock_a(request,task_id): task.pdbcode=pdbid else: task.myfile1=form.cleaned_data["file1"] - task.md_pdbref=form.cleaned_data["md_pdbref"] - task.md_ntwx=task.remd_nstex + + pdbid2=form.cleaned_data["pdbid2"] + if pdbid2: + task.myfile2=load_pdbid(pdbid2,task.jobdirname,'plik2.pdb') + task.pdbcode2=pdbid2 + else: + task.myfile2=form.cleaned_data["file2"] + task.md_ntwx=task.remd_nstex + task.md_start="pdbstart" + task.md_pdbref=True + task.md_respa=False + task.ssbond="" + task.md_seq="" - if task.md_start == "pdbstart" or task.md_pdbref: - seq,task.ssbond=from_pdb(task.myfile1) + + seq1,ssbond1=from_pdb(task.myfile1) + seq2,ssbond2=from_pdb(task.myfile2) + + if seq1[-1]=='X' and seq2[0]=='X': + seq=seq1+seq2 + elif seq1[-1]!='X' and seq2[0]!='X': + seq=seq1+'XX'+seq2 else: - seq=seq_add_x(form.cleaned_data["md_seq"]) + seq=seq1+'X'+seq2 + for i in range(0,len(seq),40): task.md_seq=task.md_seq+seq[i:i+40]+" " - if task.md_start != "pdbstart": - task.ssbond='' - task.md_seed=form.cleaned_data["md_seed"] task.md_nstep=form.cleaned_data["md_nstep"] + task.md_total_steps=task.md_nstep + + task.md_dt=form.cleaned_data["md_dt"] + task.md_lang=form.cleaned_data["md_lang"] + task.md_tau=form.cleaned_data["md_tau"] + task.md_scal_fric=form.cleaned_data["md_scal_fric"] + task.min_maxfun=form.cleaned_data["min_maxfun"] + 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_cluter_temp=form.cleaned_data["remd_cluter_temp"] + task.unres_ff=form.cleaned_data["unres_ff"] if any(c.islower() for c in seq): task.md_respa=False @@ -840,13 +870,11 @@ def add_dock_a(request,task_id): task.save() - if is_lazy_user(request.user): - return redirect('/details1/'+str(task.owner)+'/'+str(task.id)+'/') - else: - return redirect('/') + return redirect('addmlist',task_id=task.id) + else: data= {'name':task.name,'md_seed':-random.randint(10000000,99999999)} - form = TaskForm_remd(initial=data) + form = TaskForm_dock_a(initial=data) basic_adv=False p_type='docking - advanced options' return render(request, 'edit.html', {'form': form, 'task':task, 'basic_adv':basic_adv, 'p_type':p_type}) @@ -1062,7 +1090,7 @@ def refresh_done0(task): task.results_text=text - if task.md_pdbref and task.type=='remd': + if task.md_pdbref and task.type=='remd' or task.type=='dock': for i in range(1,6): try: @@ -1104,7 +1132,7 @@ def refresh_done0(task): - if task.type=='remd': + if task.type=='remd' or task.type=='dock': with open(task.jobdirname+'/file_cluster_clust.out_000', 'r') as f: for line in f: diff --git a/files/generator_v12a b/files/generator_v12a new file mode 100755 index 0000000..091190a Binary files /dev/null and b/files/generator_v12a differ diff --git a/files/generator_v7 b/files/generator_v7 deleted file mode 100755 index f12d7c9..0000000 Binary files a/files/generator_v7 and /dev/null differ diff --git a/files/pbs8.csh b/files/pbs8.csh index 650f7f9..f554a0b 100755 --- a/files/pbs8.csh +++ b/files/pbs8.csh @@ -96,9 +96,13 @@ endif if ( `grep -c pdbref file.inp` ) then awk '{printf "%s%s%s\n",substr($0,0,21)," ",substr($0,23)}' plik.pdb > tmp.pdb + if ( -f "plik1ter.pdb" ) then + grep -v TER plik1ter.pdb | awk '{printf "%s%s%s\n",substr($0,0,21)," ",substr($0,23)}' > tmp.pdb + endif /users2/local/mmtsb/perl/convpdb.pl -renumber 1 -out generic tmp.pdb > plik1.pdb rm tmp.pdb + /users2/local/bin/tmscore MODEL1.pdb plik1.pdb > tmscore1.out /users2/local/bin/tmscore MODEL2.pdb plik1.pdb > tmscore2.out /users2/local/bin/tmscore MODEL3.pdb plik1.pdb > tmscore3.out diff --git a/files/pbs8_new.csh b/files/pbs8_new.csh index ec056c1..cdd73f6 100755 --- a/files/pbs8_new.csh +++ b/files/pbs8_new.csh @@ -96,6 +96,9 @@ endif if ( `grep -c pdbref file.inp` ) then awk '{printf "%s%s%s\n",substr($0,0,21)," ",substr($0,23)}' plik.pdb > tmp.pdb + if ( -f "plik1ter.pdb" ) then + grep -v TER plik1ter.pdb | awk '{printf "%s%s%s\n",substr($0,0,21)," ",substr($0,23)}' > tmp.pdb + endif /users2/local/mmtsb/perl/convpdb.pl -renumber 1 -out generic tmp.pdb > plik1.pdb rm tmp.pdb diff --git a/files/pbs8_newct-9p.csh b/files/pbs8_newct-9p.csh index bb332fd..49083e0 100755 --- a/files/pbs8_newct-9p.csh +++ b/files/pbs8_newct-9p.csh @@ -96,6 +96,9 @@ endif if ( `grep -c pdbref file.inp` ) then awk '{printf "%s%s%s\n",substr($0,0,21)," ",substr($0,23)}' plik.pdb > tmp.pdb + if ( -f "plik1ter.pdb" ) then + grep -v TER plik1ter.pdb | awk '{printf "%s%s%s\n",substr($0,0,21)," ",substr($0,23)}' > tmp.pdb + endif /users2/local/mmtsb/perl/convpdb.pl -renumber 1 -out generic tmp.pdb > plik1.pdb rm tmp.pdb