diff --git a/Images/Images-PlantMetWikiInterface.png b/Images/Images-PlantMetWikiInterface.png new file mode 100644 index 0000000..f36a6de Binary files /dev/null and b/Images/Images-PlantMetWikiInterface.png differ diff --git a/README.md b/README.md index 25705f7..6f632e9 100644 --- a/README.md +++ b/README.md @@ -88,13 +88,45 @@ This uses the Gemfile in the repository to install: - and any other required gems. -### 5. Serve the site locally +### 5. Serve the site locally (macOS) + +### Why this setup +macOS ships with a locked “system Ruby” that often causes permission errors when installing gems. +To avoid this, use Homebrew Ruby and install gems locally in the repo. + + +#### 1 Install Ruby via Homebrew +```bash +brew install ruby +``` + +##### 2 Ensure Homebrew Ruby is used (IMPORTANT) +```bash +echo 'export PATH="$(brew --prefix ruby)/bin:$PATH"' >> ~/.zshrc +source ~/.zshrc + +which ruby +ruby -v ``` + +If which ruby prints /usr/bin/ruby, you are still using system Ruby — fix your PATH before continuing. + +#### 3 Install Bundler and dependencies (local install) +```bash +gem install bundler + +bundle config set --local path vendor/bundle +bundle install +``` + +#### 4 Run the site locally + +```bash bundle exec jekyll serve --port 4001 ``` Jekyll will print something like: -``` +```bash Server address: http://127.0.0.1:4001/ Server running... press ctrl-c to stop. ``` diff --git a/_tutorial/1.UnderstandingSPARQL.md b/_tutorial/1.UnderstandingSPARQL.md index e3718d3..3a5416d 100644 --- a/_tutorial/1.UnderstandingSPARQL.md +++ b/_tutorial/1.UnderstandingSPARQL.md @@ -12,29 +12,52 @@ By the end of this page, you should be comfortable: - reading a SPARQL query used in PlantMetWiki, - understanding what biological question it answers, -- recognizing how pathway content is represented in RDF, +- recognising how pathway content is represented in RDF, - following links from PlantMetWiki to external resources such as PlantCyc. **SPARQL endpoint**: -https://plantmetwiki.bioinformatics.nl/sparql +https://plantmetwiki.bioinformatics.nl/sparql -**Graph used in all queries**: -`FROM ` +## The multi-graph architecture of PlantMetWiki -We will work with the **α-solanine / α-chaconine biosynthesis pathway**, a well-known plant specialised metabolic pathway involved in glycoalkaloid production in *Solanum* species (e.g. potato and tomato). +PlantMetWiki stores its data in **named graphs** — separate, labelled containers within the same SPARQL endpoint. This is different from a single flat database: each graph holds a specific type of information, and queries must explicitly target the relevant graph(s) using `GRAPH` blocks. + +The core graph for pathway content is: + +``` +http://rdf-plantmetwiki.bioinformatics.nl/graph/pathways +``` + +You will always wrap pathway queries in a `GRAPH` block like this: + +```sparql +GRAPH { + ... +} +``` + +Other graphs (for species, stable identifiers, gene clusters) are introduced in later tutorials. + +We will work with the **capsaicin biosynthesis pathway** (PlantCyc ID: PWY-5710, internal ID: PC629), a well-known plant specialised metabolic pathway responsible for pungency in *Capsicum* species. ## Anatomy of a SPARQL query -A SPARQL query consist out of several elements, which can be considered as building blocks. +A SPARQL query consists of several elements that can be considered as building blocks. -Our PlantMetWiki question +Our PlantMetWiki question: -> ***Which PlantCyc reactions are part of the α-solanine / α-chaconine biosynthesis pathway, and how can we validate them in PlantCyc?*** +> ***Which PlantCyc reactions are part of the capsaicin biosynthesis pathway, and how can we validate them in PlantCyc?*** -We will use this pathway URI throughout the tutorial: +We will use the capsaicin pathway throughout this tutorial. Its IRI follows the pattern: ``` - +http://rdf-plantmetwiki.bioinformatics.nl/pathways/PC629_r17.0.0_ +``` + +We can locate it reliably by filtering on the internal ID: + +```sparql +FILTER(CONTAINS(STR(?pw), '/PC629_')) ``` ### SELECT — what do we want to see in the results? @@ -42,80 +65,98 @@ We will use this pathway URI throughout the tutorial: The SELECT clause defines what will be returned as results. For our question, we want: - • the reaction identifier (?reactionId) - • a clickable PlantCyc link (?plantCycReactionURL) +- the reaction identifier (`?reactionId`) +- a clickable PlantCyc link (`?plantCycReactionURL`) -```sparql +```sparql SELECT ?reactionId ?plantCycReactionURL ``` -SELECT is used to indicate with variables from the SPARQL query you want to visualise as a result (in other words: which variables we find relevant as output to answer our biological question). +SELECT indicates which variables from the SPARQL query you want to visualise as a result (which variables we find relevant as output to answer our biological question). ### WHERE — how do we find that information? -The second element we encouter in a SPARQL query, is the _query pattern_, which starts with the word WHERE, with the query itself enclosed in curly brackets: {} . - The WHERE clause defines the graph pattern to match (triples in the form subject–predicate–object). -For PlantMetWiki pathways, we already discovered the key predicates: - • gpml:hasInteraction (links a pathway to interactions) - • some interactions represent real PlantCyc reactions (e.g. RXN-10730) - • some interactions are GPML anchor helper nodes (contain _anchor_) and should not be linked to PlantCyc or interpreted as reactions +In PlantMetWiki, the key predicate for linking any node to its pathway is: + +``` +?node dcterms:isPartOf ?pw +``` + +This is used for reactions (typed `wp:Conversion`), enzymes (`wp:GeneProduct`, `wp:Protein`), metabolites (`wp:Metabolite`), and other node types alike. -```sparql +```sparql WHERE { - VALUES ?pathway { <...> } - ?pathway gpml:hasInteraction ?interaction . - ... + GRAPH { + ?pw a wp:Pathway . + FILTER(CONTAINS(STR(?pw), '/PC629_')) + ?rxn dcterms:isPartOf ?pw ; + a wp:Conversion . + ... + } } ``` -This is a set of RDF triples (subject–predicate–object), just like in the Wikidata tutorial, but with PlantMetWiki predicates. +This is a set of RDF triples (subject–predicate–object) matched within the named graph. ## Step-by-step interpretation of the query -### Line 1 — VALUES (what are we querying about?) +### Step 1 — Identify the pathway -VALUES lets us “pin” the query to one (or multiple) specific items. +We use `FILTER(CONTAINS(...))` to select the capsaicin pathway by its internal ID: ```sparql -VALUES ?pathway { - +?pw a wp:Pathway . +FILTER(CONTAINS(STR(?pw), '/PC629_')) +``` + +This matches any version of the pathway IRI that contains `/PC629_`, making the query robust across data releases. + +You can also use a `VALUES` block if you have the full IRI: + +```sparql +VALUES ?pw { + } -``` -You can add more pathways inside the braces later (separated by spaces) if you want to compare multiple pathways. +``` -### Line 2 — Retrieve interactions from the pathway +### Step 2 — Retrieve reactions from the pathway -This line uses the pathway as the subject and gets all linked interactions: +Reactions are typed `wp:Conversion` and linked to their pathway with `dcterms:isPartOf`: ```sparql -?pathway gpml:hasInteraction ?interaction . +?rxn dcterms:isPartOf ?pw ; + a wp:Conversion . ``` -### Line 3 — Turn an interaction URI into a PlantCyc reaction link +### Step 3 — Extract the reaction ID from the IRI -PlantMetWiki does not use Wikidata’s label service. Instead, we often extract meaningful identifiers from URIs. +PlantMetWiki does not provide a label service. Instead, we extract meaningful identifiers from IRIs using string functions. -1. Extract the part after /Interaction/: +The reaction IRI looks like: ``` -BIND( - STRAFTER(STR(?interaction), "/Interaction/") - AS ?reactionId -) +http://rdf-plantmetwiki.bioinformatics.nl/Interaction/PC629_RXN-10730_r17.0.0_... ``` -2. Keep only “real” reactions and exclude anchor helper nodes: +We extract the reaction identifier using `STRAFTER` and `REPLACE`: -``` -FILTER(CONTAINS(?reactionId, "RXN-")) -FILTER(!CONTAINS(?reactionId, "_anchor_")) +```sparql +BIND(REPLACE(STRAFTER(STR(?rxn), "/Interaction/"), "_", "-") AS ?reactionId) ``` -3. Construct a clickable PlantCyc URL: +Some interaction nodes are GPML drawing helper nodes (containing `_anchor_`) and are not real reactions. We exclude them: +```sparql +FILTER(!CONTAINS(STR(?rxn), "_anchor_")) ``` + +### Step 4 — Construct a clickable PlantCyc URL + +We turn the extracted identifier into a clickable external link: + +```sparql BIND( IRI(CONCAT( "https://pmn.plantcyc.org/PLANT/NEW-IMAGE?type=REACTION&object=", @@ -125,34 +166,33 @@ BIND( ) ``` -This turns the extracted identifier into a clickable external link. +### Full query -#### Full query - -```sparql -PREFIX gpml: +```sparql +PREFIX wp: +PREFIX dcterms: SELECT ?reactionId ?plantCycReactionURL -FROM WHERE { - VALUES ?pathway { - - } + GRAPH { + ?pw a wp:Pathway . + FILTER(CONTAINS(STR(?pw), '/PC629_')) - ?pathway gpml:hasInteraction ?interaction . + ?rxn dcterms:isPartOf ?pw ; + a wp:Conversion . - BIND(STRAFTER(STR(?interaction), "/Interaction/") AS ?reactionId) + FILTER(!CONTAINS(STR(?rxn), "_anchor_")) - FILTER(CONTAINS(?reactionId, "RXN-")) - FILTER(!CONTAINS(?reactionId, "_anchor_")) + BIND(REPLACE(STRAFTER(STR(?rxn), "/Interaction/"), "_", "-") AS ?reactionId) - BIND( - IRI(CONCAT( - "https://pmn.plantcyc.org/PLANT/NEW-IMAGE?type=REACTION&object=", - ?reactionId - )) - AS ?plantCycReactionURL - ) + BIND( + IRI(CONCAT( + "https://pmn.plantcyc.org/PLANT/NEW-IMAGE?type=REACTION&object=", + ?reactionId + )) + AS ?plantCycReactionURL + ) + } } ORDER BY ?reactionId LIMIT 200 @@ -160,59 +200,93 @@ LIMIT 200 ### Listing pathway components (genes, metabolites) -To see which data nodes (genes, metabolites) are present in the same pathway: +To see which data nodes are present in the same pathway, query for all nodes that are part of it and inspect their types: -``` -PREFIX gpml: +```sparql +PREFIX wp: +PREFIX dcterms: +PREFIX dc: -SELECT ?dataNodeId -FROM +SELECT ?node ?type ?label WHERE { - VALUES ?pathway { - + GRAPH { + ?pw a wp:Pathway . + FILTER(CONTAINS(STR(?pw), '/PC629_')) + + ?node dcterms:isPartOf ?pw ; + a ?type . + + OPTIONAL { ?node dc:title ?label } + + FILTER(?type IN (wp:GeneProduct, wp:Protein, wp:Metabolite, wp:Complex)) } +} +ORDER BY ?type ?label +LIMIT 200 +``` + +### Exploring enzyme–reaction links (Catalysis) + +PlantMetWiki uses `wp:Catalysis` nodes to link enzymes to the reactions they catalyse: - ?pathway gpml:hasDataNode ?dataNode . - BIND(STRAFTER(STR(?dataNode), "/DataNode/") AS ?dataNodeId) +```sparql +PREFIX wp: +PREFIX dcterms: + +SELECT ?enzyme ?reaction +WHERE { + GRAPH { + ?pw a wp:Pathway . + FILTER(CONTAINS(STR(?pw), '/PC629_')) + + ?catalysis a wp:Catalysis ; + dcterms:isPartOf ?pw ; + wp:source ?enzyme ; + wp:target ?reaction . + } } -ORDER BY ?dataNodeId LIMIT 200 ``` +`wp:source` points to the enzyme (a `wp:GeneProduct` or `wp:Protein`) and `wp:target` points to the reaction (a `wp:Conversion`). + ## A note on labels and identifiers -Unlike Wikidata, PlantMetWiki does not provide a dedicated label service (SERVICE wikibase:label). +Unlike Wikidata, PlantMetWiki does not provide a dedicated label service (`SERVICE wikibase:label`). Instead: - • some readable information is stored directly (e.g. gpml:name, gpml:textLabel), - • otherwise, meaningful identifiers are extracted directly from URIs using string functions such as STRAFTER(). +- pathway titles are stored as `dc:title` literals on the pathway node, +- reaction and data-node identifiers are extracted from IRIs using string functions such as `STRAFTER()` and `REPLACE()`. This approach is used consistently throughout the tutorial. - -## Questions +## Questions
- Question 1: Which part of the query selects the pathway we want to investigate? + Question 1: Which graph must we always specify when querying pathway content?

Answer:
- VALUES ?pathway { <http://rdf-plantmetwiki.bioinformatics.nl/Pathway/RC1000_r20251206224344> } + GRAPH <http://rdf-plantmetwiki.bioinformatics.nl/graph/pathways> { ... }

- Question 2: Which line retrieves all interactions that belong to the pathway? + Question 2: Which predicate links a reaction or data node to its pathway?

Answer:
- ?pathway gpml:hasInteraction ?interaction . + dcterms:isPartOf. The triple is: ?node dcterms:isPartOf ?pw .

- Question 3: Why do we filter out _anchor_ interactions? + Question 3: Why do we filter out _anchor_ nodes?

Answer:
- Interactions that contain _anchor_ are GPML helper nodes used for drawing/connecting edges. They are not real PlantCyc reaction identifiers, so PlantCyc will not recognize them. + Nodes whose IRI contains _anchor_ are GPML drawing helper nodes used for connecting edges on the pathway diagram. They are not real PlantCyc reaction identifiers, so PlantCyc will not recognise them.

- - +
+ Question 4: How do we find the pathway title? +

Answer:
+ Use ?pw dc:title ?title inside the GRAPH block, with prefix PREFIX dc: <http://purl.org/dc/elements/1.1/>. +

+
diff --git a/_tutorial/2.ExpandQueries.md b/_tutorial/2.ExpandQueries.md index 4900054..9727256 100644 --- a/_tutorial/2.ExpandQueries.md +++ b/_tutorial/2.ExpandQueries.md @@ -4,7 +4,6 @@ title: "Exploring Species and Pathways" order: 20 --- - In the previous page, we focused on a **single plant metabolic pathway** and examined how reactions are represented and linked to PlantCyc. In this section, we take a step back and explore **PlantMetWiki as a collection**: @@ -17,223 +16,240 @@ This page introduces **exploratory queries** that help you understand the scope **SPARQL endpoint** https://plantmetwiki.bioinformatics.nl/sparql -**Graph used in all queries** -```sparql -FROM -``` +## How species are represented in PlantMetWiki -### How species are represented in PlantMetWiki +In PlantMetWiki, **species are not stored on the pathway node itself**. Instead, they are attached to individual **data nodes** (genes, proteins, metabolites) within each pathway. -Unlike Wikidata, PlantMetWiki stores species names directly as text literals, rather than numeric identifiers. +This reflects how the data is curated: a single pathway entry can contain genes from multiple species, and the species annotation belongs to each gene or protein individually. -This makes it easy to: - • read queries - • copy species names into VALUES blocks - • explore the database interactively +Species information lives in a dedicated named graph: + +``` +http://rdf-plantmetwiki.bioinformatics.nl/graph/gpml-taxonomy-extra +``` + +Taxon labels (readable species names) are stored in a separate graph: + +``` +http://rdf-plantmetwiki.bioinformatics.nl/graph/ncbitaxon +``` -Species information is attached to pathways using the predicate: `gpml:organism` +The pattern to retrieve the species for a data node always requires **two GRAPH blocks**: -So far, we have implicitly focused on a single species by querying a single pathway. -If we want to explore pathways from multiple species, we can do this by changing the VALUES line in our query. +```sparql +PREFIX wp: +PREFIX rdfs: +PREFIX ncbi: -```sparql -{ - VALUES ?organism { "Solanum tuberosum" } +GRAPH { + ?node wp:organism ?taxon . + FILTER(?taxon != ncbi:33090) # exclude Viridiplantae — pathway-level placeholder +} +GRAPH { + ?taxon rdfs:label ?species . } ``` -This restricts the query to pathways annotated for potato. +The `FILTER(?taxon != ncbi:33090)` line is important: NCBI taxon 33090 is *Viridiplantae* (all green plants), used as a fallback annotation at pathway level. Excluding it gives you the actual species annotations at data-node level. -### Discovering which species are available +## Discovering which species are available Before querying pathways for a specific plant, it is useful to know which species are present at all. The following query lists all species annotated in PlantMetWiki: +```sparql +PREFIX wp: +PREFIX rdfs: +PREFIX ncbi: +PREFIX dcterms: -```sparql -PREFIX gpml: - -SELECT DISTINCT ?organism -FROM +SELECT DISTINCT ?species WHERE { - ?pathway gpml:organism ?organism . + GRAPH { + ?node dcterms:isPartOf ?pw . + } + GRAPH { + ?node wp:organism ?taxon . + FILTER(?taxon != ncbi:33090) + } + GRAPH { + ?taxon rdfs:label ?species . + } } -ORDER BY ?organism +ORDER BY ?species ``` -This gives you a controlled vocabulary of species names that can be reused directly in other queries. +This gives you the full list of species names that appear at data-node level across all pathways. -### Listing pathways for a given species +## Listing pathways for a given species -Once you know which species exist, you can retrieve the pathways associated with a specific plant. +Once you know which species exist, you can retrieve the pathways that contain data nodes annotated for a specific plant. -For example, to list pathways annotated for Solanum tuberosum (potato): +For example, to list pathways that contain *Solanum tuberosum* (potato) annotations: -``` -PREFIX gpml: +```sparql +PREFIX wp: +PREFIX rdfs: +PREFIX ncbi: +PREFIX dcterms: +PREFIX dc: -SELECT ?pathway -FROM +SELECT DISTINCT ?pw ?title WHERE { - ?pathway gpml:organism "Solanum tuberosum" . + GRAPH { + ?node dcterms:isPartOf ?pw . + ?pw dc:title ?title . + } + GRAPH { + ?node wp:organism ?taxon . + FILTER(?taxon != ncbi:33090) + } + GRAPH { + ?taxon rdfs:label ?species . + FILTER(STR(?species) = "Solanum tuberosum") + } } LIMIT 200 ``` -At this stage, the query returns pathway identifiers (URIs). +Because species are at data-node level, we use `DISTINCT` to avoid duplicate pathway rows (one row per matching data node). -## Making results more informative: pathway names +## Making results more informative: listing species per pathway -To make the output easier to interpret, we can include pathway names when they are available. +We can invert the question and ask which species are annotated within a specific pathway. -We extend the SELECT clause and add an OPTIONAL pattern: +Using the capsaicin biosynthesis pathway (PC629) as an example: ```sparql -PREFIX gpml: +PREFIX wp: +PREFIX rdfs: +PREFIX ncbi: +PREFIX dcterms: -SELECT ?pathway ?pathwayName -FROM +SELECT DISTINCT ?species WHERE { - ?pathway gpml:organism "Solanum tuberosum" . - OPTIONAL { ?pathway gpml:name ?pathwayName } + GRAPH { + ?node dcterms:isPartOf ?pw . + FILTER(CONTAINS(STR(?pw), '/PC629_')) + } + GRAPH { + ?node wp:organism ?taxon . + FILTER(?taxon != ncbi:33090) + } + GRAPH { + ?taxon rdfs:label ?species . + } } -LIMIT 200 +ORDER BY ?species ``` -Using OPTIONAL ensures that pathways without a name are still returned. - ## Comparing pathways across multiple species -SPARQL allows you to compare species by listing them explicitly using VALUES. +SPARQL allows you to compare species by listing them explicitly using `VALUES`. -For example, to retrieve pathways for potato and Arabidopsis: -``` -PREFIX gpml: +For example, to retrieve pathways that contain data nodes from both potato and *Arabidopsis thaliana*: -SELECT ?organism ?pathway ?pathwayName -FROM +```sparql +PREFIX wp: +PREFIX rdfs: +PREFIX ncbi: +PREFIX dcterms: +PREFIX dc: + +SELECT DISTINCT ?species ?pw ?title WHERE { - VALUES ?organism { - "Solanum tuberosum" - "Arabidopsis thaliana" - } + VALUES ?species { "Solanum tuberosum" "Arabidopsis thaliana" } - ?pathway gpml:organism ?organism . - OPTIONAL { ?pathway gpml:name ?pathwayName } + GRAPH { + ?node dcterms:isPartOf ?pw . + ?pw dc:title ?title . + } + GRAPH { + ?node wp:organism ?taxon . + FILTER(?taxon != ncbi:33090) + } + GRAPH { + ?taxon rdfs:label ?species . + } } +ORDER BY ?species ?title LIMIT 200 ``` This query makes the species explicit in the results, which is especially useful when comparing model plants with crop species. - -### Questions +### Questions
How would the VALUES line look if we also want to include Oryza sativa?

Answer:
- - VALUES ?organism {
-   "Solanum tuberosum"
-   "Arabidopsis thaliana"
-   "Oryza sativa"
- } -
+ VALUES ?species { "Solanum tuberosum" "Arabidopsis thaliana" "Oryza sativa" }

-### Which species? +## Counting pathways per species -Since we are now retrieving pathways from multiple species, it is useful to explicitly show the species in the results. -To do this, we modify the SELECT clause so that the organism is visible: +We can also aggregate results to answer questions such as: -```sparql -SELECT ?organism ?pathway -``` -If we also want to include the pathway name (when available), we can extend this further: +> Which species have the most pathway coverage in PlantMetWiki? -```sparql -SELECT ?organism ?pathway ?pathwayName -``` - -And add the corresponding triple pattern: -``` -OPTIONAL { ?pathway gpml:name ?pathwayName } -``` - -### Updated query with pathway names -``` -PREFIX gpml: +```sparql +PREFIX wp: +PREFIX rdfs: +PREFIX ncbi: +PREFIX dcterms: -SELECT ?organism ?pathway ?pathwayName -FROM +SELECT ?species (COUNT(DISTINCT ?pw) AS ?nPathways) WHERE { - VALUES ?organism { - "Solanum tuberosum" - "Arabidopsis thaliana" + GRAPH { + ?node dcterms:isPartOf ?pw . + } + GRAPH { + ?node wp:organism ?taxon . + FILTER(?taxon != ncbi:33090) + } + GRAPH { + ?taxon rdfs:label ?species . } - - ?pathway gpml:organism ?organism . - OPTIONAL { ?pathway gpml:name ?pathwayName } } -LIMIT 200 +GROUP BY ?species +ORDER BY DESC(?nPathways) ``` -### Questions +### Questions
- Which variable adds the species name to the results? + Why do we use DISTINCT inside COUNT(DISTINCT ?pw)?

Answer:
- ?organism, filled via ?pathway gpml:organism ?organism + Because many data nodes within a single pathway may share the same species annotation, we would otherwise count the same pathway multiple times — once per matching data node. DISTINCT ensures each pathway is counted only once per species.

-### Easier querying: discovering species in PlantMetWiki - -Unlike Wikidata, PlantMetWiki does not require numeric identifiers (such as Q-numbers). -Species names are stored directly as literals. - -If you are not sure which species are present in the database, you can list them: - -``` -PREFIX gpml: - -SELECT DISTINCT ?organism -FROM -WHERE { - ?pathway gpml:organism ?organism . -} -ORDER BY ?organism -``` - -This query gives you a controlled vocabulary of species that you can copy directly into a VALUES block. - -### Small expansion: count pathways per species - -We can also aggregate results to answer questions such as: - -Which species have the most pathways in PlantMetWiki? +
+ Why is species stored at data-node level rather than on the pathway? +

Answer:
+ Because a single pathway may contain data nodes (genes, enzymes) from multiple species — the pathway is a shared biochemical template. The species annotation is meaningful at the level of each individual gene or protein, not on the pathway as a whole. +

+
-``` -PREFIX gpml: +## Summary of key patterns -SELECT ?organism (COUNT(DISTINCT ?pathway) AS ?nPathways) -FROM -WHERE { - ?pathway gpml:organism ?organism . -} -GROUP BY ?organism -ORDER BY DESC(?nPathways) -``` +| Task | Pattern | +|---|---| +| List all species | `?node wp:organism ?taxon` in gpml-taxonomy-extra + `?taxon rdfs:label ?species` in ncbitaxon | +| Exclude Viridiplantae placeholder | `FILTER(?taxon != ncbi:33090)` | +| Pathways for a species | Join taxonomy-extra with pathways via shared `?node` | +| Species in a pathway | Filter on pathway IRI, then join to taxonomy-extra | +| Count pathways per species | `COUNT(DISTINCT ?pw)` grouped by `?species` | -### Notes on visualization +## Notes on visualization -Unlike Wikidata, the PlantMetWiki SPARQL endpoint does not provide built-in image visualizations. +The PlantMetWiki SPARQL endpoint does not provide built-in image visualisations. However, you can: - • export results as tabless - • click through to PlantCyc reaction links (as shown in Assignment 1) - • use external tools (e.g. notebooks, R, Python) to visualize pathway statistics +- export results as tables, +- click through to PlantCyc reaction links (as shown in Tutorial 1), +- use external tools (e.g. notebooks, R, Python) to visualise pathway statistics. diff --git a/_tutorial/3.GeneClusterLinks.md b/_tutorial/3.GeneClusterLinks.md index 75bf736..6530ea7 100644 --- a/_tutorial/3.GeneClusterLinks.md +++ b/_tutorial/3.GeneClusterLinks.md @@ -4,176 +4,255 @@ title: "Linking Pathways to Biosynthetic Gene Clusters" order: 30 --- -Plant specialized metabolites are often produced by **biosynthetic gene clusters (BGCs)** — groups of physically co-located genes that together encode a metabolic pathway. +Plant specialised metabolites are often produced by **biosynthetic gene clusters (BGCs)** — groups of physically co-located genes that together encode a metabolic pathway. PlantMetWiki provides explicit **cross-links between metabolic pathways and BGC resources**, allowing you to move from: - pathway-level knowledge - to genomic context -- to specialized metabolite biosynthesis +- to specialised metabolite biosynthesis In this section, we explore how PlantMetWiki connects pathways to: -- **plantiSMASH** predictions -- **MIBiG** curated BGCs +- **plantiSMASH** predictions (computationally predicted BGCs) +- **MIBiG** curated BGCs (experimentally validated) - external metadata describing gene clusters **SPARQL endpoint** https://plantmetwiki.bioinformatics.nl/sparql -**Graph used in all queries** -```sparql -FROM - -``` +## BGC data lives in dedicated named graphs -## What is a BGC cross-link in PlantMetWiki? +Unlike pathway content (which lives in `graph/pathways`), BGC data is stored in separate named graphs: -A BGC cross-link connects: +| Graph | Contents | +|---|---| +| `http://rdf-plantmetwiki.bioinformatics.nl/graph/bgc-plantismash` | plantiSMASH v2 predictions — 65 BGCs, *Arabidopsis thaliana* only | +| `http://rdf-plantmetwiki.bioinformatics.nl/graph/bgc-mibig` | MIBiG 4.0 curated BGCs — 43 BGCs | - • a PlantMetWiki pathway - • to a gene cluster identifier - • originating from an external resource +BGC nodes are typed `pmw:BiosyntheticGeneCluster`: -These links are derived from: +```sparql +PREFIX pmw: - • pathway annotations - • genomic metadata - • curated and predicted BGC databases +?bgc a pmw:BiosyntheticGeneCluster . +``` -PlantMetWiki does not duplicate BGC data; instead, it acts as a hub connecting pathways to specialized genomics resources. +## How BGC–pathway links work: the shared gene IRI join -⸻ +BGCs are **not** directly connected to pathway IRIs by a single predicate. Instead, the connection is made through **shared gene IRIs** from identifiers.org: -## Discovering all BGC cross-links +1. A BGC `ro:0000051` (RO *has_part*) a gene IRI from identifiers.org +2. The same gene IRI appears in `graph/pathways` as a `wp:GeneProduct` that is `dcterms:isPartOf` a pathway -To get an overview of how many pathway–BGC links exist, you can list all known cross-links: +The join therefore spans **three named graphs**: ``` -SELECT ?pathway ?bgc -FROM -WHERE { - ?pathway ?predicate ?bgc . - FILTER(CONTAINS(STR(?bgc), "BGC")) -} -LIMIT 200 +bgc-plantismash (or bgc-mibig) → shared gene IRI → graph/pathways ``` -This query reveals that: - • pathways may link to multiple BGCs - • BGC identifiers come from different external sources +The required prefix for the RO relation: +```sparql +PREFIX ro: +``` -## Linking pathways to plantiSMASH BGCs +The join pattern looks like this: -plantiSMASH predicts biosynthetic gene clusters directly from plant genomes. +```sparql +GRAPH { + ?bgc ro:0000051 ?gene . +} +GRAPH { + ?gene a wp:GeneProduct ; + dcterms:isPartOf ?pw . + ?pw dc:title ?title . +} +``` -PlantMetWiki pathways can link to plantiSMASH BGC identifiers, allowing you to: - • move from pathway → genome - • inspect candidate gene clusters - • evaluate biosynthetic hypotheses +## Listing all plantiSMASH BGC–pathway cross-links -Example query (from plantiSMASHLinks.rq): +```sparql +PREFIX wp: +PREFIX dcterms: +PREFIX dc: +PREFIX ro: +PREFIX pmw: -``` -SELECT ?pathway ?plantiSMASH_BGC -FROM +SELECT DISTINCT ?bgc ?pw (STR(?titleLit) AS ?title) WHERE { - ?pathway ?p ?plantiSMASH_BGC . - FILTER(CONTAINS(STR(?plantiSMASH_BGC), "plantiSMASH")) + GRAPH { + ?bgc a pmw:BiosyntheticGeneCluster ; + ro:0000051 ?gene . + } + GRAPH { + ?gene a wp:GeneProduct ; + dcterms:isPartOf ?pw . + ?pw dc:title ?titleLit . + } } +ORDER BY ?title LIMIT 200 ``` +plantiSMASH cluster IRIs follow the pattern: -Each returned BGC identifier can be clicked through to explore: - • predicted cluster boundaries - • gene annotations - • domain architecture - - -## Linking pathways to curated MIBiG clusters - -MIBiG is a manually curated database of experimentally validated biosynthetic gene clusters. +``` +https://plantismash.bioinformatics.nl/precalc/v2/ +``` -PlantMetWiki links pathways to MIBiG entries when: - • a pathway is supported by experimental evidence - • a known BGC has been described in the literature +## Listing all MIBiG BGC–pathway cross-links -Example query (from MIBiGLinks.rq): +```sparql +PREFIX wp: +PREFIX dcterms: +PREFIX dc: +PREFIX ro: +PREFIX pmw: -``` -SELECT ?pathway ?mibig -FROM +SELECT DISTINCT ?bgc ?pw (STR(?titleLit) AS ?title) WHERE { - ?pathway ?p ?mibig . - FILTER(CONTAINS(STR(?mibig), "mibig")) + GRAPH { + ?bgc a pmw:BiosyntheticGeneCluster ; + ro:0000051 ?gene . + } + GRAPH { + ?gene a wp:GeneProduct ; + dcterms:isPartOf ?pw . + ?pw dc:title ?titleLit . + } } +ORDER BY ?title LIMIT 200 ``` -These links allow you to: - • trace pathways to experimentally validated gene clusters - • connect pathway knowledge with publications - • assess confidence in biosynthetic assignments +MIBiG cluster IRIs follow the pattern: -## Combining multiple BGC sources +``` +https://bioregistry.io/mibig: +``` -Some pathways link to both predicted and curated clusters. +## Combining plantiSMASH and MIBiG in a single query -You can retrieve all BGC-related links regardless of source: -``` -SELECT ?pathway ?bgc -FROM +Some pathways link to both predicted and curated clusters. You can retrieve all BGC–pathway links regardless of source using `UNION`: + +```sparql +PREFIX wp: +PREFIX dcterms: +PREFIX dc: +PREFIX ro: +PREFIX pmw: + +SELECT DISTINCT ?bgc ?source ?pw (STR(?titleLit) AS ?title) WHERE { - ?pathway ?p ?bgc . - FILTER( - CONTAINS(STR(?bgc), "plantiSMASH") || - CONTAINS(STR(?bgc), "mibig") - ) + { + GRAPH { + ?bgc a pmw:BiosyntheticGeneCluster ; + ro:0000051 ?gene . + } + BIND("plantiSMASH" AS ?source) + } + UNION + { + GRAPH { + ?bgc a pmw:BiosyntheticGeneCluster ; + ro:0000051 ?gene . + } + BIND("MIBiG" AS ?source) + } + + GRAPH { + ?gene a wp:GeneProduct ; + dcterms:isPartOf ?pw . + ?pw dc:title ?titleLit . + } } +ORDER BY ?source ?title LIMIT 200 ``` -This makes it possible to: - • compare predictions with curated knowledge - • identify gaps in experimental validation - • prioritize clusters for follow-up study +This allows you to compare predictions with curated knowledge and identify pathways that have experimental validation. -## Pathway-centric view: BGCs for a specific pathway +## Pathway-centric view: which pathway belongs to a specific BGC? -You can also start from a specific MIBiG BGC and ask what is the pathway that belongs to that BGC +You can start from a specific MIBiG BGC and ask which pathway its genes belong to. -``` -PREFIX ro: -PREFIX wp: -PREFIX dc: +Example: **MIBiG BGC0000670** is the thalianol BGC in *Arabidopsis thaliana*. + +```sparql +PREFIX wp: PREFIX dcterms: +PREFIX dc: +PREFIX ro: -# Retrieve thalianol pathway SELECT DISTINCT ?pw (STR(?titleLit) AS ?title) -FROM WHERE { - ro:0000051 ?gene . + GRAPH { + ro:0000051 ?gene . + } + GRAPH { + ?gene a wp:GeneProduct ; + dcterms:isPartOf ?pw . + ?pw dc:title ?titleLit . + } +} +ORDER BY ?title +``` + +## BGC-centric view: which BGCs are linked to a specific pathway? + +You can also start from a pathway and retrieve all associated BGCs from both sources: - ?interaction wp:participants ?gene ; - dcterms:isPartOf ?pw . +```sparql +PREFIX wp: +PREFIX dcterms: +PREFIX ro: +PREFIX pmw: - ?pw dc:title ?titleLit . +SELECT DISTINCT ?bgc ?source +WHERE { + GRAPH { + ?gene a wp:GeneProduct ; + dcterms:isPartOf ?pw . + FILTER(CONTAINS(STR(?pw), '/PC629_')) + } + { + GRAPH { + ?bgc ro:0000051 ?gene . + } + BIND("plantiSMASH" AS ?source) + } + UNION + { + GRAPH { + ?bgc ro:0000051 ?gene . + } + BIND("MIBiG" AS ?source) + } } -ORDER BY ?title +ORDER BY ?source ``` +## plantiSMASH vs MIBiG: key differences + +| Feature | plantiSMASH | MIBiG | +|---|---|---| +| Method | Computational prediction | Manual curation | +| Species coverage | *Arabidopsis thaliana* only (v2) | Multi-species, plant-focused | +| Number of BGCs in PMW | 65 | 43 | +| Evidence level | Predicted | Experimentally validated | +| IRI pattern | `https://plantismash.bioinformatics.nl/precalc/v2/...` | `https://bioregistry.io/mibig:BGC...` | + ## Why BGC cross-links matter -By linking pathways to gene clusters, PlantMetWiki enables: - • genome-to-metabolite reasoning - • discovery of candidate biosynthetic loci - • comparison of predicted vs curated clusters - • integration with omics pipelines +By linking pathways to gene clusters through shared gene IRIs, PlantMetWiki enables: +- genome-to-metabolite reasoning +- discovery of candidate biosynthetic loci +- comparison of predicted vs curated clusters +- integration with omics pipelines This makes PlantMetWiki especially useful for: - • plant specialized metabolism research - • natural product discovery - • functional genomics - • comparative pathway analysis \ No newline at end of file +- plant specialised metabolism research +- natural product discovery +- functional genomics +- comparative pathway analysis diff --git a/_tutorial/4.FederatedQueries.md b/_tutorial/4.FederatedQueries.md index 0b73ceb..d1516c4 100644 --- a/_tutorial/4.FederatedQueries.md +++ b/_tutorial/4.FederatedQueries.md @@ -17,252 +17,307 @@ In this section, we show how to move beyond PlantMetWiki alone and place plant m **SPARQL endpoint** https://plantmetwiki.bioinformatics.nl/sparql -**Graph used in all queries** -```sparql -FROM -``` - ## What is a federated SPARQL query? -A federated query uses the SERVICE keyword to send part of the query to a remote SPARQL endpoint. +A federated query uses the `SERVICE` keyword to send part of the query to a remote SPARQL endpoint. Conceptually: - • PlantMetWiki provides pathway context - • External endpoints provide chemical, biological, or literature metadata - • SPARQL stitches them together - +- PlantMetWiki provides pathway context +- External endpoints provide chemical, biological, or literature metadata +- SPARQL stitches them together -``` +```sparql SERVICE { ... } ``` -Each SERVICE block is evaluated remotely, and the results are merged with the local query. +Each `SERVICE` block is evaluated remotely, and the results are merged with the local query. + +**Important:** always use `SERVICE ` for Wikidata federation. Other Wikidata SPARQL mirrors may have rate limits or produce unstable results. ## Why federate from PlantMetWiki? PlantMetWiki focuses on: - • pathways - • species - • biosynthesis - • gene clusters +- pathways +- species +- biosynthesis +- gene clusters It deliberately does not duplicate: - • chemical ontologies - • literature databases - • encyclopedic metadata +- chemical ontologies +- literature databases +- encyclopedic metadata Federation lets you: - • enrich pathways with chemical identifiers - • connect metabolites to publications - • reuse authoritative external resources +- enrich pathways with chemical identifiers +- connect metabolites to publications +- reuse authoritative external resources -⸻ +## How metabolite identifiers are stored in PlantMetWiki -## Example 1 — Sending metabolites to Wikidata +Before federating, it is important to know how InChIKeys are represented in `graph/pathways`. -Many PlantMetWiki pathways contain metabolites with identifiers that are also known to Wikidata. +InChIKeys on metabolite nodes use a **source/identifier pair**: -Using a federated query, we can: +```sparql +?metabolite dc:source "InChIKey" ; + dcterms:identifier ?inchikey . +``` - 1. extract metabolite identifiers from PlantMetWiki - 2. send them to Wikidata - 3. retrieve additional metadata +This is the correct pattern to extract InChIKeys. Do **not** use `FILTER(CONTAINS(STR(?p), "InChIKey"))` — that matches predicates by string, which is fragile and will not work reliably. -Example (from WikidataTest.rq): +The required prefixes: + +```sparql +PREFIX dc: +PREFIX dcterms: ``` -PREFIX gpml: -SELECT ?metabolite ?wikidataItem -FROM -WHERE { - ?pathway gpml:hasDataNode ?metabolite . +## Example 1 — Extracting metabolite InChIKeys from a pathway - SERVICE { - ?wikidataItem ?p ?metabolite . +Before federating to Wikidata, let us first verify that we can retrieve InChIKeys from PlantMetWiki locally. + +```sparql +PREFIX wp: +PREFIX dc: +PREFIX dcterms: + +SELECT DISTINCT ?metabolite ?inchikey +WHERE { + GRAPH { + ?pw a wp:Pathway . + FILTER(CONTAINS(STR(?pw), '/PC629_')) + + ?metabolite dcterms:isPartOf ?pw ; + a wp:Metabolite ; + dc:source "InChIKey" ; + dcterms:identifier ?inchikey . } } +ORDER BY ?inchikey LIMIT 100 ``` -This demonstrates the mechanism of federation, even before refining identifiers. +This returns InChIKeys for metabolites in the capsaicin biosynthesis pathway. -## Example 2 — Linking metabolites via InChIKeys +## Example 2 — Linking metabolites via InChIKeys to Wikidata Chemical identifiers such as InChIKeys provide a robust bridge between databases. PlantMetWiki → InChIKey → Wikidata → ChEBI -Example (from WikidataInChiKeys.rq): +```sparql +PREFIX wp: +PREFIX dc: +PREFIX dcterms: +PREFIX wdt: -``` -SELECT ?metabolite ?inchiKey ?wikidataItem -FROM +SELECT DISTINCT ?metabolite ?inchikey ?wikidataItem WHERE { - ?metabolite ?p ?inchiKey . - FILTER(CONTAINS(STR(?p), "InChIKey")) + GRAPH { + ?pw a wp:Pathway . + FILTER(CONTAINS(STR(?pw), '/PC629_')) + + ?metabolite dcterms:isPartOf ?pw ; + a wp:Metabolite ; + dc:source "InChIKey" ; + dcterms:identifier ?inchikey . + } SERVICE { - ?wikidataItem wdt:P235 ?inchiKey . + ?wikidataItem wdt:P235 ?inchikey . } } LIMIT 100 ``` -This pattern allows you to: +In Wikidata, `wdt:P235` is the InChIKey property. The SERVICE block sends the InChIKey values to Wikidata and retrieves the matching Wikidata items. - • unify chemical identities across resources - • avoid ambiguous names - • build reliable cross-database links +This pattern allows you to: -⸻ +- unify chemical identities across resources +- avoid ambiguous names +- build reliable cross-database links -## Example 3 — Federating to ChEBI +## Example 3 — Retrieving ChEBI IDs via Wikidata ChEBI is the authoritative ontology for chemical entities of biological interest. -Using InChIKeys or ChEBI IDs, you can retrieve: +We can extend the previous query to also retrieve ChEBI IDs via Wikidata: - • chemical classifications - • roles (e.g. alkaloid, glycoside) - • ontology relationships +```sparql +PREFIX wp: +PREFIX dc: +PREFIX dcterms: +PREFIX wdt: -Example (from FederatedMetabolitesChEBI.rq): -``` -SELECT ?metabolite ?chebi -FROM +SELECT DISTINCT ?metabolite ?inchikey ?wikidataItem ?chebiId WHERE { - ?metabolite ?p ?chebi . - FILTER(CONTAINS(STR(?chebi), "CHEBI")) + GRAPH { + ?pw a wp:Pathway . + FILTER(CONTAINS(STR(?pw), '/PC629_')) + + ?metabolite dcterms:isPartOf ?pw ; + a wp:Metabolite ; + dc:source "InChIKey" ; + dcterms:identifier ?inchikey . + } SERVICE { - ?chebiItem wdt:P683 ?chebi . + ?wikidataItem wdt:P235 ?inchikey . + OPTIONAL { ?wikidataItem wdt:P683 ?chebiId . } } } LIMIT 100 ``` -This enables ontology-aware pathway analysis without duplicating ChEBI locally. +`wdt:P683` is the ChEBI ID property in Wikidata. The `OPTIONAL` ensures that metabolites without a ChEBI ID are still returned. +This enables ontology-aware pathway analysis without duplicating ChEBI locally. ## Example 4 — Linking pathways to publications (PubMed) Many pathways and gene clusters are supported by literature evidence. -Using federated queries, you can: +We can retrieve PubMed IDs linked to pathway nodes in PlantMetWiki: - • extract PubMed IDs - • query Wikidata for article metadata - • retrieve titles, journals, and authors +```sparql +PREFIX dcterms: -Example (from ListPubMedIDs.rq): -``` SELECT DISTINCT ?pmid -FROM WHERE { - ?pathway ?p ?pmid . - FILTER(CONTAINS(STR(?pmid), "pubmed")) + GRAPH { + ?pw a . + FILTER(CONTAINS(STR(?pw), '/PC629_')) + + ?node dcterms:isPartOf ?pw . + ?node ?p ?pmid . + FILTER(CONTAINS(STR(?pmid), "pubmed")) + } } ``` -Extended with federation (from WikidataLookupByInChIKeys.rq): -``` -SERVICE { - ?article wdt:P698 ?pmid ; - rdfs:label ?title . - FILTER(LANG(?title) = "en") +Extended with federation to retrieve article titles: + +```sparql +PREFIX dcterms: +PREFIX rdfs: +PREFIX wdt: + +SELECT DISTINCT ?pmid ?title +WHERE { + GRAPH { + ?pw a . + FILTER(CONTAINS(STR(?pw), '/PC629_')) + + ?node dcterms:isPartOf ?pw . + ?node ?p ?pmid . + FILTER(CONTAINS(STR(?pmid), "pubmed")) + + BIND(STRAFTER(STR(?pmid), "pubmed/") AS ?pmidNum) + } + + SERVICE { + ?article wdt:P698 ?pmidNum ; + rdfs:label ?title . + FILTER(LANG(?title) = "en") + } } ``` This connects: - • pathway → metabolite → publication - • enabling traceable biological evidence - +- pathway → node → publication +- enabling traceable biological evidence ## Example 5 — Bidirectional federation Federation does not have to start from PlantMetWiki. -You can: +You can query Wikidata first, then match results against PlantMetWiki: - • query Wikidata first - • then match results against PlantMetWiki +```sparql +PREFIX wp: +PREFIX dc: +PREFIX dcterms: +PREFIX wdt: -Example (from SendInChiKeysToWikidata.rq): +SELECT DISTINCT ?wikidataItem ?inchikey ?metabolite ?pw +WHERE { + # Start from Wikidata: retrieve InChIKeys for compounds classified as capsaicinoids + SERVICE { + ?wikidataItem wdt:P31/wdt:P279* ; + wdt:P235 ?inchikey . + } -``` -SERVICE { - ?item wdt:P235 ?inchiKey . + # Match against PlantMetWiki + GRAPH { + ?metabolite dc:source "InChIKey" ; + dcterms:identifier ?inchikey ; + dcterms:isPartOf ?pw . + } } - -?metabolite ?p ?inchiKey . +LIMIT 100 ``` This pattern is useful when: - • starting from literature or chemical knowledge - • and asking whether PlantMetWiki contains related pathways +- starting from literature or chemical knowledge +- and asking whether PlantMetWiki contains related pathways -⸻ +## Practical considerations -Practical considerations +**Performance** -Performance +- Federated queries are slower than local queries +- Limit result sizes (`LIMIT`) +- Avoid unnecessary variables +- Push specific filters to the correct graph; do not retrieve large intermediate sets - • Federated queries are slower than local queries - • Limit result sizes (LIMIT) - • Avoid unnecessary variables +**Stability** -Stability - - • External endpoints may change - • Wikidata enforces rate limits - • Queries should be robust to partial results +- External endpoints may change or have downtime +- Wikidata enforces rate limits for automated queries +- Use `OPTIONAL` for external data that may not always be present ## Design philosophy PlantMetWiki intentionally stays lightweight: - • no chemical ontology duplication - • no literature mirroring - • no monolithic data model +- no chemical ontology duplication +- no literature mirroring +- no monolithic data model Federation keeps the ecosystem modular and sustainable. -⸻ - ## What you can do with federated queries By combining PlantMetWiki with external resources, you can: - • trace metabolites from genome → pathway → chemistry → literature - • enrich pathway analyses with ontology information - • integrate PlantMetWiki into larger knowledge graphs - • support FAIR, reusable, interoperable workflows - -⸻ +- trace metabolites from genome → pathway → chemistry → literature +- enrich pathway analyses with ontology information +- integrate PlantMetWiki into larger knowledge graphs +- support FAIR, reusable, interoperable workflows ## Summary Federated SPARQL queries allow PlantMetWiki to function as: - • a hub for plant metabolic pathways - • a connector between genomics, chemistry, and literature - • a first-class citizen of the Linked Open Data ecosystem +- a hub for plant metabolic pathways +- a connector between genomics, chemistry, and literature +- a first-class citizen of the Linked Open Data ecosystem This closes the loop from: genes → pathways → metabolites → publications → knowledge -| Tutorial section | Query file | -|-----------------|------------| -| Wikidata basics | `WikidataTest.rq` | -| InChIKey federation | `WikidataInChiKeys.rq` | -| ChEBI federation | `FederatedMetabolitesChEBI.rq` | -| PubMed links | `ListPubMedIDs.rq` | -| Reverse federation | `SendInChiKeysToWikidata.rq` | -| Advanced lookups | `WikidataLookupByInChIKeys.rq` | \ No newline at end of file +| Tutorial section | Key pattern | +|---|---| +| Local InChIKey extraction | `dc:source "InChIKey" ; dcterms:identifier ?inchikey` | +| InChIKey → Wikidata | `SERVICE wdt:P235 ?inchikey` | +| Wikidata → ChEBI | `wdt:P683 ?chebiId` | +| PubMed links | `FILTER(CONTAINS(STR(?pmid), "pubmed"))` | +| Reverse federation | Query Wikidata first, match to PlantMetWiki | diff --git a/_tutorial/Capsicum.md b/_tutorial/Capsicum.md new file mode 100644 index 0000000..2e03812 --- /dev/null +++ b/_tutorial/Capsicum.md @@ -0,0 +1,207 @@ +--- +layout: docs +title: "Resolving Biosynthetic Pathways Across Species" +order: 50 +--- + +# A multispecies example using capsaicin biosynthesis in Capsicum + +## Background + +Plant specialised metabolic pathways are often incompletely characterised in individual species. While a biosynthetic pathway may be experimentally resolved in one species, annotations in closely related species are frequently partial, missing reactions, enzymes, or regulatory steps. + +This fragmentation limits comparative analysis, pathway reconstruction, and hypothesis generation. + +Plant Metabolic Pathways Wiki (PlantMetWiki) addresses this challenge by modelling plant biosynthetic pathways as multispecies, linked open data objects, enabling cross-species integration of biochemical knowledge. + +In this tutorial, we demonstrate how PlantMetWiki can be used to resolve pathway annotations across related species by leveraging shared reactions, substrates, and products. + +## Research question + +How can **incomplete biosynthetic pathway annotations** in plant species be resolved by leveraging shared biochemical reactions and metabolites across related species using linked open data? + +We explore this question using the capsaicin biosynthesis pathway as a case study across *Capsicum* species. + +## Case study: capsaicin biosynthesis in Capsicum + +Capsaicin is a specialised metabolite responsible for pungency in chilli peppers (*Capsicum* spp.). While capsaicin biosynthesis is well studied in some species (e.g. *Capsicum annuum*), pathway annotations across the genus are uneven. + +PlantMetWiki models capsaicin biosynthesis as pathway **PC629** (PlantCyc stable ID: **PWY-5710**). This pathway can be associated with multiple *Capsicum* species, allowing comparative inspection. + +## Step 1 — Identify species associated with the capsaicin biosynthesis pathway + +We start by asking: + +> Which plant species are associated with the capsaicin biosynthesis pathway in PlantMetWiki? + +In PlantMetWiki, species are stored at **data-node level** (not on the pathway node itself). We therefore join three named graphs: +1. `graph/pathways` — to find data nodes that belong to the capsaicin pathway +2. `graph/gpml-taxonomy-extra` — to get the taxon IRI for each data node +3. `graph/ncbitaxon` — to get a readable species name from the taxon IRI + +```sparql +PREFIX wp: +PREFIX dcterms: +PREFIX dc: +PREFIX rdfs: +PREFIX ncbi: + +SELECT DISTINCT ?species ?taxon +WHERE { + GRAPH { + ?node dcterms:isPartOf ?pw . + FILTER(CONTAINS(STR(?pw), '/PC629_')) + } + GRAPH { + ?node wp:organism ?taxon . + FILTER(?taxon != ncbi:33090) + } + GRAPH { + ?taxon rdfs:label ?species . + } +} +ORDER BY ?species +``` + +Run the query in PlantMetWiki. + +## Step 2 — Interpret the results + +The query returns *Capsicum* species associated with the capsaicin biosynthesis pathway, for example: + +- *Capsicum annuum* +- *Capsicum chinense* +- *Capsicum frutescens* +- Genus-level *Capsicum* annotations + +All are linked to the same pathway, but with different NCBI Taxon identifiers reflecting species- or clade-level annotations. + +The `FILTER(?taxon != ncbi:33090)` line excludes the *Viridiplantae* (NCBI:33090) placeholder, which is used as a pathway-level default and does not represent a real species annotation. + +## Key observation + +> The same biosynthetic pathway is associated with multiple related species, even though species-specific pathway annotations differ in completeness. + +This reflects a core design principle of PlantMetWiki: + +- pathways are modelled independently of species +- species associations can be partial or evolving + +## Step 3 — Look up the pathway using its stable PlantCyc ID + +PlantMetWiki also stores the stable **PlantCyc PWY ID** in a dedicated graph (`graph/gpml-properties-extra`). This lets you find the pathway even if its internal version ID changes: + +```sparql +PREFIX wp: +PREFIX dcterms: +PREFIX dc: + +SELECT ?pw ?title +WHERE { + GRAPH { + ?pw dcterms:identifier "PWY-5710" . + } + GRAPH { + ?pw dc:title ?title . + } +} +``` + +## Step 4 — Which reactions are covered by which Capsicum species? + +We can now ask which individual reactions within the capsaicin pathway are annotated for each *Capsicum* species. This reveals where coverage is complete and where gaps remain. + +```sparql +PREFIX wp: +PREFIX dcterms: +PREFIX rdfs: +PREFIX ncbi: + +SELECT DISTINCT ?species ?reactionId +WHERE { + GRAPH { + ?pw a wp:Pathway . + FILTER(CONTAINS(STR(?pw), '/PC629_')) + + ?rxn dcterms:isPartOf ?pw ; + a wp:Conversion . + FILTER(!CONTAINS(STR(?rxn), "_anchor_")) + + BIND(REPLACE(STRAFTER(STR(?rxn), "/Interaction/"), "_", "-") AS ?reactionId) + + # Find enzymes catalysing this reaction + ?catalysis a wp:Catalysis ; + dcterms:isPartOf ?pw ; + wp:source ?enzyme ; + wp:target ?rxn . + } + GRAPH { + ?enzyme wp:organism ?taxon . + FILTER(?taxon != ncbi:33090) + } + GRAPH { + ?taxon rdfs:label ?species . + } + FILTER(CONTAINS(?species, "Capsicum")) +} +ORDER BY ?species ?reactionId +``` + +This query connects reactions to species via the enzyme nodes: a reaction is "covered" by a species if at least one enzyme catalysing that reaction is annotated for that species. + +## Step 5 — Resolving pathways across species + +The presence of a pathway annotation does not imply that: + +- all reactions are experimentally validated in every species +- all enzymes or genes are known for each species + +Instead, PlantMetWiki enables cross-species inference: + +If a reaction, substrate, or product is known in one *Capsicum* species, it can serve as a hypothesis for unresolved steps in another closely related species. + +This is particularly powerful for: + +- specialised metabolism +- lineage-specific pathways +- species with limited experimental characterisation + +## Step 6 — Generating hypotheses using shared pathway structure + +Using PlantMetWiki, researchers can now ask follow-up questions such as: +- Which reactions are shared across *Capsicum* species? +- Which enzymes are present in one species but missing in another? +- Are missing steps supported by shared substrates or products? +- Do predicted biosynthetic gene clusters (from plantiSMASH) overlap with these pathways? + +Because all information is represented as linked open data, these questions can be answered by extending the queries above or combining them with: +- gene annotations +- biosynthetic gene cluster predictions (Tutorial 3) +- metabolite identifiers +- external resources (e.g. Wikidata, LOTUS) (Tutorial 4) + +## Takeaway + +This example illustrates how PlantMetWiki supports hypothesis-driven pathway reconstruction: + +Incompletely annotated biosynthetic pathways in one plant species can be resolved by leveraging biochemical knowledge from related species that share pathway structure and metabolites. + +Rather than treating missing annotations as gaps, PlantMetWiki enables researchers to reason across species boundaries using shared biochemical context. + +In this tutorial, we showed how PlantMetWiki can be used to: + +- Query multispecies pathway annotations using the correct multi-graph pattern +- Identify related species sharing a biosynthetic pathway via data-node–level taxon annotations +- Use stable PlantCyc IDs (PWY-5710) to locate pathways robustly +- Cross-tabulate reaction coverage by species to identify annotation gaps +- Generate hypotheses for resolving missing pathway steps + +This multispecies, linked-data approach is central to advancing the discovery and characterisation of plant specialised metabolism. + +## Summary of queries in this tutorial + +| Query | Graphs used | +|---|---| +| Species in capsaicin pathway | pathways + gpml-taxonomy-extra + ncbitaxon | +| Lookup by stable PWY ID | gpml-properties-extra + pathways | +| Reaction coverage by species | pathways + gpml-taxonomy-extra + ncbitaxon | diff --git a/_tutorial/Castoroil.md b/_tutorial/Castoroil.md new file mode 100755 index 0000000..fd8a969 --- /dev/null +++ b/_tutorial/Castoroil.md @@ -0,0 +1,195 @@ +--- +layout: docs +title: "Diving into Natural Products" +order: 60 +--- + +## A molecule-centric example using castor oil components + +Natural products research often starts from the molecule, not from the pathway. + +For many compounds of industrial, nutritional, or toxicological relevance, researchers want to understand: + + • Which plants produce this compound? + • In which biosynthetic pathways does it occur? + • What biochemical context surrounds its production? + • What chemical knowledge already exists about it? + +However, this information is typically fragmented across: + + • pathway databases, + • organism-specific studies, + • chemistry resources, + • and the scientific literature. + +Plant Metabolic Pathways Wiki (PlantMetWiki) addresses this fragmentation by modeling plant metabolism as linked open data, enabling researchers to start from a molecule and traverse seamlessly across pathways, species, and external chemical knowledge bases. + +In this tutorial, we demonstrate a molecule-centric workflow using components of castor oil as a case study. + +## Research question + +> How can plant biosynthetic pathways and producing species be identified starting from natural product molecules, and how can this knowledge be enriched with external chemical information using linked open data? + +This directly reflects the PlantMetWiki goal of connecting biochemistry, biosynthesis, and chemistry. + +## Case study: natural products in castor oil + +Castor oil, derived primarily from Ricinus communis, contains a mixture of fatty acids and specialized metabolites with important industrial applications. + +Rather than starting from a known pathway, we begin from specific molecules of interest, identified by their InChIKeys, and ask: + +> Where do these molecules occur in plant metabolism, and what is known about them? + +## Step 1 — Identify pathways and species associated with molecules of interest + +We first ask: + +Which plant pathways and species contain specific natural product molecules related to castor oil? + +SPARQL query +```sparql +PREFIX dc: +PREFIX dcterms: +PREFIX rdf: +PREFIX rdfs: +PREFIX wp: + +SELECT DISTINCT ?title + (GROUP_CONCAT(DISTINCT ?species; separator=", ") AS ?Species) + ?inchikey ?wd ?wdLabel +FROM +WHERE { + ?metabolite a wp:Metabolite ; + dcterms:isPartOf ?pw ; + dc:source "InChIKey" ; + dcterms:identifier ?inchikey . + + FILTER(?inchikey IN ( + "BGWGXPAPYGQALX-ARQDHWQXSA-L", + "CZMRCDWAGMRECN-UGDNZRGBSA-N", + "ASKKPQKSCFYPPP-FVLDFCIYSA-J" + )) + + ?pw dc:title ?title ; + wp:organismName ?species . + + SERVICE { + ?wd ?inchikey . + OPTIONAL { + ?wd rdfs:label ?wdLabel . + FILTER(LANG(?wdLabel) = "en") + } + } +} +ORDER BY ?wd +``` + +## Step 2 — Interpret the results + +This query returns: + • Pathways in which the selected molecules occur + • Plant species associated with those pathways + • Chemical identifiers and labels retrieved from Wikidata + +Key observation + +Starting from only chemical identifiers (InChIKeys), PlantMetWiki enables the identification of plant pathways and species involved in the biosynthesis or utilization of these molecules. + +This demonstrates the reverse traversal of classical pathway analysis: + • molecule → pathway → species + + +## Step 3 — Linking molecules to broader biochemical context + +Because metabolites in PlantMetWiki are part of explicitly modeled pathways, we can now place individual molecules into a biochemical and biological context, including: + + • upstream and downstream reactions, + • shared substrates and products, + • related metabolites across pathways. + +This allows researchers to move beyond isolated compound lists and reason about biosynthetic logic. + +## Step 4 — Enriching natural products with external chemical knowledge + +PlantMetWiki supports federated SPARQL queries, enabling live integration with external resources such as Wikidata. + +This allows us to retrieve additional chemical annotations (e.g. ingredient classifications, identifiers) without duplicating data. + +Example: linking metabolites to Wikidata ingredient information + +```sparql +PREFIX dc: +PREFIX dcterms: +PREFIX rdf: +PREFIX rdfs: +PREFIX wp: + +SELECT ?pwID + (GROUP_CONCAT(DISTINCT ?species; separator=", ") AS ?Species) + ?name ?wd ?ingredientLabel +FROM +WHERE { + ?metabolite a wp:Metabolite ; + rdfs:label ?name ; + dcterms:isPartOf ?pw ; + dc:source "InChIKey" ; + dcterms:identifier ?inchikey . + + FILTER(?name IN ( + "caffeine", + "theobromine", + "xanthine", + "7-methylxanthine" + )) + + ?pw a wp:Pathway ; + dc:identifier ?pwID ; + wp:organismName ?species . + + SERVICE { + ?wd ?inchikey . + OPTIONAL { + ?wd ?ingredient . + ?ingredient rdfs:label ?ingredientLabel . + FILTER(LANG(?ingredientLabel) = "en") + } + } +} +ORDER BY ?name +``` + +## Step 5 — From molecules to hypotheses + +This molecule-centric approach enables new research questions, such as: + + • Which plant species produce chemically similar compounds? + • Are related molecules produced via shared or divergent pathways? + • Can missing biosynthetic steps be inferred from chemically related compounds in other species? + • How do chemical classifications align with biosynthetic pathway structure? + +Because PlantMetWiki integrates biosynthesis, species, and chemistry as linked data, these questions can be addressed programmatically. + +## Takeaways + +This example illustrates how PlantMetWiki supports natural product-driven hypothesis generation: + +By starting from molecular identifiers, researchers can traverse plant metabolic knowledge across pathways, species, and external chemical databases, enabling integrative analysis of biosynthesis and chemistry. + +This workflow is particularly powerful for: + + • natural products discovery, + • food and ingredient research, + • toxicology, + • comparative metabolomics. + + +## Summary + +In this tutorial, we demonstrated how PlantMetWiki can be used to: + + • Start from natural product molecules + • Identify associated pathways and producing species + • Integrate biosynthetic context with chemical knowledge + • Enrich results via federated queries to Wikidata + +Together with pathway-centric analyses, this molecule-centric perspective highlights the flexibility and power of PlantMetWiki as a linked open data platform for plant metabolism. \ No newline at end of file diff --git a/_tutorial/Theobromine.md b/_tutorial/Theobromine.md new file mode 100644 index 0000000..1fe1a44 --- /dev/null +++ b/_tutorial/Theobromine.md @@ -0,0 +1,452 @@ +--- +layout: docs +title: "Theobromine and Federated queries" +order: 70 +--- + +## From Chemistry to Biosynthesis: Exploring Theobromine with PlantMetWiki + +Plant specialized metabolites are often chemically well known across many organisms, while their biosynthesis is only resolved in a handful of species. + +In this tutorial, we explore theobromine, a purine alkaloid best known from cocoa and tea, to show how PlantMetWiki connects biosynthetic knowledge with chemical knowledge using federated queries. + +We will combine: PlantMetWiki (biosynthetic pathways, genes, enzymes from curated data from PlantCyc/PMN) and Wikidata (chemical properties, uses, species distribution). + + +For many compounds of industrial, nutritional, or toxicological relevance, researchers want to understand: + + • Which plants produce this compound? + • In which biosynthetic pathways does it occur? + • What biochemical context surrounds its production? + • What chemical knowledge already exists about it? + +However, this information is typically fragmented across: + + • pathway databases, + • organism-specific studies, + • chemistry resources, + • and the scientific literature. + +Plant Metabolic Pathways Wiki (PlantMetWiki) addresses this fragmentation by modeling plant metabolism as linked open data, enabling researchers to start from a molecule and traverse seamlessly across pathways, species, and external chemical knowledge bases. + +In this tutorial, we demonstrate a molecule-centric workflow using components of theobromine as a case study. + + +## Research question + +> How can plant biosynthetic pathways and producing species be identified starting from natural product molecules, and how can this knowledge be enriched with external chemical information using linked open data? + +This directly reflects the PlantMetWiki goal of connecting biochemistry, biosynthesis, and chemistry. + +# Example application : Breeding for naturally sweet (and Dog-safe!) chocolate! + +Theobromine is one of the key alkaloids that give chocolate its characteristic bitterness and stimulant properties. But it’s also the main reason chocolate is toxic to dogs, who metabolize it much more slowly than humans. + +Without theobromine, chocolate becomes naturally sweeter and safe for dogs! By tweaking theobromine synthesis with plant engineering we could breed cacao varieties that keep the nice flavor profile, but reduce theobromine to levels for sweet dog-safe cacao. + +Here we show how PlantMetWiki can support integrating information from toxicology, chemistry, and biosynthesis to identify breeding targets for reduced theobromine content. + + +## What is the InChIKey for theobromine? + +First, let's get the InChIKey for theobromine which uniquely identifies theobromine as a compound and can be used for follow up federated queries with other databases. + +[SPARQL query](https://bit.ly/3O3PeKF) + +## Chemistry coverage: In how many species is theobromine found? + +Use the InChIKey you got in the previous query to query Wikidata to find the taxa and species where theobromine is found. + +[SPARQL query](https://bit.ly/4k5iDAq) + +What are the taxa and species names that have theobromine? + +[SPARQL query](https://edu.nl/uaff4) + +## Biosynthesis coverage: how many PlantMetWiki species have a pathway containing theobromine + +In how many species is the pathway for theobromine been experimentally characterised? + +[SPARQL query](https://bit.ly/49WS6R1) + +We see that even if theobromine is chemically known to be present in 38 species, its pathway is only known in 7 species. + +> We see a gap between chemical and biosynthetic characterization of theobromine across species. This shows that PlantMetWiki can help link biosynthesis to biochemistry to solve gaps in knowledge about plant metabolism. + +What are the PlantCyc pathways and species in PlantWiki that contain theobromine? + +[SPARQL query](https://bit.ly/4pZ8p5W) + +## Industrial/drug identifiers DrugBank, ChEMBL, ChEBI, PubChem from Wikidata : anchors in the chemical universe + +Now, we use the lookup of the theobromine InChIkey on Wikidata to get the identifiers from chemical and drug databases for theobromine. + +[SPARQL query](https://edu.nl/3p6uc) + +This shows how it’s a well-characterized small molecule. Gives you canonical IDs to link to toxicity databases (DSSTox) and cheminformatics tools, if you want to simulate analogues or structure–activity relationships. + +> These identifiers let us connect theobromine to toxicology dashboards (DSSTox/CompTox), regulatory databases, and medicinal chemistry resources. + +In our breeding example application, thanks to these databases, we can quantify how much theobromine is too much for dogs and humans. + +Once we have these identifiers, theobromine stops being “just a node in Wikidata” and becomes a portal into many different data worlds. Each ID suggests a different line of investigation: + +1. Toxicology and safety: how dangerous is it, and for whom? + + Use the PubChem and ChEBI IDs to jump into: + + • LD₅₀ data + • reported adverse effects + • species-specific toxicity reports + • Follow the DSSTox/CompTox links (via IDs we get in a later query) to: + • compare dog vs human sensitivity + • identify safe exposure ranges + + In the breeding story, this tells us what target concentration we need to stay below in cacao beans to meaningfully reduce risk for dogs. + +2. Pharmacology and mechanism: what does theobromine actually do? + + Use the DrugBank and ChEMBL IDs to: + + • see known targets (receptors, enzymes) + • collect assay data (IC₅₀, EC₅₀, Ki, etc.) + • check which indications (diseases/conditions) it has been studied for. + + This helps explain the “subject has role” annotations we saw (vasodilator, bronchodilator…) and shows which biological pathways might be perturbed if we strongly decrease theobromine in plants. + +3. Chemical neighbourhood: what are the “cousins” of theobromine? + + With ChEBI, KEGG, HMDB, PubChem: + + • find structurally related methylxanthines (caffeine, paraxanthine, 7-methylxanthine, etc.) + • inspect which ones are less bitter or less toxic, but still contribute desirable flavor or physiological effects. + • This opens a design question: + + Can we push flux away from theobromine and towards a safer, less bitter analogue? + +4. Link back to biosynthesis: which genes control its levels in plants? + + Once we know which derivatives exist, we can: + • use PlantMetWiki to find reactions that produce or consume theobromine + • list the genes and enzymes responsible + • compare them across species that accumulate different methylxanthine profiles. + + In the breeding scenario, these genes become markers in genomic selection and candidates for gene editing to tweak methylxanthine balance. + +5. Literature and evidence base: what do recent papers say? + + Using these IDs (especially PubChem, ChEBI, DrugBank), we can: + + • query PubMed or Europe PMC for recent works mentioning theobromine + • filter by topics like toxicity, metabolism in dogs, flavor chemistry, plant breeding. + + This lets us validate which of the hypotheses from our graph exploration are already tested, and which remain open research questions. + + +## Toxicity profile of theobromine : is theobromine a toxic compound? + +> Is theobromine registered as a toxic substance? These links let us inspect detailed toxicity data (e.g. species-specific LD₅₀). + +Use your DSSTox federated query: DSSTox substance and compound IDs → link to EPA CompTox dashboard. CompTox then provides LD₅₀, NOAELs, species sensitivity (you don’t have to query those via SPARQL; just note that you can click through). + +We want to show: + 1. how to retrieve the DrugBank ID for theobromine from Wikidata (P715)  + 2. how to build a clickable URL to DrugBank + 3. a concise description we can quote in the text (we’ll reuse the Wikidata “description” field as a neutral summary) + +[SPARQL query](https://edu.nl/pq98w) + +If we click for instance on the [DRUGbank ID url](https://go.drugbank.com/drugs/DB01412) we can see more information about theobromine. + +By clicking on the [DSSTox / CompTox url](https://comptox.epa.gov/dashboard/chemical/details/DTXSID9026132) from the result table and explore the acute toxicity endpoints (LD₅₀), species sensitivity, and reported effects. Based on these values, we can define a rough ‘safe upper bound’ for theobromine exposure in dogs, which we will later map onto plausible cacao bean concentrations. + +> By following the DSSTox IDs, we can pull toxicological data indicating the dose ranges at which theobromine is harmful in different species. Dogs are particularly sensitive. + +For our breeding program, this tells us what target concentration range cacao beans should stay below to be considered “pet-safer” while still palatable for humans. + +## Which medical conditions are caused by theobromine? + +we can ask Wikidata which medical conditions are explicitly annotated as being caused by theobromine (property has cause = P828). Our federated query returns the item theobromine poisoning (Q1550819), described as an “overdose reaction to the xanthine alkaloid theobromine” and classified as a subclass of poisoning. This anchors the biochemical story in a concrete toxicological outcome and justifies why lowering theobromine in cacao is not only a flavour choice, but also a relevant safety consideration—especially for dogs. + +[SPARQL query](https://edu.nl/3debg) + +## Pharmacological role of theobromine + +How is theobromine used and what pharmacological roles does it play? + +[SPARQL query](https://edu.nl/fe9ry) + +WikiData annotates theobromine with roles such as vasodilator, bronchodilator, nootropic, and with uses such as medication. + +So when we try to reduce theobromine in cacao, we are perturbing a molecule that’s important both ecologically and pharmacologically. + +Even though we encounter theobromine mostly as “the bitter part of chocolate”, Wikidata reminds us that it is a bona fide drug-like compound, with established roles as bronchodilator and vasodilator. Any attempt to breed cacao with much lower theobromine is therefore not just a flavour tweak, but a change to the pharmacological profile of chocolate. + +## Is theobromine used in any drug products? + +We showed that theobromine has roles in human medicine. Is it present as an active principle in any drug? + +In Wikidata, which medications or drug products list theobromine as an active ingredient or have it as has use = medication? + +[SPARQL query](https://edu.nl/g6qjb) + +Theobromine is a pharmacologically active compound with use = medication.Chocolate is a food that contains this active compound – not modelled as a medication itself. + +> "Let the food be thy medicine and the medicine be thy food" ~ Hippocrates + + +## Recent publications about theobromine (via Wikidata + PubMed IDs) + +Now we can research what are the most recent articles whose main subject is theobromine, and for which a PubMed ID is known. + +[SPARQL query](https://edu.nl/g9mf6) + +This gives you titles + PubMed IDs, which you can turn into URLs like +https://pubmed.ncbi.nlm.nih.gov// + +This is a nice example of “semantic pivot”: from **compound → article metadata → PubMed. + +## Products and link to LOTUS : Is theobromine a precursor of other natural products? + +We can make sure that theobromine is not a precursor of important natural products that are important qualities in cacao. + +First, we run a query to see all of the otehr metabolites taht are present in the theobromine pathwyas, and we find their Wikidata entry. + +We can also ask the query if PlantMetWiki and Wikidata represent the same organism as LOTUS/Wikidata. We represent this information in the column `sameLotusOrganism`. + +[SPARQL query](https://edu.nl/6v7yw) + +> Linking biosynthetic and chemical information from PlantMetWiki to Wikidata with Federated queries allows to see what compounds are known to PLantMetWiki and in which species and which are known to LOTUS/Wikidata. + +We can also explicitly check which are the taxa not matching, for instance to represent them in an image: + +[SPARQL query](https://edu.nl/c897b) + +In PlantMetWiki, theobromine is described as a direct biosynthetic precursor of caffeine in the methylxanthine pathway. + +> This is a nice example of a gap that PlantMetWiki could fill: despite caffeine and theobromine are biosynthetically linked, this precursor–product relation is not yet represented as an explicit triple in Wikidata or LOTUS. + +So by following the reaction “theobromine → caffeine” in PlantMetWiki and linking it out to +Wikidata/LOTUS, we can argue that selecting for *theobromine-reduced* cacao could +simultaneously give us **caffeine-reduced chocolate** — attractive both for pet safety +and for caffeine-sensitive consumers. + +## Finding theobromine precursors : Immediate substrates for reactions producing theobromine (who feeds into theobromine?) + +What are the substrates for theobromine production, and what is their InChiKey? + +[SPARQL query](https://bit.ly/45ye9Mt) + +Here we ask: **what are the direct substrates of reactions that produce theobromine**, in which species, and what are their InChIKeys? + +The query above scans all PlantMetWiki pathways that contain a metabolite labelled +“theobromine”, then finds reactions where: + +- `wp:target` = theobromine +- `wp:source` = its immediate precursor(s) + +and reports: + +- the **pathway ID** (`?pwID`) +- the **species** (`?species`) +- the **PlantCyc reaction ID** (`?rxnId`) +- the **precursor label** (`?precursorLabel`) +- the **precursor InChIKey** (`?precursorInChIKey`) + +[SPARQL query](https://edu.nl/jntax) + +For example, we see that: + +- in *Camellia irrawadiensis* and *Camellia ptilophylla*, + the reaction `RXN-7598` converts **7-methylxanthine** + (InChIKey `PFWLFWPASULGAN-UHFFFAOYSA-N`) + into **theobromine**. + +- in *Camellia ptilophylla*, + the reaction `RXN-7603` converts **3-methylxanthine** + (InChIKey `GMSNIKWWOQHZGF-UHFFFAOYSA-N`) + into **theobromine**. + +Together with the “theobromine → caffeine” step, this reveals the familiar +*methylxanthine ladder*: + +> xanthine → 3- or 7-methylxanthine → **theobromine** → caffeine + +In other words, PlantMetWiki lets us enumerate the **immediate precursors** of +theobromine as concrete chemical entities (with InChIKeys), not just generic +“methylated xanthines”. + +## Wikidata molecular function for theobromine: Does it match with PlantMetWiki/PMN knowledge? + +So far, we've looked at specific enzymes in cacao that convert theobromine to caffeine. +Wikidata also captures this as a **generic molecular function**: + +> *theobromine:S-adenosyl-L-methionine 1-N-methyltransferase activity* +> described as +> “Catalysis of the reaction: theobromine + S-adenosyl-L-methionine <=> H⁺ + caffeine + S-adenosyl-L-homocysteine” + +Our federated query to Wikidata retrieves this molecular function item (Q27124976), +annotated as: + +- **instance of**: molecular function +- **subclass of**: methyltransferase activity + +This cleanly summarizes what our pathway-level analysis already suggested: +the key step that *consumes* theobromine is a **SAM-dependent N-methyltransferase** +that produces caffeine. + +[SPARQL query](https://edu.nl/rg3cb) + +This gives us two complementary views: + +>PlantMetWiki tells us **which concrete genes** in cacao and related species + perform this function. + +>Wikidata’s molecular function term captures the **abstract reaction**, which + we can reuse across species, ontologies, and functional annotation tools. + +## Enzymes synthetizing and consuming theobromine : identify genetic "knobs" you can turn + +Chemistry and toxicology tell us why we care about theobromine. +PlantMetWiki tells us how plants make it: which pathways, enzymes, and genes are involved in its biosynthesis in cacao and related species. + +This query: + + 1. Looks for theobromine in Theobroma cacao pathways. + 2. Finds reactions that produce or consume theobromine. + 3. Gets the enzymes/genes catalysing those reactions. + 4. Checks all other pathways anywhere in PlantMetWiki where the same enzyme participates, so you can spot possible “off-target” effects. + +[SPARQL query](https://edu.nl/dfrda) + + +Theobromine sits in the methylxanthine pathway, with steps like: xanthosine → 7-methylxanthine → theobromine → caffeine + +PlantMetWiki’s pathway view + gene annotations show: the N-methyltransferases that carry out those steps and which steps are shared vs unique. + +Here’s where PlantMetWiki’s gene/enzyme info shines. + +Use your local queries to: + + 1. List all enzymes that produce theobromine (reactions with wp:target ?theobromine). + 2. List all enzymes that consume theobromine (reactions with wp:source ?theobromine). + 3. For each enzyme: retrieve gene identifiers, EC numbers, + +In cacao, we find a small set of methyltransferase genes that eitehr take theobromine from 7-methylxanthine or onvert theobromine onwards to caffeine. + +These genes are our breeding knobs: + + • down-regulate or knock out theobromine-forming enzymes + • up-regulate enzymes that convert theobromine further to other methylxanthines + • or redirect flux into less bitter, less toxic analogues. + +This might lower flux into theobromine and possibly increase other flavor components (polyphenols, sugars, aroma volatiles) that are not toxic to dogs. + +The `otherPathways` column is especially important for breeding or engineering: +if it is empty, the enzyme appears only in the theobromine/caffeine pathway; +if it contains additional pathway IDs, the same enzyme also participates in +other parts of plant metabolism. + +This allows us to distinguish: + +- **“clean” knobs** – enzymes specific to methylxanthine biosynthesis, and +- **“pleiotropic” knobs** – enzymes that also act elsewhere, where editing them + might have broader effects on plant physiology. + +In the context of dog-safer, caffeine-reduced chocolate, the ideal targets are +enzymes that: + +1. **produce theobromine** in cacao, +2. have few or no roles in other pathways, and +3. sit between upstream precursors and theobromine → caffeine step. + +Those genes are our best candidates for lowering theobromine (and likely +caffeine) in cacao beans while minimizing unintended changes in other +metabolic networks. + +## What is the SMILES string from theobromine? + +Now you want to draw theobromine in Chemdraw or any chemical sketiching tool. To do that you query PlantMetWiki to find the SMILES of theobromine: paste the SMILES on [PubChem Sketcher](https://pubchem.ncbi.nlm.nih.gov/edit2/index.html) to see the compound structure. + +[SPARQL query](https://edu.nl/r4e8m) + +# Follow-up : A potential breeding strategy supported by PlantMetWiki + +To carry out a successful breeding strategy one could for instance use species diversity as a natural experiment: you could use the species from PlantMetWiki where theobromine is found to study identify allelic variants or expression patterns associated with lower theobromine, starting from the species where fully annotated pathways are found. + +Using PlantMetWiki’s information and PlantCyc gene annotations, we can: + + • pick methylxanthine pathway genes as marker candidates for breeding + • search for natural variants associated with lower theobromine + • or design plant engineering or gene editing targets for fine-tuning flux through the pathway. + +That’s a perfect “breeding strategy” hook: borrow nature’s existing variation. + +Can use ortholog inference algorithms, such as OrthoFinder, SonicParanoidOrthoMCL, or larger databases like eggNOG / Ensembl Compara if they already contain your species. + +# Takeaways + +This investigation strategy of theobromine via PlantMetWiki identifies: + + • Pathways in which the selected molecules occur + • Plant species associated with those pathways + • Chemical identifiers and labels retrieved from Wikidata + +> Starting from only chemical identifiers (InChIKeys), PlantMetWiki enables the identification of plant pathways and species involved in the biosynthesis or utilization of these molecules. + +This demonstrates the reverse traversal of classical pathway analysis: molecule → pathway → species + + +## Linking molecules to broader biochemical context + +Because metabolites in PlantMetWiki are part of explicitly modeled pathways, we can now place individual molecules into a biochemical and biological context, including: + + • upstream and downstream reactions, + • shared substrates and products, + • related metabolites across pathways. + +This allows researchers to move beyond isolated compound lists and reason about biosynthetic logic. + +## Enriching natural products with external chemical knowledge + +PlantMetWiki supports federated SPARQL queries, enabling live integration with external resources such as Wikidata. + +This allows us to retrieve additional chemical annotations (e.g. ingredient classifications, identifiers) without duplicating data. + +Example: linking metabolites to Wikidata ingredient information + + +## From molecules to hypotheses + +This molecule-centric approach enables new research questions, such as: + + • Which plant species produce chemically similar compounds? + • Are related molecules produced via shared or divergent pathways? + • Can missing biosynthetic steps be inferred from chemically related compounds in other species? + • How do chemical classifications align with biosynthetic pathway structure? + +Because PlantMetWiki integrates biosynthesis, species, and chemistry as linked data, these questions can be addressed programmatically. + +## Takeaways + +This example illustrates how PlantMetWiki supports natural product-driven hypothesis generation: + +By starting from molecular identifiers, researchers can traverse plant metabolic knowledge across pathways, species, and external chemical databases, enabling integrative analysis of biosynthesis and chemistry. + + +In this tutorial, we demonstrated how PlantMetWiki can be used to: + + • Start from natural product molecules + • Identify associated pathways and producing species + • Integrate biosynthetic context with chemical knowledge + • Enrich results via federated queries to Wikidata + +This workflow is particularly powerful for: + + • natural products discovery, + • food and ingredient research, + • toxicology, + • comparative metabolomics. + +Together with pathway-centric analyses, this molecule-centric perspective highlights the flexibility and power of PlantMetWiki as a linked open data platform for plant metabolism. + diff --git a/_tutorial/_archivedpages/WikidataQueries.md b/_tutorial/_archivedpages/WikidataQueries.md index a41321a..a8a9e03 100644 --- a/_tutorial/_archivedpages/WikidataQueries.md +++ b/_tutorial/_archivedpages/WikidataQueries.md @@ -1,10 +1,6 @@ --- layout: docs title: "A more complicated query on Wikidata" -prev: "/Assignments/assignment2A/" -prev_title: "Previous page" -next: "/Assignments/assignment2A/" -next_title: "Next page" --- diff --git a/index.md b/index.md index ef91b33..44cf3d5 100644 --- a/index.md +++ b/index.md @@ -29,7 +29,7 @@ Follow the steps below to execute a pre-written query: 4: You can **select your own** list of example queries from github, by adding the link and click the **refresh button**.

- New Snorql Interface + New Snorql Interface

* Update your SPARQL query from [this template]({{ "/ParticipantQueries/Example1/" | relative_url }}) @@ -41,13 +41,37 @@ Output data is available for download in native RDF format (.ttl), TSV, CSV, and ## Use Cases --------- -### 1. Diving into Natural Products : and example from castor oil ---------- +PlatMetWiki supports generating insights and hypotheses from plant metabolism to other research areas, including biomarker discovery, toxicology, precision nutrition, and forensic (wildlife) sciences. +Some examples include: + +### 1. Resolving pathways across species: an example in *Capsicum* + +**Focus:** Multispecies pathway modeling and cross-species inference + +Incomplete pathway annotations are common in plant metabolism. This tutorial shows how PlantMetWiki can be used to compare pathway information across related species and leverage shared reactions, substrates, and products to resolve missing biosynthetic steps. + +**Research question:** +*If a reaction or enzyme is present in* *Capsicum annuum* *but missing in* *Capsicum frutescens*, *can its presence be inferred based on shared pathway context across species?* + +👉 **[Read the full tutorial →](Assignments/capsicum)** + +--- + +### 2. Diving into natural products: an example from castor oil + +**Focus:** Molecule-centric exploration of biosynthesis and chemistry + +Natural product research often starts from a molecule rather than a pathway. This tutorial demonstrates how PlantMetWiki can be used to identify the plant pathways and species associated with specific natural product molecules, and how this information can be enriched with external chemical knowledge using federated queries. + +**Research question:** +*Which plant species and biosynthetic pathways are associated with natural product molecules found in castor oil, and how can their biochemical context be explored using linked open data?* + +👉 **[Read the full tutorial on Castor oil →](Assignments/castoroil)** + +👉 **[Read the full tutorial on Theobromine →](Assignments/theobromine)** -### 2. Resolving Pathways across Species : an example in Capsicum ---------- ## Tutorial Pages : the SPARQL PlantMetWiki Explorer @@ -62,6 +86,8 @@ Output data is available for download in native RDF format (.ttl), TSV, CSV, and ## Resources --------- +* [Using SPARQL to query Life Science Databases](https://bigcat-um.github.io/PRA3006-SPARQL/) + * [Introduction to RDF and SPARQL](/Presentation_introRDF.pdf) by BiGCaT Maastricht University * Wikipathway ontology [The WikiPathways WP Ontology](https://vocabularies.wikipathways.org/) @@ -70,6 +96,8 @@ Output data is available for download in native RDF format (.ttl), TSV, CSV, and * [The WikiPathways Semantic Web Portal](https://classic.wikipathways.org/index.php/Portal:Semantic_Web) +* [Wikipathways and Multiomics presentation](https://zenodo.org/records/18654362) + ## PlantMetWiki architecture ---------