aboutsummaryrefslogtreecommitdiff
path: root/server.py
diff options
context:
space:
mode:
authorHao Chen2019-05-07 16:30:29 -0500
committerHao Chen2019-05-07 16:30:29 -0500
commitf09a791cf83f71b930faf842d7d5806627d6aa84 (patch)
tree599f160b75ad23631ce092c01704a264791d8e89 /server.py
parent636e2166164a56cf26361dd4369526c2ac45663d (diff)
downloadgenecup-f09a791cf83f71b930faf842d7d5806627d6aa84.tar.gz
basic cytoscape plot
Diffstat (limited to 'server.py')
-rw-r--r--server.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/server.py b/server.py
new file mode 100644
index 0000000..907877a
--- /dev/null
+++ b/server.py
@@ -0,0 +1,32 @@
+from flask import Flask, render_template, request, redirect
+import simplejson as json
+from gatpub import *
+
+app=Flask(__name__)
+app.config['SECRET_KEY'] = '#DtfrL98G5t1dC*4'
+
+@app.route("/")
+def root():
+ return render_template('index.html')
+
+@app.route("/home")
+def home():
+ return render_template('index.html')
+
+@app.route("/network", methods=['GET', 'POST'])
+def network():
+ edges_list=[]
+ nodes_list=[]
+ if request.method == 'POST':
+ term = request.form
+ gene=term['query']
+ nodes="{ data: { id: '" + gene + "'} },\n" + default_nodes
+ tmp0=gene_addiction(gene)
+ e0=generate_edges(tmp0)
+ tmp1=gene_functional(gene)
+ e1=generate_edges(tmp1)
+ tmp2=gene_anatomical(gene)
+ e2=generate_edges(tmp2)
+ return render_template('network.html', elements=nodes+e0+e1+e2)
+if __name__ == '__main__':
+ app.run(debug=True)