136_chebi_compounds_unique_to_one_reaction
- ChEBI
- Metabolite
Count all ChEBI compounds that occur as a participant in exactly one Rhea reaction quad - i.e. compounds specific to a single chemical transformation, as opposed to widely-reused ones like water or ATP. Counting is done over BidirectionalReactions reactions, one per quad, selected via rdfs:subClassOf rh:BidirectionalReaction, so the same quad's LR/RL/BI directional variants aren't counted as separate reactions.
Use at
PREFIX rh: <http://rdf.rhea-db.org/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT
(COUNT(DISTINCT ?chebi) AS ?chebisInOnlyOneReaction)
WHERE {
{
SELECT
?chebi (COUNT(DISTINCT ?r) AS ?reactions)
WHERE {
?r rdfs:subClassOf rh:BidirectionalReaction ;
rh:status rh:Approved ;
rh:substratesOrProducts ?side .
?side rh:contains ?participant .
?participant rh:compound ?compound .
?compound (rh:chebi|(rh:reactivePart/rh:chebi)|rh:underlyingChebi) ?chebi .
}
GROUP BY ?chebi
HAVING (COUNT(DISTINCT ?r) = 1)
}}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?_anon_having_057439080f2472d4cc7b45b0c4bfe72d471")
v5("?chebi"):::projected
v8("?chebisInOnlyOneReaction")
v4("?compound")
v3("?participant")
v1("?r")
v7("?reactions")
v2("?side")
a1((" "))
a2((" "))
c5(["rh:Approved"]):::iri
c3(["rh:BidirectionalReaction"]):::iri
f0[[" = '1^^xsd:integer'"]]
f0 --> a1
v1 --"rdfs:subClassOf"--> c3
v1 --"rh:status"--> c5
v1 --"rh:substratesOrProducts"--> v2
v2 --"rh:contains"--> v3
v3 --"rh:compound"--> v4
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
subgraph union1[" Union "]
subgraph union1l[" "]
style union1l fill:#abf,stroke-dasharray: 3 3;
v4 --"rh:underlyingChebi"--> v5
end
subgraph union1r[" "]
style union1r fill:#abf,stroke-dasharray: 3 3;
v4 --"rh:reactivePart"--> a2
a2 --"rh:chebi"--> v5
end
union1r <== or ==> union1l
end
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
v4 --"rh:chebi"--> v5
end
union0r <== or ==> union0l
end
bind3[/"count(?r)"/]
v1 --o bind3
bind3 --as--o v6
bind4[/"count(?r)"/]
v1 --o bind4
bind4 --as--o v7
bind6[/"count(?chebi)"/]
v5 --o bind6
bind6 --as--o v8