from .models import MD_LANG
from .models import FF_CHOICE
from .models import NMR_FORMAT
+from .models import XLMS_FORMAT
from django.utils.safestring import mark_safe
#---v
from django.core.files import File
nmr_scal = forms.IntegerField(label='NMR option: scal_peak',initial=20)
nmr_fordepth = forms.FloatField(label='NMR option: FORDEPTH_PEAK',initial=0.5)
nmr_slope = forms.FloatField(label='NMR option: SLOPE_PEAK',initial=0.05)
+
+
+ use_xlms = forms.BooleanField(required=False,label='use XLMS restraints',
+ help_text='this option requires the XLMS restraints file to be set.')
+ xlms_format = forms.ChoiceField(choices=XLMS_FORMAT,widget=forms.RadioSelect,
+ label='XLMS restraints format',initial='txt')
+ file4 = forms.FileField(label='Upload a XLMS restraints file',required=False,
+ help_text=' ')
+
+
file1 = forms.FileField(label='Upload a PDB file',required=False,
help_text='starting structure for pdbstart/reference structure; <i>Hint: if you are using <u>NMR example data</u> then the field will be filled out automatically</i>')
#---^
nmr_scal = cleaned_data.get("nmr_scal")
nmr_fordepth = cleaned_data.get("nmr_fordepth")
nmr_slope = cleaned_data.get("nmr_slope")
- if (use_nmr and file3):
+ nmr_format = cleaned_data.get("nmr_format")
+ use_xlms = cleaned_data.get("use_xlms")
+ if (use_nmr and file3 and nmr_format == 'txt'):
msg=nmr_bad_cols(file3)
if msg != '':
self.add_error('file3',msg)
if (use_nmr and not file3):
self.add_error('file3','"Use NMR restarints" and "Upload a NMR restr. file" must be used together')
- if (use_nmr and (unres_ff != 'NEWCT-9P')):
- self.add_error('unres_ff','"Use NMR restarints" requires NEWCT-9P force field')
+ if ( ( use_nmr or use_xlms ) and (unres_ff != 'NEWCT-9P')):
+ self.add_error('unres_ff','"Use NMR or XLMS restarints" requires NEWCT-9P force field')
+
+ if (use_xlms and not file4):
+ self.add_error('file4','"Use XLMS restarints" and "Upload a XLMS restr. file" must be used together')
#---^
if md_start == 'pdbstart' and not (file1 or pdbid):
nmr_scal = forms.IntegerField(label='NMR option: scal_peak',initial=20)
nmr_fordepth = forms.FloatField(label='NMR option: FORDEPTH_PEAK',initial=0.5)
nmr_slope = forms.FloatField(label='NMR option: SLOPE_PEAK',initial=0.05)
+
+ use_xlms = forms.BooleanField(required=False,label='use XLMS restraints',
+ help_text='this option requires the XLMS restraints file to be set.')
+ xlms_format = forms.ChoiceField(choices=XLMS_FORMAT,widget=forms.RadioSelect,
+ label='XLMS restraints format',initial='txt')
+ file4 = forms.FileField(label='Upload a XLMS restraints file',required=False,
+ help_text=' ')
+
#---^
file1 = forms.FileField(label='Upload a PDB file',required=False,
help_text='starting structure for pdbstart/reference structure; <i>Hint: if you are using <u>NMR example data</u> then the field will be filled out automatically</i>')
nmr_scal = cleaned_data.get("nmr_scal")
nmr_fordepth = cleaned_data.get("nmr_fordepth")
nmr_slope = cleaned_data.get("nmr_slope")
- if (use_nmr and file3):
+ nmr_format = cleaned_data.get("nmr_format")
+ use_xlms = cleaned_data.get("use_xlms")
+ if (use_nmr and file3 and nmr_format == 'txt'):
msg=nmr_bad_cols(file3)
if msg != '':
self.add_error('file3',msg)
if (use_nmr and not file3):
self.add_error('file3','"Use NMR restarints" and "Upload a NMR restr. file" must be used together')
- if (use_nmr and (unres_ff != 'NEWCT-9P')):
+ if ( ( use_nmr or use_xlms ) and (unres_ff != 'NEWCT-9P')):
self.add_error('unres_ff','"Use NMR restarints" requires NEWCT-9P force field')
+ if (use_xlms and not file4):
+ self.add_error('file4','"Use XLMS restarints" and "Upload a XLMS restr. file" must be used together')
+
#---^
if md_start == 'pdbstart' and not (file1 or pdbid):
msg = 'pdbstart with no PDB file or code'
MD_LANG = (('langevin','Langevin'),('berendsen','Berendsen'))
FF_CHOICE = (('FF2','FF2 = JCC 30 2127 (2009) + JCTC 11 817-831 (2015)'),('opt-wtfsa-2','OPT-WTFSA-2 = JCIM 57 2364-2377 (2017)'),('NEWCT-9P','NEWCT-9P = JCP 150 155104 (2019)'))
NMR_FORMAT = (('nef','NEF'),('nef_distance','NEF ignoring angular restraints'),('v2','NMR restraints v2'),('txt','NMR restraints txt'))
+XLMS_FORMAT = (('contact','contact/contact-style crosslinks'),('leitner','Leitner-style crosslink'),('pseudo','MD-determined crosslink pseudopotentials'))
logger = logging.getLogger(__name__)
return '{0}/{1}/{2}'.format('/big/staff/DJANGO_UNRES/django_unres/JOBS/',
instance.jobdirname, 'plik3.nmr')
+def user_directory_path4(instance, filename):
+ # file will be uploaded to MEDIA_ROOT/<jobdirname>/plik4.xlms
+ return '{0}/{1}/{2}'.format('/big/staff/DJANGO_UNRES/django_unres/JOBS/',
+ instance.jobdirname, 'plik4.xlms')
+
+
# Create your models here.
class Task(models.Model):
nmr_slope = models.FloatField(default=0.05)
linijek_nmr=models.IntegerField(default=0)
nmr_format = models.CharField(max_length=20,choices=NMR_FORMAT,default='nef')
+#xlms
+ use_xlms = models.BooleanField(default=False)
+ myfile4 = models.FileField(default='',upload_to=user_directory_path4)
+ xlms_format = models.CharField(max_length=20,choices=XLMS_FORMAT,default='contact')
# system
ready = models.BooleanField(default=False)