about summary refs log tree commit diff
path: root/server.py
diff options
context:
space:
mode:
Diffstat (limited to 'server.py')
-rwxr-xr-xserver.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/server.py b/server.py
index 519eedf..33f3bb0 100755
--- a/server.py
+++ b/server.py
@@ -146,7 +146,6 @@ def login():
         else:
             flash("Invalid username or password!", "inval")
             return render_template('signup.html')
-    print(onto_list)
     return render_template('index.html',onto_len_dir=onto_len_dir, onto_list=onto_list, ontol = 'addiction', dict_onto = dict_onto)
 
 
@@ -570,7 +569,11 @@ def ontoarchive():
     if ('email' in session):
         if os.path.exists(datadir+"/user/"+str(session['hashed_email'])+"/ontology") == False:
             flash("Ontology history doesn't exist!")
-            return render_template('index.html',onto_len_dir=session['onto_len_dir'], onto_list=session['onto_list'])
+            onto_len_dir = 0
+            onto_list = ''
+            onto_cont=open("addiction.onto","r").read()
+            dict_onto=ast.literal_eval(onto_cont)
+            return render_template('index.html',onto_len_dir=onto_len_dir, onto_list=onto_list, ontol = 'addiction', dict_onto = dict_onto) 
         else:
             session['user_folder'] = datadir+"/user/"+str(session['hashed_email'])
     else:
@@ -762,7 +765,7 @@ def search():
     if(len(genes)==1):
         percent_ratio=2
     timeextension=session['timeextension']
-    percent=round(100/percent_ratio,1)-1 # 7 categories + 1 at the beginning
+    percent=100/percent_ratio-0.00000001 # 7 categories + 1 at the beginning
 
     if ('email' in session):
         sessionpath = session['path_user'] + timeextension
@@ -852,6 +855,7 @@ def search():
             yield "data:"+str(progress)+"\n\n"
             for gene in genes:
                 abstracts_raw = getabstracts(gene,all_d)
+                #print(abstracts_raw)
                 sentences_ls=[]
 
                 for row in abstracts_raw.split("\n"):
@@ -891,10 +895,11 @@ def search():
                                 dict_onto=ast.literal_eval(onto_cont)
                                 #ky_d=undic(list(dict_onto[ky].values()))    
                                 sent=gene_category(gene,ky,str(ky), sentences_ls, addiction_flag,dict_onto)
-                            
                             else:
                                 #ky_d=undic(list(dict_onto[ky].values()))
+                                #print(sentences_ls)
                                 sent=gene_category(gene,ky,str(ky), sentences_ls, addiction_flag,dict_onto)
+                                #print(sent)
                             yield "data:"+str(progress)+"\n\n"
                             
                             geneEdges += generate_edges(sent, tf_name)
@@ -918,7 +923,7 @@ def search():
                                             +str(row['MAPPED_TRAIT'])+"</b><br>"
                                         gwas_sent.append(gene+"\t"+"GWAS"+"\t"+nd+"_GWAS\t"+str(row['PUBMEDID'])+"\t"+gwas_text)
                     cys, gwas_json, sn_file = searchArchived('GWAS', gene , 'json',gwas_sent, path_user)
-                    with open(path_user+"gwas_results.tab", "w") as gwas_edges:
+                    with open(path_user+"gwas_results.tab", "a") as gwas_edges:
                         gwas_edges.write(sn_file)
                     geneEdges += cys
                     json_edges += gwas_json