Skip to content

Commit

Permalink
Add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
gromdimon committed Sep 16, 2024
1 parent e230979 commit ab1a945
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 35 deletions.
11 changes: 8 additions & 3 deletions .env.dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
DEBUG=1
USE_CACHE=1
# Disable debug mode per default
DEBUG=0
# Disable cache to avoid memory issues
USE_CACHE=0
# Use the REEV API. Change it if you have other instance of REEV.
API_REEV_URL=https://reev.cubi.bihealth.org/internal/proxy
SEQREPO_DATA_DIR=/home/username/seqrepo/master
# Default path to seqrepo data for Docker. Change it to your local development path.
# It can look like this: "/home/<username>/seqrepo/master"
SEQREPO_DATA_DIR=
12 changes: 0 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,6 @@ RUN sed -i -e 's/if aliases_cur.fetchone() is not None/if next(aliases_cur, None
.venv/lib/python3.12/site-packages/biocommons/seqrepo/cli.py

# Set up seqrepo
# RUN mkdir -p /usr/local/share/seqrepo \
# && chown -R root:root /usr/local/share/seqrepo
# RUN pipenv run seqrepo init -i auto-acmg
# RUN pipenv run seqrepo fetch-load -i auto-acmg -n RefSeq NC_000001.10 NC_000002.11 NC_000003.11 \
# NC_000004.11 NC_000005.9 NC_000006.11 NC_000007.13 NC_000008.10 NC_000009.11 NC_000010.10 \
# NC_000011.9 NC_000012.11 NC_000013.10 NC_000014.8 NC_000015.9 NC_000016.9 NC_000017.10 \
# NC_000018.9 NC_000019.9 NC_000020.10 NC_000021.8 NC_000022.10 NC_000023.10 NC_000024.9 \
# NC_012920.1 NC_000001.11 NC_000002.12 NC_000003.12 NC_000004.12 NC_000005.10 NC_000006.12 \
# NC_000007.14 NC_000008.11 NC_000009.12 NC_000010.11 NC_000011.10 NC_000012.12 NC_000013.11 \
# NC_000014.9 NC_000015.10 NC_000016.10 NC_000017.11 NC_000018.10 NC_000019.10 NC_000020.11 \
# NC_000021.9 NC_000022.11 NC_000023.11 NC_000024.10 NC_012920.1

# The seqrepo data is too large to be included in the image
VOLUME /usr/local/share/seqrepo/
VOLUME /home/auto-acmg/seqrepo/master
Expand Down
90 changes: 70 additions & 20 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,53 +20,103 @@ containing the Dockerfile. Use the following command to build the image:
This command builds the Docker image with the tag ``auto-acmg``. You can replace ``auto-acmg`` with
any other tag suitable for your deployment or versioning schema.

Setting Up Volumes
------------------

The AutoACMG Docker container requires access to SeqRepo data directories for sequence information.
You must set up volumes that the Docker container can use to access this data without needing to
copy it into the container directly. Here's how you set up these volumes:

1. **SeqRepo Data Volume:** This volume stores the SeqRepo datasets.
2. **Custom Project Data Volume:** This volume stores the custom project seqrepo data.

Ensure these directories exist on your host and are populated with the necessary data:

.. code-block:: bash
mkdir -p /usr/local/share/seqrepo
chown -R root:root /usr/local/share/seqrepo
.. code-block:: bash
pipenv run seqrepo init -i auto-acmg
.. code-block:: bash
pipenv run seqrepo fetch-load -i auto-acmg -n RefSeq NC_000001.10 NC_000002.11 NC_000003.11 \
NC_000004.11 NC_000005.9 NC_000006.11 NC_000007.13 NC_000008.10 NC_000009.11 NC_000010.10 \
NC_000011.9 NC_000012.11 NC_000013.10 NC_000014.8 NC_000015.9 NC_000016.9 NC_000017.10 \
NC_000018.9 NC_000019.9 NC_000020.10 NC_000021.8 NC_000022.10 NC_000023.10 NC_000024.9 \
NC_012920.1 NC_000001.11 NC_000002.12 NC_000003.12 NC_000004.12 NC_000005.10 NC_000006.12 \
NC_000007.14 NC_000008.11 NC_000009.12 NC_000010.11 NC_000011.10 NC_000012.12 NC_000013.11 \
NC_000014.9 NC_000015.10 NC_000016.10 NC_000017.11 NC_000018.10 NC_000019.10 NC_000020.11 \
NC_000021.9 NC_000022.11 NC_000023.11 NC_000024.10 NC_012920.1
.. note::

The paths used in this example are for demonstration purposes! You should adjust the paths
to match your actual directory structure and ensure that the directories have the correct
permissions for Docker to access them. The ``/usr/local/share/seqrepo`` directory is the default
location for Linux systems. The ``/home/auto-acmg/seqrepo/master`` directory is an example of
a custom project data directory.

Running the Docker Image
------------------------

Once the Docker image is built, you can run it using the following command:
Once the Docker image is built, you can run it using the following command to include the volumes:

.. code-block:: bash
docker run -d -p 8000:8000 --env-file .env.dev auto-acmg
docker run -d -p 8000:8000 --env-file .env \
-v /usr/local/share/seqrepo:/usr/local/share/seqrepo \
-v /home/auto-acmg/seqrepo/master:/home/auto-acmg/seqrepo/master \
auto-acmg
Here, ``-d`` runs the container in detached mode (in the background), ``-p 8000:8000`` maps port
8000 of the container to port 8000 on the host, making the application accessible via
``localhost:8000``. The ``--env-file .env.dev`` option tells Docker to use the environment variables d
efined in the ``.env.dev`` file. Replace ``.env.dev`` with the path to your actual environment
file if different.
This command runs the container in detached mode (in the background), maps port 8000 of the
container to port 8000 on the host, making the application accessible via ``localhost:8000``.
The ``--env-file .env`` option tells Docker to use the environment variables defined in the
``.env`` file. Replace ``.env`` with the path to your actual environment file if different.
The ``-v`` flags map the local directories to their respective directories within the container,
ensuring that SeqRepo data is accessible.

.. note::

You have to configure the environment file before running the Docker container. See the next
section for details.
You must configure the environment file before running the Docker container and ensure that
the directories used for volumes are properly set up and have the correct permissions for
Docker to access them. See the configuration details in the sections below.

Configuring the Environment File
--------------------------------

The application can be configured using environment variables. An example configuration file named
``.env.dev`` might look like this:

.. code-block:: none
API_V1_STR=/api/v1
DATABASE_URL=postgres://user:password@localhost/dbname
SECRET_KEY=your_secret_key
Adjust the values according to your environment. Here are brief descriptions of the variables. Note
that not all variables are required for the application to run. More info below.:

Adjust the values according to your environment. Here are brief descriptions of the variables:

- ``API_V1_STR``: Base path for API endpoints.
- ``DEBUG``: Enable or disable debug mode.
- ``USE_CACHE``: Enable or disable caching of API responses.
- ``CACHE_DIR``: Path to the cache directory.
- ``API_V1_STR``: Base path for API endpoints.
- ``API_REEV_URL``: URL of the REEV API.
- ``SEQREPO_DATA_DIR``: Path to the SeqRepo data directory.
- ``SEQREPO_DATA_DIR``: Path to the project-specific SeqRepo data directory.
- ``GENEBE_API_KEY``: API key for the GeneBE service. You'll need it for running the benchmarks.
- ``GENEBE_USERNAME``: Username for the GeneBE service. You'll need it for running the benchmarks.

You will most likely need to set the following variables:

- ``DEBUG``: Set to ``1`` to enable debug mode.
- ``USE_CACHE``: Set to ``1`` to enable caching. This is recommended only for development.
- ``SEQREPO_DATA_DIR``: Set to the path of the custom project SeqRepo data directory.

To pass this configuration to the Docker container, ensure the ``.env.dev`` file is located where
you run the ``docker run`` command or specify the correct path to the file using the ``--env-file``
option.

.. note::

The ``.env.dev`` file has example values for demonstration purposes. You will probably need to
adjust SEQREPO_DATA_DIR to point to the correct location on your system.
Ensure that the environment variables are correctly set up and that the paths are valid and
accessible by the Docker container.

Accessing the OpenAPI Documentation
------------------------------------
Expand Down

0 comments on commit ab1a945

Please sign in to comment.