From ff353fe0386856a230d69d7ec100a4d217ff7616 Mon Sep 17 00:00:00 2001 From: Johannes Alneberg Date: Tue, 16 Jan 2024 10:49:33 +0100 Subject: [PATCH 1/3] Working dockerfile for arm64 --- Dockerfile | 41 +++++++++++++++++++++++++++++++++++++---- environment.yml | 9 ++++----- requirements.txt | 4 ++++ setup.py | 8 ++------ 4 files changed, 47 insertions(+), 15 deletions(-) create mode 100644 requirements.txt diff --git a/Dockerfile b/Dockerfile index c79f571..a8b2449 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,12 +5,45 @@ LABEL author="Remi-Andre Olsen" \ maintainer="remi-andre.olsen@scilifelab.se" USER root + +# Check for arm64 architecture to install minimap2 +ARG TARGETARCH +RUN if [ "$TARGETARCH" = "arm64" ]; then \ + # Install compliation tools for minimap2 + apt-get update;\ + apt-get install -y curl build-essential libz-dev;\ + fi + +ENV MINIMAP_VERSION=2.26 + +RUN if [ "$TARGETARCH" = "arm64" ]; then \ + # Download minimap2 + curl -L https://github.com/lh3/minimap2/archive/refs/tags/v${MINIMAP_VERSION}.tar.gz | tar -zxvf - ;\ + fi + +RUN if [ "$TARGETARCH" = "arm64" ]; then \ + # Compile minimap2 + cd minimap2-${MINIMAP_VERSION};\ + make arm_neon=1 aarch64=1; \ + # Add to path + mv minimap2 /usr/local/bin/;\ + fi + COPY --chown=$MAMBA_USER:$MAMBA_USER environment.yml / -RUN micromamba env create -n anglerfish && micromamba install -y -n anglerfish -f /environment.yml && micromamba clean --all --yes -ENV PATH /opt/conda/envs/anglerfish/bin:$PATH +COPY --chown=$MAMBA_USER:$MAMBA_USER requirements.txt / + +RUN if [ "$TARGETARCH" = "arm64" ]; then \ + grep -v 'minimap2' /environment.yml > /environment.tmp.yml ;\ + else \ + cp /environment.yml /environment.tmp.yml ;\ + fi ;\ + chown $MAMBA_USER:$MAMBA_USER /environment.tmp.yml # Add source files to the container ADD . /usr/src/anglerfish WORKDIR /usr/src/anglerfish -RUN eval "$(micromamba shell hook --shell bash)" && micromamba activate anglerfish && python -m pip install . -USER $MAMBA_USER + +RUN micromamba install -y -n base -f /environment.tmp.yml && micromamba clean --all --yes + +RUN eval "$(micromamba shell hook --shell bash)" && micromamba activate base && python -m pip install . +USER $MAMBA_USER \ No newline at end of file diff --git a/environment.yml b/environment.yml index f695b3d..b36521a 100644 --- a/environment.yml +++ b/environment.yml @@ -3,8 +3,7 @@ channels: - conda-forge - bioconda dependencies: - - conda-forge::biopython=1.79 - - conda-forge::python-levenshtein=0.23.0 - - conda-forge::numpy=1.22.0 - - bioconda::minimap2=2.20 - - conda-forge::pyyaml=6.0 + - bioconda::minimap2=2.26 + - pip + - pip: + - -r requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..9fd76d3 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +numpy==1.26.3 +biopython==1.83 +levenshtein==0.23.0 +pyyaml==6.0.1 \ No newline at end of file diff --git a/setup.py b/setup.py index 72b5591..e1bbfad 100644 --- a/setup.py +++ b/setup.py @@ -30,12 +30,8 @@ python_requires=">=3.7", packages = find_packages(), package_data = {"":["config/adaptors.yaml"]}, - install_requires=[ - 'python-levenshtein==0.23.0', - 'biopython==1.79', - 'numpy==1.22.0', - 'pyyaml==6.0' - ], + # Read requirements.txt + install_requires=[x.strip() for x in open("requirements.txt").readlines()], entry_points={ "console_scripts": [ "anglerfish=anglerfish.anglerfish:anglerfish", From f306ecdc0dcc554c2068bd8789b14ca236ec427d Mon Sep 17 00:00:00 2001 From: Johannes Alneberg Date: Tue, 16 Jan 2024 11:59:15 +0100 Subject: [PATCH 2/3] Add back pre-commit and prettier to conda env --- environment.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/environment.yml b/environment.yml index 3a1e3ed..dfdf6bd 100644 --- a/environment.yml +++ b/environment.yml @@ -8,3 +8,5 @@ dependencies: - pip - pip: - -r requirements.txt + - conda-forge::pre-commit + - conda-forge::prettier \ No newline at end of file From 5609e0db09350bc0e40b694930a173cc966d2517 Mon Sep 17 00:00:00 2001 From: Johannes Alneberg Date: Tue, 16 Jan 2024 12:02:23 +0100 Subject: [PATCH 3/3] Ruff formatting of environment.yml --- environment.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/environment.yml b/environment.yml index dfdf6bd..ec2d96d 100644 --- a/environment.yml +++ b/environment.yml @@ -7,6 +7,6 @@ dependencies: - bioconda::minimap2=2.26 - pip - pip: - - -r requirements.txt + - -r requirements.txt - conda-forge::pre-commit - - conda-forge::prettier \ No newline at end of file + - conda-forge::prettier