-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4e00f6b
commit bd50faa
Showing
1 changed file
with
73 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,73 @@ | ||
#!/bin/bash | ||
set -eo pipefail | ||
|
||
# ToDo: set final namespace | ||
IMAGE=quay.io/biocontainers/bakta:1.8.2--pyhdfd78af_0 | ||
DEFAULT_DBPATH=$BAKTA_DB | ||
|
||
args=( "$@" ) | ||
argcount=${#args[@]} | ||
|
||
# handle help parameter separately | ||
if [[ $argcount -eq 0 || " ${args[@]} " =~ " --help " || " ${args[@]} " =~ " -h " ]]; then | ||
podman run -it --rm $IMAGE bakta --help | ||
exit $? | ||
fi | ||
|
||
# run bakta podman | ||
# decisions: | ||
# all parameters are passed through, except genome, db and output | ||
# they are replaced with their absolute paths and are mounted to | ||
# the container | ||
|
||
CWD=$(realpath .) | ||
DB= | ||
OUTPUT= | ||
GENOME=$(realpath ${args[$argcount-1]}) | ||
args[$((argcount-1))]=$GENOME | ||
|
||
for i in `seq 0 $((argcount-1))`; do | ||
VAL=${args[i]} | ||
j=$((i+1)) | ||
if [[ "$VAL" == "--db" || "$VAL" == "-d" ]]; then | ||
DB=${args[j]} | ||
DB=$(realpath $DB) | ||
args[j]=$DB | ||
fi | ||
if [[ "$VAL" == "--output" || "$VAL" == "-o" ]]; then | ||
OUTPUT=${args[j]} | ||
OUTPUT=$(realpath $OUTPUT) | ||
args[j]=$OUTPUT | ||
fi | ||
done; | ||
|
||
if [[ -z "$DB" ]]; then | ||
DB=$DEFAULT_DBPATH | ||
fi | ||
if [[ -z "$OUTPUT" ]]; then | ||
OUTPUT=$PWD | ||
fi | ||
if [[ ! -d "$OUTPUT" ]]; then | ||
mkdir -p "$OUTPUT" | ||
fi | ||
|
||
echo "******************************" | ||
echo "* bakta podman wrapper *" | ||
echo "******************************" | ||
echo "* # Arguments: " $argcount | ||
echo "* Database location: " $DB | ||
echo "* Genome location: " $GENOME | ||
echo "* Output location : " $OUTPUT | ||
echo "******************************" | ||
CMD=$(cat <<-END | ||
podman run -it --rm \ | ||
-v $DB:$DB:ro \ | ||
-v $OUTPUT:$OUTPUT:rw \ | ||
-v $GENOME:$GENOME:ro \ | ||
--workdir $CWD \ | ||
$IMAGE bakta --force ${args[@]} | ||
END | ||
) | ||
echo "* Commandline: " $CMD | ||
echo "******************************" | ||
$CMD |