aboutsummaryrefslogtreecommitdiff
path: root/server.py
diff options
context:
space:
mode:
authorHao Chen2019-05-08 01:55:31 -0500
committerHao Chen2019-05-08 01:55:31 -0500
commitefaf3a4abe2f6ae5b67578182085d18d05f25c5f (patch)
tree00ee6bb45907e03cc192e469892c06c30e0f2e6b /server.py
parent577515fb8afdf7fa535a3b16d13f261696bb6ce0 (diff)
downloadgenecup-efaf3a4abe2f6ae5b67578182085d18d05f25c5f.tar.gz
multiple genes allowed
Diffstat (limited to 'server.py')
-rw-r--r--server.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/server.py b/server.py
index 76cb63c..d65625e 100644
--- a/server.py
+++ b/server.py
@@ -19,14 +19,21 @@ def network():
nodes_list=[]
if request.method == 'POST':
term = request.form
- gene=term['query']
- nodes="{ data: { id: '" + gene + "', nodecolor:'#FADBD8'} },\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)
+ 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)
if __name__ == '__main__':
app.run(debug=True)