diff options
author | Hao Chen | 2019-05-08 06:01:49 -0500 |
---|---|---|
committer | Hao Chen | 2019-05-08 06:01:49 -0500 |
commit | 30a9a40ae3170f0a13efd394ac12e297d3eda03d (patch) | |
tree | ae07d1b41181c2c1027adf99b1c422e8a55f1362 /server.py | |
parent | efaf3a4abe2f6ae5b67578182085d18d05f25c5f (diff) | |
download | genecup-30a9a40ae3170f0a13efd394ac12e297d3eda03d.tar.gz |
rename to ratspub
Diffstat (limited to 'server.py')
-rw-r--r-- | server.py | 43 |
1 files changed, 20 insertions, 23 deletions
@@ -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) |