diff options
author | Hao Chen | 2019-05-13 22:01:25 -0500 |
---|---|---|
committer | Hao Chen | 2019-05-13 22:01:25 -0500 |
commit | 5a264b6d58fa55714b5c844830dc7d42d8d303b1 (patch) | |
tree | 73f7db870facd18996bb7a9672a2e88300f5e003 | |
parent | 1a9b0800d3e95d9cd2a1ec7597dd793cf6b6c62a (diff) | |
download | genecup-5a264b6d58fa55714b5c844830dc7d42d8d303b1.tar.gz |
addiction terms must present together with drug terms
-rwxr-xr-x | ratspub.py | 3 | ||||
-rwxr-xr-x | server.py | 9 |
2 files changed, 8 insertions, 4 deletions
@@ -30,6 +30,7 @@ def getSentences(query, gene): def gene_category(gene, cat_d, query, cat): #e.g. BDNF, addiction_d, undic(addiction_d) "addiction" q="\"(" + query.replace("|", " OR ") + ") AND " + gene + "\"" + print (">>>>>>>>>>" + q) sents=getSentences(q, gene) out=str() for sent in sents.split("\n"): @@ -75,7 +76,7 @@ addiction=undic(addiction_d) drug_d = {"alcohol":"alcohol|alcoholism|alcoholic|alcoholics", "nicotine":"smoking|nicotine|tobacco|smoker|smokers", "cocaine":"cocaine", - "opioid":"opioid|opioids|fentanyl|oxycodone|oxycontin|heroin|morphine|methadone|buprenorphine|vicodin|hydrocodone|hycodan|kadian|percoset|hydromorphone|naloxone|codeine|suboxone|tramadol|kratom", + "opioid":"opioid|opioids|fentanyl|oxycodone|oxycontin|heroin|morphine|methadone|buprenorphine|vicodin|hydrocodone|hycodan|kadian|percoset|hydromorphone|naloxone|codeine|suboxone|tramadol|kratom|ultram", "amphetamine":"methamphetamine|amphetamine|METH|AMPH", "cannabinoid":"endocannabinoid|cannabinoids|cannabis|endocannabinoids|marijuana|cannabidiol|cannabinoid|tetrahydrocannabinol|thc|thc 9|Oleoylethanolamide|palmitoylethanolamide|acylethanolamides" } @@ -25,7 +25,7 @@ def progress(): genes=genes.replace(",", " ") genes=genes.replace(";", " ") genes=genes.split() - if len(genes)>=6: + if len(genes)>=60: message="<span class='text-danger'>Up to five terms can be searched at a time</span>" return render_template('index.html', message=message) elif len(genes)==0: @@ -50,13 +50,15 @@ def search(): edges=str() nodes=default_nodes progress=0 + searchCnt=0 for gene in genes: gene=gene.replace("-"," ") nodes+="{ data: { id: '" + gene + "', nodecolor:'#E74C3C', fontweight:700, url:'/gene_gene?gene="+gene+"'} },\n" # report progress immediately progress+=percent yield "data:"+str(progress)+"\n\n" - addiction=undic(addiction_d) + #addiction terms must present with at least one drug + addiction=undic(addiction_d) +") AND ("+undic(drug_d) sent0=gene_category(gene, addiction_d, addiction, "addiction") e0=generate_edges(sent0, tf_name) # @@ -78,7 +80,8 @@ def search(): edges+=e0+e1+e2+e3 sentences+=sent0+sent1+sent2+sent3 #save data before the last yield - if (progress>99): + searchCnt+=1 + if (searchCnt==len(genes)): progress=100 sntdata.write(sentences) sntdata.close() |