forked from Karollus/5UTR
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added Dockerfile + custom init script
- Loading branch information
Showing
4 changed files
with
1,229 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# using ubuntu LTS version | ||
# from https://luis-sena.medium.com/creating-the-perfect-python-dockerfile-51bdec41f1c8 | ||
|
||
# using ubuntu LTS version | ||
FROM ubuntu:20.04 | ||
|
||
RUN apt-get update && apt-get install --no-install-recommends -y python3.8-dev \ | ||
python3.8-venv python3-pip python3-wheel build-essential && \ | ||
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" | ||
|
||
# Install Poetry | ||
RUN python3 -m pip install pipx && \ | ||
python3 -m pipx ensurepath && \ | ||
pipx install poetry && \ | ||
pipx ensurepath | ||
|
||
# Set up environment variables for Poetry | ||
ENV PATH="$PATH:/root/.local/bin" | ||
ENV POETRY_HOME="/root/.poetry" | ||
|
||
# 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 | ||
|
||
# Install dependencies | ||
#RUN poetry install --no-root -vvv | ||
|
||
# Copy the rest of the application code | ||
COPY . . | ||
|
||
# append Python module dir to Path | ||
RUN PATH="${PATH}:/app/modules" | ||
|
||
# Set the default command to run the application | ||
CMD ["python", "framepool_annotate.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
""" | ||
Created on Wed Feb 8 07:26:34 2023 | ||
Script to invoke FramePool annotation provided an input dataframe path | ||
@author: bbowles | ||
""" | ||
|
||
import sys | ||
sys.path.append('/app/modules/') | ||
from kipoi_functions import framepool_caller | ||
|
||
def main(): | ||
# Create an argument parser | ||
parser = argparse.ArgumentParser(description="Annotate an ORFA file with FramePool ribosome load prediction.") | ||
|
||
# Add the "--input" argument | ||
parser.add_argument("--input", help="Input, tab-delimited ORFA file.", required=True) | ||
|
||
# Parse the command line arguments | ||
args = parser.parse_args() | ||
|
||
# Get and print the full path | ||
path = args.input | ||
|
||
if path.endswith(".tsv"): | ||
|
||
# run FramePool | ||
scored_df = framepool_caller(path) | ||
|
||
# save output | ||
outpath = path.replace(".tsv",".framepool.tsv") | ||
scored_df.to_csv(outpath, index=False, sep='\t') | ||
print(f"Saved FramePool-annotated output to {outpath}.") | ||
|
||
else: | ||
raise Exception("Input file must end with .tsv!") | ||
|
||
if __name__ == "__main__": | ||
main() |
Oops, something went wrong.