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 | |
parent | efaf3a4abe2f6ae5b67578182085d18d05f25c5f (diff) | |
download | genecup-30a9a40ae3170f0a13efd394ac12e297d3eda03d.tar.gz |
rename to ratspub
-rwxr-xr-x | ratspub.py (renamed from gatpub.py) | 0 | ||||
-rw-r--r-- | server.py | 43 | ||||
-rw-r--r-- | templates/cytoscape.html (renamed from templates/network.html) | 0 | ||||
-rw-r--r-- | templates/layout.html | 8 |
4 files changed, 22 insertions, 29 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) diff --git a/templates/network.html b/templates/cytoscape.html index 24c18c1..24c18c1 100644 --- a/templates/network.html +++ b/templates/cytoscape.html diff --git a/templates/layout.html b/templates/layout.html index 1a81c1a..2887e2f 100644 --- a/templates/layout.html +++ b/templates/layout.html @@ -10,7 +10,7 @@ <link rel=stylesheet type=text/css href="{{ url_for('static', filename='style.css') }}"> - <title>GatPub: Gene Addictionness through PubMed</title> + <title>RatsPub: Relationship with Addiction Through Searches of PubMed</title> </head> <body> @@ -23,10 +23,7 @@ <div class="collapse navbar-collapse" id="navbarSupportedContent"> <ul class="navbar-nav mr-auto"> <li class="nav-item active"> - <a class="nav-link" href="/home">Home <span class="sr-only">(current)</span></a> - </li> - <li class="nav-item"> - <a class="nav-link" href="/search">Search</a> + <a class="nav-link" href="/home">Search <span class="sr-only">(current)</span></a> </li> <li class="nav-item"> <a class="nav-link" href="/result">Result</a> @@ -40,7 +37,6 @@ <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script> -<script src="http://d3js.org/d3.v5.min.js"></script> </body> |