aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHao Chen2019-05-10 12:52:29 -0500
committerHao Chen2019-05-10 12:52:29 -0500
commit08503676ea318ade7a72fcd999a32bc6e5433e0c (patch)
tree558aa9e2ee008540cc150fb1d08f5188fbcef9dc
parent08c88ea579cbdb9dd89d4c6ca7906e5e729a2c64 (diff)
downloadgenecup-08503676ea318ade7a72fcd999a32bc6e5433e0c.tar.gz
re run the quey if no result
-rwxr-xr-xcnt_gene_addiction_abstracts.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/cnt_gene_addiction_abstracts.py b/cnt_gene_addiction_abstracts.py
index c216862..f55586f 100755
--- a/cnt_gene_addiction_abstracts.py
+++ b/cnt_gene_addiction_abstracts.py
@@ -8,6 +8,10 @@ from ratspub import *
def gene_addiction_cnt(gene):
q="\"(" + addiction.replace("|", "[tiab] OR ") + ") AND (" + drug.replace("|", "[tiab] OR ", ) + ") AND (" + gene + ")\""
count=os.popen('esearch -db pubmed -query ' + q + ' | xtract -pattern ENTREZ_DIRECT -element Count ').read()
+ if (len(count)==0):
+ print("pause")
+ time.sleep(15)
+ gene_addiction_cnt(gene)
return (count)
out=open("gene_addiction_cnt_result_part1.tab", "w+")
@@ -25,9 +29,6 @@ with open ("./ncbi_gene_symb_syno_txid9606_part1.txt", "r") as f:
gene_q=gene.replace("|", " [tiab] OR ")
gene_q+="[tiab]"
count=gene_addiction_cnt(gene_q)
- if (len(count)==0):
- print("pause")
- time.sleep(10)
print(gene+"\t"+count)
out.write(gene+"\t"+count)