Gitlab is now using https://gitlab.lcsb.uni.lu as it's primary address. Please update your bookmarks. FAQ.

Commit 4c1894d1 authored by Aishwarya Alex's avatar Aishwarya Alex
Browse files

added mesh

parent 41416b6d
......@@ -11,9 +11,12 @@
##############################################################################################
# Import the modules needed to run the script.
import MySQLdb, reflectclient
import MySQLdb, reflectclient, os,urllib
from reflectclient.config import EntityType
#LOAD NAMESPACE DICTIONARY
def getDict(filename):
dict={}
for line in open(filename,'r'):
......@@ -35,6 +38,7 @@ def termToIdentifier(belnamespace,term):
term=getGoIDfromTerm(term)
if "CHEM" in belnamespace:
term=getChemicalIDfromTerm(term)
return term
#Get GOID from reflect
......@@ -68,7 +72,32 @@ def getMeshIDfromTerm(term):
if len(meshResult) >0:
mesh_id=meshResult[0]['entities'][0]['identifier']
return mesh_id
#getMeshIDfromTerm("Parkinson's Disease")
getGoIDfromTerm("leukotriene production involved in inflammatory response")
getGoIDfromTerm("inflammatory response")
def getMeSHDict():
dict={}
filename="inputs/2017MeshTree.txt"
try:
# input file fetch from :https://www.nlm.nih.gov/mesh/2017/download/2017MeshTree.txt
if not os.path.exists(filename):
urllib.urlretrieve("https://www.nlm.nih.gov/mesh/2017/download/2017MeshTree.txt", filename)
else:
for line in open(filename,'r'):
line=line.replace('\x00','')
line=line.strip()
nspace=line.split("\t")
if len(nspace)==3:
meshID=nspace[1]
term=nspace[2]
dict[term]=meshID
except IndexError as dicterror:
print str("here")
return dict
#getMeshIDfromTerm("Drug-Induced Liver Injury")
# getGoIDfromTerm("leukotriene production involved in inflammatory response")
#getGoIDfromTerm("inflammatory response")
# getChemicalIDfromTerm("lipopigment")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment