about summary refs log tree commit diff
diff options
context:
space:
mode:
authorHao Chen2019-08-30 12:00:33 -0500
committerHao Chen2019-08-30 12:00:33 -0500
commit88ab6a3a21fcc2715c9a7528d8b4d15bb7ea85ed (patch)
tree6ab903394e18ec6f8bdfd06257b7f5bbc78fa414
parent19bc3078c06bef3c10c55dc6e69018e595d07d17 (diff)
downloadgenecup-88ab6a3a21fcc2715c9a7528d8b4d15bb7ea85ed.tar.gz
add psychiatric keywords
-rwxr-xr-xratspub.py10
-rw-r--r--ratspub_keywords.py12
-rwxr-xr-xserver.py30
3 files changed, 41 insertions, 11 deletions
diff --git a/ratspub.py b/ratspub.py
index 8ee1f74..7320889 100755
--- a/ratspub.py
+++ b/ratspub.py
@@ -6,7 +6,6 @@ from ratspub_keywords import *
 
 global function_d, brain_d, drug_d, addiction_d, brain_query_term, pubmed_path
 
-
 ## turn dictionary (synonyms) to regular expression
 def undic(dic):
     return "|".join(dic.values())
@@ -103,14 +102,15 @@ function=undic(function_d)
 addiction=undic(addiction_d)
 drug=undic(drug_d)
 
-nodecolor={'function':"#A9CCE3", 'addiction': "#D7BDE2", 'drug': "#F9E79F", 'brain':"#A3E4D7", 'gwas':"#AEB6BF"}
-#https://htmlcolorcodes.com/
+nodecolor={'function':"#A9CCE3", 'addiction': "#D7BDE2", 'drug': "#F9E79F", 'brain':"#A3E4D7", 'gwas':"#AEB6BF", 'stress':"#EDBB99", 'psychiatric':"#F5B7B1"}
+#https://htmlcolorcodes.com/ third column down
 n0=generate_nodes(function_d, 'function')
 n1=generate_nodes(addiction_d, 'addiction')
 n2=generate_nodes(drug_d, 'drug')
 n3=generate_nodes(brain_d, 'brain')
-default_nodes=n0+n1+n2+n3
-
+n4=generate_nodes(stress_d, 'stress')
+n5=generate_nodes(psychiatric_d, 'psychiatric')
+default_nodes=n0+n1+n2+n3+n4+n5
 
 host= os.popen('hostname').read().strip()
 if host=="x1":
diff --git a/ratspub_keywords.py b/ratspub_keywords.py
index 8a23e73..ade04f6 100644
--- a/ratspub_keywords.py
+++ b/ratspub_keywords.py
@@ -31,3 +31,15 @@ function_d={"signalling":"signalling|signaling|phosphorylation|glycosylation",
             "neurotransmission": "neurotransmission|neuropeptides|neuropeptide|glutamate|glutamatergic|GABA|GABAergic|dopamine|dopaminergic|DAergic|cholinergic|nicotinic|muscarinic|serotonergic|serotonin|5 ht|acetylcholine",
             }
 #"regulation":"increased|decreased|regulated|inhibited|stimulated",
+
+stress_d={"stress":"stress|psycological trauma|distress",
+          "PTSD":"PTSD"
+         }
+psychiatric_d={"anxiety":"anxiety|anxious",
+               "depression":"depression|depressive",
+               "bipolar":"bipolar disorder",
+               "impulsivity":"impulsivity|impulsive",
+               "compulsive":"compulsive|obssessive",
+               "schizophrenia": "schizophrenia",
+               "autism": "autism|autistic"
+               }
diff --git a/server.py b/server.py
index d312a5a..07e5f72 100755
--- a/server.py
+++ b/server.py
@@ -20,7 +20,7 @@ def about():
 
 @app.route('/progress')
 def progress():
-    # only 1-6 terms are allowed
+    # only 1-100 terms are allowed
     genes=request.args.get('query')
     genes=genes.replace(",", " ")
     genes=genes.replace(";", " ")
@@ -42,7 +42,7 @@ def progress():
 @app.route("/search")
 def search():
     genes=session['query']
-    percent=round(100/(len(genes)*4),1)
+    percent=round(100/(len(genes)*6),1) # 6 categories 
     snt_file=session['path']+"_snt"
     cysdata=open(session['path']+"_cy","w+")
     sntdata=open(snt_file,"w+")
@@ -79,16 +79,34 @@ def search():
             sent3=gene_category(gene, brain_d, brain_query_term, "brain")
             progress+=percent
             e3=generate_edges(sent3, tf_name)
+            # stress
+            stress=undic(stress_d)
+            sent4=gene_category(gene, stress_d, stress, "drug")
+            progress+=percent
+            yield "data:"+str(progress)+"\n\n"
+            e4=generate_edges(sent4, tf_name)
+            # psychiatric 
+            psychiatric=undic(psychiatric_d)
+            sent5=gene_category(gene, psychiatric_d, psychiatric, "psychiatric")
+            progress+=percent
+            yield "data:"+str(progress)+"\n\n"
+            e5=generate_edges(sent5, tf_name)
             # gwas
-            e4=searchArchived('gwas', gene)
-            geneEdges=e0+e1+e2+e3+e4
+            e6=searchArchived('gwas', gene)
+            geneEdges=e0+e1+e2+e3+e4+e5+e6
             ## there is a bug here. zero link notes are not excluded anymore
             if len(geneEdges) >1:
                 edges+=geneEdges
                 nodes+="{ data: { id: '" + gene +  "', nodecolor:'#E74C3C', fontweight:700, url:'/startGeneGene?forTopGene="+gene+"'} },\n"
             else:
                 nodesToHide+=gene +  " "
-            sentences+=sent0+sent1+sent2+sent3
+            sentences+=sent0+sent1+sent2+sent3+sent4+sent5
+            sent0=None 
+            sent1=None
+            sent2=None
+            sent3=None
+            sent4=None
+            sent5=None
             #save data before the last yield
             searchCnt+=1
             if (searchCnt==len(genes)):
@@ -138,7 +156,7 @@ def showTopGene():
 @app.route("/shownode")
 def shownode():
     node=request.args.get('node')
-    allnodes={**brain_d, **drug_d, **function_d, **addiction_d}
+    allnodes={**brain_d, **drug_d, **function_d, **addiction_d, **stress_d, **psychiatric_d}
     out="<p>"+node.upper()+"<hr><li>"+ allnodes[node].replace("|", "<li>")
     return render_template('sentences.html', sentences=out+"<p>")