From 32556dc0100b1795b49726fd50f8ef3a3badde2f Mon Sep 17 00:00:00 2001 From: Chris Mungall Date: Tue, 4 Apr 2023 09:29:57 -0700 Subject: [PATCH] upgrade sphinx. Fixes #512 (#513) * upgrade sphinx. Fixes #512 * doc-refactor * refactor * Update obo_graph_to_fhir_converter.py --------- Co-authored-by: Harshad --- docs/best-practice.rst | 441 ------------------ docs/concepts.rst | 2 + docs/contributing.md | 2 - docs/index.rst | 8 +- docs/introduction.md | 44 -- docs/introduction.rst | 52 +++ docs/{ => packages}/architecture.rst | 2 +- docs/packages/best-practice.rst | 83 ++++ .../converters/data-model-converter.rst | 0 docs/{ => packages}/converters/index.rst | 0 .../converters/obo-graph-to-cx.rst | 0 .../converters/obo-graph-to-fhir.rst | 0 .../converters/obo-graph-to-obo-format.rst | 0 .../converters/obo-graph-to-owl.rst | 0 .../implementations/aggregator.rst | 0 .../implementations/bioportal.rst | 0 docs/{ => packages}/implementations/gilda.rst | 0 docs/{ => packages}/implementations/index.rst | 0 .../implementations/obograph.rst | 0 docs/{ => packages}/implementations/ols.rst | 0 .../implementations/ontobee.rst | 0 .../{ => packages}/implementations/owlery.rst | 0 .../{ => packages}/implementations/pronto.rst | 0 .../implementations/simple_obo.rst | 0 .../{ => packages}/implementations/sparql.rst | 0 docs/{ => packages}/implementations/sqldb.rst | 0 .../implementations/ubergraph.rst | 0 docs/packages/index.rst | 15 + .../interfaces/association-provider.rst | 0 docs/{ => packages}/interfaces/basic.rst | 0 .../interfaces/class-enrichment.rst | 0 docs/{ => packages}/interfaces/dumper.rst | 0 docs/{ => packages}/interfaces/index.rst | 0 .../interfaces/mapping-provider.rst | 0 docs/{ => packages}/interfaces/obograph.rst | 0 docs/{ => packages}/interfaces/owl.rst | 0 docs/{ => packages}/interfaces/patcher.rst | 0 .../interfaces/relation-graph.rst | 0 docs/{ => packages}/interfaces/search.rst | 0 .../interfaces/semantic-similarity.rst | 0 docs/{ => packages}/interfaces/subsetting.rst | 0 .../interfaces/summary-statistics.rst | 0 .../interfaces/text-annotator.rst | 0 docs/{ => packages}/interfaces/validator.rst | 0 docs/{ => packages}/selectors.rst | 26 +- docs/{ => packages}/utilities.rst | 5 - poetry.lock | 71 +-- pyproject.toml | 6 +- src/oaklib/cli.py | 2 +- .../converters/obo_graph_to_fhir_converter.py | 24 +- src/oaklib/datamodels/fhir.py | 18 +- src/oaklib/datamodels/fhir.yaml | 8 +- src/oaklib/datamodels/search.py | 4 +- .../implementations/kgx/kgx_implementation.py | 4 +- .../obograph/obograph_implementation.py | 4 +- .../ontobee/ontobee_implementation.py | 4 +- .../ontoportal/bioportal_implementation.py | 2 +- .../pronto/pronto_implementation.py | 6 +- .../simpleobo/simple_obo_implementation.py | 4 +- .../sqldb/sql_implementation.py | 6 +- .../ubergraph/ubergraph_implementation.py | 2 +- .../uniprot/uniprot_implementation.py | 2 +- .../wikidata/wikidata_implementation.py | 2 +- .../interfaces/mapping_provider_interface.py | 2 +- src/oaklib/interfaces/obolegacy_interface.py | 2 +- src/oaklib/selector.py | 4 +- src/oaklib/utilities/identifier_utils.py | 6 +- src/oaklib/utilities/table_filler.py | 6 +- 68 files changed, 263 insertions(+), 606 deletions(-) delete mode 100644 docs/best-practice.rst delete mode 100644 docs/introduction.md create mode 100644 docs/introduction.rst rename docs/{ => packages}/architecture.rst (99%) create mode 100644 docs/packages/best-practice.rst rename docs/{ => packages}/converters/data-model-converter.rst (100%) rename docs/{ => packages}/converters/index.rst (100%) rename docs/{ => packages}/converters/obo-graph-to-cx.rst (100%) rename docs/{ => packages}/converters/obo-graph-to-fhir.rst (100%) rename docs/{ => packages}/converters/obo-graph-to-obo-format.rst (100%) rename docs/{ => packages}/converters/obo-graph-to-owl.rst (100%) rename docs/{ => packages}/implementations/aggregator.rst (100%) rename docs/{ => packages}/implementations/bioportal.rst (100%) rename docs/{ => packages}/implementations/gilda.rst (100%) rename docs/{ => packages}/implementations/index.rst (100%) rename docs/{ => packages}/implementations/obograph.rst (100%) rename docs/{ => packages}/implementations/ols.rst (100%) rename docs/{ => packages}/implementations/ontobee.rst (100%) rename docs/{ => packages}/implementations/owlery.rst (100%) rename docs/{ => packages}/implementations/pronto.rst (100%) rename docs/{ => packages}/implementations/simple_obo.rst (100%) rename docs/{ => packages}/implementations/sparql.rst (100%) rename docs/{ => packages}/implementations/sqldb.rst (100%) rename docs/{ => packages}/implementations/ubergraph.rst (100%) create mode 100644 docs/packages/index.rst rename docs/{ => packages}/interfaces/association-provider.rst (100%) rename docs/{ => packages}/interfaces/basic.rst (100%) rename docs/{ => packages}/interfaces/class-enrichment.rst (100%) rename docs/{ => packages}/interfaces/dumper.rst (100%) rename docs/{ => packages}/interfaces/index.rst (100%) rename docs/{ => packages}/interfaces/mapping-provider.rst (100%) rename docs/{ => packages}/interfaces/obograph.rst (100%) rename docs/{ => packages}/interfaces/owl.rst (100%) rename docs/{ => packages}/interfaces/patcher.rst (100%) rename docs/{ => packages}/interfaces/relation-graph.rst (100%) rename docs/{ => packages}/interfaces/search.rst (100%) rename docs/{ => packages}/interfaces/semantic-similarity.rst (100%) rename docs/{ => packages}/interfaces/subsetting.rst (100%) rename docs/{ => packages}/interfaces/summary-statistics.rst (100%) rename docs/{ => packages}/interfaces/text-annotator.rst (100%) rename docs/{ => packages}/interfaces/validator.rst (100%) rename docs/{ => packages}/selectors.rst (74%) rename docs/{ => packages}/utilities.rst (90%) diff --git a/docs/best-practice.rst b/docs/best-practice.rst deleted file mode 100644 index 5c0fb5fc4..000000000 --- a/docs/best-practice.rst +++ /dev/null @@ -1,441 +0,0 @@ -.. _best_practice: - -Best Practice -============= - -External Services ------------------ - -Consider making your code robust regardless of whether the ontology implementation is local or a remote service. - -Iterators -^^^^^^^^^ - -Most interface methods that provide more that one result will return :term:`Iterator`s which yield individual elements. -You can iterate over these in exactly the same way you iterate over lists, for example: - -.. code:: python - - >>> for curie in oi.basic_search("cell"): - >>> ## do something with results - >>> print(f'MATCH: {curie}') - -If you like you can directly convert an iterator to a list: - -.. code:: python - - >>> curies = list(oi.basic_search("cell")) - -However, this may be an anti-pattern if the implementation is a remote service and the results include possible thousands of results, -as this will block on waiting for all results. - -For more on iterators, see `How to Use Generators and yield in Python `_ - -Weaving calls together -^^^^^^^^^^^^^^^^^^^^^^ - -A common pattern is to iterate over a result set and issue a separate call for each result: - -.. code:: python - - >>> for curie in oi.basic_search("cell"): - >>> print(f'MATCH: {curie} ! {oi.label(curie)}') - - This is fine if the implementation has a low latency for individual calls, but if the implementation is backed by - a remote service (for example, a SPARQL endpoint like ontobee or ubergraph, or a remote SQL database) then this will - issue one network call for each result, which may be inefficient. - - One possibility is to use a dedicated method for retrieving batch results, for example - >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') - - This is fine if the implementation has a low latency for individual calls, but if the implementation is backed by - a remote service (for example, a SPARQL endpoint like ontobee or ubergraph, or a remote SQL database) then this will - issue one network call for each result, which may be inefficient. - - One possibility is to use a dedicated method for retrieving batch results, for example - >>> print(f'MATCH: {curie} ! {oi.label_by_curie(curie)}') - - This is fine if the implementation has a low latency for individual calls, but if the implementation is backed by - a remote service (for example, a SPARQL endpoint like ontobee or ubergraph, or a remote SQL database) then this will - issue one network call for each result, which may be inefficient. - - One possibility is to use a dedicated method for retrieving batch results, for example - >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') - -This is fine if the implementation has a low latency for individual calls, but if the implementation is backed by -a remote service (for example, a SPARQL endpoint like ontobee or ubergraph, or a remote SQL database) then this will -issue one network call for each result, which may be inefficient. - -One possibility is to use a dedicated method for retrieving batch results, for example :ref:`.get_label_by_curie`: - -.. code:: python - - >>> curies = oi.basic_search("cell"): - >>> for curie, label in oi.labels(curies): - >>> print(f'MATCH: {curie} ! {oi.label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.labels(curies): - >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.label(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.labels(curies): - >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.labels(curies): - >>> print(f'MATCH: {curie} ! {oi.label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.labels(curies): - >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.label(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.labels(curies): - >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.labels(curies): - >>> print(f'MATCH: {curie} ! {oi.label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.labels(curies): - >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.labels(curies): - >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.label(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.labels(curies): - >>> print(f'MATCH: {curie} ! {oi.label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.labels(curies): - >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.labels(curies): - >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.label(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.labels(curies): - >>> print(f'MATCH: {curie} ! {oi.label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.label(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.labels(curies): - >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.labels(curies): - >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.labels(curies): - >>> print(f'MATCH: {curie} ! {oi.label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.label(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.labels(curies): - >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.labels(curies): - >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.labels(curies): - >>> print(f'MATCH: {curie} ! {oi.label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.labels(curies): - >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.labels(curies): - >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.label_by_curie(curie)}') - - This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - - A better approach is to - >>> for curie, label in oi.get_labels_for_curies(curies): - >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') - -This is likely fine if the search results are relatively low in cardinality, but may be less efficient for large numbers of results. - -A better approach is to *chunk* over iterators: - -Chunking -^^^^^^^^ - -The :ref:`.chunk` utility function will chunk iterator calls into sizeable amounts: - -.. code:: python - - >>> for curie_it in chunk(impl.basic_search(t)): - >>> logging.info('** Next chunk:') - >>> for curie, label in impl.labels(curie_it): - >>> print(f'{curie} ! {label}') - - This is slightly more boilerplate code, and may not be necessary for an in-memory implementation like Pronto. However, this - pattern could have considerable advantages for result sets that are potentially large. Even if the external server is - slow to return results, users will see batches or results rather than waiting on the external server to produce - >>> logging.info('** Next chunk:') - >>> for curie, label in impl.get_labels_for_curies(curie_it): - >>> print(f'{curie} ! {label}') - -This is slightly more boilerplate code, and may not be necessary for an in-memory implementation like Pronto. However, this -pattern could have considerable advantages for result sets that are potentially large. Even if the external server is -slow to return results, users will see batches or results rather than waiting on the external server to produce *all* results. - -Command Line ------------- - -If you are extending the CLI module or writing a Python application that uses OAK: - -- Use click -- Follow CLIG guidelines -- Ensure that there are tests for the command line using test_click \ No newline at end of file diff --git a/docs/concepts.rst b/docs/concepts.rst index e72f72c0c..9b4403319 100644 --- a/docs/concepts.rst +++ b/docs/concepts.rst @@ -1,5 +1,7 @@ .. _concepts: +**NOTE** this is largely replaced by the :ref:`guide` + Ontology Concepts ================= diff --git a/docs/contributing.md b/docs/contributing.md index 690d9c93d..4230452e3 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -2,8 +2,6 @@ All contributions are welcome! -But we warned until [v0.2.0](https://github.com/INCATools/ontology-access-kit/milestone/1) things may be in flux! - ## Reporting issues and giving general feedback Please use the [issue tracker](https://github.com/INCATools/ontology-access-kit/issues) for questions, bugs, enhancements, feature requests, etc diff --git a/docs/index.rst b/docs/index.rst index f60ba660e..3501a6ba6 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -10,17 +10,11 @@ Ontology Access Kit (OAK) Documentation introduction intro/index guide/index - architecture - interfaces/index - implementations/index + packages/index cli - selectors datamodels/index - converters/index - utilities howtos/index notebooks - concepts glossary faq diff --git a/docs/introduction.md b/docs/introduction.md deleted file mode 100644 index e319a503e..000000000 --- a/docs/introduction.md +++ /dev/null @@ -1,44 +0,0 @@ - -## Introduction - -Ontology Access Toolkit (OAK) is a Python library for common ontology operations over a variety of backends. - -This library provides a collection of different interfaces for different kinds of ontology operations, including: - - - basic features of an ontology element, such as its label, definition, relationships, or aliases. - - search an ontology for a term. - - update, delete, or modify terms. - - provide specialized object models for more advanced operations, such as graph traversal, or OWL axiom processing, or text annotation. - -These interfaces are *separated* from any particular backend. This means the same API can be used regardless of whether the ontology: - - - is served by a remote API such as OLS or BioPortal. - - is present locally on the filesystem in owl, obo, obojson, or sqlite formats. - - is to be downloaded from a remote repository such as the OBO library. - - is queried from a remote database, including SPARQL endpoints, A SQL database, a Solr/ES endpoint. - -### Basic Python Example - -The following code will load an ontology from a SQLite3 database, lookup -basic information on terms matching a search - -```python -from src.oaklib.resource import OntologyResource -from src.oaklib.implementations.sqldb.sql_implementation import SqlImplementation - -resource = OntologyResource(slug='tests/input/go-nucleus.db', local=True) -si = SqlImplementation(resource) -for curie in si.basic_search("nucleus"): - print(f'{curie} ! {si.label(curie)}') - print(f'Definition: {si.definition(curie)}') - for rel, fillers in si.outgoing_relationship_map(curie).items(): - print(f' RELATION: {rel} ! {si.label(rel)}') - for filler in fillers: - print(f' * {filler} ! {si.label(filler)}') -``` - -### Basic Command Line Example - -```bash -runoak -i obi.db info "assay" -``` \ No newline at end of file diff --git a/docs/introduction.rst b/docs/introduction.rst new file mode 100644 index 000000000..3d981a761 --- /dev/null +++ b/docs/introduction.rst @@ -0,0 +1,52 @@ +Introduction +------------ + +Ontology Access Toolkit (OAK) is a Python library for common +:term:`Ontology` operations over a variety of :term:`Adapters`. + +This library provides a collection of different :term:`Interfaces` for different +kinds of ontology operations, including: + +- basic features of an :term:`Ontology Element`, such as its :term:`Label`, :term:`Definition`, + :term:`Relationships`, or :term:`Synonyms`. +- :term:`Search` an ontology for a term. +- :term:`Apply` modifications to terms, including adding, deleting, or updating +- numerous specialized operations, such as :term:`Graph Traversal`, or :term:`Axiom` processing, + :term:`Ontology Alignment`, or :term`Text Annotation`. + +These interfaces are *separated* from any particular backend. This means +the same API can be used regardless of whether the ontology: + +- is served by a remote API such as :term:`OLS` or :term:`BioPortal`. +- is present locally on the filesystem in :term:`OWL`, :term:`OBO Format`, + :term:`OBO Graphs`, or :term:`SQLite` formats. +- is to be downloaded from a remote :term:`Ontology Repository` such as the :term:`OBO Library`. +- is queried from a remote database, including :term:`SPARQL` endpoints, A SQL + database, a Solr/ES endpoint. + +Basic Python Example +~~~~~~~~~~~~~~~~~~~~ + +The following code will load an ontology from a :term:`SQLite` database, lookup +basic information on terms matching a search + +.. code:: python + + >>> from oaklib import get_adapter + >>> adapter = get_adapter("sqlite:obo:cl") + >>> for curie in adapter.basic_search("T cell"): + ... print(f'{curie} ! {si.label(curie)}') + ... print(f'Definition: {si.definition(curie)}') + ... for rel, fillers in si.outgoing_relationship_map(curie).items(): + ... print(f' RELATION: {rel} ! {si.label(rel)}') + ... for filler in fillers: + ... print(f' * {filler} ! {si.label(filler)}') + +Basic Command Line Example +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code:: bash + + $ runoak -i sqlite:obo:obi info "assay" + +This does a basic lookup of the term "assay" in :term:`OBI` diff --git a/docs/architecture.rst b/docs/packages/architecture.rst similarity index 99% rename from docs/architecture.rst rename to docs/packages/architecture.rst index 58e8aff05..95718c8c9 100644 --- a/docs/architecture.rst +++ b/docs/packages/architecture.rst @@ -16,7 +16,7 @@ you can do on an ontology, mostly simple lookup operations. Here is a simplified .. mermaid:: - classDiagram + classDiagram class OntologyInterface { +interfaces_implemented() } diff --git a/docs/packages/best-practice.rst b/docs/packages/best-practice.rst new file mode 100644 index 000000000..fe08fb48c --- /dev/null +++ b/docs/packages/best-practice.rst @@ -0,0 +1,83 @@ +.. _best_practice: + +Best Practice +============= + +External Services +----------------- + +Consider making your code robust regardless of whether the ontology implementation is local or a remote service. + +Iterators +^^^^^^^^^ + +Most interface methods that provide more that one result will return :term:`Iterator`s which yield individual elements. +You can iterate over these in exactly the same way you iterate over lists, for example: + +.. code:: python + + >>> for curie in oi.basic_search("cell"): + >>> ## do something with results + >>> print(f'MATCH: {curie}') + +If you like you can directly convert an iterator to a list: + +.. code:: python + + >>> curies = list(oi.basic_search("cell")) + +However, this may be an anti-pattern if the implementation is a remote service and the results include possible thousands of results, +as this will block on waiting for all results. + +For more on iterators, see `How to Use Generators and yield in Python `_ + +Weaving calls together +^^^^^^^^^^^^^^^^^^^^^^ + +A common pattern is to iterate over a result set and issue a separate call for each result: + +.. code:: python + + >>> for curie in oi.basic_search("cell"): + >>> print(f'MATCH: {curie} ! {oi.label(curie)}') + + This is fine if the implementation has a low latency for individual calls, but if the implementation is backed by + a remote service (for example, a SPARQL endpoint like ontobee or ubergraph, or a remote SQL database) then this will + issue one network call for each result, which may be inefficient. + + One possibility is to use a dedicated method for retrieving batch results, for example + >>> print(f'MATCH: {curie} ! {oi.get_label_by_curie(curie)}') + +A better approach is to *chunk* over iterators: + +Chunking +^^^^^^^^ + +The :ref:`.chunk` utility function will chunk iterator calls into sizeable amounts: + +.. code:: python + + >>> for curie_it in chunk(impl.basic_search(t)): + >>> logging.info('** Next chunk:') + >>> for curie, label in impl.labels(curie_it): + >>> print(f'{curie} ! {label}') + + This is slightly more boilerplate code, and may not be necessary for an in-memory implementation like Pronto. However, this + pattern could have considerable advantages for result sets that are potentially large. Even if the external server is + slow to return results, users will see batches or results rather than waiting on the external server to produce + >>> logging.info('** Next chunk:') + >>> for curie, label in impl.get_labels_for_curies(curie_it): + >>> print(f'{curie} ! {label}') + +This is slightly more boilerplate code, and may not be necessary for an in-memory implementation like Pronto. However, this +pattern could have considerable advantages for result sets that are potentially large. Even if the external server is +slow to return results, users will see batches or results rather than waiting on the external server to produce *all* results. + +Command Line +------------ + +If you are extending the CLI module or writing a Python application that uses OAK: + +- Use click +- Follow CLIG guidelines +- Ensure that there are tests for the command line using test_click \ No newline at end of file diff --git a/docs/converters/data-model-converter.rst b/docs/packages/converters/data-model-converter.rst similarity index 100% rename from docs/converters/data-model-converter.rst rename to docs/packages/converters/data-model-converter.rst diff --git a/docs/converters/index.rst b/docs/packages/converters/index.rst similarity index 100% rename from docs/converters/index.rst rename to docs/packages/converters/index.rst diff --git a/docs/converters/obo-graph-to-cx.rst b/docs/packages/converters/obo-graph-to-cx.rst similarity index 100% rename from docs/converters/obo-graph-to-cx.rst rename to docs/packages/converters/obo-graph-to-cx.rst diff --git a/docs/converters/obo-graph-to-fhir.rst b/docs/packages/converters/obo-graph-to-fhir.rst similarity index 100% rename from docs/converters/obo-graph-to-fhir.rst rename to docs/packages/converters/obo-graph-to-fhir.rst diff --git a/docs/converters/obo-graph-to-obo-format.rst b/docs/packages/converters/obo-graph-to-obo-format.rst similarity index 100% rename from docs/converters/obo-graph-to-obo-format.rst rename to docs/packages/converters/obo-graph-to-obo-format.rst diff --git a/docs/converters/obo-graph-to-owl.rst b/docs/packages/converters/obo-graph-to-owl.rst similarity index 100% rename from docs/converters/obo-graph-to-owl.rst rename to docs/packages/converters/obo-graph-to-owl.rst diff --git a/docs/implementations/aggregator.rst b/docs/packages/implementations/aggregator.rst similarity index 100% rename from docs/implementations/aggregator.rst rename to docs/packages/implementations/aggregator.rst diff --git a/docs/implementations/bioportal.rst b/docs/packages/implementations/bioportal.rst similarity index 100% rename from docs/implementations/bioportal.rst rename to docs/packages/implementations/bioportal.rst diff --git a/docs/implementations/gilda.rst b/docs/packages/implementations/gilda.rst similarity index 100% rename from docs/implementations/gilda.rst rename to docs/packages/implementations/gilda.rst diff --git a/docs/implementations/index.rst b/docs/packages/implementations/index.rst similarity index 100% rename from docs/implementations/index.rst rename to docs/packages/implementations/index.rst diff --git a/docs/implementations/obograph.rst b/docs/packages/implementations/obograph.rst similarity index 100% rename from docs/implementations/obograph.rst rename to docs/packages/implementations/obograph.rst diff --git a/docs/implementations/ols.rst b/docs/packages/implementations/ols.rst similarity index 100% rename from docs/implementations/ols.rst rename to docs/packages/implementations/ols.rst diff --git a/docs/implementations/ontobee.rst b/docs/packages/implementations/ontobee.rst similarity index 100% rename from docs/implementations/ontobee.rst rename to docs/packages/implementations/ontobee.rst diff --git a/docs/implementations/owlery.rst b/docs/packages/implementations/owlery.rst similarity index 100% rename from docs/implementations/owlery.rst rename to docs/packages/implementations/owlery.rst diff --git a/docs/implementations/pronto.rst b/docs/packages/implementations/pronto.rst similarity index 100% rename from docs/implementations/pronto.rst rename to docs/packages/implementations/pronto.rst diff --git a/docs/implementations/simple_obo.rst b/docs/packages/implementations/simple_obo.rst similarity index 100% rename from docs/implementations/simple_obo.rst rename to docs/packages/implementations/simple_obo.rst diff --git a/docs/implementations/sparql.rst b/docs/packages/implementations/sparql.rst similarity index 100% rename from docs/implementations/sparql.rst rename to docs/packages/implementations/sparql.rst diff --git a/docs/implementations/sqldb.rst b/docs/packages/implementations/sqldb.rst similarity index 100% rename from docs/implementations/sqldb.rst rename to docs/packages/implementations/sqldb.rst diff --git a/docs/implementations/ubergraph.rst b/docs/packages/implementations/ubergraph.rst similarity index 100% rename from docs/implementations/ubergraph.rst rename to docs/packages/implementations/ubergraph.rst diff --git a/docs/packages/index.rst b/docs/packages/index.rst new file mode 100644 index 000000000..d65d747bb --- /dev/null +++ b/docs/packages/index.rst @@ -0,0 +1,15 @@ +.. _packages: + +Package Documentation +================================== + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + architecture + interfaces/index + implementations/index + selectors + converters/index + utilities diff --git a/docs/interfaces/association-provider.rst b/docs/packages/interfaces/association-provider.rst similarity index 100% rename from docs/interfaces/association-provider.rst rename to docs/packages/interfaces/association-provider.rst diff --git a/docs/interfaces/basic.rst b/docs/packages/interfaces/basic.rst similarity index 100% rename from docs/interfaces/basic.rst rename to docs/packages/interfaces/basic.rst diff --git a/docs/interfaces/class-enrichment.rst b/docs/packages/interfaces/class-enrichment.rst similarity index 100% rename from docs/interfaces/class-enrichment.rst rename to docs/packages/interfaces/class-enrichment.rst diff --git a/docs/interfaces/dumper.rst b/docs/packages/interfaces/dumper.rst similarity index 100% rename from docs/interfaces/dumper.rst rename to docs/packages/interfaces/dumper.rst diff --git a/docs/interfaces/index.rst b/docs/packages/interfaces/index.rst similarity index 100% rename from docs/interfaces/index.rst rename to docs/packages/interfaces/index.rst diff --git a/docs/interfaces/mapping-provider.rst b/docs/packages/interfaces/mapping-provider.rst similarity index 100% rename from docs/interfaces/mapping-provider.rst rename to docs/packages/interfaces/mapping-provider.rst diff --git a/docs/interfaces/obograph.rst b/docs/packages/interfaces/obograph.rst similarity index 100% rename from docs/interfaces/obograph.rst rename to docs/packages/interfaces/obograph.rst diff --git a/docs/interfaces/owl.rst b/docs/packages/interfaces/owl.rst similarity index 100% rename from docs/interfaces/owl.rst rename to docs/packages/interfaces/owl.rst diff --git a/docs/interfaces/patcher.rst b/docs/packages/interfaces/patcher.rst similarity index 100% rename from docs/interfaces/patcher.rst rename to docs/packages/interfaces/patcher.rst diff --git a/docs/interfaces/relation-graph.rst b/docs/packages/interfaces/relation-graph.rst similarity index 100% rename from docs/interfaces/relation-graph.rst rename to docs/packages/interfaces/relation-graph.rst diff --git a/docs/interfaces/search.rst b/docs/packages/interfaces/search.rst similarity index 100% rename from docs/interfaces/search.rst rename to docs/packages/interfaces/search.rst diff --git a/docs/interfaces/semantic-similarity.rst b/docs/packages/interfaces/semantic-similarity.rst similarity index 100% rename from docs/interfaces/semantic-similarity.rst rename to docs/packages/interfaces/semantic-similarity.rst diff --git a/docs/interfaces/subsetting.rst b/docs/packages/interfaces/subsetting.rst similarity index 100% rename from docs/interfaces/subsetting.rst rename to docs/packages/interfaces/subsetting.rst diff --git a/docs/interfaces/summary-statistics.rst b/docs/packages/interfaces/summary-statistics.rst similarity index 100% rename from docs/interfaces/summary-statistics.rst rename to docs/packages/interfaces/summary-statistics.rst diff --git a/docs/interfaces/text-annotator.rst b/docs/packages/interfaces/text-annotator.rst similarity index 100% rename from docs/interfaces/text-annotator.rst rename to docs/packages/interfaces/text-annotator.rst diff --git a/docs/interfaces/validator.rst b/docs/packages/interfaces/validator.rst similarity index 100% rename from docs/interfaces/validator.rst rename to docs/packages/interfaces/validator.rst diff --git a/docs/selectors.rst b/docs/packages/selectors.rst similarity index 74% rename from docs/selectors.rst rename to docs/packages/selectors.rst index 1947fc733..94be1812f 100644 --- a/docs/selectors.rst +++ b/docs/packages/selectors.rst @@ -1,6 +1,6 @@ .. _selectors: -Ontology Implementation Selectors +Ontology Adapter Selectors ================= In the command line interface and in Python code, *descriptors* can be used as a shorthand way to refer to either a local or remote ontology, plus @@ -11,8 +11,8 @@ to instantiate an implementation. The descriptors can also be used in the :ref:` Ontologies are available in a sometimes bewildering range of formats. One thing that constantly trips people up is the distinction between ontology *language* and *serialization*. OWL is an ontology - language, *not* a syntax. OWL has its own syntaxes such as Manchester, OWL-XML and Functional -- additionally - it can be *mapped* to RDF, which is its *own* datamodel/language, with its *own* serializations (Turtle, + language, *not* a syntax. OWL has its own syntaxes such as :term:`Manchester Syntax`, OWL-XML and :term:`Functional Syntax' -- additionally + it can be *mapped* to RDF, which is its *own* datamodel/language, with its *own* serializations (:term:`Turtle`, RDF/XML (NOT the same as OWL-XML), JSON-LD, ...). Confusing, huh? We are doing our best in this library to simplify things for you the user, please be patient! @@ -29,10 +29,10 @@ Examples Examples of scheme-less descriptors, implicit implementation: -- :code:`tests/input/go-nucleus.obo` - local obo format file loaded with pronto -- :code:`tests/input/go-nucleus.json` - local obojson format file loaded with pronto +- :code:`tests/input/go-nucleus.obo` - local :term:`OBO Format` file loaded with pronto +- :code:`tests/input/go-nucleus.json` - local :term:`OBO Graphs` json format file loaded with pronto - :code:`tests/input/go-nucleus.owl` - local OWL rdf/xml format file (loaded with rdflib at the moment, may change) -- :code:`tests/input/go-nucleus.owl.ttl` - local OWL turtle format file (loaded with rdflib at the moment, may change) +- :code:`tests/input/go-nucleus.owl.ttl` - local OWL :term:`Turtle` file (loaded with rdflib at the moment, may change) - :code:`tests/input/go-nucleus.db` - local sqlite3 db loaded with SqlImplementation - :code:`http://purl.obolibrary.org/obo/pato.obo` - NOT IMPLEMENTED; download locally for now - :code:`http://purl.obolibrary.org/obo/pato.owl` - NOT IMPLEMENTED; download locally for now @@ -41,21 +41,23 @@ Examples of explicit schemes: - :code:`sparql:tests/input/go-nucleus.owl.ttl` - local OWL file in turtle serialization - :code:`sparql:tests/input/go-nucleus.owl` - local OWL file (RDF/XML assumed unless explicit format option passed) -- :code:`pronto:tests/input/go-nucleus.obo` - local obo format file loaded with pronto -- :code:`pronto:tests/input/go-nucleus.json` - local obojson format file loaded with pronto +- :code:`pronto:tests/input/go-nucleus.obo` - local :term:`OBO Format` file loaded with pronto +- :code:`pronto:tests/input/go-nucleus.json` - local :term:`OBO Graphs` json format file loaded with pronto - :code:`pronto:tests/input/go-nucleus.owl` - local OWL rdf/xml format file (loaded with pronto at the moment may change) - :code:`pronto:tests/input/go-nucleus.db` - local sqlite3 db loaded with SqlImplementation -- :code:`prontolib:pato.obo` - remote obo format file loaded from OBO Library with pronto +- :code:`prontolib:pato.obo` - remote :term:`OBO Format` file loaded from OBO Library with pronto - :code:`prontolib:pato.owl` - remote owl format file loaded from OBO Library with pronto +- :code:`sqlite:tests/input/go-nucleus.db` - local SQLite file - :code:`sqlite:tests/input/go-nucleus.owl` - convert OWL to SQLite and query using sql_implementation +- :code:`sqlite:obo:go` - pre-made SQLite from :term:`Semantic SQL` registry - :code:`bioportal:` all of bioportal -- :code:`bioportal:pato` pato in bioportal (NOT IMPLEMENTED) +- :code:`bioportal:pato` pato in bioportal - :code:`ontobee:` all of ontobee -- :code:`ontobee:pato` pato in ontobee (NOT IMPLEMENTED) +- :code:`ontobee:pato` pato in ontobee - :code:`ols:` all of OLS - :code:`ols:pato` pato in OLS (NOT IMPLEMENTED) - :code:`ubergraph:` all of OLS -- :code:`ubergraph:pato` pato in ubergraph (NOT IMPLEMENTED) +- :code:`ubergraph:pato` pato in ubergraph See :ref:`cli` for more examples diff --git a/docs/utilities.rst b/docs/packages/utilities.rst similarity index 90% rename from docs/utilities.rst rename to docs/packages/utilities.rst index 08f41ae07..dafcc23da 100644 --- a/docs/utilities.rst +++ b/docs/packages/utilities.rst @@ -6,11 +6,6 @@ Where possible, this library uses simple standalone python functions organized i Note: some of these may involve iterated calls on a remote backend, these are candidates for being turned into :ref:`interfaces`. -.. currentmodule:: oaklib - :toctree: src - - selector - .. currentmodule:: oaklib.utilities .. autosummary:: diff --git a/poetry.lock b/poetry.lock index 509e69a85..1a6588189 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,5 +1,6 @@ # This file is automatically @generated by Poetry 1.4.1 and should not be changed by hand. + [[package]] name = "adeft" version = "0.11.2" @@ -966,14 +967,14 @@ files = [ [[package]] name = "docutils" -version = "0.17.1" +version = "0.18.1" description = "Docutils -- Python Documentation Utilities" category = "main" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" files = [ - {file = "docutils-0.17.1-py2.py3-none-any.whl", hash = "sha256:cf316c8370a737a022b72b56874f6602acf974a37a9fba42ec2876387549fc61"}, - {file = "docutils-0.17.1.tar.gz", hash = "sha256:686577d2e4c32380bb50cbb22f575ed742d58168cee37e99117a854bcd88f125"}, + {file = "docutils-0.18.1-py2.py3-none-any.whl", hash = "sha256:23010f129180089fbcd3bc08cfefccb3b890b0050e1ca00c867036e9d161b98c"}, + {file = "docutils-0.18.1.tar.gz", hash = "sha256:679987caf361a7539d76e584cbeddc311e3aee937877c87346f31debc63e9d06"}, ] [[package]] @@ -2557,30 +2558,30 @@ files = [ [[package]] name = "myst-parser" -version = "0.17.2" -description = "An extended commonmark compliant parser, with bridges to docutils & sphinx." +version = "1.0.0" +description = "An extended [CommonMark](https://spec.commonmark.org/) compliant parser," category = "main" optional = false python-versions = ">=3.7" files = [ - {file = "myst-parser-0.17.2.tar.gz", hash = "sha256:4c076d649e066f9f5c7c661bae2658be1ca06e76b002bb97f02a09398707686c"}, - {file = "myst_parser-0.17.2-py3-none-any.whl", hash = "sha256:1635ce3c18965a528d6de980f989ff64d6a1effb482e1f611b1bfb79e38f3d98"}, + {file = "myst-parser-1.0.0.tar.gz", hash = "sha256:502845659313099542bd38a2ae62f01360e7dd4b1310f025dd014dfc0439cdae"}, + {file = "myst_parser-1.0.0-py3-none-any.whl", hash = "sha256:69fb40a586c6fa68995e6521ac0a525793935db7e724ca9bac1d33be51be9a4c"}, ] [package.dependencies] -docutils = ">=0.15,<0.18" +docutils = ">=0.15,<0.20" jinja2 = "*" markdown-it-py = ">=1.0.0,<3.0.0" -mdit-py-plugins = ">=0.3.0,<0.4.0" +mdit-py-plugins = ">=0.3.4,<0.4.0" pyyaml = "*" -sphinx = ">=3.1,<5" -typing-extensions = "*" +sphinx = ">=5,<7" [package.extras] -code-style = ["pre-commit (>=2.12,<3.0)"] +code-style = ["pre-commit (>=3.0,<4.0)"] linkify = ["linkify-it-py (>=1.0,<2.0)"] -rtd = ["ipython", "sphinx-book-theme", "sphinx-panels", "sphinxcontrib-bibtex (>=2.4,<3.0)", "sphinxcontrib.mermaid (>=0.7.1,<0.8.0)", "sphinxext-opengraph (>=0.6.3,<0.7.0)", "sphinxext-rediraffe (>=0.2.7,<0.3.0)"] -testing = ["beautifulsoup4", "coverage", "docutils (>=0.17.0,<0.18.0)", "pytest (>=6,<7)", "pytest-cov", "pytest-param-files (>=0.3.4,<0.4.0)", "pytest-regressions"] +rtd = ["ipython", "pydata-sphinx-theme (==v0.13.0rc4)", "sphinx-autodoc2 (>=0.4.2,<0.5.0)", "sphinx-book-theme (==1.0.0rc2)", "sphinx-copybutton", "sphinx-design2", "sphinx-pyscript", "sphinx-tippy (>=0.3.1)", "sphinx-togglebutton", "sphinxext-opengraph (>=0.7.5,<0.8.0)", "sphinxext-rediraffe (>=0.2.7,<0.3.0)"] +testing = ["beautifulsoup4", "coverage[toml]", "pytest (>=7,<8)", "pytest-cov", "pytest-param-files (>=0.3.4,<0.4.0)", "pytest-regressions", "sphinx-pytest"] +testing-docutils = ["pygments", "pytest (>=7,<8)", "pytest-param-files (>=0.3.4,<0.4.0)"] [[package]] name = "nbclassic" @@ -4381,28 +4382,28 @@ pandas = ["pandas (>=1.3.5)"] [[package]] name = "sphinx" -version = "4.5.0" +version = "6.1.3" description = "Python documentation generator" category = "main" optional = false -python-versions = ">=3.6" +python-versions = ">=3.8" files = [ - {file = "Sphinx-4.5.0-py3-none-any.whl", hash = "sha256:ebf612653238bcc8f4359627a9b7ce44ede6fdd75d9d30f68255c7383d3a6226"}, - {file = "Sphinx-4.5.0.tar.gz", hash = "sha256:7bf8ca9637a4ee15af412d1a1d9689fec70523a68ca9bb9127c2f3eeb344e2e6"}, + {file = "Sphinx-6.1.3.tar.gz", hash = "sha256:0dac3b698538ffef41716cf97ba26c1c7788dba73ce6f150c1ff5b4720786dd2"}, + {file = "sphinx-6.1.3-py3-none-any.whl", hash = "sha256:807d1cb3d6be87eb78a381c3e70ebd8d346b9a25f3753e9947e866b2786865fc"}, ] [package.dependencies] alabaster = ">=0.7,<0.8" -babel = ">=1.3" -colorama = {version = ">=0.3.5", markers = "sys_platform == \"win32\""} -docutils = ">=0.14,<0.18" -imagesize = "*" -importlib-metadata = {version = ">=4.4", markers = "python_version < \"3.10\""} -Jinja2 = ">=2.3" -packaging = "*" -Pygments = ">=2.0" -requests = ">=2.5.0" -snowballstemmer = ">=1.1" +babel = ">=2.9" +colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""} +docutils = ">=0.18,<0.20" +imagesize = ">=1.3" +importlib-metadata = {version = ">=4.8", markers = "python_version < \"3.10\""} +Jinja2 = ">=3.0" +packaging = ">=21.0" +Pygments = ">=2.13" +requests = ">=2.25.0" +snowballstemmer = ">=2.0" sphinxcontrib-applehelp = "*" sphinxcontrib-devhelp = "*" sphinxcontrib-htmlhelp = ">=2.0.0" @@ -4412,8 +4413,8 @@ sphinxcontrib-serializinghtml = ">=1.1.5" [package.extras] docs = ["sphinxcontrib-websupport"] -lint = ["docutils-stubs", "flake8 (>=3.5.0)", "isort", "mypy (>=0.931)", "types-requests", "types-typed-ast"] -test = ["cython", "html5lib", "pytest", "pytest-cov", "typed-ast"] +lint = ["docutils-stubs", "flake8 (>=3.5.0)", "flake8-simplify", "isort", "mypy (>=0.990)", "ruff", "sphinx-lint", "types-requests"] +test = ["cython", "html5lib", "pytest (>=4.6)"] [[package]] name = "sphinx-click" @@ -4551,14 +4552,14 @@ test = ["flake8", "mypy", "pytest"] [[package]] name = "sphinxcontrib-mermaid" -version = "0.7.1" +version = "0.8.1" description = "Mermaid diagrams in yours Sphinx powered docs" category = "dev" optional = false -python-versions = "*" +python-versions = ">=3.7" files = [ - {file = "sphinxcontrib-mermaid-0.7.1.tar.gz", hash = "sha256:aa8a40b50ec86ad12824b62180240ca52a9bda8424455d7eb252eae9aa5d293c"}, - {file = "sphinxcontrib_mermaid-0.7.1-py2.py3-none-any.whl", hash = "sha256:3e20de1937c30dfa807e446bf99983d73d0dd3dc5c6524addda59800fe928762"}, + {file = "sphinxcontrib-mermaid-0.8.1.tar.gz", hash = "sha256:fa3e5325d4ba395336e6137d113f55026b1a03ccd115dc54113d1d871a580466"}, + {file = "sphinxcontrib_mermaid-0.8.1-py3-none-any.whl", hash = "sha256:15491c24ec78cf1626b1e79e797a9ce87cb7959cf38f955eb72dd5512aeb6ce9"}, ] [[package]] @@ -5360,4 +5361,4 @@ seaborn = [] [metadata] lock-version = "2.0" python-versions = ">=3.9,<4.0.0" -content-hash = "c78d6a0cecb3b18e731e5341d1159058318964db4a894661602fbc6baf8445f1" +content-hash = "e5faafca79f04662301d0741035c23976dd39095a7ac7ad9afbcaa34f948fe5f" diff --git a/pyproject.toml b/pyproject.toml index 1055696ce..b5616f0f3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,13 +38,13 @@ ndex2 = "^3.5.0" [tool.poetry.dev-dependencies] pytest = "^7.1.3" -Sphinx = "^4.4.0" +Sphinx = ">=6.1.3" jupyter = "^1.0.0" sphinx-rtd-theme = "^1.0.0" sphinx-click = "^3.1.0" -myst-parser = "^0.17.0" +myst-parser = ">=1.0.0" linkml = "^1.2.14" -sphinxcontrib-mermaid = "^0.7.1" +sphinxcontrib-mermaid = "^0.8.1" sphinx-copybutton = "0.5.1" coverage = "^6.3.2" diff --git a/src/oaklib/cli.py b/src/oaklib/cli.py index 083684ddc..c3518d956 100644 --- a/src/oaklib/cli.py +++ b/src/oaklib/cli.py @@ -1787,7 +1787,7 @@ def tree( This produces output like: - .code:: + .packages:: * [i] ENVO:00000094 ! volcanic feature * [i] ENVO:00000247 ! volcano diff --git a/src/oaklib/converters/obo_graph_to_fhir_converter.py b/src/oaklib/converters/obo_graph_to_fhir_converter.py index f00bb55da..fe7ea4080 100644 --- a/src/oaklib/converters/obo_graph_to_fhir_converter.py +++ b/src/oaklib/converters/obo_graph_to_fhir_converter.py @@ -57,7 +57,7 @@ class OboGraphToFHIRConverter(DataModelConverter): - An ontology is mapped to a FHIR `CodeSystem `_. - Each node in the OboGraph is converted to a _FHIR Concept_. - - Each CURIE/URI in the OboGraph is treated as a CURIE when it becomes a code (e.g. "HP:0000001") + - Each CURIE/URI in the OboGraph is treated as a CURIE when it becomes a packages (e.g. "HP:0000001") - Each edge in the OboGraph is converted to a _FHIR ConceptProperty_ if the `include_all_predicates` param is True. Otherwise, will only convert edges if the predicate is in the `DIRECT_PREDICATE_MAP`. @@ -131,15 +131,15 @@ def convert( ... "concept": [ { - "code": "HP:0012639", + "packages": "HP:0012639", "display": "Abnormal nervous system morphology", "definition": "A structural anomaly of the nervous system.", "designation": [ ... - :param code_system_id: The code system ID to use for identification on the server uploaded to. + :param code_system_id: The packages system ID to use for identification on the server uploaded to. See: https://hl7.org/fhir/resource-definitions.html#Resource.id - :param code_system_url: Canonical URL for the code system. + :param code_system_url: Canonical URL for the packages system. See: https://hl7.org/fhir/codesystem-definitions.html#CodeSystem.url :param native_uri_stems: A list of URI stems that will be used to determine whether a concept is native to the CodeSystem. (not implemented) @@ -156,8 +156,8 @@ def convert( do appear, this converter defaults to URIs for references, unless this flag is present, in which case the converter will attempt to construct CURIEs. (not implemented) - :param predicate_period_replacement: Predicates URIs populated into `CodeSystem.concept.property.code` - and `CodeSystem.concept.property.code`, but the popular FHIR server "HAPI" + :param predicate_period_replacement: Predicates URIs populated into `CodeSystem.concept.property.packages` + and `CodeSystem.concept.property.packages`, but the HAPI FHIR server has a bug in whih periods '.' cause errors. If this flag is present, periods will be replaced with underscores '_'. :return: FHIR CodeSystem object @@ -183,7 +183,7 @@ def convert( return target def code(self, uri: CURIE) -> str: - """Convert a code. + """Convert a packages. This is a wrapper onto curie_converter.compress @@ -227,13 +227,13 @@ def _convert_graph( ) # CodeSystem.property # todo's - # i. code: mostly URIs, which don't conform to [^\s]+(\s[^\s]+)* (https://hl7.org/fhir/datatypes.html#code) + # i. packages: mostly URIs, which don't conform to [^\s]+(\s[^\s]+)* (https://hl7.org/fhir/datatypes.html#code) # ii. description: can get, but tedious; downloading and caching and looking up in source ontologies - # iii. type: ideally Coding (https://build.fhir.org/datatypes.html#Coding). The property value is a code - # defined in an external code system. This may be used for translations, but is not the intent. + # iii. type: ideally Coding (https://build.fhir.org/datatypes.html#Coding). The property value is a packages + # defined in an external packages system. This may be used for translations, but is not the intent. # https://hl7.org/fhir/codesystem-concept-property-type.htm target.property = [ - CodeSystemProperty(code=x, uri=x, type="code") for x in self.predicates_to_export + CodeSystemProperty(code=x, uri=x, type="packages") for x in self.predicates_to_export ] return target @@ -251,7 +251,7 @@ def _convert_node( """Converts a node to a FHIR Concept. Also collects predicates to be included in CodeSystem.property.""" # TODO: Use new flags # self.uri(source.id) # <--- self.uri does not exist - # self.code is actually a curie. change to self.curie and add a self.code func? + # self.packages is actually a curie. change to self.curie and add a self.packages func? _id = self.code(source.id) logging.debug(f"Converting node {_id} from {source}") concept = Concept(code=_id, display=source.lbl) diff --git a/src/oaklib/datamodels/fhir.py b/src/oaklib/datamodels/fhir.py index e965d40bd..4569edc98 100644 --- a/src/oaklib/datamodels/fhir.py +++ b/src/oaklib/datamodels/fhir.py @@ -5,7 +5,7 @@ # id: https://w3id.org/oak/fhir # description: Schema for working with FHIR objects (Partial). This is currently intentionally incomplete. The # sole purpose of this rendering of FHIR is purely for the purposes of using OAK to convert native -# OAK data models into FHIR using Python code. +# OAK data models into FHIR using Python packages. # license: https://creativecommons.org/publicdomain/zero/1.0/ import dataclasses @@ -68,7 +68,7 @@ @dataclass class CodeSystem(YAMLRoot): """ - Declares the existence of and describes a code system or code system supplement + Declares the existence of and describes a packages system or packages system supplement """ _inherited_slots: ClassVar[List[str]] = [] @@ -305,7 +305,7 @@ class CodeSystemFilter(YAMLRoot): def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): if self._is_empty(self.code): - self.MissingRequiredField("code") + self.MissingRequiredField("packages") if not isinstance(self.code, str): self.code = str(self.code) @@ -340,7 +340,7 @@ class CodeSystemProperty(YAMLRoot): def __post_init__(self, *_: List[str], **kwargs: Dict[str, Any]): if self._is_empty(self.code): - self.MissingRequiredField("code") + self.MissingRequiredField("packages") if not isinstance(self.code, str): self.code = str(self.code) @@ -676,7 +676,7 @@ class slots: slots.concept__code = Slot( uri=FHIR.code, name="concept__code", - curie=FHIR.curie("code"), + curie=FHIR.curie("packages"), model_uri=FHIR.concept__code, domain=None, range=Optional[str], @@ -730,7 +730,7 @@ class slots: slots.conceptProperty__code = Slot( uri=FHIR.code, name="conceptProperty__code", - curie=FHIR.curie("code"), + curie=FHIR.curie("packages"), model_uri=FHIR.conceptProperty__code, domain=None, range=Optional[str], @@ -829,7 +829,7 @@ class slots: slots.codeSystemFilter__code = Slot( uri=FHIR.code, name="codeSystemFilter__code", - curie=FHIR.curie("code"), + curie=FHIR.curie("packages"), model_uri=FHIR.codeSystemFilter__code, domain=None, range=str, @@ -865,7 +865,7 @@ class slots: slots.codeSystemProperty__code = Slot( uri=FHIR.code, name="codeSystemProperty__code", - curie=FHIR.curie("code"), + curie=FHIR.curie("packages"), model_uri=FHIR.codeSystemProperty__code, domain=None, range=str, @@ -919,7 +919,7 @@ class slots: slots.coding__code = Slot( uri=FHIR.code, name="coding__code", - curie=FHIR.curie("code"), + curie=FHIR.curie("packages"), model_uri=FHIR.coding__code, domain=None, range=Optional[str], diff --git a/src/oaklib/datamodels/fhir.yaml b/src/oaklib/datamodels/fhir.yaml index 6c9202e3e..5b4c9aaa9 100644 --- a/src/oaklib/datamodels/fhir.yaml +++ b/src/oaklib/datamodels/fhir.yaml @@ -28,7 +28,7 @@ default_range: string classes: CodeSystem: class_uri: fhir:codesystem - description: Declares the existence of and describes a code system or code system supplement + description: Declares the existence of and describes a packages system or packages system supplement attributes: id: range: string @@ -46,7 +46,7 @@ classes: #range: Identifier version: name: - description: Name for this code system (computer friendly) + description: Name for this packages system (computer friendly) title: status: #range: PublicationStatus @@ -136,7 +136,7 @@ classes: description: range: string type: - # TODO: type: an enum of: code | Coding | string | integer | boolean | dateTime | decimal + # TODO: type: an enum of: packages | Coding | string | integer | boolean | dateTime | decimal # https://hl7:org/fhir/valueset-concept-property-type.html required: true range: string @@ -168,7 +168,7 @@ classes: #range: Identifier version: name: - description: Name for this code system (computer friendly) + description: Name for this packages system (computer friendly) title: status: #range: PublicationStatus diff --git a/src/oaklib/datamodels/search.py b/src/oaklib/datamodels/search.py index fc2db7e5f..2700e813f 100644 --- a/src/oaklib/datamodels/search.py +++ b/src/oaklib/datamodels/search.py @@ -24,7 +24,7 @@ def create_search_configuration(term: str) -> "SearchConfiguration": term is either a plaintext search term, or a search term prefixed by - - 1. a property code, one of t, ., l (for term, anything, label) + - 1. a property packages, one of t, ., l (for term, anything, label) - 2. a match type indicator, one of "~","/","=","^" For more documentation, see `Search docs `_ @@ -62,7 +62,7 @@ def create_search_configuration(term: str) -> "SearchConfiguration": elif prop == "x": props = [SearchProperty.MAPPED_IDENTIFIER] else: - raise ValueError(f"Unknown property code: {prop}") + raise ValueError(f"Unknown property packages: {prop}") cfg.properties = [SearchProperty(p) for p in props] return cfg else: diff --git a/src/oaklib/implementations/kgx/kgx_implementation.py b/src/oaklib/implementations/kgx/kgx_implementation.py index f8fdcc10c..66504bde9 100644 --- a/src/oaklib/implementations/kgx/kgx_implementation.py +++ b/src/oaklib/implementations/kgx/kgx_implementation.py @@ -210,13 +210,13 @@ class KGXImplementation( To connect, either use KGXImplementation directly: - .. code:: python + .. packages:: python >>> oi = KGXImplementation(OntologyResource(slug=f"sqlite:///{path}")) Or use a selector: - .. code:: python + .. packages:: python >>> oi = get_implementation_from_shorthand('obojson:path/to/my/ontology.db') diff --git a/src/oaklib/implementations/obograph/obograph_implementation.py b/src/oaklib/implementations/obograph/obograph_implementation.py index 0d50b868d..3df01773a 100644 --- a/src/oaklib/implementations/obograph/obograph_implementation.py +++ b/src/oaklib/implementations/obograph/obograph_implementation.py @@ -75,7 +75,7 @@ class OboGraphImplementation( To use: - .. code :: python + .. packages :: python >>> oi = get_implementation_from_shorthand('obojson:path/to/my/ontology.json') >>> for term in oi.entities(): @@ -329,7 +329,7 @@ def incoming_relationship_map(self, *args, **kwargs) -> RELATIONSHIP_MAP: # TODO: DRY def basic_search(self, search_term: str, config: SearchConfiguration = None) -> Iterable[CURIE]: - # TODO: move up, avoid repeating code + # TODO: move up, avoid repeating packages if config is None: config = SearchConfiguration() matches = [] diff --git a/src/oaklib/implementations/ontobee/ontobee_implementation.py b/src/oaklib/implementations/ontobee/ontobee_implementation.py index 589e54278..81c3db437 100644 --- a/src/oaklib/implementations/ontobee/ontobee_implementation.py +++ b/src/oaklib/implementations/ontobee/ontobee_implementation.py @@ -20,7 +20,7 @@ class OntobeeImplementation( An OntobeeImplementation can be initialed by: - .. code:: python + .. packages:: python >>> oi = OntobeeImplementation() @@ -28,7 +28,7 @@ class OntobeeImplementation( Alternatively, use a selector: - .. code :: python + .. packages :: python >>> oi = get_implementation_from_shorthand("ontobee:") >>> for a in oi.ancestors("UBERON:0002398", predicates=[IS_A]): diff --git a/src/oaklib/implementations/ontoportal/bioportal_implementation.py b/src/oaklib/implementations/ontoportal/bioportal_implementation.py index 2e6c93955..9c93ff4d9 100644 --- a/src/oaklib/implementations/ontoportal/bioportal_implementation.py +++ b/src/oaklib/implementations/ontoportal/bioportal_implementation.py @@ -14,7 +14,7 @@ class BioPortalImplementation(OntoPortalImplementationBase): Example: - .. code :: python + .. packages :: python >>> api_key = get_apikey_value(BioPortalImplementation.ontoportal_client_class.name) >>> oi = BioPortalImplementation(api_key=api_key) diff --git a/src/oaklib/implementations/pronto/pronto_implementation.py b/src/oaklib/implementations/pronto/pronto_implementation.py index e3dcf8807..e882179e2 100644 --- a/src/oaklib/implementations/pronto/pronto_implementation.py +++ b/src/oaklib/implementations/pronto/pronto_implementation.py @@ -110,21 +110,21 @@ class ProntoImplementation( To load a local file: - .. code:: python + .. packages:: python >>> resource = OntologyResource(slug='go.obo', directory='input', local=True) >>> oi = ProntoImplementation(resource) To load from the OBO library: - .. code:: python + .. packages:: python >>> resource = OntologyResource(local=False, slug='go.obo')) >>> oi = ProntoImplementation(resource) Currently this implementation implements most of the BaseOntologyInterface - .. code:: python + .. packages:: python >>> rels = oi.outgoing_relationships('GO:0005773') >>> for rel, parents in rels.items(): diff --git a/src/oaklib/implementations/simpleobo/simple_obo_implementation.py b/src/oaklib/implementations/simpleobo/simple_obo_implementation.py index c4a1377d2..fc732c9c8 100644 --- a/src/oaklib/implementations/simpleobo/simple_obo_implementation.py +++ b/src/oaklib/implementations/simpleobo/simple_obo_implementation.py @@ -434,7 +434,7 @@ def synonym_property_values( def map_shorthand_to_curie(self, rel_code: PRED_CODE) -> PRED_CURIE: """ - Maps either a true relationship type CURIE or a shorthand code to a CURIE. + Maps either a true relationship type CURIE or a shorthand packages to a CURIE. See `section 5.9 `_ @@ -486,7 +486,7 @@ def relationships( yield s, p, o def basic_search(self, search_term: str, config: SearchConfiguration = None) -> Iterable[CURIE]: - # TODO: move up, avoid repeating code + # TODO: move up, avoid repeating packages if config is None: config = SearchConfiguration() matches = [] diff --git a/src/oaklib/implementations/sqldb/sql_implementation.py b/src/oaklib/implementations/sqldb/sql_implementation.py index a003b9810..8cf56277f 100644 --- a/src/oaklib/implementations/sqldb/sql_implementation.py +++ b/src/oaklib/implementations/sqldb/sql_implementation.py @@ -258,13 +258,13 @@ class SqlImplementation( To connect, either use SqlImplementation directly: - .. code:: python + .. packages:: python >>> oi = SqlImplementation(OntologyResource(slug=f"sqlite:///{path}")) Or use a selector: - .. code:: python + .. packages:: python >>> oi = get_implementation_from_shorthand('obojson:path/to/my/ontology.db') @@ -1596,7 +1596,7 @@ def _check_slot( if slot.pattern: # check values against regexes # NOTE: this may be slow as we have to do this in - # code rather than SQL. Some SQL engines have regex support, + # packages rather than SQL. Some SQL engines have regex support, # and we should leverage that when it exists re_pattern = re.compile(slot.pattern) main_q = self.session.query(Statements).filter(Statements.predicate == predicate) diff --git a/src/oaklib/implementations/ubergraph/ubergraph_implementation.py b/src/oaklib/implementations/ubergraph/ubergraph_implementation.py index 0b8995b3d..b225099f9 100644 --- a/src/oaklib/implementations/ubergraph/ubergraph_implementation.py +++ b/src/oaklib/implementations/ubergraph/ubergraph_implementation.py @@ -64,7 +64,7 @@ class UbergraphImplementation( An UbergraphImplementation can be initialed by: - .. code:: python + .. packages:: python >>> oi = UbergraphImplementation() diff --git a/src/oaklib/implementations/uniprot/uniprot_implementation.py b/src/oaklib/implementations/uniprot/uniprot_implementation.py index 46a0a0177..d2b40ba0e 100644 --- a/src/oaklib/implementations/uniprot/uniprot_implementation.py +++ b/src/oaklib/implementations/uniprot/uniprot_implementation.py @@ -84,7 +84,7 @@ class UniprotImplementation( An UniprotImplementation can be initialed by: - .. code:: python + .. packages:: python >>> oi = UniprotImplementation() diff --git a/src/oaklib/implementations/wikidata/wikidata_implementation.py b/src/oaklib/implementations/wikidata/wikidata_implementation.py index 6e5d1934b..64ecfd331 100644 --- a/src/oaklib/implementations/wikidata/wikidata_implementation.py +++ b/src/oaklib/implementations/wikidata/wikidata_implementation.py @@ -62,7 +62,7 @@ class WikidataImplementation( An wikidataImplementation can be initialed by: - .. code:: python + .. packages:: python >>> oi = WikidataImplementation.create() diff --git a/src/oaklib/interfaces/mapping_provider_interface.py b/src/oaklib/interfaces/mapping_provider_interface.py index 2a292ce26..43f721e24 100644 --- a/src/oaklib/interfaces/mapping_provider_interface.py +++ b/src/oaklib/interfaces/mapping_provider_interface.py @@ -16,7 +16,7 @@ class MappingProviderInterface(BasicOntologyInterface, ABC): """ - # TODO: move code from mapping-walker + # TODO: move packages from mapping-walker def inject_mapping_labels(self, mappings: Iterable[Mapping]) -> None: for mapping in mappings: diff --git a/src/oaklib/interfaces/obolegacy_interface.py b/src/oaklib/interfaces/obolegacy_interface.py index 6258273bd..f18ec2d3b 100644 --- a/src/oaklib/interfaces/obolegacy_interface.py +++ b/src/oaklib/interfaces/obolegacy_interface.py @@ -16,7 +16,7 @@ class OboLegacyInterface(BasicOntologyInterface, ABC): def map_shorthand_to_curie(self, rel_code: PRED_CODE) -> PRED_CURIE: """ - Maps either a true relationship type CURIE or a shorthand code to a CURIE. + Maps either a true relationship type CURIE or a shorthand packages to a CURIE. See `section 5.9 `_ diff --git a/src/oaklib/selector.py b/src/oaklib/selector.py index a67b85154..1f59a88c5 100644 --- a/src/oaklib/selector.py +++ b/src/oaklib/selector.py @@ -34,7 +34,7 @@ def get_adapter(descriptor: str, format: str = None) -> BasicOntologyInterface: Example: - .. code :: python + .. packages :: python >>> from oaklib import get_adapter >>> @@ -54,7 +54,7 @@ def get_adapter(descriptor: str, format: str = None) -> BasicOntologyInterface: If you omit the scheme then OAK will try to guess the scheme based on the suffix of the descriptor - .. code :: python + .. packages :: python >>> from oaklib import get_adapter >>> ## Use an adapter that is able to read OBO Format: diff --git a/src/oaklib/utilities/identifier_utils.py b/src/oaklib/utilities/identifier_utils.py index b6d4e405c..bd6a674ce 100644 --- a/src/oaklib/utilities/identifier_utils.py +++ b/src/oaklib/utilities/identifier_utils.py @@ -15,7 +15,7 @@ def string_as_base64_curie(input: str) -> CURIE: def synonym_type_code_from_curie(curie: CURIE) -> str: """ - Get the synonym type code from a CURIE + Get the synonym type packages from a CURIE In many OBO ontologies, the synonym type is encoded as a hash URI, which compacts to a curie of form @@ -23,7 +23,7 @@ def synonym_type_code_from_curie(curie: CURIE) -> str: - obo:chebi#BRAND_NAME - obo:hp#layperson - In these cases, the code is the part after the hash + In these cases, the packages is the part after the hash See: @@ -31,7 +31,7 @@ def synonym_type_code_from_curie(curie: CURIE) -> str: - https://github.com/INCATools/ontology-access-kit/issues/385 :param curie: represents synonym type - :return: code for the synonym type, or if cannot be determined, the input curie + :return: packages for the synonym type, or if cannot be determined, the input curie """ if "#" in curie: return curie.split("#")[-1] diff --git a/src/oaklib/utilities/table_filler.py b/src/oaklib/utilities/table_filler.py index 67882e571..175821fa4 100644 --- a/src/oaklib/utilities/table_filler.py +++ b/src/oaklib/utilities/table_filler.py @@ -218,10 +218,10 @@ def fill_table_column(self, rows: List[ROW], dependency: ColumnDependency): } fwd_mapping = {} rev_mapping = {} - # Note to developers: it may be tempting to genericize the code below, + # Note to developers: it may be tempting to genericize the packages below, # but be very careful before doing this. Logic for different properties # may be subtly different, and over-genericizing may lead to overly - # abstract or less efficient code + # abstract or less efficient packages if rel == LABEL_KEY: if pk_vals: for curie, label in oi.labels(list(pk_vals)): @@ -327,7 +327,7 @@ def extract_metadata_from_linkml( For example, with the following schema - .. code-block :: + .. packages-block :: classes: Person: