Skip to content

Commit

Permalink
Move SIGNOR-mechanism-to-GO mappings to YAML
Browse files Browse the repository at this point in the history
  • Loading branch information
dustine32 committed Apr 20, 2020
1 parent 6862ceb commit 96f28ec
Show file tree
Hide file tree
Showing 3 changed files with 233 additions and 45 deletions.
175 changes: 175 additions & 0 deletions metadata/signor_mechanism_go_mapping.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
-
MECHANISM: acetylation
MI_ID: MI:0192
GO_ID: GO:0016407 # acetyltransferase activity
RELATION: RO:0002304 # causally upstream of, positive effect
-
MECHANISM: binding
MI_ID: MI:0915
GO_ID: GO:0005515 # protein binding
RELATION: RO:0002629 # directly positively regulates
-
MECHANISM: catalytic activity
MI_ID: MI:0414
GO_ID: GO:0003824
RELATION:
-
MECHANISM: chemical activation
MI_ID:
GO_ID: GO:0005488
RELATION:
-
MECHANISM: chemical inhibition
MI_ID:
GO_ID: GO:0005488
RELATION:
-
MECHANISM: cleavage
MI_ID: MI:0194
GO_ID: GO:0008233
RELATION:
-
MECHANISM: deacetylation
MI_ID: MI:0197
GO_ID: GO:0033558
RELATION:
-
MECHANISM: demethylation
MI_ID: MI:0871
GO_ID: GO:0032451
RELATION:
-
MECHANISM: dephosphorylation
MI_ID: MI:0203
GO_ID: GO:0004721
RELATION:
-
MECHANISM: destabilization
MI_ID:
GO_ID:
RELATION:
-
MECHANISM: desumoylation
MI_ID: MI:0568
GO_ID: GO:0070140
RELATION:
-
MECHANISM: deubiquitination
MI_ID: MI:0204
GO_ID: GO:0004843
RELATION:
-
MECHANISM: glycosylation
MI_ID: MI:0559
GO_ID: GO:0016757
RELATION:
-
MECHANISM: gtpase-activating protein
MI_ID: MI:0414
GO_ID: GO:0005096
RELATION:
-
MECHANISM: guanine nucleotide exchange factor
MI_ID: MI:2252
GO_ID: GO:0005085
RELATION:
-
MECHANISM: hydroxylation
MI_ID: MI:0210
GO_ID: GO:0016491
RELATION:
-
MECHANISM: lipidation
MI_ID:
GO_ID: GO:0016747
RELATION:
-
MECHANISM: methylation
MI_ID: MI:0213
GO_ID: GO:0008276
RELATION:
-
MECHANISM: neddylation
MI_ID: MI:0567
GO_ID: GO:0061663
RELATION:
-
MECHANISM: oxidation
MI_ID:
GO_ID:
RELATION:
-
MECHANISM: palmitoylation
MI_ID: MI:0216
GO_ID: GO:0016409
RELATION:
-
MECHANISM: phosphorylation
MI_ID: MI:0217
GO_ID: GO:0004672
RELATION:
-
MECHANISM: post transcriptional regulation
MI_ID: MI:2249
GO_ID: GO:0003730
RELATION:
-
MECHANISM: relocalization
MI_ID: MI:0915
GO_ID: GO:0005215
RELATION:
-
MECHANISM: small molecule catalysis
MI_ID: MI:0414
GO_ID:
RELATION:
-
MECHANISM: stabilization
MI_ID:
GO_ID:
RELATION:
-
MECHANISM: sumoylation
MI_ID: MI:0566
GO_ID: GO:0061665
RELATION:
-
MECHANISM: s-nitrosylation
MI_ID:
GO_ID: GO:0035605
RELATION:
-
MECHANISM: transcriptional regulation
MI_ID: MI:2247
GO_ID: GO:0140110
RELATION:
-
MECHANISM: transcriptional activation
MI_ID: MI:2247
GO_ID: GO:0140110
RELATION:
-
MECHANISM: transcriptional repression
MI_ID: MI:2247
GO_ID: GO:0140110
RELATION:
-
MECHANISM: translation regulation
MI_ID: MI:2248
GO_ID: GO:0003730
RELATION:
-
MECHANISM: trimethylation
MI_ID: MI:0213
GO_ID: GO:0008276
RELATION:
-
MECHANISM: tyrosination
MI_ID: MI:2273
GO_ID: GO:0004835
RELATION:
-
MECHANISM: ubiquitination
MI_ID: MI:0220
GO_ID: GO:0061630
RELATION:
83 changes: 38 additions & 45 deletions pathway_connections.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import csv
import itertools
import yaml
from ontobio.vocabulary.relations import OboRO
from rdflib.term import URIRef
from prefixcommons.curie_util import expand_uri
Expand All @@ -10,48 +11,40 @@

ENABLED_BY = URIRef(expand_uri(ro.enabled_by))

MECHANISM_GO_MAPPING = {
"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",
"dephosphorylation" : "GO:0004721",
"destabilization" : "GO:0003674",
"desumoylation" : "GO:0070140",
"deubiquitination" : "GO:0004843",
"glycosylation" : "GO:0016757",
"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:0003730",
"relocalization" : "GO:0005215", # transporter activity
"small molecule catalysis" : "GO:0003674",
"stabilization" : "GO:0003674",
"sumoylation" : "GO:0061665",
"s-nitrosylation" : "GO:0035605", # peptidyl-cysteine S-nitrosylase activity
"transcriptional activation": "GO:0140110",
"transcriptional regulation": "GO:0140110",
"transcriptional repression": "GO:0140110",
"translation regulation": "GO:0045182",
"trimethylation" : "GO:0008276",
"tyrosination" : "GO:0004835",
"ubiquitination" : "GO:0061630"
}

complex_csv_filename = "SIGNOR_complexes.csv"
COMPLEXES = SignorComplexFactory(complex_csv_filename).complexes

class MechanismToGoMapping:
def __init__(self, mechanism, mi_id, go_id, relation):
self.mechanism = mechanism
self.mi_id = mi_id
self.go_id = go_id
self.relation = relation


class MechanismToGoMappingSet:
def __init__(self, mapping_file=None):
self.mappings = []
if mapping_file:
with open(mapping_file) as mf:
mappings = yaml.load(mf)
for m in mappings:
self.mappings.append(MechanismToGoMapping(
mechanism=m["MECHANISM"],
mi_id=m["MI_ID"],
go_id=m["GO_ID"],
relation=m["RELATION"]
))

def go_id_by_mechanism(self, mechanism):
for m in self.mappings:
if m.mechanism == mechanism:
return m.go_id


class PathwayConnection():
MECHANISM_GO_MAPPING = MechanismToGoMappingSet("metadata/signor_mechanism_go_mapping.yaml")
complex_csv_filename = "SIGNOR_complexes.csv"
COMPLEXES = SignorComplexFactory(complex_csv_filename).complexes

def __init__(self, id_a, id_b, mechanism, effect, direct, relation, pmid, linenum):
self.id_a = id_a
self.id_b = id_b
Expand All @@ -63,19 +56,19 @@ def __init__(self, id_a, id_b, mechanism, effect, direct, relation, pmid, linenu
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]
if NamingConvention.is_complex(self.id_a) and self.id_a in self.COMPLEXES:
self.complex_a = self.COMPLEXES[self.id_a]
except TypeError as err:
print(self.id_a)
raise err
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 NamingConvention.is_complex(self.id_b) and self.id_b in self.COMPLEXES:
self.complex_b = self.COMPLEXES[self.id_b]
# by default mechanism = molecular function
mechanism_term = "GO:0003674"
if self.direct in ["YES", "t"]:
if(mechanism):
mechanism_term = MECHANISM_GO_MAPPING[mechanism]
mechanism_term = self.MECHANISM_GO_MAPPING.go_id_by_mechanism(mechanism)
self.mechanism = { "name" : mechanism, "uri" : None, "term" : mechanism_term }
self.regulated_activity = { "name" : None, "uri" : None, "term" : None }

Expand Down
20 changes: 20 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import unittest
import yaml
from pathway_connections import MechanismToGoMappingSet

M_FILE = "metadata/signor_mechanism_go_mapping.yaml"

class TestSignor2Gocam(unittest.TestCase):

def test_mechanism_map_loading(self):
with open(M_FILE) as mf:
mappings = yaml.load(mf)
self.assertGreater(len(mappings), 1)

def test_mechanism_mapping_set(self):
mapping_set = MechanismToGoMappingSet(M_FILE)
go_term = mapping_set.go_id_by_mechanism("catalytic activity")
self.assertEqual(go_term, "GO:0003824")

if __name__ == '__main__':
unittest.main()

1 comment on commit 96f28ec

@dustine32
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For issue #18

Please sign in to comment.