Commit 14afb7c3 authored by Aishwarya Alex's avatar Aishwarya Alex
Browse files

added mesh

parent 4c1894d1
...@@ -85,12 +85,17 @@ def get_entry_for_term(term): ...@@ -85,12 +85,17 @@ def get_entry_for_term(term):
entityDict = NT.getDict("inputs/EntityDictFile.txt") entityDict = NT.getDict("inputs/EntityDictFile.txt")
abundanceDict= NT.getDict("inputs/abundanceEntity.txt") abundanceDict= NT.getDict("inputs/abundanceEntity.txt")
namespaceDict = NT.getDict("inputs/namespaceDictFile.txt") namespaceDict = NT.getDict("inputs/namespaceDictFile.txt")
element = term.get(ns_tag('function')) element = term.get(ns_tag('function')) if term.get(ns_tag('function')) is not None else ""
parameter = term.find(ns_tag("parameter")) parameter = term.find(ns_tag("parameter"))
belnamespace = parameter.get(ns_tag("ns")) if parameter.get(ns_tag("ns")) is not None else "" belnamespace = parameter.get(ns_tag("ns")) if parameter.get(ns_tag("ns")) is not None else ""
miriamnamespace = belnamespace miriamnamespace = belnamespace
identifier=parameter.text identifier=parameter.text
if belnamespace is not "":
if "MESH" in belnamespace:
mDict = NT.getMeSHDict()
identifier=mDict[identifier] if mDict.has_key(identifier) is True else identifier
elif belnamespace is not "" :
identifier = NT.termToIdentifier(belnamespace, parameter.text) identifier = NT.termToIdentifier(belnamespace, parameter.text)
elementName = "" # function@TERM elementName = "" # function@TERM
elementAnnotation = "" # ns@PARAMETER+text elementAnnotation = "" # ns@PARAMETER+text
...@@ -124,6 +129,7 @@ def get_entry_for_term(term): ...@@ -124,6 +129,7 @@ def get_entry_for_term(term):
return entry return entry
except Exception as ExceptionTerm: except Exception as ExceptionTerm:
print "!!! FUNC:get_entry_for_term!!!" print "!!! FUNC:get_entry_for_term!!!"
print term,belnamespace
print str(ExceptionTerm.args) print str(ExceptionTerm.args)
...@@ -154,7 +160,7 @@ def convertXBEL(filepath): ...@@ -154,7 +160,7 @@ def convertXBEL(filepath):
nFile.close() nFile.close()
reactionFile = "outputs/reactions.txt" reactionFile = "outputs/reactions.txt"
rFile = open(reactionFile, "w") rFile = open(reactionFile, "w")
rFile.write("IDENTIFIER\tTYPE\tREACTANTS\tMODIFIERS\tPRODUCTS\tMODIFIER_TYPE\tSPECIES\tDISEASE\tCELL\tTISSUE\tCELLSTRUCTURE\tCELLLINE\tOTHER_ANNOTATION\n") rFile.write("IDENTIFIER\tTYPE\tREACTANTS\tMODIFIERS\tPRODUCTS\tMODIFIER_TYPE\tREFERNCE\tSPECIES\tDISEASE\tCELL\tTISSUE\tCELLSTRUCTURE\tCELLLINE\tOTHER_ANNOTATION\n")
rFile.close() rFile.close()
try: try:
tree = ET.parse(filepath) tree = ET.parse(filepath)
...@@ -170,7 +176,7 @@ def convertXBEL(filepath): ...@@ -170,7 +176,7 @@ def convertXBEL(filepath):
# LOAD namespace DIctionary # LOAD namespace DIctionary
namespaceDict = NT.getDict("inputs/namespaceDictFile.txt") namespaceDict = NT.getDict("inputs/namespaceDictFile.txt")
reactionDict = NT.getDict("inputs/reactionDictFile.txt") reactionDict = NT.getDict("inputs/reactionDictFile.txt")
mDict=NT.getMeSHDict()
#create dictionary for species #create dictionary for species
speciesMap={} speciesMap={}
# get all statement nodes, annotation and sub nodes (complex, or composite structures) # get all statement nodes, annotation and sub nodes (complex, or composite structures)
...@@ -243,7 +249,12 @@ def convertXBEL(filepath): ...@@ -243,7 +249,12 @@ def convertXBEL(filepath):
except Exception as nestedException: except Exception as nestedException:
print "!!! EXCEPTION in nested statement!!!" print "!!! EXCEPTION in nested statement!!!"
print " !!!EXCEPTION!!! : " + str(nestedException.args) print " !!!EXCEPTION!!! : " + str(nestedException.args)
exit() f = open(expStatementFile, 'a')
f.write(
str(index) + "|" + str(statement_num) + "|" + str(relationship) + "|" + evidence + "\n")
f.write(" !!!EXCEPTION!!! : " + str(nestedException.args) + "==================================\n")
f.close()
#exit()
#REACTANT AND PRODUCTS #REACTANT AND PRODUCTS
print "REACTANT :" print "REACTANT :"
...@@ -295,7 +306,7 @@ def convertXBEL(filepath): ...@@ -295,7 +306,7 @@ def convertXBEL(filepath):
print "REACTION : " print "REACTION : "
reactionEntry = "r" + str( reactionEntry = "r" + str(
reactionIdentifier) + "\t" + relationship + "\t" + reactant + "\t" + modifier + "\t" + product + "\t" + modifierType + "\t" + species + "\t" + referenceType + ":" + reference + "\t" + annoEntry + "\t" + str( reactionIdentifier) + "\t" + relationship + "\t" + reactant + "\t" + modifier + "\t" + product + "\t" + modifierType + "\t" + referenceType + ":" + reference + "\t" + species + "\t"+ annoEntry + "\t" + str(
otherAnnotation) + "\n" otherAnnotation) + "\n"
print reactionEntry print reactionEntry
reactionFile = open("outputs/reactions.txt", 'a') reactionFile = open("outputs/reactions.txt", 'a')
...@@ -304,10 +315,11 @@ def convertXBEL(filepath): ...@@ -304,10 +315,11 @@ def convertXBEL(filepath):
except Exception as ex: except Exception as ex:
f = open(expStatementFile, 'a') f = open(expStatementFile, 'a')
f.write(str(index) +"|"+str(statement_num)+"|"+str(relationship)+"|"+evidence+"\n") f.write(str(index) +"|"+str(statement_num)+"|"+str(relationship)+"|"+evidence+"\n")
f.write(" !!!EXCEPTION!!! : " + str(ex.args)+"==================================\n")
f.close() f.close()
print " !!!EXCEPTION!!! : " + str(ex.args) print " !!!EXCEPTION!!! : " + str(ex.args)
exit() #exit()
# Convert file # Convert file
......
Supports Markdown
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