def f_eigenvectors(path, pdb): import sys sys.path.append('/home/people/tc/python/goodvibes/') import goodvibes instance_goodvibes = goodvibes.vibration() fd = open('%saverage/%s' %(path,pdb)) pdb1lines = fd.readlines() fd.close() chains1 = ['A'] pdb1model = [1] atoms_hessian = ['CA'] cutoff_distance = 10. verbose = True jobid = pdb[:-4] pdb1ATOM_all, HEADERdepDate1, REMARK350transformations1, REMARK2resolution1, COMPNDchains1, helices1, strands1 = instance_goodvibes.parse_pdb(pdb1lines, chains1, pdb1model) coordinates1 = [] vectors_difference = [] for chain1 in chains1: for residue in pdb1ATOM_all[chain1]['residues'].keys(): for atom in pdb1ATOM_all[chain1]['residues'][residue]['atoms'].keys(): if atom in atoms_hessian: coordinates1.append(pdb1ATOM_all[chain1]['residues'][residue]['atoms'][atom]['coordinates']) pdb1ATOM_all[chain1]['residues'][residue]['atoms'][atom]['hessian'] = 1 matrix_hessian = instance_goodvibes.hessian_calculation(coordinates1, float(cutoff_distance), verbose) ## calculate with coordinates2 as well... and compare results to switching pdb1 and pdb2 eigenvectors_nonperturbed, eigenvalues_nonperturbed, eigenvectors_combined_nonperturbed = instance_goodvibes.eigenv_calccomb(matrix_hessian, jobid, verbose) stop return
def main(self): import cgi, cgitb, time, os, sys, shutil cgitb.enable() ## enable traceback, which reports non-syntax errors ## set jobid timetuple = time.gmtime(time.time()) timestr = str(timetuple[0])+str(timetuple[1]).zfill(2)+str(timetuple[2]).zfill(2)+str(timetuple[3]).zfill(2)+str(timetuple[4]).zfill(2)+str(timetuple[5]).zfill(2) form = cgi.FieldStorage() if form.has_key("timestr"): timestr = form["timestr"].value ## set paths self.path_tmp = '/var/www/cgi-bin/goodvibes/tmp/' self.path_results = '/var/www/html/goodvibes/results/' self.path_pdbs = '/data/pdb/' self.path_python = '/var/www/cgi-bin/goodvibes/python/' ## initiate fasthtml print 'Content-type: text/html\n\n' print ''' <html> <head><title>UCD GoodVibes</title></head> <body> ''' ## check form for erros and terminate fasthtml if any errors self.errorcheckfile(form) ## if no errors then queue job if os.path.isfile(self.path_tmp+'queue.txt'): fd = open(self.path_tmp+'queue.txt', 'a') fd.write(timestr+'\n') fd.close() queuemanager = False else: fd = open(self.path_tmp+'queue.txt', 'w') fd.write(timestr+'\n') fd.close() queuemanager = True ## if no errors and job queued, then write fast output and slow 1st temporary output sys.stdout.flush() sys.stderr.flush() pid = os.fork() if pid: htmlbody = 'Dear user. Your input data has been queued for processing. Your job is still in the queue.' self.slowhtml(htmlbody, timestr, self.path_results) htmlbody = 'Dear user. Your input data is being processed. Your results or an estimated time for the completion of your calculation will be available from <a href="http://polymerase.ucd.ie/goodvibes/results/'+timestr+'.html" target="_blank">http://polymerase.ucd.ie/goodvibes/results/'+timestr+'.html</a>' self.fasthtml(htmlbody) ## flush the output from fasthtml sys.stdout.flush() os._exit(0) sys.stdout.flush() # double flush used in pKD os.close(0) os.close(1) os.close(2) fd=open('junkout','w') sys.stderr=fd sys.stdout=fd ################################################################################ ## parse html form if form.has_key("cutoffs"): cutoffs = form.getlist("cutoffs") else: cutoffs = ['10'] if form.has_key("amplitude_average"): amplitude_average = form["amplitude"].value else: amplitude_average = 2 if form.has_key("mutations"): mutations = form["mutations"].value else: mutations = 0 if form.has_key("quarternary"): quarternary = form["quarternary"].value else: quarternary = 'monomeric' if form.has_key("frames"): frames = form['frames'].value else: frames = 50 calctype = form['calctype'].value if form["pdb1_id"].value != "": fd = open(self.path_pdbs+form["pdb1_id"].value.lower()+'.pdb', 'r') pdb_lines = fd.readlines() fd.close() fd = open(self.path_tmp+timestr+'_reference.pdb', 'w') fd.writelines(pdb_lines) fd.close() if form["pdb1_file"].value: fd = open(self.path_tmp+timestr+'_reference.pdb', 'w') fd.writelines(form["pdb1_file"].file.readlines()) fd.close() if form["pdb1_txt"].value: fd = open(self.path_tmp+timestr+'_reference.pdb', 'w') fd.writelines(form["pdb1_txt"].file.readlines()) fd.close() if form["chains1"].value: chains1 = form["chains1"].value.upper() else: chains1 = '' ## resranges need to refer to chains. resranges dont need to be updated when building biomolecules from remark350 because residues not parsed. ## self.residue_terminal_n = {'A':-9999, 'B':-9999, 'C':-9999, 'D':-9999, 'E':-9999, 'F':-9999, 'G':-9999, 'H':-9999, 'I':-9999, 'J':-9999, 'K':-9999, 'L':-9999, 'M':-9999, 'N':-9999, 'O':-9999, 'P':-9999, 'Q':-9999, 'R':-9999, 'S':-9999, 'T':-9999, 'U':-9999, 'V':-9999, 'W':-9999, 'X':-9999, 'Y':-9999, 'Z':-9999, ' ':-9999,} ## self.residue_terminal_c = {'A':9999, 'B':9999, 'C':9999, 'D':9999, 'E':9999, 'F':9999, 'G':9999, 'H':9999, 'I':9999, 'J':9999, 'K':9999, 'L':9999, 'M':9999, 'N':9999, 'O':9999, 'P':9999, 'Q':9999, 'R':9999, 'S':9999, 'T':9999, 'U':9999, 'V':9999, 'W':9999, 'X':9999, 'Y':9999, 'Z':9999, ' ':9999,} if form.has_key("resrange1start"): resrange1start = form["resrange1start"].value else: resrange1start = -99999 if form.has_key("resrange1end"): resrange1end = form["resrange1end"].value else: resrange1end = 99999 if form.has_key("model1"): model1 = form["model1"].value else: model1 = '' if not form.has_key("atoms"): atoms_hessian = ['CA'] else: l_atoms = form.getlist("atoms") import sets all = sets.Set(['OXT']) for chemical_symbol in ['C','O','H','N','S']: all.add(chemical_symbol) for remoteness_indicator in ['A','B','G','D','E','Z','H']: all.add(chemical_symbol+remoteness_indicator) for branch_designator in range(10): all.add(chemical_symbol+remoteness_indicator+str(branch_designator)) mainchain = sets.Set(['C', 'O', 'N', 'CA']) sidechain = all-mainchain alpha = sets.Set(['CA']) beta = sets.Set(['CB']) atoms_hessian = sets.Set() for s_atoms in l_atoms: if s_atoms == 'yall': atoms_hessian |= all break if s_atoms == 'ymainchain': atoms_hessian |= mainchain if s_atoms == 'ysidechain': atoms_hessian |= sidechain if s_atoms == 'yalpha': atoms_hessian |= alpha if s_atoms == 'ybeta': atoms_hessian |= beta for s_atoms in l_atoms: if s_atoms == 'nmainchain': atoms_hessian -= mainchain if s_atoms == 'nsidechain': atoms_hessian -= sidechain if s_atoms == 'nalpha': atoms_hessian -= alpha if s_atoms == 'nbeta': atoms_hessian -= beta atoms_hessian = list(atoms_hessian) if form.has_key("pdb2_id"): fd = open(self.path_pdbs+form["pdb2_id"].value.lower()+'.pdb', 'r') pdb_lines = fd.readlines() fd.close() fd = open(self.path_tmp+timestr+'_conformer.pdb', 'w') fd.writelines(pdb_lines) fd.close() if form.has_key("pdb2_file"): fd = open(self.path_tmp+timestr+'_conformer.pdb', 'w') fd.write(form["pdb2_file"].value) fd.close() if form.has_key("chains2"): chains2 = form["chains2"].value.upper() else: chains2 = '' if form.has_key("resrange2start"): resrange2start = form["resrange2start"].value else: resrange2start = -99999 if form.has_key("resrange2end"): resrange2end = form["resrange2end"].value else: resrange2end = 99999 if form.has_key("model2"): model2 = form["model2"].value else: model2 = '' ## write job input to job file lines_input = [] lines_input.append('%s;%s\n' %('chains', chains1)) lines_input.append('%s;%s\n' %('model', model1)) lines_input.append('%s;%s\n' %('resrangestart', resrange1start)) lines_input.append('%s;%s\n' %('resrangeend', resrange1end)) lines_input.append('%s;%s\n' %('cutoffs', ','.join(cutoffs))) lines_input.append('%s;%s\n' %('amplitude', amplitude_average)) lines_input.append('%s;%s\n' %('atoms_hessian', ','.join(atoms_hessian))) lines_input.append('%s;%s\n' %('mutations', mutations)) lines_input.append('%s;%s\n' %('quarternary', quarternary)) lines_input.append('%s;%s\n' %('frames', frames)) lines_input.append('%s;%s\n' %('calctype', calctype)) fd = open(self.path_tmp+'job_'+timestr+'.txt', 'w') fd.writelines(lines_input) fd.close() ## fd = open(self.path_tmp+'job_'+timestr+'.txt', 'w') ## fd.write( ## str(chains1)+'\n'+str(model1)+'\n'+str(resrange1start)+'\n'+str(resrange1end)+'\n'+ ## str(cutoffs)+'\n'+str(amplitude_average)+'\n'+str(atoms_hessian)+'\n'+str(mutations)+'\n'+str(quarternary)+'\n'+ ## str(frames)+'\n'+str(inputfiles)+'\n'+str(calctype)+'\n'+ ## str(chains2)+'\n'+str(model2)+'\n'+str(resrange2start)+'\n'+str(resrange2end)+'\n' ## ) ## fd.close() ## send mail via SMTP server to user about job being queued import smtplib from email.MIMEText import MIMEText mailfrom = 'GoodVibes' mailto = form['mail'].value msg = MIMEText('Dear user. Your input data is being processed. Your results or an estimated time for the completion of your calculation will be available from http://polymerase.ucd.ie/goodvibes/results/'+timestr+'.html <http://polymerase.ucd.ie/goodvibes/results/'+timestr+'.html>.') msg['Subject'] = 'Your GoodVibes job with the ID %s has been queued for processing' %timestr msg['From'] = mailfrom msg['Reply-To'] = '*****@*****.**' msg['To'] = mailto server=smtplib.SMTP('mail.ucd.ie') server.set_debuglevel(1) server.sendmail(mailfrom, mailto, msg.as_string()) server.close() ## delete timestr to avoid use of this variable beyond this point (not really necessary) del timestr ################################################################################ ## end if not queue manager if not queuemanager: return ################################################################################ ## process queue if queue manager ## change dir in case of any goodvibes outputs (dislin etc.) os.chdir(self.path_results) ## append the python library to sys.paths after change of dir sys.path.append(self.path_python) import goodvibes instance_NMA = goodvibes.vibration() ## process queue while it exists while os.path.isfile(self.path_tmp+'queue.txt'): ## parse job id fd = open(self.path_tmp+'queue.txt', 'r') job = fd.readline().strip() fd.close() ## write slow 2nd temporary output htmlbody = 'Dear user. Your input is being processed. Return to this page in a few seconds to get an estimate of the end time of the calculations.' self.slowhtml(htmlbody, job, self.path_results) ## parse parameters from job txt file to goodvibes fd = open(self.path_tmp+'job_'+job+'.txt', 'r') lines_job = fd.readlines() fd.close() input_job = {} for line in lines_job: input_job[line.split(';')[0]] = line.split(';')[1][:-1] if input_job['chains'] != '': chains1 = input_job['chains'].split(',') else: chains1 = [] model1 = input_job['model'].strip() resrange1start = int(input_job['resrangestart'].strip()) resrange1end = int(input_job['resrangeend'].strip()) cutoffs = input_job['cutoffs'].split(',') for i in range(len(cutoffs)): cutoffs[i] = float(cutoffs[i]) amplitude_average = float(input_job['amplitude'].strip()) atoms_hessian = input_job['atoms_hessian'].split(',') quarternary = input_job['quarternary'].strip() frames = float(input_job['frames']) calctype = int(input_job['calctype'].strip()) fd = open(self.path_tmp+job+'_reference.pdb', 'r') pdblines1 = fd.readlines() fd.close() ## run goodvibes try: results = instance_NMA.main(pdblines1,chains1,model1, atoms_hessian, quarternary, job, frames, cutoffs, calctype, [1], path_html = self.path_results, path_python = self.path_python) ## except 'chainerror', error: ## ## if expected error then remove from queue and report to user ## self.slowhtml(error, job, self.path_results) ## self.queue() ## continue except IOError, (errno,strerror): self.slowhtml(str(errno)+str(strerror), job, self.path_results) self.queue() results = instance_NMA.main(pdblines1,chains1,model1, atoms_hessian, quarternary, job, frames, cutoffs, calctype, [1], path_html = self.path_results, path_python = self.path_python) continue except:
def errorcheckfile(self, form): import os, sys sys.path.append(self.path_python) import goodvibes ## ## check for essential settings ## if not (form["cutoffs"] and form["amplitude"] and ## form["mutations"] and form["atoms"] and form["frames"]): ## self.fasthtml('Dear User. You need to set cutoff distance, amplitude, number of allowed mutations, frames and atoms to be used.', error = True) ## check for essential input if not ( form["pdb1_id"].value or form["pdb1_file"].value or form["pdb1_txt"].value ): self.fasthtml('Dear user. You need to specify a pdb to be used.', error = True) self.queue() ## check for multiple input if ( form["pdb1_id"].value and form["pdb1_file"].value ) or ( form["pdb1_id"].value and form["pdb1_txt"].value ) or ( form["pdb1_file"].value and form["pdb1_txt"].value ): self.fasthtml('Dear user. You must use *either* a PDB ID, an attached PDB file *or* a pasted PDB file as input.', error = True) self.queue() ## check for valid pdb ids if specified if form["pdb1_id"].value: if not os.path.isfile(self.path_pdbs+form["pdb1_id"].value.lower()+'.pdb'): self.fasthtml('The PDB ID you have specified is not found in the protein data bank.', error = True) self.queue() ## check that a mail address has been given if not form["mail"].value: self.fasthtml('Please specify an address where you want status about your job sent to.', error = True) self.queue() ## check that either of the radio buttons for method of calculation is checked if not form["calctype"].value: self.fasthtml('You need to specify which calculation you want to perform.', error = True) self.queue() ## check for valid or missing chain id(s) ## parse chains if form["pdb1_id"].value: fd = open(self.path_pdbs+form["pdb1_id"].value.lower()+'.pdb', 'r') pdb_lines = fd.readlines() fd.close() if form["pdb1_file"].value != "": pdb_lines = form["pdb1_file"].file.readlines() if form["pdb1_txt"].value != "": pdb_lines = form["pdb1_txt"].file.readlines() instance_NMA = goodvibes.vibration() pdb1ATOM_all = instance_NMA.parse_pdb(pdb_lines, pdb_chain = [], pdb_model = None)[0] ## check for valid chain ids if form["chains1"].value: if not form["chains1"].value.upper() in pdb1ATOM_all.keys(): self.fasthtml('Specified chain ID not present in PDB. Only chains (%s) are present in pdb.' %pdb1ATOM_all.keys(), error = True) self.queue() ## check that only 1 chain is present if none specified by user if form["chains1"].value == "": ## error if no chains present if len(pdb1ATOM_all.keys()) == 0: self.fasthtml('No protein chains present in pdb. GoodVibes does not compute polynucleotides at present.', error = True) self.queue() ## error if multiple chains if len(pdb1ATOM_all.keys()) > 1: self.fasthtml('Multiple chains (%s) present in pdb. Please specify which one to use.' %pdb1ATOM_all.keys(), error = True) self.queue() ## check if input exceeds a certain allwed length ## check for valid number of frames if form.has_key("frames"): if int(form["frames"].value) > 500 or int(form["frames"].value) < 2: self.fasthtml('Please change the number of frames to be within the range 10 to 500.', error = True) self.queue() ## acummulate error messages and then return them in errorhtml if there is any... return
def main(self): import cgi, cgitb, time, os, sys, shutil cgitb.enable() ## enable traceback, which reports non-syntax errors ## set jobid timetuple = time.gmtime(time.time()) timestr = str(timetuple[0])+str(timetuple[1]).zfill(2)+str(timetuple[2]).zfill(2)+str(timetuple[3]).zfill(2)+str(timetuple[4]).zfill(2)+str(timetuple[5]).zfill(2) form = cgi.FieldStorage() if form.has_key("timestr"): timestr = form["timestr"].value ## set paths self.path_tmp = '/var/www/cgi-bin/goodvibes/tmp/' self.path_results = '/var/www/html/goodvibes/results/' self.path_pdbs = '/data/pdb/' self.path_python = '/var/www/cgi-bin/goodvibes/python/' ## check form for erros if form["inputfiles"].value == '1': inputfiles = 1 self.errorcheck1file(form) elif form["inputfiles"].value == '2': inputfiles = 2 self.errorcheck2files(form) ## if no errors then queue job if os.path.isfile(self.path_tmp+'queue.txt'): fd = open(self.path_tmp+'queue.txt', 'a') fd.write(timestr+'\n') fd.close() queuemanager = False else: fd = open(self.path_tmp+'queue.txt', 'w') fd.write(timestr+'\n') fd.close() queuemanager = True ## write fast output and slow 1st temporary output ## pid = os.fork() pid = 11 if pid: htmlbody = 'Dear user. Your input data has been queued for processing. Your job is still in the queu.' self.slowhtml(htmlbody, timestr) htmlbody = 'Dear user. Your input data is being processed. Your results will be available from <a href="http://polymerase.ucd.ie/goodvibes/results/'+timestr+'.html">http://polymerase.ucd.ie/goodvibes/results/'+timestr+'.html</a> in a minute...' self.fasthtml(htmlbody) ## sys.stdout.flush() ## os.close(0) ## ## os.close(1) ## os.close(2) ################################################################################ ## parse html form if form.has_key("cutoffs"): cutoffs = form.getlist("cutoffs") for i in range(len(cutoffs)): cutoffs[i] = float(cutoffs[i]) else: cutoffs = [10] if form.has_key("amplitude_average"): amplitude_average = form["amplitude"].value else: amplitude_average = 2 if form.has_key("mutations"): mutations = form["mutations"].value else: mutations = 0 if form.has_key("quarternary"): quarternary = form["quarternary"].value else: quarternary = 'monomeric' if form.has_key("frames"): frames = form['frames'].value else: frames = 50 if form.has_key("pdb1_id"): fd = open(self.path_pdbs+form["pdb1_id"].value.lower()+'.pdb', 'r') pdb_lines = fd.readlines() fd.close() fd = open(self.path_tmp+timestr+'_reference.pdb', 'w') fd.writelines(pdb_lines) fd.close() if form.has_key("pdb1_file"): fd = open(self.path_tmp+timestr+'_reference.pdb', 'w') fd.write(form["pdb1_file"].value) fd.close() if form.has_key("chains1"): chains1 = form["chains1"].value.upper() else: chains1 = '' ## resranges need to refer to chains. resranges dont need to be updated when building biomolecules from remark350 because residues not parsed. ## self.residue_terminal_n = {'A':-9999, 'B':-9999, 'C':-9999, 'D':-9999, 'E':-9999, 'F':-9999, 'G':-9999, 'H':-9999, 'I':-9999, 'J':-9999, 'K':-9999, 'L':-9999, 'M':-9999, 'N':-9999, 'O':-9999, 'P':-9999, 'Q':-9999, 'R':-9999, 'S':-9999, 'T':-9999, 'U':-9999, 'V':-9999, 'W':-9999, 'X':-9999, 'Y':-9999, 'Z':-9999, ' ':-9999,} ## self.residue_terminal_c = {'A':9999, 'B':9999, 'C':9999, 'D':9999, 'E':9999, 'F':9999, 'G':9999, 'H':9999, 'I':9999, 'J':9999, 'K':9999, 'L':9999, 'M':9999, 'N':9999, 'O':9999, 'P':9999, 'Q':9999, 'R':9999, 'S':9999, 'T':9999, 'U':9999, 'V':9999, 'W':9999, 'X':9999, 'Y':9999, 'Z':9999, ' ':9999,} if form.has_key("resrange1start"): resrange1start = form["resrange1start"].value else: resrange1start = -99999 if form.has_key("resrange1end"): resrange1end = form["resrange1end"].value else: resrange1end = 99999 if form.has_key("model1"): model1 = form["model1"].value else: model1 = '' if not form.has_key("atoms"): atoms_hessian = ['CA'] else: l_atoms = form.getlist("atoms") import sets all = sets.Set(['OXT']) for chemical_symbol in ['C','O','H','N','S']: all.add(chemical_symbol) for remoteness_indicator in ['A','B','G','D','E','Z','H']: all.add(chemical_symbol+remoteness_indicator) for branch_designator in range(10): all.add(chemical_symbol+remoteness_indicator+str(branch_designator)) mainchain = sets.Set(['C', 'O', 'N', 'CA']) sidechain = all-mainchain alpha = sets.Set(['CA']) beta = sets.Set(['CB']) atoms_hessian = sets.Set() for s_atoms in l_atoms: if s_atoms == 'yall': atoms_hessian |= all break if s_atoms == 'ymainchain': atoms_hessian |= mainchain if s_atoms == 'ysidechain': atoms_hessian |= sidechain if s_atoms == 'yalpha': atoms_hessian |= alpha if s_atoms == 'ybeta': atoms_hessian |= beta for s_atoms in l_atoms: if s_atoms == 'nmainchain': atoms_hessian -= mainchain if s_atoms == 'nsidechain': atoms_hessian -= sidechain if s_atoms == 'nalpha': atoms_hessian -= alpha if s_atoms == 'nbeta': atoms_hessian -= beta atoms_hessian = list(atoms_hessian) if form.has_key("pdb2_id"): fd = open(self.path_pdbs+form["pdb2_id"].value.lower()+'.pdb', 'r') pdb_lines = fd.readlines() fd.close() fd = open(self.path_tmp+timestr+'_conformer.pdb', 'w') fd.writelines(pdb_lines) fd.close() if form.has_key("pdb2_file"): fd = open(self.path_tmp+timestr+'_conformer.pdb', 'w') fd.write(form["pdb2_file"].value) fd.close() if form.has_key("chains2"): chains2 = form["chains2"].value.upper() else: chains2 = '' if form.has_key("resrange2start"): resrange2start = form["resrange2start"].value else: resrange2start = -99999 if form.has_key("resrange2end"): resrange2end = form["resrange2end"].value else: resrange2end = 99999 if form.has_key("model2"): model2 = form["model2"].value else: model2 = '' ## write job input to job file fd = open(self.path_tmp+'job_'+timestr+'.txt', 'w') fd.write( str(chains1)+'\n'+str(model1)+'\n'+str(resrange1start)+'\n'+str(resrange1end)+'\n'+ str(cutoffs)+'\n'+str(amplitude_average)+'\n'+str(atoms_hessian)+'\n'+str(mutations)+'\n'+str(quarternary)+'\n'+ str(frames)+'\n'+str(inputfiles)+'\n'+ str(chains2)+'\n'+str(model2)+'\n'+str(resrange2start)+'\n'+str(resrange2end)+'\n' ) fd.close() del timestr ################################################################################ ## end if not queue manager if not queuemanager: return ################################################################################ ## process queue if queue manager ## change dir in case of any goodvibes outputs (dislin etc.) os.chdir(self.path_results) ## append the python library to sys.paths after change of dir sys.path.append(self.path_python) import goodvibes instance_NMA = goodvibes.vibration() ## process queue while it exists while os.path.isfile(self.path_tmp+'queue.txt'): ## parse job id fd = open(self.path_tmp+'queue.txt', 'r') job = fd.readline().strip() fd.close() ## write slow 2nd temporary output htmlbody = 'Dear user. Your input is being processed. Your results - or an error if you gave an invalid input - will be here in less than 30 minutes.' self.slowhtml(htmlbody, job) ## parse parameters from job txt file to goodvibes fd = open(self.path_tmp+'job_'+job+'.txt', 'r') lines_job = fd.readlines() fd.close() if lines_job[0].strip() != '': chains1 = lines_job[0].strip().split(',') else: chains1 = [] model1 = lines_job[1].strip() resrange1start = int(lines_job[2].strip()) resrange1end = int(lines_job[3].strip()) cutoffs = lines_job[4].strip()[1:-1].split(', ') for i in range(len(cutoffs)): cutoffs[i] = float(cutoffs[i]) amplitude_average = float(lines_job[5].strip()) atoms_hessian = lines_job[6].strip()[2:-2].split(',') mutations = int(lines_job[7].strip()) quarternary = lines_job[8].strip() frames = float(lines_job[9].strip()) inputfiles = int(lines_job[10].strip()) fd = open(self.path_tmp+job+'_reference.pdb', 'r') pdblines1 = fd.readlines() fd.close() if inputfiles == 2: fd = open(self.path_tmp+job+'_conformer.pdb', 'r') pdblines2 = fd.readlines() fd.close() if lines_job[11].strip() != '': chains2 = lines_job[11].strip().split(',') else: chains2 = [] model2 = lines_job[12].strip() resrange2start = int(lines_job[13].strip()) resrange2end = int(lines_job[14].strip()) else: pdblines2 = None chains2 = None model2 = None ## run goodvibes try: results = instance_NMA.main(pdblines1,chains1,model1, atoms_hessian, amplitude_average, cutoffs, mutations, quarternary, job, frames, pdblines2, chains2, model2) except 'chainerror', error: ## if expected error then remove from queue and report to user self.slowhtml(error, job) self.queue() continue except:
def main(self): import cgi, cgitb, time, os, sys, shutil cgitb.enable() ## enable traceback, which reports non-syntax errors ## set jobid timetuple = time.gmtime(time.time()) timestr = str(timetuple[0]) + str(timetuple[1]).zfill(2) + str( timetuple[2]).zfill(2) + str(timetuple[3]).zfill(2) + str( timetuple[4]).zfill(2) + str(timetuple[5]).zfill(2) form = cgi.FieldStorage() if form.has_key("timestr"): timestr = form["timestr"].value ## set paths self.path_tmp = '/var/www/cgi-bin/goodvibes/tmp/' self.path_results = '/var/www/html/goodvibes/results/' self.path_pdbs = '/data/pdb/' self.path_python = '/var/www/cgi-bin/goodvibes/python/' ## check form for erros if form["inputfiles"].value == '1': inputfiles = 1 self.errorcheck1file(form) elif form["inputfiles"].value == '2': inputfiles = 2 self.errorcheck2files(form) ## if no errors then queue job if os.path.isfile(self.path_tmp + 'queue.txt'): fd = open(self.path_tmp + 'queue.txt', 'a') fd.write(timestr + '\n') fd.close() queuemanager = False else: fd = open(self.path_tmp + 'queue.txt', 'w') fd.write(timestr + '\n') fd.close() queuemanager = True ## write fast output and slow 1st temporary output ## pid = os.fork() pid = 11 if pid: htmlbody = 'Dear user. Your input data has been queued for processing. Your job is still in the queu.' self.slowhtml(htmlbody, timestr) htmlbody = 'Dear user. Your input data is being processed. Your results will be available from <a href="http://polymerase.ucd.ie/goodvibes/results/' + timestr + '.html">http://polymerase.ucd.ie/goodvibes/results/' + timestr + '.html</a> in a minute...' self.fasthtml(htmlbody) ## sys.stdout.flush() ## os.close(0) ## ## os.close(1) ## os.close(2) ################################################################################ ## parse html form if form.has_key("cutoffs"): cutoffs = form.getlist("cutoffs") for i in range(len(cutoffs)): cutoffs[i] = float(cutoffs[i]) else: cutoffs = [10] if form.has_key("amplitude_average"): amplitude_average = form["amplitude"].value else: amplitude_average = 2 if form.has_key("mutations"): mutations = form["mutations"].value else: mutations = 0 if form.has_key("quarternary"): quarternary = form["quarternary"].value else: quarternary = 'monomeric' if form.has_key("frames"): frames = form['frames'].value else: frames = 50 if form.has_key("pdb1_id"): fd = open(self.path_pdbs + form["pdb1_id"].value.lower() + '.pdb', 'r') pdb_lines = fd.readlines() fd.close() fd = open(self.path_tmp + timestr + '_reference.pdb', 'w') fd.writelines(pdb_lines) fd.close() if form.has_key("pdb1_file"): fd = open(self.path_tmp + timestr + '_reference.pdb', 'w') fd.write(form["pdb1_file"].value) fd.close() if form.has_key("chains1"): chains1 = form["chains1"].value.upper() else: chains1 = '' ## resranges need to refer to chains. resranges dont need to be updated when building biomolecules from remark350 because residues not parsed. ## self.residue_terminal_n = {'A':-9999, 'B':-9999, 'C':-9999, 'D':-9999, 'E':-9999, 'F':-9999, 'G':-9999, 'H':-9999, 'I':-9999, 'J':-9999, 'K':-9999, 'L':-9999, 'M':-9999, 'N':-9999, 'O':-9999, 'P':-9999, 'Q':-9999, 'R':-9999, 'S':-9999, 'T':-9999, 'U':-9999, 'V':-9999, 'W':-9999, 'X':-9999, 'Y':-9999, 'Z':-9999, ' ':-9999,} ## self.residue_terminal_c = {'A':9999, 'B':9999, 'C':9999, 'D':9999, 'E':9999, 'F':9999, 'G':9999, 'H':9999, 'I':9999, 'J':9999, 'K':9999, 'L':9999, 'M':9999, 'N':9999, 'O':9999, 'P':9999, 'Q':9999, 'R':9999, 'S':9999, 'T':9999, 'U':9999, 'V':9999, 'W':9999, 'X':9999, 'Y':9999, 'Z':9999, ' ':9999,} if form.has_key("resrange1start"): resrange1start = form["resrange1start"].value else: resrange1start = -99999 if form.has_key("resrange1end"): resrange1end = form["resrange1end"].value else: resrange1end = 99999 if form.has_key("model1"): model1 = form["model1"].value else: model1 = '' if not form.has_key("atoms"): atoms_hessian = ['CA'] else: l_atoms = form.getlist("atoms") import sets all = sets.Set(['OXT']) for chemical_symbol in ['C', 'O', 'H', 'N', 'S']: all.add(chemical_symbol) for remoteness_indicator in [ 'A', 'B', 'G', 'D', 'E', 'Z', 'H' ]: all.add(chemical_symbol + remoteness_indicator) for branch_designator in range(10): all.add(chemical_symbol + remoteness_indicator + str(branch_designator)) mainchain = sets.Set(['C', 'O', 'N', 'CA']) sidechain = all - mainchain alpha = sets.Set(['CA']) beta = sets.Set(['CB']) atoms_hessian = sets.Set() for s_atoms in l_atoms: if s_atoms == 'yall': atoms_hessian |= all break if s_atoms == 'ymainchain': atoms_hessian |= mainchain if s_atoms == 'ysidechain': atoms_hessian |= sidechain if s_atoms == 'yalpha': atoms_hessian |= alpha if s_atoms == 'ybeta': atoms_hessian |= beta for s_atoms in l_atoms: if s_atoms == 'nmainchain': atoms_hessian -= mainchain if s_atoms == 'nsidechain': atoms_hessian -= sidechain if s_atoms == 'nalpha': atoms_hessian -= alpha if s_atoms == 'nbeta': atoms_hessian -= beta atoms_hessian = list(atoms_hessian) if form.has_key("pdb2_id"): fd = open(self.path_pdbs + form["pdb2_id"].value.lower() + '.pdb', 'r') pdb_lines = fd.readlines() fd.close() fd = open(self.path_tmp + timestr + '_conformer.pdb', 'w') fd.writelines(pdb_lines) fd.close() if form.has_key("pdb2_file"): fd = open(self.path_tmp + timestr + '_conformer.pdb', 'w') fd.write(form["pdb2_file"].value) fd.close() if form.has_key("chains2"): chains2 = form["chains2"].value.upper() else: chains2 = '' if form.has_key("resrange2start"): resrange2start = form["resrange2start"].value else: resrange2start = -99999 if form.has_key("resrange2end"): resrange2end = form["resrange2end"].value else: resrange2end = 99999 if form.has_key("model2"): model2 = form["model2"].value else: model2 = '' ## write job input to job file fd = open(self.path_tmp + 'job_' + timestr + '.txt', 'w') fd.write( str(chains1) + '\n' + str(model1) + '\n' + str(resrange1start) + '\n' + str(resrange1end) + '\n' + str(cutoffs) + '\n' + str(amplitude_average) + '\n' + str(atoms_hessian) + '\n' + str(mutations) + '\n' + str(quarternary) + '\n' + str(frames) + '\n' + str(inputfiles) + '\n' + str(chains2) + '\n' + str(model2) + '\n' + str(resrange2start) + '\n' + str(resrange2end) + '\n') fd.close() del timestr ################################################################################ ## end if not queue manager if not queuemanager: return ################################################################################ ## process queue if queue manager ## change dir in case of any goodvibes outputs (dislin etc.) os.chdir(self.path_results) ## append the python library to sys.paths after change of dir sys.path.append(self.path_python) import goodvibes instance_NMA = goodvibes.vibration() ## process queue while it exists while os.path.isfile(self.path_tmp + 'queue.txt'): ## parse job id fd = open(self.path_tmp + 'queue.txt', 'r') job = fd.readline().strip() fd.close() ## write slow 2nd temporary output htmlbody = 'Dear user. Your input is being processed. Your results - or an error if you gave an invalid input - will be here in less than 30 minutes.' self.slowhtml(htmlbody, job) ## parse parameters from job txt file to goodvibes fd = open(self.path_tmp + 'job_' + job + '.txt', 'r') lines_job = fd.readlines() fd.close() if lines_job[0].strip() != '': chains1 = lines_job[0].strip().split(',') else: chains1 = [] model1 = lines_job[1].strip() resrange1start = int(lines_job[2].strip()) resrange1end = int(lines_job[3].strip()) cutoffs = lines_job[4].strip()[1:-1].split(', ') for i in range(len(cutoffs)): cutoffs[i] = float(cutoffs[i]) amplitude_average = float(lines_job[5].strip()) atoms_hessian = lines_job[6].strip()[2:-2].split(',') mutations = int(lines_job[7].strip()) quarternary = lines_job[8].strip() frames = float(lines_job[9].strip()) inputfiles = int(lines_job[10].strip()) fd = open(self.path_tmp + job + '_reference.pdb', 'r') pdblines1 = fd.readlines() fd.close() if inputfiles == 2: fd = open(self.path_tmp + job + '_conformer.pdb', 'r') pdblines2 = fd.readlines() fd.close() if lines_job[11].strip() != '': chains2 = lines_job[11].strip().split(',') else: chains2 = [] model2 = lines_job[12].strip() resrange2start = int(lines_job[13].strip()) resrange2end = int(lines_job[14].strip()) else: pdblines2 = None chains2 = None model2 = None ## run goodvibes try: results = instance_NMA.main(pdblines1, chains1, model1, atoms_hessian, amplitude_average, cutoffs, mutations, quarternary, job, frames, pdblines2, chains2, model2) except 'chainerror', error: ## if expected error then remove from queue and report to user self.slowhtml(error, job) self.queue() continue except:
def errorcheckfile(self, form): import os, sys sys.path.append(self.path_python) import goodvibes ## ## check for essential settings ## if not (form["cutoffs"] and form["amplitude"] and ## form["mutations"] and form["atoms"] and form["frames"]): ## self.fasthtml('Dear User. You need to set cutoff distance, amplitude, number of allowed mutations, frames and atoms to be used.', error = True) ## check for essential input if not ( form["pdb1_id"].value or form["pdb1_file"].value or form["pdb1_txt"].value ): self.fasthtml('Dear user. You need to specify a pdb to be used.', error = True) ## check for multiple input if ( form["pdb1_id"].value and form["pdb1_file"].value ) or ( form["pdb1_id"].value and form["pdb1_txt"].value ) or ( form["pdb1_file"].value and form["pdb1_txt"].value ): self.fasthtml('Dear user. You must use *either* a PDB ID, an attached PDB file *or* a pasted PDB file as input.', error = True) ## check for valid pdb ids if specified if form["pdb1_id"].value: if not os.path.isfile(self.path_pdbs+form["pdb1_id"].value.lower()+'.pdb'): self.fasthtml('The PDB ID you have specified is not found in the protein data bank.', error = True) ## check that a mail address has been given if not form["mail"].value: self.fasthtml('Please specify an address where you want status about your job sent to.', error = True) ## check that either of the radio buttons for method of calculation is checked if not form["calctype"].value: self.fasthtml('You need to specify which calculation you want to perform.', error = True) ## check for valid or missing chain id(s) ## parse chains if form["pdb1_id"].value: fd = open(self.path_pdbs+form["pdb1_id"].value.lower()+'.pdb', 'r') pdb_lines = fd.readlines() fd.close() if form["pdb1_file"].value != "": pdb_lines = form["pdb1_file"].file.readlines() if form["pdb1_txt"].value != "": pdb_lines = form["pdb1_txt"].file.readlines() instance_NMA = goodvibes.vibration() pdb1ATOM_all = instance_NMA.parse_pdb(pdb_lines, pdb_chain = [], pdb_model = None)[0] ## check for valid chain ids if form["chains1"].value: if not form["chains1"].value.upper() in pdb1ATOM_all.keys(): self.fasthtml('Specified chain ID not present in PDB. Only chains (%s) are present in pdb.' %pdb1ATOM_all.keys(), error = True) ## check that only 1 chain is present if none specified by user if form["chains1"].value == "": ## error if no chains present if len(pdb1ATOM_all.keys()) == 0: self.fasthtml('No protein chains present in pdb. GoodVibes does not compute polynucleotides at present.', error = True) ## error if multiple chains if len(pdb1ATOM_all.keys()) > 1: self.fasthtml('Multiple chains (%s) present in pdb. Please specify which one to use.' %pdb1ATOM_all.keys(), error = True) ## check if input exceeds a certain allwed length ## check for valid number of frames if form.has_key("frames"): if int(form["frames"].value) > 500 or int(form["frames"].value) < 2: self.fasthtml('Please change the number of frames to be within the range 10 to 500.', error = True) ## acummulate error messages and then return them in errorhtml if there is any... return
def main(self): import cgi, cgitb, time, os, sys, shutil cgitb.enable() ## enable traceback, which reports non-syntax errors ## set jobid timetuple = time.gmtime(time.time()) timestr = ( str(timetuple[0]) + str(timetuple[1]).zfill(2) + str(timetuple[2]).zfill(2) + str(timetuple[3]).zfill(2) + str(timetuple[4]).zfill(2) + str(timetuple[5]).zfill(2) ) form = cgi.FieldStorage() if form.has_key("timestr"): timestr = form["timestr"].value ## set paths self.path_tmp = "/var/www/cgi-bin/goodvibes/tmp/" self.path_results = "/var/www/html/goodvibes/results/" self.path_pdbs = "/data/pdb/" self.path_python = "/var/www/cgi-bin/goodvibes/python/" ## initiate fasthtml print "Content-type: text/html\n\n" print """ <html> <head><title>UCD GoodVibes</title></head> <body> """ ## check form for erros and terminate fasthtml if any errors self.errorcheckfile(form) ## if no errors then queue job if os.path.isfile(self.path_tmp + "queue.txt"): fd = open(self.path_tmp + "queue.txt", "a") fd.write(timestr + "\n") fd.close() queuemanager = False else: fd = open(self.path_tmp + "queue.txt", "w") fd.write(timestr + "\n") fd.close() queuemanager = True ## if no errors and job queued, then write fast output and slow 1st temporary output sys.stdout.flush() sys.stderr.flush() pid = os.fork() if pid: htmlbody = "Dear user. Your input data has been queued for processing. Your job is still in the queue." self.slowhtml(htmlbody, timestr, self.path_results) htmlbody = ( 'Dear user. Your input data is being processed. Your results or an estimated time for the completion of your calculation will be available from <a href="http://polymerase.ucd.ie/goodvibes/results/' + timestr + '.html" target="_blank">http://polymerase.ucd.ie/goodvibes/results/' + timestr + ".html</a>" ) self.fasthtml(htmlbody) ## flush the output from fasthtml sys.stdout.flush() os._exit(0) sys.stdout.flush() # double flush used in pKD os.close(0) os.close(1) os.close(2) fd = open("junkout", "w") sys.stderr = fd sys.stdout = fd ################################################################################ ## parse html form if form.has_key("cutoffs"): cutoffs = form.getlist("cutoffs") else: cutoffs = ["10"] if form.has_key("amplitude_average"): amplitude_average = form["amplitude"].value else: amplitude_average = 2 if form.has_key("mutations"): mutations = form["mutations"].value else: mutations = 0 if form.has_key("quarternary"): quarternary = form["quarternary"].value else: quarternary = "monomeric" if form.has_key("frames"): frames = form["frames"].value else: frames = 50 calctype = form["calctype"].value if form["pdb1_id"].value != "": fd = open(self.path_pdbs + form["pdb1_id"].value.lower() + ".pdb", "r") pdb_lines = fd.readlines() fd.close() fd = open(self.path_tmp + timestr + "_reference.pdb", "w") fd.writelines(pdb_lines) fd.close() if form["pdb1_file"].value: fd = open(self.path_tmp + timestr + "_reference.pdb", "w") fd.writelines(form["pdb1_file"].file.readlines()) fd.close() if form["pdb1_txt"].value: fd = open(self.path_tmp + timestr + "_reference.pdb", "w") fd.writelines(form["pdb1_txt"].file.readlines()) fd.close() if form["chains1"].value: chains1 = form["chains1"].value.upper() else: chains1 = "" ## resranges need to refer to chains. resranges dont need to be updated when building biomolecules from remark350 because residues not parsed. ## self.residue_terminal_n = {'A':-9999, 'B':-9999, 'C':-9999, 'D':-9999, 'E':-9999, 'F':-9999, 'G':-9999, 'H':-9999, 'I':-9999, 'J':-9999, 'K':-9999, 'L':-9999, 'M':-9999, 'N':-9999, 'O':-9999, 'P':-9999, 'Q':-9999, 'R':-9999, 'S':-9999, 'T':-9999, 'U':-9999, 'V':-9999, 'W':-9999, 'X':-9999, 'Y':-9999, 'Z':-9999, ' ':-9999,} ## self.residue_terminal_c = {'A':9999, 'B':9999, 'C':9999, 'D':9999, 'E':9999, 'F':9999, 'G':9999, 'H':9999, 'I':9999, 'J':9999, 'K':9999, 'L':9999, 'M':9999, 'N':9999, 'O':9999, 'P':9999, 'Q':9999, 'R':9999, 'S':9999, 'T':9999, 'U':9999, 'V':9999, 'W':9999, 'X':9999, 'Y':9999, 'Z':9999, ' ':9999,} if form.has_key("resrange1start"): resrange1start = form["resrange1start"].value else: resrange1start = -99999 if form.has_key("resrange1end"): resrange1end = form["resrange1end"].value else: resrange1end = 99999 if form.has_key("model1"): model1 = form["model1"].value else: model1 = "" if not form.has_key("atoms"): atoms_hessian = ["CA"] else: l_atoms = form.getlist("atoms") import sets all = sets.Set(["OXT"]) for chemical_symbol in ["C", "O", "H", "N", "S"]: all.add(chemical_symbol) for remoteness_indicator in ["A", "B", "G", "D", "E", "Z", "H"]: all.add(chemical_symbol + remoteness_indicator) for branch_designator in range(10): all.add(chemical_symbol + remoteness_indicator + str(branch_designator)) mainchain = sets.Set(["C", "O", "N", "CA"]) sidechain = all - mainchain alpha = sets.Set(["CA"]) beta = sets.Set(["CB"]) atoms_hessian = sets.Set() for s_atoms in l_atoms: if s_atoms == "yall": atoms_hessian |= all break if s_atoms == "ymainchain": atoms_hessian |= mainchain if s_atoms == "ysidechain": atoms_hessian |= sidechain if s_atoms == "yalpha": atoms_hessian |= alpha if s_atoms == "ybeta": atoms_hessian |= beta for s_atoms in l_atoms: if s_atoms == "nmainchain": atoms_hessian -= mainchain if s_atoms == "nsidechain": atoms_hessian -= sidechain if s_atoms == "nalpha": atoms_hessian -= alpha if s_atoms == "nbeta": atoms_hessian -= beta atoms_hessian = list(atoms_hessian) if form.has_key("pdb2_id"): fd = open(self.path_pdbs + form["pdb2_id"].value.lower() + ".pdb", "r") pdb_lines = fd.readlines() fd.close() fd = open(self.path_tmp + timestr + "_conformer.pdb", "w") fd.writelines(pdb_lines) fd.close() if form.has_key("pdb2_file"): fd = open(self.path_tmp + timestr + "_conformer.pdb", "w") fd.write(form["pdb2_file"].value) fd.close() if form.has_key("chains2"): chains2 = form["chains2"].value.upper() else: chains2 = "" if form.has_key("resrange2start"): resrange2start = form["resrange2start"].value else: resrange2start = -99999 if form.has_key("resrange2end"): resrange2end = form["resrange2end"].value else: resrange2end = 99999 if form.has_key("model2"): model2 = form["model2"].value else: model2 = "" ## write job input to job file lines_input = [] lines_input.append("%s;%s\n" % ("chains", chains1)) lines_input.append("%s;%s\n" % ("model", model1)) lines_input.append("%s;%s\n" % ("resrangestart", resrange1start)) lines_input.append("%s;%s\n" % ("resrangeend", resrange1end)) lines_input.append("%s;%s\n" % ("cutoffs", ",".join(cutoffs))) lines_input.append("%s;%s\n" % ("amplitude", amplitude_average)) lines_input.append("%s;%s\n" % ("atoms_hessian", ",".join(atoms_hessian))) lines_input.append("%s;%s\n" % ("mutations", mutations)) lines_input.append("%s;%s\n" % ("quarternary", quarternary)) lines_input.append("%s;%s\n" % ("frames", frames)) lines_input.append("%s;%s\n" % ("calctype", calctype)) fd = open(self.path_tmp + "job_" + timestr + ".txt", "w") fd.writelines(lines_input) fd.close() ## fd = open(self.path_tmp+'job_'+timestr+'.txt', 'w') ## fd.write( ## str(chains1)+'\n'+str(model1)+'\n'+str(resrange1start)+'\n'+str(resrange1end)+'\n'+ ## str(cutoffs)+'\n'+str(amplitude_average)+'\n'+str(atoms_hessian)+'\n'+str(mutations)+'\n'+str(quarternary)+'\n'+ ## str(frames)+'\n'+str(inputfiles)+'\n'+str(calctype)+'\n'+ ## str(chains2)+'\n'+str(model2)+'\n'+str(resrange2start)+'\n'+str(resrange2end)+'\n' ## ) ## fd.close() ## send mail via SMTP server to user about job being queued import smtplib from email.MIMEText import MIMEText mailfrom = "GoodVibes" mailto = form["mail"].value msg = MIMEText( "Dear user. Your input data is being processed. Your results or an estimated time for the completion of your calculation will be available from http://polymerase.ucd.ie/goodvibes/results/" + timestr + ".html <http://polymerase.ucd.ie/goodvibes/results/" + timestr + ".html>." ) msg["Subject"] = "Your GoodVibes job with the ID %s has been queued for processing" % timestr msg["From"] = mailfrom msg["Reply-To"] = "*****@*****.**" msg["To"] = mailto server = smtplib.SMTP("mail.ucd.ie") server.set_debuglevel(1) server.sendmail(mailfrom, mailto, msg.as_string()) server.close() ## delete timestr to avoid use of this variable beyond this point (not really necessary) del timestr ################################################################################ ## end if not queue manager if not queuemanager: return ################################################################################ ## process queue if queue manager ## change dir in case of any goodvibes outputs (dislin etc.) os.chdir(self.path_results) ## append the python library to sys.paths after change of dir sys.path.append(self.path_python) import goodvibes instance_NMA = goodvibes.vibration() ## process queue while it exists while os.path.isfile(self.path_tmp + "queue.txt"): ## parse job id fd = open(self.path_tmp + "queue.txt", "r") job = fd.readline().strip() fd.close() ## write slow 2nd temporary output htmlbody = "Dear user. Your input is being processed. Return to this page in a few seconds to get an estimate of the end time of the calculations." self.slowhtml(htmlbody, job, self.path_results) ## parse parameters from job txt file to goodvibes fd = open(self.path_tmp + "job_" + job + ".txt", "r") lines_job = fd.readlines() fd.close() input_job = {} for line in lines_job: input_job[line.split(";")[0]] = line.split(";")[1][:-1] if input_job["chains"] != "": chains1 = input_job["chains"].split(",") else: chains1 = [] model1 = input_job["model"].strip() resrange1start = int(input_job["resrangestart"].strip()) resrange1end = int(input_job["resrangeend"].strip()) cutoffs = input_job["cutoffs"].split(",") for i in range(len(cutoffs)): cutoffs[i] = float(cutoffs[i]) amplitude_average = float(input_job["amplitude"].strip()) atoms_hessian = input_job["atoms_hessian"].split(",") quarternary = input_job["quarternary"].strip() frames = float(input_job["frames"]) calctype = int(input_job["calctype"].strip()) fd = open(self.path_tmp + job + "_reference.pdb", "r") pdblines1 = fd.readlines() fd.close() ## run goodvibes try: results = instance_NMA.main( pdblines1, chains1, model1, atoms_hessian, quarternary, job, frames, cutoffs, calctype, [1], path_html=self.path_results, path_python=self.path_python, ) ## except 'chainerror', error: ## ## if expected error then remove from queue and report to user ## self.slowhtml(error, job, self.path_results) ## self.queue() ## continue except IOError, (errno, strerror): self.slowhtml(str(errno) + str(strerror), job, self.path_results) self.queue() results = instance_NMA.main( pdblines1, chains1, model1, atoms_hessian, quarternary, job, frames, cutoffs, calctype, [1], path_html=self.path_results, path_python=self.path_python, ) continue except: