From 2fe62381ba9e0bda51205d708c62e36435c60ea7 Mon Sep 17 00:00:00 2001 From: Hao Chen Date: Wed, 8 May 2019 16:11:19 -0500 Subject: clean up bold text --- ratspub.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'ratspub.py') diff --git a/ratspub.py b/ratspub.py index 7400488..cc52591 100755 --- a/ratspub.py +++ b/ratspub.py @@ -37,10 +37,12 @@ def gene_addiction(gene): for sent in sents.split("\n"): for drug0 in drug_d: if findWholeWord(drug_d[drug0])(sent) : + sent=sent.replace("","").replace("","") sent=re.sub(r'\b(%s)\b' % drug_d[drug0], r'\1', sent, flags=re.I) out+=gene+"\t"+"drug\t" + drug0+"\t"+sent+"\n" for add0 in addiction_d: if findWholeWord(addiction_d[add0])(sent) : + sent=sent.replace("","").replace("","") sent=re.sub(r'\b(%s)\b' % addiction_d[add0], r'\1', sent, flags=re.I) out+=gene+"\t"+"addiction\t"+add0+"\t"+sent+"\n" return(out) @@ -52,6 +54,7 @@ def gene_anatomical(gene): for sent in sents.split("\n"): for brain0 in brain_d: if findWholeWord(brain_d[brain0])(sent) : + sent=sent.replace("","").replace("","") sent=re.sub(r'\b(%s)\b' % brain_d[brain0], r'\1', sent, flags=re.I) out+=gene+"\t"+"brain\t"+brain0+"\t"+sent+"\n" return(out) @@ -63,6 +66,7 @@ def gene_functional(gene): for sent in sents.split("\n"): for bio0 in function_d: if findWholeWord(function_d[bio0])(sent) : + sent=sent.replace("","").replace("","") sent=re.sub(r'\b(%s)\b' % function_d[bio0], r'\1', sent, flags=re.I) out+=gene+"\t"+"function\t"+bio0+"\t"+sent+"\n" return(out) @@ -111,9 +115,9 @@ drug_d = {"alcohol":"alcohol|alcoholism|alcoholic", drug=undic(drug_d) brain_d ={"cortex":"cortex|prefrontal|pfc|mPFC|vmpfc|corticostriatal|cortico limbic|corticolimbic|prl|prelimbic|infralimbic|orbitofrontal|cingulate|cerebral|insular|insula", - "striatum":"striatum|STR|striatal|caudate|putamen", + "striatum":"striatum|STR|striatal|caudate|putamen|basal ganglia|globus pallidus", "accumbens":"accumbens|accumbal|shell|core|Nacc|NacSh|acbs|acbc", - "hippocampus":"hippocampus|hippocampal|hipp|hip|ca1|ca3|dentate gyrus|subiculum|vhipp", + "hippocampus":"hippocampus|hippocampal|hipp|hip|ca1|ca3|dentate gyrus|subiculum|vhipp|dhpc|vhpc", "amygdala":"amygdala|cea|bla|amy", "vta":"ventral tegmental|vta|pvta|mesolimbic|limbic|midbrain|mesoaccumbens" } -- cgit v1.2.3