|
88 | 88 | "source": [ |
89 | 89 | "## Overview\n", |
90 | 90 | "\n", |
91 | | - "This notebook serves as a **sandbox environment** to explore and test the functionalities of the `OntoGraph` Python package. It is designed to: \n", |
| 91 | + "This notebook serves as a **sandbox environment** to explore and test the functionalities of the `OntoGraph` Python package. Its goals are to: \n", |
92 | 92 | "\n", |
93 | 93 | "- Evaluate the **user experience** during development. \n", |
94 | | - "- Demonstrate common use cases and workflows to potential users. \n", |
95 | | - "- Collect feedback from collaborators before finalizing the official documentation.\n", |
96 | | - "- Help to create use cases based on what the user wants.\n", |
| 94 | + "- Demonstrate common use cases and workflows for potential users. \n", |
| 95 | + "- Gather feedback from collaborators before finalizing the official documentation.\n", |
| 96 | + "- Support the creation of use cases based on user requirements.\n", |
97 | 97 | "\n", |
98 | | - "Feel free to execute, modify, and extend the examples in this notebook to better understand how the package can be used in real scenarios." |
| 98 | + "Feel free to execute, modify, and extend the examples in this notebook to gain a deeper understanding of how the package can be applied in real-world scenarios." |
99 | 99 | ] |
100 | 100 | }, |
101 | 101 | { |
|
109 | 109 | "3. To reset, click `Kernel -> Restart & Run All`." |
110 | 110 | ] |
111 | 111 | }, |
| 112 | + { |
| 113 | + "cell_type": "markdown", |
| 114 | + "metadata": {}, |
| 115 | + "source": [ |
| 116 | + "## Setup" |
| 117 | + ] |
| 118 | + }, |
| 119 | + { |
| 120 | + "cell_type": "code", |
| 121 | + "execution_count": null, |
| 122 | + "metadata": {}, |
| 123 | + "outputs": [], |
| 124 | + "source": [ |
| 125 | + "!uv pip install -e ../" |
| 126 | + ] |
| 127 | + }, |
112 | 128 | { |
113 | 129 | "cell_type": "markdown", |
114 | 130 | "metadata": { |
|
147 | 163 | "source": [ |
148 | 164 | "## Client Catalog (optional, but useful)\n", |
149 | 165 | "\n", |
150 | | - "Users can retrieve the catalog of ontologies offered in OBO Foundries. With this catalog, you have the names, descriptions and other useful ontologies metadata in a single place. For that reason we offer this client to the catalog. It automatically downloads a `.yaml` file containing all this information. If this file already exist in your cache it will be loaded from there automatically." |
| 166 | + "Users can retrieve the catalog of ontologies provided by the OBO Foundry. This catalog contains names, descriptions, and other useful metadata for all supported ontologies in one place.\n", |
| 167 | + "\n", |
| 168 | + "To facilitate access, we provide a dedicated client for interacting with the catalog. It automatically downloads a `.yaml` file containing the catalog information. If the file already exists in your local cache, it will be loaded from there automatically." |
151 | 169 | ] |
152 | 170 | }, |
153 | 171 | { |
|
242 | 260 | "source": [ |
243 | 261 | "### Get metadata of a specific ontology\n", |
244 | 262 | "\n", |
245 | | - "For instance, we are interested in know metadata about the ontology `chebi` (Chemical Entities of Biological Interest). We just only need the `ontology_id` in this case is `chebi`. Let's do it!" |
| 263 | + "For example, suppose we are interested in retrieving metadata about the chebi ontology (Chemical Entities of Biological Interest).\n", |
| 264 | + "In this case, we only need the `ontology_id`, which is `chebi`." |
246 | 265 | ] |
247 | 266 | }, |
248 | 267 | { |
|
264 | 283 | "source": [ |
265 | 284 | "### Print catalog schema\n", |
266 | 285 | "\n", |
267 | | - "You have the metadata, but do not understand all those fields returned. Just print the schema of this ontology. It is dynamically generated in case OBO foundry change this, you will have the updates." |
| 286 | + "You have access to the metadata, but you may not fully understand all the returned fields.\n", |
| 287 | + "To clarify their structure and meaning, simply print the schema of the catalog.\n", |
| 288 | + "\n", |
| 289 | + "The schema is dynamically generated, so if the OBO Foundry updates the format, you will automatically receive the latest version." |
268 | 290 | ] |
269 | 291 | }, |
270 | 292 | { |
|
282 | 304 | "source": [ |
283 | 305 | "### Get available formats for a given ontology\n", |
284 | 306 | "\n", |
285 | | - "Are you interested in knowing which ontology formats (`.obo`, `.owl`, `.json`, etc) have a given ontology. Just get this with a single command!" |
| 307 | + "Are you interested in knowing which formats (e.g., `.obo`, `.owl`, etc.) are available for a given ontology?\n", |
| 308 | + "You can retrieve this information with a single command!" |
286 | 309 | ] |
287 | 310 | }, |
288 | 311 | { |
|
316 | 339 | "source": [ |
317 | 340 | "## Client Ontology\n", |
318 | 341 | "\n", |
319 | | - "We provide a dummy ontology that allows us to navigate and undestand the purpose of each method offered by the client. This is the ontology named as `dummy_ontology.obo`:\n", |
320 | | - "\n", |
| 342 | + "We provide a dummy ontology that allows users to navigate and understand the purpose of each method offered by the client. This ontology is named `dummy_ontology.obo`." |
| 343 | + ] |
| 344 | + }, |
| 345 | + { |
| 346 | + "cell_type": "markdown", |
| 347 | + "metadata": {}, |
| 348 | + "source": [ |
321 | 349 | "```mermaid\n", |
322 | 350 | "graph TB\n", |
323 | 351 | " \n", |
|
598 | 626 | "cell_type": "markdown", |
599 | 627 | "metadata": {}, |
600 | 628 | "source": [ |
601 | | - "### " |
| 629 | + "### Relationship queries" |
| 630 | + ] |
| 631 | + }, |
| 632 | + { |
| 633 | + "cell_type": "markdown", |
| 634 | + "metadata": {}, |
| 635 | + "source": [ |
| 636 | + "#### Get common ancestors (all)" |
| 637 | + ] |
| 638 | + }, |
| 639 | + { |
| 640 | + "cell_type": "code", |
| 641 | + "execution_count": null, |
| 642 | + "metadata": {}, |
| 643 | + "outputs": [], |
| 644 | + "source": [ |
| 645 | + "client_dummy_ontology.get_common_ancestors(node_ids=['K', 'L'])" |
| 646 | + ] |
| 647 | + }, |
| 648 | + { |
| 649 | + "cell_type": "markdown", |
| 650 | + "metadata": {}, |
| 651 | + "source": [ |
| 652 | + "#### Get the most proximate ancestor" |
| 653 | + ] |
| 654 | + }, |
| 655 | + { |
| 656 | + "cell_type": "code", |
| 657 | + "execution_count": null, |
| 658 | + "metadata": {}, |
| 659 | + "outputs": [], |
| 660 | + "source": [ |
| 661 | + "client_dummy_ontology.get_lowest_common_ancestors(node_ids=['K', 'L'])" |
| 662 | + ] |
| 663 | + }, |
| 664 | + { |
| 665 | + "cell_type": "markdown", |
| 666 | + "metadata": {}, |
| 667 | + "source": [ |
| 668 | + "#### Evaluate if one node is ancestor or another node" |
602 | 669 | ] |
603 | 670 | }, |
604 | 671 | { |
605 | 672 | "cell_type": "code", |
606 | 673 | "execution_count": null, |
607 | 674 | "metadata": {}, |
608 | 675 | "outputs": [], |
609 | | - "source": [] |
| 676 | + "source": [ |
| 677 | + "client_dummy_ontology.is_ancestor(ancestor_node='A', descendant_node='N')" |
| 678 | + ] |
| 679 | + }, |
| 680 | + { |
| 681 | + "cell_type": "markdown", |
| 682 | + "metadata": {}, |
| 683 | + "source": [ |
| 684 | + "#### Evaluate if a node is descendant of another node" |
| 685 | + ] |
610 | 686 | }, |
611 | 687 | { |
612 | 688 | "cell_type": "code", |
613 | 689 | "execution_count": null, |
614 | 690 | "metadata": {}, |
615 | 691 | "outputs": [], |
616 | | - "source": [] |
| 692 | + "source": [ |
| 693 | + "client_dummy_ontology.is_descendant(descendant_node='A', ancestor_node='N')" |
| 694 | + ] |
| 695 | + }, |
| 696 | + { |
| 697 | + "cell_type": "markdown", |
| 698 | + "metadata": {}, |
| 699 | + "source": [ |
| 700 | + "#### Evaluate if a node is sibling of another node" |
| 701 | + ] |
| 702 | + }, |
| 703 | + { |
| 704 | + "cell_type": "code", |
| 705 | + "execution_count": null, |
| 706 | + "metadata": {}, |
| 707 | + "outputs": [], |
| 708 | + "source": [ |
| 709 | + "client_dummy_ontology.is_sibling(nodeA='F', nodeB='G')" |
| 710 | + ] |
| 711 | + }, |
| 712 | + { |
| 713 | + "cell_type": "markdown", |
| 714 | + "metadata": {}, |
| 715 | + "source": [ |
| 716 | + "### Introspection" |
| 717 | + ] |
| 718 | + }, |
| 719 | + { |
| 720 | + "cell_type": "markdown", |
| 721 | + "metadata": {}, |
| 722 | + "source": [ |
| 723 | + "#### Get the distance between a node and the root (or roots)" |
| 724 | + ] |
| 725 | + }, |
| 726 | + { |
| 727 | + "cell_type": "code", |
| 728 | + "execution_count": null, |
| 729 | + "metadata": {}, |
| 730 | + "outputs": [], |
| 731 | + "source": [ |
| 732 | + "client_dummy_ontology.get_distance_from_root(term_id='V')" |
| 733 | + ] |
| 734 | + }, |
| 735 | + { |
| 736 | + "cell_type": "markdown", |
| 737 | + "metadata": {}, |
| 738 | + "source": [ |
| 739 | + "#### Get the path between two nodes (if those are related as ancestor-descendat or descendant-ancestor)" |
| 740 | + ] |
| 741 | + }, |
| 742 | + { |
| 743 | + "cell_type": "code", |
| 744 | + "execution_count": null, |
| 745 | + "metadata": {}, |
| 746 | + "outputs": [], |
| 747 | + "source": [ |
| 748 | + "client_dummy_ontology.get_path_between(nodeA='Q', nodeB='B')" |
| 749 | + ] |
| 750 | + }, |
| 751 | + { |
| 752 | + "cell_type": "markdown", |
| 753 | + "metadata": {}, |
| 754 | + "source": [ |
| 755 | + "#### Get all the direct trajectories to an specific node." |
| 756 | + ] |
| 757 | + }, |
| 758 | + { |
| 759 | + "cell_type": "code", |
| 760 | + "execution_count": null, |
| 761 | + "metadata": {}, |
| 762 | + "outputs": [], |
| 763 | + "source": [ |
| 764 | + "trajectories = client_dummy_ontology.get_trajectories_from_root(term_id='Y')" |
| 765 | + ] |
| 766 | + }, |
| 767 | + { |
| 768 | + "cell_type": "markdown", |
| 769 | + "metadata": {}, |
| 770 | + "source": [ |
| 771 | + "#### Print all the trajectories in terminal" |
| 772 | + ] |
| 773 | + }, |
| 774 | + { |
| 775 | + "cell_type": "code", |
| 776 | + "execution_count": null, |
| 777 | + "metadata": {}, |
| 778 | + "outputs": [], |
| 779 | + "source": [ |
| 780 | + "client_dummy_ontology.print_term_trajectories_tree(trajectories)" |
| 781 | + ] |
617 | 782 | }, |
618 | 783 | { |
619 | 784 | "cell_type": "markdown", |
620 | 785 | "metadata": {}, |
621 | 786 | "source": [ |
622 | 787 | "## References and Further Reading\n", |
623 | 788 | "\n", |
| 789 | + "- [OntoGraph Repo](https://github.com/saezlab/ontograph/)\n", |
624 | 790 | "- [OBO Foundry](https://obofoundry.org/)\n", |
625 | 791 | "- [`pronto` documentation](https://pronto.readthedocs.io/en/stable/)\n", |
626 | 792 | "- [`pooch` documentation](https://www.fatiando.org/pooch/latest/)" |
|
0 commit comments