diff options
author | Hao Chen | 2019-05-09 00:07:32 -0500 |
---|---|---|
committer | Hao Chen | 2019-05-09 00:07:32 -0500 |
commit | 888e95f82ec96129257ff9064e9860a275fb7b15 (patch) | |
tree | 607903cb4711517101c86e9119a8419b14a4c7d9 /server.py | |
parent | 502008d20887f69557e223129e2f520d51272c2a (diff) | |
download | genecup-888e95f82ec96129257ff9064e9860a275fb7b15.tar.gz |
clean up
Diffstat (limited to 'server.py')
-rwxr-xr-x | server.py | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -1,6 +1,5 @@ #!/bin/env python3 from flask import Flask, render_template, request, redirect -import simplejson as json from ratspub import * app=Flask(__name__) @@ -18,6 +17,8 @@ def search(): genes=genes.replace(",", " ") genes=genes.replace(";", " ") genes=genes.split() + if len(genes)>=6: + return render_template('index.html') nodes=default_nodes edges=str() for gene in genes: @@ -30,9 +31,9 @@ def search(): e2=generate_edges(sent2) edges+=e0+e1+e2 all_sentences+=sent0+sent1+sent2 - f=open("all_sentences.tab","w") - f.write(all_sentences) - f.close() + #f=open("all_sentences.tab","w") + #f.write(all_sentences) + #f.close() return render_template('cytoscape.html', elements=nodes+edges) @app.route("/sentences") @@ -42,12 +43,11 @@ def sentences(): print (gene0 + cat0) out="<h3>"+gene0 + " and " + cat0 + "</h3>\n" for sent in all_sentences.split("\n"): - #print (sent) if len(sent.strip())!=0: (gene,nouse,cat, pmid, text)=sent.split("\t") if (gene == gene0 and cat == cat0) : out+= "<li> "+ text + " <a href=\"https://www.ncbi.nlm.nih.gov/pubmed/?term=" + pmid +"\" target=_new>PMID:"+pmid+"<br></a>" - return render_template('sentences.html', sentences=out+"<p>") + return render_template('sentences.html', sentences="<ol>"+out+"</ol><p>") if __name__ == '__main__': app.run(debug=True) |