From d51d99a421661071c57b5d7fbe9e98e69fc0acc8 Mon Sep 17 00:00:00 2001 From: Reece Hoffmann Date: Fri, 19 Sep 2025 13:04:57 -0700 Subject: [PATCH 1/2] feat: support cd-hit 4.8.1 --- Dockerfile | 13 +++++++++++-- install_cdhit.sh | 14 ++++++++++++++ test.sh | 22 +++++++++++++++++++++- 3 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 install_cdhit.sh diff --git a/Dockerfile b/Dockerfile index 77b32e2..7d424d1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -49,6 +49,14 @@ RUN apt-get update && apt-get install -y build-essential wget libbz2-dev zlib1g- COPY install_samtools.sh . RUN bash install_samtools.sh 1.22.1 +FROM debian:bookworm AS cdhit +WORKDIR /build +RUN apt-get update && apt-get install -y wget build-essential libz-dev && rm -rf /var/lib/apt/lists/* +COPY install_cdhit.sh . +RUN bash install_cdhit.sh 4.8.1 v4.8.1-2019-0228 +RUN ls +RUN pwd + # Combine tools into a single image. FROM debian:bookworm AS combine WORKDIR /tools @@ -59,11 +67,12 @@ COPY --from=hmmer /hmmer ./hmmer COPY --from=pigz /pigz/ ./pigz COPY --from=samtools /samtools/ ./samtools COPY --from=skewer /skewer ./skewer +COPY --from=cdhit /cd-hit ./cd-hit # Testing FROM debian:bookworm AS test WORKDIR /tools -RUN apt-get update && apt-get install -y default-jre perl libcurl4 && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y default-jre perl libcurl4 libgomp1 && rm -rf /var/lib/apt/lists/* COPY --from=combine /tools /tools COPY test.sh . RUN bash test.sh @@ -71,5 +80,5 @@ RUN bash test.sh FROM debian:bookworm WORKDIR /tools -RUN apt-get update && apt-get install -y libcurl4 && apt-get clean && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y libcurl4 libgomp1 && apt-get clean && rm -rf /var/lib/apt/lists/* COPY --from=test /tools /tools \ No newline at end of file diff --git a/install_cdhit.sh b/install_cdhit.sh new file mode 100644 index 0000000..0db8447 --- /dev/null +++ b/install_cdhit.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# Get the version from the command line argument +version=$1 +slug=$2 + +# Download, extract, configure, and install the version +wget https://github.com/weizhongli/cdhit/releases/download/V${version}/cd-hit-${slug}.tar.gz +tar -xf cd-hit-$slug.tar.gz +cd cd-hit-$slug +make && make install +cd .. +mkdir -p /cd-hit/${version} +mv cd-hit-$slug/cd-hit* /cd-hit/${version} \ No newline at end of file diff --git a/test.sh b/test.sh index 76364fe..a302091 100644 --- a/test.sh +++ b/test.sh @@ -137,4 +137,24 @@ for version in "${skewer_versions[@]}"; do echo "Skewer version ${version} is not installed or not executable." exit 1 fi -done \ No newline at end of file +done + +# Test cd-hit +cd_hit_versions=("4.8.1") + +for version in "${cd_hit_versions[@]}"; do + cd_hit_path="/tools/cd-hit/${version}/cd-hit" + + if [ -x "$cd_hit_path" ]; then + detected_version=$("$cd_hit_path" | head -n 1 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+') + if [ "$detected_version" = "$version" ]; then + echo "cd-hit version ${version} is installed and correct." + else + echo "cd-hit version ${version} is installed but version mismatch (found $detected_version)." + exit 1 + fi + else + echo "cd-hit version ${version} is not installed or not executable." + exit 1 + fi +done From c95301582a04d418a3db68e44238e5691b604959 Mon Sep 17 00:00:00 2001 From: Reece Hoffmann Date: Wed, 24 Sep 2025 12:08:56 -0700 Subject: [PATCH 2/2] fix: statically link libgomp into cdhit binary --- Dockerfile | 6 ++---- install_cdhit.sh | 1 + 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7d424d1..98cbc4e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -54,8 +54,6 @@ WORKDIR /build RUN apt-get update && apt-get install -y wget build-essential libz-dev && rm -rf /var/lib/apt/lists/* COPY install_cdhit.sh . RUN bash install_cdhit.sh 4.8.1 v4.8.1-2019-0228 -RUN ls -RUN pwd # Combine tools into a single image. FROM debian:bookworm AS combine @@ -72,7 +70,7 @@ COPY --from=cdhit /cd-hit ./cd-hit # Testing FROM debian:bookworm AS test WORKDIR /tools -RUN apt-get update && apt-get install -y default-jre perl libcurl4 libgomp1 && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y default-jre perl libcurl4 && rm -rf /var/lib/apt/lists/* COPY --from=combine /tools /tools COPY test.sh . RUN bash test.sh @@ -80,5 +78,5 @@ RUN bash test.sh FROM debian:bookworm WORKDIR /tools -RUN apt-get update && apt-get install -y libcurl4 libgomp1 && apt-get clean && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y libcurl4 && apt-get clean && rm -rf /var/lib/apt/lists/* COPY --from=test /tools /tools \ No newline at end of file diff --git a/install_cdhit.sh b/install_cdhit.sh index 0db8447..2746079 100644 --- a/install_cdhit.sh +++ b/install_cdhit.sh @@ -8,6 +8,7 @@ slug=$2 wget https://github.com/weizhongli/cdhit/releases/download/V${version}/cd-hit-${slug}.tar.gz tar -xf cd-hit-$slug.tar.gz cd cd-hit-$slug +sed -i 's/LDFLAGS += -lz -o/LDFLAGS += -Wl,-Bstatic -lgomp -Wl,-Bdynamic -lz -o/' Makefile make && make install cd .. mkdir -p /cd-hit/${version}