Skip to content

Commit

Permalink
docs: improve documentation structure
Browse files Browse the repository at this point in the history
  • Loading branch information
jjjermiah committed Mar 16, 2024
1 parent 5ff0550 commit 1404c10
Show file tree
Hide file tree
Showing 15 changed files with 232 additions and 205 deletions.
6 changes: 6 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@
copyright = "2023, Jermiah Joseph"
author = "Jermiah Joseph"

import nbiatoolkit

# The full version, including alpha/beta/rc tags
release: str = nbiatoolkit.__version__

# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
Expand All @@ -28,6 +33,7 @@
"sphinx.ext.viewcode",
"sphinx_tabs.tabs",
"sphinx_exec_code",
"sphinx.ext.autosectionlabel",
]
autoapi_dirs = ["../src/nbiatoolkit"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ If you would like to return the data as a pandas DataFrame, you can pass the
Feel free to open an issue on the GitHub repository if you would like to see this feature added.


Alternatively, you can set the return type for all methods by passing the `return_type` argument to the NBIAClient class.
Alternatively, you can set the return type for all methods by passing the `return_type` argument when
initializing the NBIAClient class.

.. tabs::

Expand All @@ -141,7 +142,8 @@ Alternatively, you can set the return type for all methods by passing the `retur

Logging
^^^^^^^
The client can be initialized with a log level to control the verbosity of the logs. This is primarily intended for debugging and development purposes.
The client can be initialized with a log level to control the verbosity of the logs. This is primarily
intended for debugging and development purposes.
The default log level is 'INFO' and the available log levels are `DEBUG`, `INFO`, `WARNING`, `ERROR`.

.. tabs::
Expand Down
40 changes: 40 additions & 0 deletions docs/getting_started/Installation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Installation
____________

`nbiatoolkit` is currently under development and is not guaranteed to be stable.
Please refer to the `1.0.0 Stable Release Milestone <https://github.com/jjjermiah/nbia-toolkit/milestone/1>`_
for the roadmap to the first stable release.

PyPi Installation
~~~~~~~~~~~~~~~~~

The easiest way to install `nbiatoolkit` is to use `pip` to install it from the
`Python Package Index (PyPi) <https://pypi.org/project/nbiatoolkit/>`_.

.. code-block:: console
$ pip install nbiatoolkit
***NOTE: It is recommended that you install the package in a conda or virtual environment.***

Conda Installation
~~~~~~~~~~~~~~~~~~

Though the package is not available on conda, you can create a conda environment and install the package using pip:

.. code-block:: console
$ conda create -n nbia python=3.12
$ conda activate nbia
$ pip install nbiatoolkit
Virtual Environment Installation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you prefer to use a virtual environment, you can create one and install the package using pip:

.. code-block:: console
$ python3 -m venv nbia
$ source nbia/bin/activate
$ pip install nbiatoolkit
File renamed without changes.
File renamed without changes.
17 changes: 0 additions & 17 deletions docs/index.md

This file was deleted.

32 changes: 32 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.. include:: ../README.md
:parser: myst_parser.sphinx_

.. toctree::
:caption: Getting started
:name: getting-started
:hidden:
:maxdepth: 2

getting_started/NBIA.md
getting_started/Installation.rst
getting_started/InitializeClient.rst
getting_started/logger.rst

.. toctree::
:caption: Querying API
:name: querying-api
:hidden:
:maxdepth: 2

querying_api/ExploringCollections.rst
querying_api/ExploringModalities.rst

.. toctree::
:caption: Project Info
:name: project-info
:hidden:
:maxdepth: 2

project_info/CONTRIBUTING.md
project_info/CHANGELOG.md
project_info/CONDUCT.md
37 changes: 0 additions & 37 deletions docs/markdowns/Installation.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CHANGELOG
# Changelog



Expand Down Expand Up @@ -40,7 +40,7 @@

* Merge pull request #123 from jjjermiah/development

docs: Start building better documentation.
docs: Start building better documentation.
feat: Enhance logging functionality ([`5bb80c3`](https://github.com/jjjermiah/nbia-toolkit/commit/5bb80c3056fab8804ea789aa37702d9fd6741797))

* Merge pull request #122 from jjjermiah/88-logger-functionality
Expand Down
2 changes: 1 addition & 1 deletion docs/markdowns/CONDUCT.md → docs/project_info/CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CODE OF CONDUCT
# Code of Conduct

## Our Pledge

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# CONTRIBUTING
# Contributing

Contributions are welcome, and they are greatly appreciated! Every little bit
helps, and credit will always be given.
Expand Down
74 changes: 74 additions & 0 deletions docs/querying_api/ExploringCollections.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
Collection Methods
^^^^^^^^^^^^^^^^^^
The simplest way to get a list of collections is to use the
:meth:`nbiatoolkit.NBIAClient.getCollections` method.
This method returns a list of all collections available in the NBIA database.

The method has the following signature:

.. automethod:: nbiatoolkit.NBIAClient.getCollections

Passing no parameters to the method will return a list of all collections available in the NBIA database.
Passing a `prefix` parameter will return a list of collections that match the prefix.

.. tabs::

.. tab:: Python

.. exec_code::

# --- hide: start ---
from nbiatoolkit import NBIAClient
from pprint import pprint as print
# --- hide: stop ---

client = NBIAClient(return_type = "dataframe")
collections_df = client.getCollections(prefix='TCGA')

print(f"The number of available collections is {len(collections_df)}")

print(collections_df)


.. automethod:: nbiatoolkit.NBIAClient.getCollectionDescriptions

.. tabs::

.. tab:: Python

.. exec_code::

# --- hide: start ---
from nbiatoolkit import NBIAClient
from pprint import pprint as print
# --- hide: stop ---

with NBIAClient() as client:
desc = client.getCollectionDescriptions(collectionName = "TCGA-BLCA")[0]

print(desc['Description'])
print(desc['DescriptionURI'])
print(desc['LastUpdated'])



.. automethod:: nbiatoolkit.NBIAClient.getCollectionPatientCount


.. tabs::

.. tab:: Python

.. exec_code::

# --- hide: start ---
from nbiatoolkit import NBIAClient
# --- hide: stop ---

with NBIAClient() as client:
counts_df = client.getCollectionPatientCount(
prefix = "TCGA",
return_type="dataframe"
)

print(counts_df)
62 changes: 62 additions & 0 deletions docs/querying_api/ExploringModalities.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@


Modality Methods
^^^^^^^^^^^^^^^^^^
The :meth:`getModalityValues` method can provide insight to the available modality types in the NBIA database.

The method has the following signature:

.. automethod:: nbiatoolkit.NBIAClient.getModalityValues

Passing no parameters to the method will return a list of all modality types available in the NBIA database.
Filtering by :code:`Collection` and :code:`BodyPartExamined` is also possible.
The :code:`Counts` parameter can be set to :code:`True` to return the number of patients for each modality type.

.. tabs::

.. tab:: Python

.. tabs::

.. tab:: Default Query
.. exec_code::

# --- hide: start ---
from nbiatoolkit import NBIAClient
# --- hide: stop ---

with NBIAClient(return_type="dataframe") as client:
modalities = client.getModalityValues()

print(modalities)

.. tab:: Filtered Query

.. exec_code::

# --- hide: start ---
from nbiatoolkit import NBIAClient
# --- hide: stop ---

with NBIAClient(return_type="dataframe") as client:
modalities = client.getModalityValues(
Collection = "TCGA-BLCA",
)

print(modalities)

.. tab:: Counts Query

.. exec_code::

# --- hide: start ---
from nbiatoolkit import NBIAClient
# --- hide: stop ---

with NBIAClient(return_type="dataframe") as client:
modalities = client.getModalityValues(
Collection = "TCGA-BLCA",
Counts = True
)

print(modalities)

0 comments on commit 1404c10

Please sign in to comment.