PEATSA/WebApp/JobSubmission.py
def _checkSubmittedData(self):
	
		'''Performs a series of checks on the submitted data'''
		if not self.isPDBFilePresent() and not (self.isPDBCodePresent() or self.isPKACodePresent()):
			#No pdb supplied - error
			self.errorData = {"domain":"PDT.SubmissionDomain",
					  "description":"Error in submitted form data.",
					  "detailedDescription":"No PDB file was uploaded and no PDB code was provided. Hard to do a calculation on nothing!",
					  "recoverySuggestion":"Head back to the main page and upload a PDB or provide a PDB code."}
		elif not self.isCalculationDataPresent():
			#No calculation specified
			self.errorData = {"domain":"PDT.SubmissionDomain",
					"description":"Error in submitted form data.",
					"detailedDescription":"At least one calculation type must be selected.",
					"recoverySuggestion":"Head back to the main page and choose some calculations."}
		elif not self.isMutationDataPresent():
			self.errorData = {"domain":"PDT.SubmissionDomain",
					"description":"Error in submitted form data.",
					"detailedDescription":"The mutations to perform must be specified.",
					"recoverySuggestion":"Head back to the main page and choose some mutations or upload a mutation file."}
		elif self.calculations().count('binding') == 1 and not self.isLigandPresent():
			self.errorData = {"domain":"PDT.SubmissionDomain",
					"description":"Error in submitted form data.",
					"detailedDescription":"Binding selected but no ligand provided.",
					"recoverySuggestion":"Head back to the main page and upload a ligand."}
		elif self.calculations().count('scan') == 1 and not self.isPKACodePresent():
			self.errorData = {"domain":"PDT.SubmissionDomain",
					"description":"Error in submitted form data.",
					"detailedDescription":"pKa Scan selected but no pKa calculation code provided.",
					"recoverySuggestion":"In order to perform a scan you must have previously completed a pKa calculation."}
		elif self.calculations().count('scan') == 0 and self.isPKACodePresent():
			self.errorData = {"domain":"PDT.SubmissionDomain",
					"description":"Error in submitted form data.",
					"detailedDescription":"pKa calculation code provided but pKa scan not selected.",
					"recoverySuggestion":"Please select delta pKa option if you want to perform a scan."}				

		#If theres been an error at this stage return now
		if self.errorData is not None:
			return

		#Check the submitted PDB filename
		# In order to standardize the names of the directories 
		# (so each can be identified with a specific id) the following operations are required
		# - The filename must be of the form PDBID.pdb
		# - The PDBID must be all lowercase
		# - The PDBID must not containing any punctuation marks except for underscores
		# - No spaces allowed
		
		if self.isPDBFilePresent():
			self.standardizedPDBFilename = ProcessPDBFilename(self.formData["pdbFile"].filename)
		elif self.isPDBCodePresent():
			self.standardizedPDBFilename = ProcessPDBFilename(self.formData.getvalue("pdbCode") + ".pdb")
		elif self.isPKACodePresent():
			self.standardizedPDBFilename = self.pKaCode() + ".pdb"	
		
		#Check that after the processing pdbFilename is not just an extension
		if self.standardizedPDBFilename == "" or self.standardizedPDBFilename[0] == ".":
			self.errorData = {"domain":"PDT.SubmissionDomain",
					"description":"Error in submitted form data.",
					"detailedDescription":"The filename of the uploaded pdb is invalid.",
					"recoverySuggestion":"Go back to the main page and check the naming guidelines for uploaded pdb files."}
					
		#Check the ligand file extension is mol2 (if it exists).
		if self.isLigandPresent():
			components = os.path.splitext(self.ligandFilename())
			if len(components) != 2:
				self.errorData = {"domain":"PDT.SubmissionDomain",
					"description":"Error in submitted form data.",
					"detailedDescription":"The filename of the uploaded ligand is invalid (missing extension).",
					"recoverySuggestion":"Go back to the main page and check the naming guidelines for uploaded ligand files."}
			elif components[1].lower() != ".mol2":
				self.errorData = {"domain":"PDT.SubmissionDomain",
					"description":"Error in submitted form data.",
					"detailedDescription":"The filename of the uploaded ligand is invalid - %s." % components[1],
					"recoverySuggestion":"The filename extension must be mol2"}
Performs a series of checks on the submitted data
Performs a series of checks on the submitted data
Performs a series of checks on the submitted data
def _checkSubmittedData(self):
		if not self.isPDBFilePresent() and not (self.isPDBCodePresent() or self.isPKACodePresent()):
			self.errorData = {"domain":"PDT.SubmissionDomain",
					  "description":"Error in submitted form data.",
					  "detailedDescription":"No PDB file was uploaded and no PDB code was provided. Hard to do a calculation on nothing!",
					  "recoverySuggestion":"Head back to the main page and upload a PDB or provide a PDB code."}
		elif not self.isCalculationDataPresent():
			self.errorData = {"domain":"PDT.SubmissionDomain",
					"description":"Error in submitted form data.",
					"detailedDescription":"At least one calculation type must be selected.",
					"recoverySuggestion":"Head back to the main page and choose some calculations."}
		elif not self.isMutationDataPresent():
			self.errorData = {"domain":"PDT.SubmissionDomain",
					"description":"Error in submitted form data.",
					"detailedDescription":"The mutations to perform must be specified.",
					"recoverySuggestion":"Head back to the main page and choose some mutations or upload a mutation file."}
		elif self.calculations().count('binding') == 1 and not self.isLigandPresent():
			self.errorData = {"domain":"PDT.SubmissionDomain",
					"description":"Error in submitted form data.",
					"detailedDescription":"Binding selected but no ligand provided.",
					"recoverySuggestion":"Head back to the main page and upload a ligand."}
		elif self.calculations().count('scan') == 1 and not self.isPKACodePresent():
			self.errorData = {"domain":"PDT.SubmissionDomain",
					"description":"Error in submitted form data.",
					"detailedDescription":"pKa Scan selected but no pKa calculation code provided.",
					"recoverySuggestion":"In order to perform a scan you must have previously completed a pKa calculation."}
		elif self.calculations().count('scan') == 0 and self.isPKACodePresent():
			self.errorData = {"domain":"PDT.SubmissionDomain",
					"description":"Error in submitted form data.",
					"detailedDescription":"pKa calculation code provided but pKa scan not selected.",
					"recoverySuggestion":"Please select delta pKa option if you want to perform a scan."}				
		if self.errorData is not None:
			return
		if self.isPDBFilePresent():
			self.standardizedPDBFilename = ProcessPDBFilename(self.formData["pdbFile"].filename)
		elif self.isPDBCodePresent():
			self.standardizedPDBFilename = ProcessPDBFilename(self.formData.getvalue("pdbCode") + ".pdb")
		elif self.isPKACodePresent():
			self.standardizedPDBFilename = self.pKaCode() + ".pdb"	
		if self.standardizedPDBFilename == "" or self.standardizedPDBFilename[0] == ".":
			self.errorData = {"domain":"PDT.SubmissionDomain",
					"description":"Error in submitted form data.",
					"detailedDescription":"The filename of the uploaded pdb is invalid.",
					"recoverySuggestion":"Go back to the main page and check the naming guidelines for uploaded pdb files."}
		if self.isLigandPresent():
			components = os.path.splitext(self.ligandFilename())
			if len(components) != 2:
				self.errorData = {"domain":"PDT.SubmissionDomain",
					"description":"Error in submitted form data.",
					"detailedDescription":"The filename of the uploaded ligand is invalid (missing extension).",
					"recoverySuggestion":"Go back to the main page and check the naming guidelines for uploaded ligand files."}
			elif components[1].lower() != ".mol2":
				self.errorData = {"domain":"PDT.SubmissionDomain",
					"description":"Error in submitted form data.",
					"detailedDescription":"The filename of the uploaded ligand is invalid - %s." % components[1],
					"recoverySuggestion":"The filename extension must be mol2"}
def _checkSubmittedData ( self ) : if not self . isPDBFilePresent ( ) and not ( self . isPDBCodePresent ( ) or self . isPKACodePresent ( ) ) : self . errorData = { "domain" : "PDT.SubmissionDomain" , "description" : "Error in submitted form data." , "detailedDescription" : "No PDB file was uploaded and no PDB code was provided. Hard to do a calculation on nothing!" , "recoverySuggestion" : "Head back to the main page and upload a PDB or provide a PDB code." } elif not self . isCalculationDataPresent ( ) : self . errorData = { "domain" : "PDT.SubmissionDomain" , "description" : "Error in submitted form data." , "detailedDescription" : "At least one calculation type must be selected." , "recoverySuggestion" : "Head back to the main page and choose some calculations." } elif not self . isMutationDataPresent ( ) : self . errorData = { "domain" : "PDT.SubmissionDomain" , "description" : "Error in submitted form data." , "detailedDescription" : "The mutations to perform must be specified." , "recoverySuggestion" : "Head back to the main page and choose some mutations or upload a mutation file." } elif self . calculations ( ) . count ( 'binding' ) == 1 and not self . isLigandPresent ( ) : self . errorData = { "domain" : "PDT.SubmissionDomain" , "description" : "Error in submitted form data." , "detailedDescription" : "Binding selected but no ligand provided." , "recoverySuggestion" : "Head back to the main page and upload a ligand." } elif self . calculations ( ) . count ( 'scan' ) == 1 and not self . isPKACodePresent ( ) : self . errorData = { "domain" : "PDT.SubmissionDomain" , "description" : "Error in submitted form data." , "detailedDescription" : "pKa Scan selected but no pKa calculation code provided." , "recoverySuggestion" : "In order to perform a scan you must have previously completed a pKa calculation." } elif self . calculations ( ) . count ( 'scan' ) == 0 and self . isPKACodePresent ( ) : self . errorData = { "domain" : "PDT.SubmissionDomain" , "description" : "Error in submitted form data." , "detailedDescription" : "pKa calculation code provided but pKa scan not selected." , "recoverySuggestion" : "Please select delta pKa option if you want to perform a scan." } if self . errorData is not None : return if self . isPDBFilePresent ( ) : self . standardizedPDBFilename = ProcessPDBFilename ( self . formData [ "pdbFile" ] . filename ) elif self . isPDBCodePresent ( ) : self . standardizedPDBFilename = ProcessPDBFilename ( self . formData . getvalue ( "pdbCode" ) + ".pdb" ) elif self . isPKACodePresent ( ) : self . standardizedPDBFilename = self . pKaCode ( ) + ".pdb" if self . standardizedPDBFilename == "" or self . standardizedPDBFilename [ 0 ] == "." : self . errorData = { "domain" : "PDT.SubmissionDomain" , "description" : "Error in submitted form data." , "detailedDescription" : "The filename of the uploaded pdb is invalid." , "recoverySuggestion" : "Go back to the main page and check the naming guidelines for uploaded pdb files." } if self . isLigandPresent ( ) : components = os . path . splitext ( self . ligandFilename ( ) ) if len ( components ) != 2 : self . errorData = { "domain" : "PDT.SubmissionDomain" , "description" : "Error in submitted form data." , "detailedDescription" : "The filename of the uploaded ligand is invalid (missing extension)." , "recoverySuggestion" : "Go back to the main page and check the naming guidelines for uploaded ligand files." } elif components [ 1 ] . lower ( ) != ".mol2" : self . errorData = { "domain" : "PDT.SubmissionDomain" , "description" : "Error in submitted form data." , "detailedDescription" : "The filename of the uploaded ligand is invalid - %s." % components [ 1 ] , "recoverySuggestion" : "The filename extension must be mol2" }
Performs a series of checks on the submitted data
Performs a series of checks on the submitted data
'''Performs a series of checks on the submitted data''' #No pdb supplied - error #No calculation specified #If theres been an error at this stage return now #Check the submitted PDB filename # In order to standardize the names of the directories  # (so each can be identified with a specific id) the following operations are required # - The filename must be of the form PDBID.pdb # - The PDBID must be all lowercase # - The PDBID must not containing any punctuation marks except for underscores # - No spaces allowed #Check that after the processing pdbFilename is not just an extension #Check the ligand file extension is mol2 (if it exists).
self