Skip to content

Commit

Permalink
it ain't pretty but it works - Dockerfile runs fp_annotate and jupyter
Browse files Browse the repository at this point in the history
  • Loading branch information
bbowles1 committed May 19, 2024
1 parent 5f8f105 commit 763b4cd
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 18 deletions.
35 changes: 20 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,55 @@
# using ubuntu LTS version
FROM ubuntu:20.04

# Configure Poetry
ENV POETRY_VERSION=1.8.3
ENV POETRY_HOME=/opt/poetry
ENV POETRY_VENV=/opt/poetry-venv
ENV POETRY_CACHE_DIR=/opt/.cache
ENV PIPX_BIN_DIR=/opt/.cache/virtualenvs/orfa-9TtSrW0h-py3.8/bin/

RUN apt-get update && apt-get install --no-install-recommends -y \
python3.8-dev python3.8-venv python3-pip python3-wheel \
build-essential libhdf5-dev pkg-config && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# create and activate virtual environment
RUN python3.8 -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# Add `poetry` to PATH
ENV PATH="${PATH}:${POETRY_VENV}/bin"


# Install Poetry
RUN python3 -m pip install pipx && \
python3 -m pipx ensurepath && \
pipx install poetry && \
pipx ensurepath
# Install poetry separated from system interpreter
RUN python3 -m venv $POETRY_VENV \
&& . ${POETRY_VENV}/bin/activate \
&& $POETRY_VENV/bin/pip install -U pipx \
&& $POETRY_VENV/bin/pipx ensurepath \
&& $POETRY_VENV/bin/pipx install poetry==${POETRY_VERSION}

# Set up environment variables for Poetry
ENV PATH="$PATH:/root/.local/bin"
ENV POETRY_HOME="/root/.poetry"
#ENV PATH="$PATH:/root/.local/bin"

# export path
ENV PATH="$PATH:/root/.local/share/pipx/venvs/poetry/bin/"

# Install Pandas and Keras in a virtual environment using Poetry
WORKDIR /app

# Copy only the pyproject.toml and poetry.lock files initially to leverage Docker cache
COPY pyproject.toml ./

# upgrade pip
RUN pip install --upgrade pip setuptools wheel

# Copy the rest of the application code
COPY pyproject.toml .
COPY poetry.lock .
COPY framepool_annotate.py .
# not needed because we are mounting
ADD modules /app/modules

# append Python module dir to Path
RUN PATH="${PATH}:/app/modules"

# Install dependencies
# RUN /opt/.cache/virtualenvs/orfa-9TtSrW0h-py3.8/bin/poetry install --no-root --no-cache -vvv
RUN poetry install --no-root --no-cache -vvv


# Set the default command to run the application
#CMD ["python", "framepool_annotate.py"]

Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
# Docker

I have made a custom Dockerfile to run the Framepool codebase. Some design decisions explained:
- Ubuntu's `apt-get` does not install pipx or poetry correctly, so I used a pip workaround to install both.
- The Docker has a Jupyter notebook entrypoint by default. You can run the Docker's Jupyer notebook like so:
```
docker run -it --rm -v .:/app/mnt:ro -p 8080:8080 framepool
```
- If you want a different entrypoint (ie bash) you can run:
```
docker run -it --entrypoint /bin/bash --rm -v .:/app/mnt:ro framepool
```

I have made a custom script for annotation VCF files with FramePool. It takes a tab-delimited file as input, with columns ???.

You can run this script using: `poetry run python modules/framepool_annotate.py`

# 5UTR

In the paper "Human 5′ UTR design and variant effect prediction from a massively parallel translation assay" (Sample et al), MPRA data is used to train a powerful deep model to predict ribsome load (a measure of translation efficiency) from the seuqnece of the 5 untranslated region. This model can be used to predict the effect of variants (mutations) on the ribosome load (and thus translation efficiency), which could be used to investigate the causes of rare genetic dieseases.
Expand Down
1 change: 1 addition & 0 deletions framepool_annotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"""

import sys
import argparse
sys.path.append('/app/modules/')
from kipoi_functions import framepool_caller

Expand Down
5 changes: 2 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 763b4cd

Please sign in to comment.