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

Commit 3e7bd674 authored by Aishwarya Alex's avatar Aishwarya Alex
Browse files

update 8 : add input files for dictionary : namespace map and entities and reactions

parent 4cc24cf0
proteinAbundance PROTEIN
pathology PHENOTYPE
biologicalProcess PHENOTYPE
rnaAbundance RNA
microRNAAbundance RNA
\ No newline at end of file
......@@ -3,4 +3,5 @@ PubMed urn:miriam:pubmed
GO urn:miriam:go
MESHPP urn:miriam:mesh.2012
MESHCL urn:miriam:mesh.2012
MESHD urn:miriam:mesh.2012
\ No newline at end of file
MESHD urn:miriam:mesh.2012
CHEBIID urn:miriam:chebi:CHEBI
\ No newline at end of file
increases UNKNOWKN_POSTIVE_INFLUENCE
directlyIncreases POSTIVE_INFLUENCE
\ No newline at end of file
......@@ -21,6 +21,25 @@ def getNamespaceDict():
namespaceDict[nspace[0]]=nspace[1]
return namespaceDict
#LOAD NAMESPACE DICTIONARY
def getEntityDict():
entityDict={}
for line in open("inputs/EntityDictFile.txt",'r'):
nspace=line.split()
entityDict[nspace[0]]=nspace[1]
return entityDict
#LOAD reaction DICTIONARY
def getReactionDict():
reactionDict={}
for line in open("inputs/reactionDictFile.txt",'r'):
nspace=line.split()
reactionDict[nspace[0]]=nspace[1]
return reactionDict
#Get GOID from GOOSE
def getGoIDfromTerm(term):
cnx = MySQLdb.connect(user='go_select', passwd='amigo', host='mysql-amigo.ebi.ac.uk', db='go_latest', port=4085)
......@@ -29,4 +48,4 @@ def getGoIDfromTerm(term):
cursor.execute(query)
row=cursor.fetchone()
cnx.close()
return row
return row
\ No newline at end of file
......@@ -66,10 +66,23 @@ def get_details_from_element(node, index, statement_num, evidence, expStatementF
elementName = "" # function@TERM
elementAnnotation = "" # ns@PARAMETER+text
details = "EMPTY"
entityDict=NT.getEntityDict()
if term is not None:
elementName = term.get(ns_tag('function'))
element = term.get(ns_tag('function'))
parameter = term.find(ns_tag("parameter"))
if element in entityDict.keys():
elementName=entityDict[element]
else:
elementName=element
#LOAD entity DIctionary
alreadyIn=[line.strip() for line in open("outputs/additional/toMapEntities.txt","r")]
if element not in alreadyIn:
f=open("outputs/additional/toMapEntities.txt","a")
f.write(element+"\n")
f.close()
if parameter is not None:
belnamespace=parameter.get(ns_tag("ns"))
namespaceDict=NT.getNamespaceDict()
......@@ -101,8 +114,7 @@ def get_details_from_element(node, index, statement_num, evidence, expStatementF
details = get_details_from_element(term, index, statement_num, evidence, expStatementFile)
return details
else:
print remove_ns_tag(
node.tag).upper() + " is nested WITH A STATEMENT ## add as modifier to nested statement(reaction)"
print remove_ns_tag(node.tag).upper() + " is nested WITH A STATEMENT ## add as modifier to nested statement(reaction)"
print "----PRINTING NODE INFO RECURSIVELY"
entry = str(index+1) + "|" + str(statement_num+1) + "|" + str(elementName + " :" + elementAnnotation) + "|" +str(get_node_info_recursive(term)).replace('|',' ') +"|" + str(evidence.encode('utf-8').replace("\r\n","")+"\n")
......@@ -127,10 +139,13 @@ def convertXBEL(filepath):
tree = ET.parse(filepath)
root = tree.getroot()
#LOAD namespace DIctionary
f=open("outputs/additional/toAddNamespaces.txt","w")
#create new files
f=open("outputs/additional/toMapEntities.txt","w")
f.close()
#LOAD namespace DIctionary
namespaceDict=NT.getNamespaceDict()
reactionDict=NT.getReactionDict()
# get all statement nodes, annotation and sub nodes (complex, or composite structures)
reactionIdentifier = 0
......@@ -175,6 +190,14 @@ def convertXBEL(filepath):
nFile.write(nodeEntry)
nFile.close()
print "\n-----REACTION-----\n"
if relationship in reactionDict.keys():
relationship=reactionDict[relationship]
else:
alreadyIn=[line.strip() for line in open("outputs/additional/toMapReactions.txt","r")]
if element not in alreadyIn:
f=open("outputs/additional/toMapReactions.txt","a")
f.write(element+"\n")
f.close()
reactionEntry= "r" + str(reactionIdentifier) + "\t" + relationship + "\t" + reactant + "\t" + modifier + "\t" + product + "\t" + namespaceDict[referenceType] + ":" + reference+"\n"
print reactionEntry
rFile=open(reactionFile,"a")
......@@ -185,6 +208,6 @@ def convertXBEL(filepath):
print "TO DO : Nested statement: Add as modifier"
#COnvert file
#Convert file
#/home/alex/PhD/Bel2CellD/full_abstract3.xbel
convertXBEL('/home/alex/PhD/Bel2CellD/small_corpus.xbel')
\ No newline at end of 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