aboutsummaryrefslogtreecommitdiff
path: root/server.py
diff options
context:
space:
mode:
authorHao Chen2019-05-08 06:01:49 -0500
committerHao Chen2019-05-08 06:01:49 -0500
commit30a9a40ae3170f0a13efd394ac12e297d3eda03d (patch)
treeae07d1b41181c2c1027adf99b1c422e8a55f1362 /server.py
parentefaf3a4abe2f6ae5b67578182085d18d05f25c5f (diff)
downloadgenecup-30a9a40ae3170f0a13efd394ac12e297d3eda03d.tar.gz
rename to ratspub
Diffstat (limited to 'server.py')
-rw-r--r--server.py43
1 files changed, 20 insertions, 23 deletions
diff --git a/server.py b/server.py
index d65625e..6a28e0b 100644
--- a/server.py
+++ b/server.py
@@ -1,6 +1,6 @@
from flask import Flask, render_template, request, redirect
import simplejson as json
-from gatpub import *
+from ratspub import *
app=Flask(__name__)
app.config['SECRET_KEY'] = '#DtfrL98G5t1dC*4'
@@ -13,27 +13,24 @@ def root():
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
- genes=term['query']
- genes=genes.replace(",", " ")
- genes=genes.replace(";", " ")
- genes=genes.split()
- nodes=default_nodes
- edges=str()
- for gene in genes:
- nodes+="{ data: { id: '" + gene + "', nodecolor:'#FADBD8', fontweight:700} },\n"
- tmp0=gene_addiction(gene)
- e0=generate_edges(tmp0)
- tmp1=gene_functional(gene)
- e1=generate_edges(tmp1)
- tmp2=gene_anatomical(gene)
- e2=generate_edges(tmp2)
- edges+=e0+e1+e2
- return render_template('network.html', elements=nodes+edges)
+@app.route("/search")
+def search():
+ genes=request.args.get('query')
+ genes=genes.replace(",", " ")
+ genes=genes.replace(";", " ")
+ genes=genes.split()
+ nodes=default_nodes
+ edges=str()
+ for gene in genes:
+ nodes+="{ data: { id: '" + gene + "', nodecolor:'#FADBD8', fontweight:700} },\n"
+ tmp0=gene_addiction(gene)
+ e0=generate_edges(tmp0)
+ tmp1=gene_functional(gene)
+ e1=generate_edges(tmp1)
+ tmp2=gene_anatomical(gene)
+ e2=generate_edges(tmp2)
+ edges+=e0+e1+e2
+ return render_template('cytoscape.html', elements=nodes+edges)
+
if __name__ == '__main__':
app.run(debug=True)