from .models import MD_START
from .models import MD_LANG
from .models import FF_CHOICE
+from django.utils.safestring import mark_safe
import json
import urllib
label='or PDB code (:chain)')
+ md_seq = forms.CharField(label=mark_safe('Sequence of chain2 <br /> for dock peptide'),
+ help_text='aminoacid sequence using one letter code<br>'+
+ 'field is ignored when uploading PDB file2',
+ required=False,
+ widget=forms.Textarea(attrs={'cols': 70, 'rows': 2}))
+
+
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,
md_seed = forms.IntegerField(label='SEED',initial=-39912345,
help_text='seed for random number generator')
dock_peptide = forms.BooleanField(required=False,initial=False,
- label='dock peptide',help_text='no constraints on 2nd chain')
+ label='dock peptide',help_text='no constraints on chain2')
def clean(self):
cleaned_data = super(TaskForm_dock, self).clean()
pdbid = cleaned_data.get("pdbid")
file2 = cleaned_data.get("file2")
pdbid2 = cleaned_data.get("pdbid2")
+ md_seq = cleaned_data.get("md_seq")
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'
+ if not (file2 or pdbid2 or md_seq):
+ msg = 'no PDB file or code or sequence for chain2'
self.add_error('file2', msg)
if pdbid:
widget=forms.TextInput(attrs={'size':6, 'maxlength':6, 'title':'PDB code or PDB code:chain id'}),
label='or PDB code (:chain)')
+ md_seq = forms.CharField(label=mark_safe('Sequence of chain2 <br /> for dock peptide'),
+ help_text='aminoacid sequence using one letter code<br>'+
+ 'field is ignored when uploading PDB file2',
+ required=False,
+ widget=forms.Textarea(attrs={'cols': 70, 'rows': 2}))
+
file2 = forms.FileField(label='Upload a PDB file2',required=False,
help_text='starting structure for chain2')
pdbid = cleaned_data.get("pdbid")
file2 = cleaned_data.get("file2")
pdbid2 = cleaned_data.get("pdbid2")
-
+ md_seq = cleaned_data.get("md_seq")
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'
+ if not (file2 or pdbid2 or md_seq):
+ msg = 'no PDB file or code or sequence for chain2'
self.add_error('file2', msg)
if pdbid:
f2.write(line.replace('$ssbond',tmp_ss))
elif 'cd $PBS_O_WORKDIR' in line and instance.type == 'dock':
f2.write(line)
+ if instance.md_seq2 !='':
+ f2.write("""setenv FGPROCS 2
+setenv POT GB
+setenv PREFIX file2
+setenv OUT1FILE YES
+/users2/local/mpich2-1.4.1p1_intel/bin/mpirun -machinefile $PBS_NODEFILE -np 2 $UNRES_BIN
+/users2/local/pulchra306/pulchra -q -g file2_MD000.pdb
+cat file2_MD000.rebuilt.pdb |grep -v TER |grep -v END > tmp_plik2.pdb
+/users2/local/mmtsb/perl/convpdb.pl -renumber 1 -out generic tmp_plik2.pdb > act.rebuilt.pdb
+/users2/local/scwrl4/Scwrl4 -h -i act.rebuilt.pdb -o plik2.pdb
+rm tmp_plik2.pdb act.rebuilt.pdb\n""")
if instance.dock_peptide:
f2.write('../files/generator_v13 plik.pdb plik2.pdb 1 \n')
else:
if len(tmp)==2:
f.write(tmp[0]+' '+tmp[1]+'\n')
+ if instance.type == 'dock' and instance.md_seq2 != '':
+ with open(instance.jobdirname+'/file2.inp','w') as f:
+ f.write(instance.name + ' chain2 random start'+ '\n')
+ control_line = 'SEED='+str(instance.md_seed)+' '\
+ +'rand_conf md one_letter'\
+ + ' BOXX=1000 BOXY=1000 BOXZ=1000 '
+
+ if instance.unres_ff =='NEWCT-9P':
+ control_line = control_line+'tormode=2 cart'
+
+ type_line = ' reset_vel=0'\
+ +' t_bath=300'\
+ +' nstep=100000'\
+ +' ntwe=10000'\
+ +' ntwx=100000'\
+ +' dt=0.2 lang=1 scal_fric=0.02 respa mdpdb '
+
+ wrapper = textwrap.TextWrapper(width=70)
+ word_list = wrapper.wrap(text=control_line)
+ for element in word_list[:-1]:
+ f.write('{:79}'.format(element)+'&\n')
+ f.write(word_list[-1]+'\n')
+
+ word_list = wrapper.wrap(text=type_line)
+ for element in word_list[:-1]:
+ f.write('{:79}'.format(element)+'&\n')
+ f.write(word_list[-1]+'\n')
+
+ f.write(w+'\n')
+
+ seq=instance.md_seq2.replace(" ","")
+ f.write(str(len(seq))+'\n')
+ for i in range(0,len(seq),80):
+ f.write(seq[i:i+80]+'\n')
+ f.write('0\n')
+ f.write('0\n')
+
+
os.chdir(instance.jobdirname)
ret_code = subprocess.Popen(' /opt/torque/bin/qsub pbs8.csh', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
os.chdir('..')
myfile2 = models.FileField(default='',upload_to=user_directory_path2)
pdbcode2 = models.CharField(max_length=6,default='')
dock_peptide = models.BooleanField(default=False)
+ md_seq2 = models.TextField(max_length=2000,default='')
# system
ready = models.BooleanField(default=False)
if pdbid2:
task.myfile2=load_pdbid(pdbid2,task.jobdirname,'plik2.pdb')
task.pdbcode2=pdbid2
+ seq2,ssbond2=from_pdb(task.myfile2)
else:
task.myfile2=form.cleaned_data["file2"]
+ if not task.myfile2:
+ seq2=seq_add_x(form.cleaned_data["md_seq"])
+ task.md_seq2=seq2
+ else:
+ seq2,ssbond2=from_pdb(task.myfile2)
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
+ if task.md_seq2 =='':
+ task.md_pdbref=True
task.md_respa=False
task.ssbond=""
task.dock_peptide=form.cleaned_data["dock_peptide"]
task.md_seq=""
seq1,ssbond1=from_pdb(task.myfile1)
- seq2,ssbond2=from_pdb(task.myfile2)
+
if seq1[-1]=='X' and seq2[0]=='X':
seq=seq1+seq2
task.damino=True
box1=dock_box(task.myfile1)
- box2=dock_box(task.myfile2)
+ if task.myfile2:
+ box2=dock_box(task.myfile2)
+ else:
+ box2=len(task.md_seq2)*2.0
task.boxx=(box1+box2)*1.2+20
task.boxy=(box1+box2)*1.2+20
task.boxz=(box1+box2)*1.2+20
task.results_text=text
- if task.md_pdbref and task.type=='remd' or task.type=='dock':
+ if task.md_pdbref and task.type=='remd' or task.type=='dock' and task.md_seq2 == '':
for i in range(1,6):
try: