AntiSmash on OSX

The excellent AntiSmash team has made a Docker image of AntiSmash available (repo,post). I’ve just kicked the tires a bit and, all in all, can report a very positive experience as AntiSmash has a lot of dependencies and setting it in the past has involved a bit of wrangling. However, there were a few hiccups requiring some small modifications of the base install script to get it working. Here is a quick recap to save others a bit of hassle:

Install/Lauch Docker#

Use the docker quickstart terminal to get a shell with all the docker variable set correctly. You may need docker-machine start default to start your image.

Install coreutils#

The launchscript uses a command from coreutils that needs a newer version than whats included in OSX. Brew will install GNU coreutils but to avoid shadowin ghte system utilities, they get prefixed with a g:

brew install coreutils

Use the following, modified docker initialize script#

#!/bin/bash

set -o errexit
set -o nounset

# handle input file
readonly INPUT_FILE=$(basename $1)
readonly INPUT_DIR=$(dirname $(greadlink -f $1))
shift

# handle output file
readonly OUTPUT_DIR=$(greadlink -f $1)
shift

# Links within the container
readonly CONTAINER_SRC_DIR=/input
readonly CONTAINER_DST_DIR=/output

if [ ! -d ${OUTPUT_DIR} ]; then
    mkdir ${OUTPUT_DIR}
fi


# ideally, the input directory would be mounted read only, but currently
# antiSMASH doesn't support parsing from a read only file
docker run \
    --volume ${INPUT_DIR}:${CONTAINER_SRC_DIR}:ro \
    --volume ${OUTPUT_DIR}:${CONTAINER_DST_DIR}:rw \
    --detach=false \
    --rm \
    antismash/standalone \
    ${INPUT_FILE} \
    $@

There are only two differences compared with the original script:

  1. the use of greadlink in place of readlink and
  2. the elimination of the user line which, somewhat inexplicably, caused the output directories to be r_x instead of rwx. (can’t write throws error)

Issue to get these possibly incorporated into the build here.