Skip to content

Commit

Permalink
updated mechanism mapping + fixed PathwayConnection() mechanism + fix…
Browse files Browse the repository at this point in the history
…ed PathwayConnectionSet() effect
  • Loading branch information
vtoure committed Mar 11, 2020
1 parent c15002b commit 5969dcb
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 28 deletions.
59 changes: 33 additions & 26 deletions pathway_connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
ENABLED_BY = URIRef(expand_uri(ro.enabled_by))

MECHANISM_GO_MAPPING = {
"acetylation" : "GO:0061733",
"binding" : "GO:0005515",
"chemical activation" : None,
"chemical inhibition" : None,
"acetylation" : "GO:0016407",
"binding" : "GO:0005515", # protein binding
"catalytic activity" : "GO:0003824",
"chemical activation" : "GO:0005488", # binding
"chemical inhibition" : "GO:0005488", # binding
"cleavage" : "GO:0008233",
"deacetylation" : "GO:0033558",
"demethylation" : "GO:0032451",
Expand All @@ -22,24 +23,26 @@
"desumoylation" : "GO:0070140",
"deubiquitination" : "GO:0004843",
"glycosylation" : "GO:0016757",
"GAP" : "GO:0005096",
"GEF" : "GO:0005085",
"hydroxylation" : "GO:0036140",
"gtpase-activating protein" : "GO:0005096",
"guanine nucleotide exchange factor" : "GO:0005085",
"hydroxylation" : "GO:0016491", # oxidoreductase activity
"lipidation" : "GO:0016747",
"methylation" : "GO:0008276",
"neddylation" : "GO:0061663",
"oxidation" : "GO:0003674",
"palmitoylation" : "GO:0016409",
"phosphorylation" : "GO:0004672",
"post transcriptional regulation" : "GO:0035925",
"relocalization" : "GO:0003674",
"small molecule catalysis" : None,
"post transcriptional regulation" : "GO:0003730",
"relocalization" : "GO:0005215", # transporter activity
"small molecule catalysis" : "GO:0003674",
"stabilization" : "GO:0003674",
"sumoylation" : "GO:0061665",
"transcriptional activation" : "GO:0003700",
"transcriptional regulation" : "GO:0003700",
"transcriptional repression" : "GO:0003700",
"trimethylation (histone)" : "GO:0003674",
"s-nitrosylation" : "GO:0035605", # peptidyl-cysteine S-nitrosylase activity
"transcriptional regulation" : "GO:0140110",
"transcriptional activation": "GO:0140110",
"transcriptional repression": "GO:0140110",
"translation regulation": "GO:0045182",
"trimethylation" : "GO:0008276",
"tyrosination" : "GO:0004835",
"ubiquitination" : "GO:0061630"
}
Expand All @@ -57,6 +60,7 @@ def __init__(self, id_a, id_b, mechanism, effect, direct, relation, pmid, linenu
self.pmid = pmid
self.linenum = linenum
self.complex_a = None

try:
if NamingConvention.is_complex(self.id_a) and self.id_a in COMPLEXES:
self.complex_a = COMPLEXES[self.id_a]
Expand All @@ -66,12 +70,11 @@ def __init__(self, id_a, id_b, mechanism, effect, direct, relation, pmid, linenu
self.complex_b = None
if NamingConvention.is_complex(self.id_b) and self.id_b in COMPLEXES:
self.complex_b = COMPLEXES[self.id_b]

if self.direct == "NO":
mechanism_term = "GO:0003674"
elif self.direct == "YES":
mechanism_term = MECHANISM_GO_MAPPING[mechanism]
# self.mechanism["term"] = MECHANISM_GO_MAPPING["stabilization"]
# by default mechanism = molecular function
mechanism_term = "GO:0003674"
if self.direct == "YES":
if(mechanism):
mechanism_term = MECHANISM_GO_MAPPING[mechanism]
self.mechanism = { "name" : mechanism, "uri" : None, "term" : mechanism_term }
self.regulated_activity = { "name" : None, "uri" : None, "term" : None }

Expand Down Expand Up @@ -198,27 +201,31 @@ def __init__(self, filename=None):
data = list(csv.DictReader(f, delimiter="\t"))
for line in data:
linenum += 1
print(line)

# If up-regulates (including any variants of this), use RO:0002629 if DIRECT, and use RO:0002213 if not DIRECT
# If up-regulates (including any variants of this), use RO:0002629 if DIRECT, and use RO:0002213 if not DIRECT or UNKNOWN
relation = None

if line["EFFECT"].startswith("up-regulates"):
if line["DIRECT"] == "YES":
relation = "RO:0002629"
elif line["DIRECT"] == "NO":
relation = "RO:0002213"
# If down-regulates (including any variants of this), use RO:0002630 if DIRECT, and use RO:0002212 if not DIRECT
if line["EFFECT"].startswith("down-regulates"):

# If down-regulates (including any variants of this), use RO:0002630 if DIRECT, and use RO:0002212 if not DIRECT or UNKNOWN
elif line["EFFECT"].startswith("down-regulates"):
if line["DIRECT"] == "YES":
relation = "RO:0002630"
elif line["DIRECT"] == "NO":
relation = "RO:0002212"
# If unknown, use RO:0002211
if line["EFFECT"] == "unknown":
elif line["EFFECT"] == "unknown":
relation = "RO:0002211"
# If form_complex, ignore these lines for now
if line["EFFECT"] == "form_complex":
# If 'form complex', ignore these lines for now
elif line["EFFECT"] == "form complex":
continue


pc = PathwayConnection(
line["IDA"],
line["IDB"],
Expand Down
3 changes: 2 additions & 1 deletion pathway_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
from prefixcommons.curie_util import expand_uri
from pathway_connections import PathwayConnectionSet
import argparse
import os

ro = OboRO()
ENABLED_BY = URIRef(expand_uri(ro.enabled_by))
HAS_INPUT = URIRef(expand_uri("RO:0002233"))

parser = argparse.ArgumentParser()
parser.add_argument('-f', "--filename", type=str, required=True,
help="Input filename of Signor pathway data")
help="Input filename of SIGNOR pathway data")
parser.add_argument('-o', "--outfile", type=str, required=True,
help="Output filename of generated model")

Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ certifi==2018.1.18
chardet==3.0.4
click==6.7
decorator==4.2.1
gocamgen==0.0.2
gocamgen==0.0.4

idna==2.6
isodate==0.6.0
isort==4.3.4
Expand Down

0 comments on commit 5969dcb

Please sign in to comment.