From efaf3a4abe2f6ae5b67578182085d18d05f25c5f Mon Sep 17 00:00:00 2001 From: Hao Chen Date: Wed, 8 May 2019 01:55:31 -0500 Subject: multiple genes allowed --- server.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'server.py') 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) -- cgit v1.2.3