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

Commit 9347c784 authored by Aishwarya Alex's avatar Aishwarya Alex
Browse files

Added reflect-client for Go terms

parent e51244bd
......@@ -11,8 +11,8 @@
##############################################################################################
# Import the modules needed to run the script.
import MySQLdb
import MySQLdb, reflectclient
from reflectclient.config import EntityType
#LOAD NAMESPACE DICTIONARY
def getDict(filename):
dict={}
......@@ -30,20 +30,45 @@ def getReactionDict():
reactionDict[nspace[0]]=nspace[1]
return reactionDict
#Get GOID from GOOSE
def termToIdentifier(belnamespace,term):
if "GO" in belnamespace or belnamespace is "":
term=getGoIDfromTerm(term)
if "CHEM" in belnamespace:
term=getChemicalIDfromTerm(term)
return term
#Get GOID from reflect
def getGoIDfromTerm(term):
print "get conn"
cnx = MySQLdb.connect(user='go_select', passwd='amigo', host='spitz.lbl.gov', db='go_latest', port=4085)
cursor=cnx.cursor()
print"connected and querying"
query="SELECT acc FROM term WHERE name='cell migration'"
cursor.execute(query)
print "query done"
row=cursor.fetchone()
cnx.close()
print row
return row
print "try"
getGoIDfromTerm("cell migration")
print "done"
\ No newline at end of file
goID= term
print term
reflect_client = reflectclient.ReflectClient()
GOresult=reflect_client.get_entities(term, [EntityType.biological_process,EntityType.cellular_component,EntityType.molecular_function])
print GOresult
print len(GOresult)
if len(GOresult) >0:
goID=GOresult[0]['entities'][0]['identifier']
print goID
return goID
#Get pubchemID from reflect
def getChemicalIDfromTerm(term):
chemID= term
reflect_client = reflectclient.ReflectClient()
chemResult=reflect_client.get_entities(term, [EntityType.chemicals])
if len(chemResult) >0:
chemID=chemResult[0]['entities'][0]['identifier']
return chemID
#Get meshID from reflect
def getMeshIDfromTerm(term):
mesh_id= term
reflect_client = reflectclient.ReflectClient()
meshResult=reflect_client.get_entities(term, [EntityType.diseases])
print meshResult
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")
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