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

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):
entityDict = NT.getDict("inputs/EntityDictFile.txt")
abundanceDict= NT.getDict("inputs/abundanceEntity.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"))
belnamespace = parameter.get(ns_tag("ns")) if parameter.get(ns_tag("ns")) is not None else ""
miriamnamespace = belnamespace
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)
elementName = "" # function@TERM
elementAnnotation = "" # ns@PARAMETER+text
......@@ -124,6 +129,7 @@ def get_entry_for_term(term):
return entry
except Exception as ExceptionTerm:
print "!!! FUNC:get_entry_for_term!!!"
print term,belnamespace
print str(ExceptionTerm.args)
......@@ -154,7 +160,7 @@ def convertXBEL(filepath):
nFile.close()
reactionFile = "outputs/reactions.txt"
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()
try:
tree = ET.parse(filepath)
......@@ -170,7 +176,7 @@ def convertXBEL(filepath):
# LOAD namespace DIctionary
namespaceDict = NT.getDict("inputs/namespaceDictFile.txt")
reactionDict = NT.getDict("inputs/reactionDictFile.txt")
mDict=NT.getMeSHDict()
#create dictionary for species
speciesMap={}
# get all statement nodes, annotation and sub nodes (complex, or composite structures)
......@@ -243,7 +249,12 @@ def convertXBEL(filepath):
except Exception as nestedException:
print "!!! EXCEPTION in nested statement!!!"
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
print "REACTANT :"
......@@ -295,7 +306,7 @@ def convertXBEL(filepath):
print "REACTION : "
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"
print reactionEntry
reactionFile = open("outputs/reactions.txt", 'a')
......@@ -304,10 +315,11 @@ def convertXBEL(filepath):
except Exception as ex:
f = open(expStatementFile, 'a')
f.write(str(index) +"|"+str(statement_num)+"|"+str(relationship)+"|"+evidence+"\n")
f.write(" !!!EXCEPTION!!! : " + str(ex.args)+"==================================\n")
f.close()
print " !!!EXCEPTION!!! : " + str(ex.args)
exit()
#exit()
# Convert file
......
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