Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Docker folder #7

Merged
merged 7 commits into from
Sep 2, 2024
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
24 changes: 24 additions & 0 deletions Docker/CiDDER/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM continuumio/miniconda3
LABEL maintainer="Rauf Salamzade - Kalan Lab, UW-Madison"

WORKDIR /usr/src
SHELL ["/bin/bash", "-c"]

RUN apt-get update && apt-get install -y git wget gcc
RUN conda install -n base conda-libmamba-solver
RUN conda config --set solver libmamba
RUN conda create -p /usr/src/skder_conda_env/ -c conda-forge -c bioconda skder

# Set env variables and download minimal databases (MIBiG v3.1 + PGAP HMMs)
ENV PATH /usr/src/skder_conda_env/bin:$PATH

# chmod 777 /home changes the permissions of the /home directory
RUN chmod 777 /home
USER 1000:1000
RUN mkdir -p /home/input /home/output
WORKDIR /home
ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8

ENTRYPOINT ["cidder"]
CMD ["--help"]
83 changes: 83 additions & 0 deletions Docker/CiDDER/run_cidder
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/bin/bash

# AUTHOR: Rauf Salamzade
# AFFILIATION: Kalan Lab, UW-Madison
# run_cidder.sh

# function to determine absolute paths taken from peterh's respone on StackOverflow:
# https://stackoverflow.com/questions/3915040/how-to-obtain-the-absolute-path-of-a-file-via-shell-bash-zsh-sh
get_abs_filename() {
# $1 : relative filename
filename=$1
parentdir=$(dirname "${filename}")

if [ -d "${filename}" ]; then
echo "$(cd "${filename}" && pwd)"
elif [ -d "${parentdir}" ]; then
echo "$(cd "${parentdir}" && pwd)/$(basename "${filename}")"
fi
}

## The following is also adapted from analogous file from BIG-SCAPE
if [[ $# -eq 0 || $1 == "-h" || $1 == "--help" || $1 == "-v" || $1 == "--version" ]]; then
docker pull raufs/cidder:latest
docker run \
--detach=false \
--rm \
--user=$(id -u):$(id -g) \
raufs/cidder:latest \

else

set -o errexit
set -o nounset

# Links within the container
readonly CONTAINER_INPUT_DIR=/home/input
readonly CONTAINER_OUTPUT_DIR=/home/output

# variables for updating/input paths to account for Docker mounting

DOCKER_VOLUME_ARGS=""
EASY_ARGS=""
OUTPUT_PARENT_DIR="NA"
while [[ ! $# -eq 0 ]]; do
if [[ "$1" == '-g' || "$1" == '--genomes' ]]; then
shift
ABS_VALUE=$(get_abs_filename $1)
INPUT_DIR=$(basename $ABS_VALUE)
INPUT_PARENT_DIR=$(dirname $ABS_VALUE)
EASY_ARGS+="-g $CONTAINER_INPUT_DIR/$INPUT_DIR/ "
DOCKER_VOLUME_ARGS+="--volume $INPUT_PARENT_DIR:$CONTAINER_INPUT_DIR:ro "
shift
elif [[ "$1" == '-o' || "$1" == '--output-directory' ]]; then
shift
ABS_VALUE=$(get_abs_filename $1)
OUTPUT_DIR=$(basename $ABS_VALUE)
OUTPUT_PARENT_DIR=$(dirname $ABS_VALUE)
EASY_ARGS+="-o $CONTAINER_OUTPUT_DIR/$OUTPUT_DIR/ "
DOCKER_VOLUME_ARGS+="--volume $OUTPUT_PARENT_DIR:$CONTAINER_OUTPUT_DIR:rw "
shift
elif [[ "$1" == '-gd' || "$1" == '--genomad-database' ]]; then
shift
ABS_VALUE=$(get_abs_filename $1)
OUTPUT_DIR=$(basename $ABS_VALUE)
OUTPUT_PARENT_DIR=$(dirname $ABS_VALUE)
EASY_ARGS+="-o $CONTAINER_OUTPUT_DIR/$OUTPUT_DIR/ "
DOCKER_VOLUME_ARGS+="--volume $OUTPUT_PARENT_DIR:$CONTAINER_OUTPUT_DIR:rw "
shift
else
EASY_ARGS+="$1 "
shift
fi
done

if [[ ! -d ${OUTPUT_PARENT_DIR} && $OUTPUT_PARENT_DIR != "NA" ]]; then
mkdir ${OUTPUT_PARENT_DIR}
fi

echo ${EASY_ARGS}
# run workflow
docker pull raufs/cidder:latest
docker run ${DOCKER_VOLUME_ARGS} --detach=false --rm --user=$(id -u):$(id -g) raufs/cidder:latest ${EASY_ARGS}
fi
File renamed without changes.
File renamed without changes.