def run_dmctop(forms, uuid_fasta, uuid_text): email = [] email.append(forms.email.data) pre = Predict() pre.get_result_dmctop(uuid_fasta) out = Outputs() out.output_result_dmctop(uuid_fasta, uuid_text) #print('okkk') with open(uuid_text, 'r') as ut: result = ut.read() #print(result) with app.app_context(): msg = Message("Result from ICDtools", sender="*****@*****.**", recipients=email) print(result) msg.html = result print('ready') mail.send(msg) print('send') return render_template('Result3_dmctop.html', message=result2)
def predict(): A = request.form.get('TeamA') B = request.form.get('TeamB') H = request.form.get('Homeground') T = request.form.get('Toss') P = Predict(float(A), float(B), float(H), float(T)) return render_template('Message.html', p='Team A Has a Winning Probability of {} %'.format( P * 100))
def Index_tmp_ssurface(): # name = None forms = FastaForm() if forms.validate_on_submit(): email = [] email.append(forms.email.data) print(forms.file.data) uuid_s = uuid.uuid1() print(uuid_s) uuid_fasta = '/home/public/%s.fasta' % uuid_s # pathlib.Path(uuid_fasta).touch() uuid_text = '/home/public/%s.txt' % uuid_s uuid_text2 = '/home/public/%s.txt2' % uuid_s pathlib.Path(uuid_text).touch() if forms.m_fasta.data: m_seq = forms.m_fasta.data # f = open(uuid_fasta, 'w') # f.close() with open(uuid_fasta, "w") as ws: ws.write(m_seq) pre = Predict() y_pred = pre.get_result_tmp_ssurface(uuid_fasta) out = Outputs() out.output_result_tmp_ssurface(uuid_fasta, y_pred, uuid_text) out.print_result_tmp_ssurface(uuid_fasta, y_pred, uuid_text2) try: with open(uuid_text, 'r') as ut: result = ut.read() msg = Message("Result from ICDtools", sender="*****@*****.**", recipients=email) msg.html = result mail.send(msg) except OSError: pass try: with open(uuid_text2, 'r') as ut2: result2 = ut2.read() except OSError: pass return render_template('Result2_tmp_ssurface.html', message=result2) elif forms.file.data: # filename = forms.file.data.filename filename = fastas.save(forms.file.data, name='home/public/demo.') with open(filename) as fn: m_seq = fn.read() with open(uuid_fasta, "w+") as f: f.write(m_seq) pre = Predict() y_pred = pre.get_result_tmp_ssurface(uuid_fasta) out = Outputs() out.output_result_tmp_ssurface(uuid_fasta, y_pred, uuid_text) out.print_result_tmp_ssurface(uuid_fasta, y_pred, uuid_text2) try: with open(uuid_text, 'r') as ut: result = ut.read() msg = Message("Result from ICDtools", sender="*****@*****.**", recipients=email) msg.html = result mail.send(msg) except OSError: pass try: with open(uuid_text2, 'r') as ut2: result2 = ut2.read() except OSError: pass return render_template('Result2_tmp_ssurface.html', message=result2) return render_template('Index_tmp_ssurface.html', forms=forms)
def Index_mpls_pred(): # name = None # forms = element.AdvancedForm() forms = FastaForm() if forms.validate_on_submit(): email = [] email.append(forms.email.data) print(forms.file.data) uuid_s = uuid.uuid1() print(uuid_s) uuid_fasta = '/home/public/%s.fasta' % uuid_s pathlib.Path(uuid_fasta).touch() uuid_text = '/home/public/%s.txt' % uuid_s pathlib.Path(uuid_text).touch() if forms.m_fasta.data: # # # # msg = Message("Result from ICDtools", # # sender="*****@*****.**", # # recipients=email) # # msg.html = '111' # # mail.send(msg) m_seq = forms.m_fasta.data # f = open(uuid_fasta, 'w') # f.close() with open(uuid_fasta, "w") as ws: ws.write(m_seq) pre = Predict() result_dic, index_dic, required_dic = pre.get_result_mpls_pred( uuid_fasta) out = Outputs() out.output_result_mpls_pred(required_dic, index_dic, result_dic, uuid_text) with open(uuid_text, 'r') as ut: result = ut.read() msg = Message("Result from ICDtools", sender="*****@*****.**", recipients=email) msg.html = result mail.send(msg) return render_template('Result2_mpls_pred.html') elif forms.file.data: # filename = forms.file.data.filename filename = fastas.save(forms.file.data, name='home/public/demo.') with open(filename) as fn: m_seq = fn.read() with open(uuid_fasta, "w+") as f: f.write(m_seq) pre = Predict() result_dic, index_dic, required_dic = pre.get_result(uuid_fasta) out = Outputs() out.output_result(required_dic, index_dic, result_dic, uuid_text) with open(uuid_text, 'r') as ut: result = ut.read() msg = Message("Result from ICDtools", sender="*****@*****.**", recipients=email) msg.html = result mail.send(msg) return render_template('Result2_mpls_pred.html') return render_template('Index_mpls_pred.html', forms=forms)