#!/bin/env python3 from flask import Flask, render_template, request, redirect from ratspub import * app=Flask(__name__) app.config['SECRET_KEY'] = '#DtfrL98G5t1dC*4' @app.route("/") def root(): return render_template('index.html') @app.route("/search") def search(): global all_sentences all_sentences=str() genes=request.args.get('query') genes=genes.replace(",", " ") genes=genes.replace(";", " ") genes=genes.split() if len(genes)>=6: return render_template('index.html') nodes=default_nodes edges=str() for gene in genes: nodes+="{ data: { id: '" + gene + "', nodecolor:'#FADBD8', fontweight:700} },\n" sent0=gene_addiction(gene) e0=generate_edges(sent0) sent1=gene_functional(gene) e1=generate_edges(sent1) sent2=gene_anatomical(gene) e2=generate_edges(sent2) edges+=e0+e1+e2 all_sentences+=sent0+sent1+sent2 #f=open("all_sentences.tab","w") #f.write(all_sentences) #f.close() return render_template('cytoscape.html', elements=nodes+edges) @app.route("/sentences") def sentences(): edge=request.args.get('edgeID') (gene0, cat0)=edge.split("|") print (gene0 + cat0) out="
") if __name__ == '__main__': app.run(debug=True)