Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ 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

# Combine tools into a single image.
FROM debian:bookworm AS combine
WORKDIR /tools
Expand All @@ -59,6 +65,7 @@ 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
Expand Down
15 changes: 15 additions & 0 deletions install_cdhit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/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
sed -i 's/LDFLAGS += -lz -o/LDFLAGS += -Wl,-Bstatic -lgomp -Wl,-Bdynamic -lz -o/' Makefile
make && make install
cd ..
mkdir -p /cd-hit/${version}
mv cd-hit-$slug/cd-hit* /cd-hit/${version}
22 changes: 21 additions & 1 deletion test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,24 @@ for version in "${skewer_versions[@]}"; do
echo "Skewer version ${version} is not installed or not executable."
exit 1
fi
done
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