Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partial robot template implementation. #722

Merged
merged 9 commits into from
Mar 21, 2024
Merged

Conversation

cmungall
Copy link
Collaborator

@cmungall cmungall commented Mar 20, 2024

ROBOT Template Adapter

This is experimental and incomplete.

This is an extension of the TabularInterface adapter that provides
access to a collection of ROBOT templates.

Note that it does NOT use the ROBOT tool itself to access these, it
uses custom code that only implements a portion of the spec.

One of the main driving use cases here is to enable KGCL commands with
ontologies that use ROBOT templates.

For example, the OBI templates folder on
GitHub

contains a collection of ROBOT templates.

  • assays.tsv
  • biobank-specimens.tsv
  • ...

Assuming these are in a local path my/path/templates, you can use a
selector:

runoak -i robottemplate:my/path/templates COMMAND ...

Or in python:

from oaklib import get_adapter
adapter = get_adapter('robottemplate:my/path/templatestemplates')

Note that this does NOT trigger compilation of the templates into OWL -
this implementation works on the templates as a collection of TSVs,
facilitating update operations.

Command Line Examples

From here we assume your templates are in a local folder ./templates.

Basic operations

Currently very few operations are supported, but you can do basic things
like:

runoak -i robottemplate:templates info OBI:0002516

Returns:

  • OBI:0002516 ! brain specimen

Or limited search:

runoak -i robottemplate:templates info l~brain

Returns:

  • OBI:0002516 ! brain specimen
  • OBI:0003357 ! brain region atlas image data set
  • ...

Applying KGCL commands

You can also apply KGCL commands:

runoak -i robottemplate:templates apply \
  "rename OBI:0002516 from 'brain specimen' to 'brain sample'" -o new_templates

This will create a new copy of all templates in new_templates, with
the label column modified in biobank-specimens.tsv

only a small subset of KGCL is implemented so far

Simple ROBOT-template backed implementation.

    .. note::

        Highly incomplete!

    This provides a minimal implementation of some interfaces using a collection of ROBOT tenplates as
    a backend.

    One of the main driving use cases here is to enable KGCL commands with ontologies that use ROBOT
    templates.

    For example, the `OBI templates folder on GitHub <https://github.com/obi-ontology/obi/tree/016ca67c7e6f31a048780cee56afde24d4af7125/src/ontology/templates>`_
    contains a collection of ROBOT templates.

    - assays.tsv
    - biobank-specimens.tsv
    - ...

    Assuming these are in a local path ``templates``, you can use a selector:

    .. code-block:: bash

        runoak -i robottemplate:templates COMMAND ...

    Note that this does NOT trigger compilation of the templates into OWL - this implementation works
    on the templates as a collection of TSVs, facilitating update operations.

    Currently very few operations are supported, but you can do basic things like:

    .. code-block:: bash

        runoak -i robottemplate:templates info OBI:0002516

        OBI:0002516 ! brain specimen

    You can also apply KGCL commands:

    .. code-block:: bash

        runoak -i robottemplate:templates apply \
          "rename OBI:0002516 from 'brain specimen' to 'brain sample'" -o new_templates

    This will create a new copy of all templates in ``new_templates``, with the label
    column modified in biobank-specimens.tsv

    .. warning::

        only a small subset of KGCL is implemented so far.
Skipping patcher test until INCATools/kgcl#64 is fixed
@codecov-commenter
Copy link

codecov-commenter commented Mar 20, 2024

Codecov Report

Attention: Patch coverage is 70.77295% with 121 lines in your changes are missing coverage. Please review.

Project coverage is 74.99%. Comparing base (fb0b668) to head (f317349).

Files Patch % Lines
...entations/tabular/robot_template_implementation.py 65.10% 97 Missing ⚠️
tests/test_implementations/test_robot_template.py 73.61% 19 Missing ⚠️
.../implementations/tabular/tabular_implementation.py 91.93% 5 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #722      +/-   ##
==========================================
- Coverage   75.49%   74.99%   -0.50%     
==========================================
  Files         269      272       +3     
  Lines       31443    31843     +400     
==========================================
+ Hits        23737    23882     +145     
- Misses       7706     7961     +255     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cmungall cmungall merged commit 8da76e1 into main Mar 21, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants