Skip to content

Commit 27efd9f

Browse files
docs: add docs for first users of this package (metabolomics team)
1 parent bf1e555 commit 27efd9f

18 files changed

Lines changed: 413 additions & 40 deletions

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,3 @@ Please make sure to update tests as appropriate.
153153
## License
154154

155155
[MIT](https://choosealicense.com/licenses/mit/)
156-
157-
- [ ] TODO: Modify this based on the license you choose.
158-
- [ ] TODO: Modify the LICENSE file based on the license you choose.

docs/about.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# About
22

3-
This project was created by Edwin Carreño.
3+
This project was created by Saezlab and Scientifc Software Center.

docs/assets/isometric_logo.png

173 KB
Loading

docs/assets/logo_ontograph.png

16.7 KB
Loading
-15.8 KB
Loading

docs/index.md

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,58 @@
1-
# Welcome to OntoGraph Package
1+
# Welcome to OntoGraph
22

3-
This is the main documentation page.
3+
![Image title](assets/project-banner-readme.png){ align=center }
4+
5+
**OntoGraph** is a Python package for programmatic access, navigation, and analysis of biomedical ontologies. It provides a unified interface to download, load, and query ontologies from the [OBO Foundry](https://obofoundry.org/) and other sources, supporting both OBO and OWL formats.
6+
7+
---
8+
9+
## Key Features
10+
11+
- **Ontology Catalog Access**
12+
Browse and retrieve metadata for hundreds of ontologies from the OBO Foundry registry.
13+
14+
- **Flexible Ontology Loading**
15+
Load ontologies from local files, remote URLs, or directly from the OBO Foundry catalog.
16+
17+
- **Graph Navigation & Querying**
18+
Traverse ontology graphs: get parents, children, ancestors, descendants, siblings, and roots of terms.
19+
20+
- **Relationship Analysis**
21+
Check ancestor/descendant/sibling relationships, find common and lowest common ancestors, and compute distances between terms.
22+
23+
- **Introspection Utilities**
24+
Analyze ontology structure, calculate paths and trajectories, and visualize term hierarchies.
25+
26+
- **Caching & Download Management**
27+
Efficiently download and cache ontology files for offline use.
28+
29+
---
30+
31+
## Main Components
32+
33+
- **ClientCatalog**
34+
Interact with the ontology catalog: list available ontologies, retrieve metadata, and explore catalog structure.
35+
36+
- **ClientOntology**
37+
Load and query individual ontologies: navigate term relationships, analyze graph structure, and perform advanced queries.
38+
39+
- **Loader & Downloader Modules**
40+
Abstract and concrete classes for loading ontologies and managing downloads from various sources.
41+
42+
- **Query Adapters**
43+
Modular classes for navigation (`OntologyNavigator`), relationship analysis (`OntologyRelations`), and introspection (`OntologyIntrospection`).
44+
45+
---
46+
47+
## Why OntoGraph?
48+
49+
- Unified and extensible API for ontology operations
50+
- Designed for both interactive exploration and programmatic workflows
51+
- Built-in support for caching and efficient data management
52+
- Modular architecture for easy integration and extension
53+
54+
---
55+
56+
> _Explore, analyze, and integrate ontologies with ease using OntoGraph!_
57+
58+
---

docs/installation.md

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,48 @@
11
# Installation guide
22

3-
We strongly recommend installing a few prerequisites to ensure a smooth experience. These prerequisites are:
3+
## Prerequisites
4+
5+
Before installing `ontograph`, please ensure you have the following tools installed:
6+
7+
8+
| Tool | Minimum Version | Description | Installation Guide |
9+
| ------ | --------------- | ------------------------------------- | ---------------------------------------------------------------------------- |
10+
| Python | 3.10 | Programming language | [Install Python 3](https://docs.python.org/3/using/index.html) |
11+
| uv || Python packaging & dependency manager | [Install uv](https://docs.astral.sh/uv/getting-started/installation/) |
12+
| git || Version control system | [Install git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) |
413

5-
1. *Python 3* (version >= 3.10)
6-
- [Install Python 3](https://docs.python.org/3/using/index.html)
7-
2. *Poetry* (Python packaging and dependency manager)
8-
- [Install Poetry](https://python-poetry.org/docs/#installation)
9-
3. *git* (version control manager)
10-
- [Install git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
11-
4. *Docker* (containerization technology) [optional]
12-
- [Install Docker](https://docs.docker.com/engine/)
1314

1415
!!! tip "Tip"
1516
If you are missing any of those pre-requisites, **please follow the installation guide in each resource before you continue**.
1617

1718

1819
## Checking prerequisites
1920

20-
You can verify access to these components in your terminal:
21+
Verify that everything is installed by running:
2122

22-
1. `Python` version 3.10 or higher.
23-
```bash
24-
python --version
25-
```
26-
2. `Poetry`
23+
```bash
24+
python --version # Should be 3.10 or higher
25+
uv --version
26+
git --version
27+
```
28+
29+
## Installation
30+
31+
This package is currently under development. To try it out, you can clone the repository and install it in "editable" mode. This allows you to make changes to the code and have them reflected immediately without reinstalling.
32+
33+
1. **Clone the repository:**
2734
```bash
28-
poetry --version
35+
git clone https://github.com/saezlab/ontograph.git
2936
```
30-
3. `git`
37+
38+
2. **Navigate into the project directory:**
3139
```bash
32-
git --version
40+
cd ontograph
3341
```
34-
4. `Docker`
42+
43+
3. **Install the package in editable mode using `uv`:**
3544
```bash
36-
docker --version
45+
uv pip install -e .
3746
```
47+
48+
You can now start using `ontograph` in your Python environment. Any changes you make to the source code will take effect immediately.

docs/learn/tutorials/quickstart.md

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
# Quickstart
2+
3+
Welcome to the OntoGraph Quickstart!
4+
This guide will help you get up and running with OntoGraph, showing you how to explore ontology catalogs and interact with ontologies programmatically.
5+
6+
---
7+
8+
## 1. Explore the OBO Foundry Catalog
9+
10+
First, let's interact with the OBO Foundry catalog to discover available ontologies.
11+
12+
```python
13+
from ontograph.client import ClientCatalog
14+
15+
# Create a catalog client (specify a cache directory for downloads)
16+
client_catalog = ClientCatalog(cache_dir="./data/out")
17+
18+
# Load the catalog (downloads if not cached)
19+
client_catalog.load_catalog()
20+
```
21+
22+
### List Available Ontologies
23+
24+
```python
25+
# Get a list of ontologies (as dicts with id and title)
26+
ontologies_list = client_catalog.list_available_ontologies()
27+
print(ontologies_list[:3]) # Show the first three
28+
```
29+
30+
### Print Ontology List
31+
32+
```python
33+
client_catalog.print_available_ontologies()
34+
```
35+
36+
### Get Metadata for a Specific Ontology
37+
38+
```python
39+
# Show metadata for the Gene Ontology (GO)
40+
metadata_go = client_catalog.get_ontology_metadata(ontology_id="go", show_metadata=True)
41+
```
42+
43+
---
44+
45+
## 2. Load and Explore an Ontology
46+
47+
Now, let's load an ontology and explore its structure.
48+
49+
```python
50+
from ontograph.client import ClientOntology
51+
52+
# Create an ontology client
53+
client_ontology = ClientOntology(cache_dir="./data/out")
54+
55+
# Load a sample ontology (provided in the repo for testing)
56+
client_ontology.load(file_path_ontology="./tests/resources/dummy_ontology.obo")
57+
```
58+
59+
---
60+
61+
## 3. Visualize the Ontology Structure
62+
63+
The included demo ontology has the following structure (Z is the root):
64+
65+
```mermaid
66+
graph TB
67+
Z((Z)) --> A((A))
68+
Z((Z)) --> B((B))
69+
Z((Z)) --> C((C))
70+
A((A)) --> D((D))
71+
B((B)) --> H((H))
72+
B((B)) --> I((I))
73+
C((C)) --> J((J))
74+
D((D)) --> E((E))
75+
D((D)) --> F((F))
76+
D((D)) --> G((G))
77+
H((H)) --> K((K))
78+
I((I)) --> L((L))
79+
J((J)) --> M((M))
80+
E((E)) --> N((N))
81+
F((F)) --> O((O))
82+
F((F)) --> Y((Y))
83+
G((G)) --> K1((K1))
84+
G((G)) --> K2((K2))
85+
K((K)) --> Q((Q))
86+
K((K)) --> G1((G))
87+
M((M)) --> S((S))
88+
G1((G)) --> K11((K1))
89+
G1((G)) --> K21((K2))
90+
S((S)) --> T((T))
91+
T((T)) --> U((U))
92+
U((T)) --> V((V))
93+
U((U)) --> W((W))
94+
W((W)) --> Y1((Y))
95+
```
96+
97+
---
98+
99+
## 4. Common Ontology Queries
100+
101+
### Navigation
102+
103+
- **Get ancestors:**
104+
```python
105+
client_ontology.get_ancestors(term_id="S")
106+
```
107+
- **Ancestors with distance:**
108+
```python
109+
list(client_ontology.get_ancestors_with_distance(term_id="S"))
110+
```
111+
- **Get children:**
112+
```python
113+
client_ontology.get_children(term_id="A")
114+
```
115+
- **Get descendants:**
116+
```python
117+
client_ontology.get_descendants(term_id="U")
118+
```
119+
- **Descendants with distance:**
120+
```python
121+
list(client_ontology.get_descendants_with_distance(term_id="U"))
122+
```
123+
- **Get parents:**
124+
```python
125+
client_ontology.get_parents(term_id="U")
126+
```
127+
- **Get root node:**
128+
```python
129+
client_ontology.get_root()
130+
```
131+
- **Get siblings:**
132+
```python
133+
client_ontology.get_siblings(term_id="K1")
134+
```
135+
- **Get a term:**
136+
```python
137+
client_ontology.get_term(term_id="E")
138+
```
139+
140+
### Relations
141+
142+
- **Common ancestors:**
143+
```python
144+
client_ontology.get_common_ancestors(node_ids=["K", "L"])
145+
```
146+
- **Lowest common ancestors:**
147+
```python
148+
client_ontology.get_lowest_common_ancestors(node_ids=["K", "L"])
149+
```
150+
- **Is ancestor:**
151+
```python
152+
client_ontology.is_ancestor(ancestor_node="A", descendant_node="N")
153+
```
154+
- **Is descendant:**
155+
```python
156+
client_ontology.is_descendant(descendant_node="A", ancestor_node="N")
157+
```
158+
- **Is sibling:**
159+
```python
160+
client_ontology.is_sibling(nodeA="F", nodeB="G")
161+
```
162+
163+
### Introspection
164+
165+
- **Distance from root:**
166+
```python
167+
client_ontology.get_distance_from_root(term_id="V")
168+
```
169+
- **Path between nodes:**
170+
```python
171+
client_ontology.get_path_between(nodeA="Q", nodeB="B")
172+
```
173+
- **All trajectories from root:**
174+
```python
175+
trajectories = client_ontology.get_trajectories_from_root(term_id="Y")
176+
```
177+
- **Print trajectories tree:**
178+
```python
179+
client_ontology.print_term_trajectories_tree(trajectories)
180+
```
181+
182+
---
183+
184+
## Next Steps
185+
186+
- Explore the [API Reference](../../reference/source/ontograph/client-ontology.md) for more details.
187+
- Try loading your own ontology files or experiment with different queries!
188+
189+
> _OntoGraph makes ontology exploration and analysis simple and powerful.

docs/reference/source/ontograph/_metadata-docs.md

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# ClientCatalog
2+
3+
`ClientCatalog` is the main interface for interacting with the ontology catalog in OntoGraph.
4+
It allows you to load the catalog, list available ontologies, retrieve metadata, and access download URLs and formats.
5+
6+
This class is ideal for users who want to explore the catalog of available ontologies, inspect their metadata, and prepare for ontology loading and analysis.
7+
8+
---
9+
10+
## Features
11+
12+
- Load and cache the ontology catalog from [OBO Foundry](https://obofoundry.org/)
13+
- List all available ontologies and their metadata
14+
- Retrieve metadata for a specific ontology
15+
- Get download URLs and available formats for each ontology
16+
- Print the catalog schema tree for exploration
17+
18+
---
19+
20+
## API Reference
21+
22+
::: ontograph.client.ClientCatalog
23+
24+
---
25+
26+
## See Also
27+
28+
- [ClientOntology](client-ontology.md): For loading and querying individual ontologies.

0 commit comments

Comments
 (0)