XLMS test
authorczarek <cezary.czaplewski@ug.edu.pl>
Wed, 12 Oct 2022 11:00:26 +0000 (13:00 +0200)
committerczarek <cezary.czaplewski@ug.edu.pl>
Wed, 12 Oct 2022 11:00:26 +0000 (13:00 +0200)
django_simple/todo/forms.py
django_simple/todo/models.py

index 8898f18..0266f6a 100644 (file)
@@ -5,6 +5,7 @@ from .models import MD_START
 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
@@ -311,6 +312,16 @@ class TaskForm_md_a(forms.Form):
      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>')
 #---^
@@ -377,7 +388,9 @@ class TaskForm_md_a(forms.Form):
              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)
@@ -385,8 +398,11 @@ class TaskForm_md_a(forms.Form):
                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):
@@ -496,6 +512,14 @@ class TaskForm_remd_a(forms.Form):
      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>')
@@ -581,7 +605,9 @@ class TaskForm_remd_a(forms.Form):
              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)
@@ -589,9 +615,12 @@ class TaskForm_remd_a(forms.Form):
                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'
index cbc3c50..4fe9035 100644 (file)
@@ -11,6 +11,7 @@ MD_START= (('extconf','extended chain'),('pdbstart','start from pdb'),('rand_con
 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__)
 
@@ -29,6 +30,12 @@ def user_directory_path3(instance, filename):
     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):
     
@@ -117,6 +124,10 @@ 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)