.. _command_line_interface: Command Line ============ .. note :: we follow the `CLIG `_ guidelines as far as possible General Guidelines ------------------ .. note :: if you are running this as an internal OAK developer you need to precede the command with :code:`poetry shell` The general structure is: .. code:: bash runoak --input HANDLE COMMAND [COMMAND ARGS AND OPTIONS] The value for :code:`--input` (which can be shorted to :code:`-i`) is specified in the :ref:`selectors` documentation. Examples: .. code:: bash runoak --input ubergraph: COMMAND [COMMAND ARGS AND OPTIONS] runoak --input fbbt.obo COMMAND [COMMAND ARGS AND OPTIONS] runoak --input cl.db COMMAND [COMMAND ARGS AND OPTIONS] runoak --input sqlite:obo:cl COMMAND [COMMAND ARGS AND OPTIONS] It can be useful to create aliases for individual ontologies. For example, to create an alias for the Uberon ontology: .. code:: bash alias uberon='runoak -i obo:sqlite:uberon' alias cl='runoak -i obo:sqlite:cl' alias obi='runoak -i obo:sqlite:obi' You can specify further implementations with :code:`-a` which will create an :ref:`aggregator` implementation that wraps multiple implementations. For example, you can multiplex queries over different endpoints. Common Patterns --------------- Term Lists ^^^^^^^^^^^ Many commands take a *term* or a *list of terms* as their primary argument. These are typically one of: - a :ref:`CURIE` such as :code:`UBERON:0000955` - a :ref:`search_syntax` term, which is either: - an exact match to a label; for example "limb" or "plasma membrane" - a compound search term such as :code:`t~limb` which finds terms with partial matches to limb Search terms are *expanded* to matching CURIEs, and then fed into the command. For example, (assuming the alias above) the following command will look up two terms using their labels: .. code-block:: bash uberon info hand foot This is equivalent to: .. code-block:: bash uberon info UBERON:0002398 UBERON:0002397 Predicates ^^^^^^^^^^ Many commands take a :code:`--predicates` option (shortened to :code:`-p`). This specifies a list of predicates (aka *relationship types*, see :ref:`Predicates`) to be used in filtering. The list is specified as a comma-delimited list (no spaces) of CURIEs. For many biological ontologies, it can be useful to filter on is_a (rdfs:subClassOf) and part_of (BFO:0000050) so the command line interface understands shortcuts for these: - :code:`i`: is-a (i.e rdfs:subClassOf between two named classes) - :code:`p`: part-of For example, to draw the subgraph of terms starting from "hand" and "foot" and tracing upwards through is_a and part_of relationships: .. code-block:: bash uberon viz -p i,p hand foot Commands ----------- The following section is autogenerated from the inline docs. You should get the same results by running: .. code-block:: bash runoak COMMAND --help For example, to get help on the ``viz`` command: .. code-block:: bash runoak viz --help .. currentmodule:: oaklib.cli .. click:: oaklib.cli:main :prog: runoak :show-nested: