1:- module(rhea,
2 [
3 rhea_status/2,
4 is_approved/1,
5 is_transport/1,
6 reaction/1,
7 nondirectional_reaction/1,
8 directional_reaction/1,
9 bidirectional_reaction/1,
10 directional_form/2,
11 bidirectional_form/2,
12 reaction_all_forms/4,
13 directional_forms/3,
14 reaction_form/3,
15 rhea_xref/2,
16 rhea_ec/2,
17 rhea_xref_conflated/2,
18 rhea_xref_skos/3,
19
20 reaction_side/2,
21 side_contains/2,
22
23 reaction_participant/2,
24 participant_compound/2,
25 compound_chebi/2,
26 participant_chebi/2,
27 reaction_chebi_participant/2,
28
29 rhea_equation/2
30
31 ]). 32
33:- use_module(library(semweb/rdf11)). 34
35:- rdf_register_prefix(rh, 'http://rdf.rhea-db.org/'). 36:- rdf_register_prefix(chebi, 'http://purl.obolibrary.org/obo/CHEBI_'). 37
38:- rdf_meta status(r,r).
39rhea_status(A,B) :- rdf(A, rh:status, B).
40
41:- rdf_meta is_approved(r).
42is_approved(A) :- rhea_status(A,rh:'Approved').
43
44is_transport(R) :- rdf(R,rh:isTransport,"true"^^xsd:boolean).
45
46:- rdf_meta reaction(r).
47:- rdf_meta nondirectional_reaction(r).
48:- rdf_meta directional_reaction(r).
49:- rdf_meta bidirectional_reaction(r).
50reaction(R) :- nondirectional_reaction(R) ; directional_reaction(R) ; bidirectional_reaction(R).
51nondirectional_reaction(R) :- rdf(R,rdfs:subClassOf,rh:'Reaction').
52directional_reaction(R) :- rdf(R,rdfs:subClassOf,rh:'DirectionalReaction').
53bidirectional_reaction(R) :- rdf(R,rdfs:subClassOf,rh:'BidirectionalReaction').
54
55directional_form(R,DR) :- rdf(R,rh:directionalReaction,DR).
56bidirectional_form(R,DR) :- rdf(R,rh:bidirectionalReaction,DR).
57
58reaction_all_forms(R,D1,D2,BD) :- directional_form(R,D1),directional_form(R,D2),D1@<D2,bidirectional_form(R,BD).
59
60directional_forms(R,D1,D2) :- rdf(R,rh:directionalReaction,D1),rdf(R,rh:directionalReaction,D2),D1@<D2.
63reaction_form(R,nondirectional,R) :- reaction(R).
64reaction_form(P,directional,R) :- directional_form(P,R).
65reaction_form(P,bidirectional,R) :- bidirectional_form(P,R).
66
67
68
69rhea_ec(R,X) :- rdf(R,rh:ec,X).
70rhea_xref(R,X) :- rdf(R,rdfs:seeAlso,X).
71
72rhea_xref_conflated(R,X) :-
73 ( nondirectional_reaction(R),rhea_xref(R,X))
74 ;
75 ( directional_form(R,R2),rhea_xref(R2,X))
76 ;
77 ( bidirectional_form(R,R2),rhea_xref(R2,X)).
78
79rhea_xref_skos(R,Pred,X) :-
80 rhea_xref_conflated(R,X),
81 member([Prefix,Pred],
82 [
83 ['http://identifiers.org/reactome/',skos:broadMatch],
84 ['http://identifiers.org/biocyc/METACYC:',skos:exactmatch],
85 ['http://identifiers.org/biocyc/ECOCYC:',skos:exactmatch],
86 ['http://identifiers.org/kegg.reaction/',skos:exactmatch]
87 ]),
88 str_starts(str(X),str(Prefix)).
93rhea_products(R, S) :- rdf(R,rh:products,S).
98rhea_substrates(R, S) :- rdf(R,rh:substrates,S).
103rhea_substratesOrProducts(R, S) :- rdf(R,rh:substratesOrProducts,S).
104
105
106reaction_side(R,S) :- rdf(R,rh:side,S).
107side_contains(S,P) :- rdf(S,rh:contains,P).
108reaction_participant(R,P) :- reaction_side(R,S),side_contains(S,P).
109
110participant_compound(P,C) :- rdf(P,rh:compound,C).
111compound_chebi(C,X) :- rdf(C,rh:chebi,X).
112participant_chebi(P,X) :- participant_compound(P,C),compound_chebi(C,X).
113
114reaction_chebi_participant(R,X) :- reaction_participant(R,P),participant_chebi(P,X).
115
116rhea_name(R,N) :- rdf(R,rh:name,N).
117rhea_accession(R,A) :- rdf(R,rh:accession,A). 118
119rhea_equation(R,E) :- rdf(R,rh:equation,E)