From ef695a43493b2bfc21eaa3f39dfc3123b9855478 Mon Sep 17 00:00:00 2001
From: Hao Chen
Date: Mon, 9 Mar 2020 15:55:32 -0500
Subject: hakan fixed only one sent per abstract
---
server.py | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/server.py b/server.py
index b0ba670..f98b365 100755
--- a/server.py
+++ b/server.py
@@ -539,19 +539,22 @@ def sentences():
edge=request.args.get('edgeID')
(tf_name, gene0, cat0)=edge.split("|")
out3=""
+ num_abstract = 0
with open(tf_name, "r") as df:
all_sents=df.read()
for sent in all_sents.split("\n"):
if len(sent.strip())!=0:
- (gene,nouse,cat, pmid, text)=sent.split("\t")
- if (gene.upper() == gene0.upper() and cat.upper() == cat0.upper() and (pmid+cat0 not in pmid_list)) :
- out3+= "
"+ text + " PMID:"+pmid+"
"
- pmid_list.append(pmid+cat0)
+ (gene,nouse,cat, pmid, text)=sent.split("\t")
+ if (gene.upper() == gene0.upper() and cat.upper() == cat0.upper()) :
+ out3+= " "+ text + " PMID:"+pmid+"
"
+ num_abstract += 1
+ if(pmid+cat0 not in pmid_list):
+ pmid_list.append(pmid+cat0)
out1=""+gene0 + " and " + cat0 + "
\n"
if len(pmid_list)>1:
- out2 = str(len(pmid_list)) + ' sentences in ' + str(len(pmid_list)) + ' studies' "
\n"
+ out2 = str(num_abstract) + ' sentences in ' + str(len(pmid_list)) + ' studies' "
\n"
else:
- out2 = str(len(pmid_list)) + ' sentence in ' + str(len(pmid_list)) + ' study' "
\n"
+ out2 = str(num_abstract) + ' sentence in ' + str(len(pmid_list)) + ' study' "
\n"
out= out1+ out2 +out3
return render_template('sentences.html', sentences=""+out+"
")
--
cgit v1.2.3