Skip to content
Snippets Groups Projects
README.rst 4.94 KiB

OST Docker

Note

For many docker installations it is required to run docker commands as root. As this depends on set up, we skip the sudo in all commands.

Build Docker image

In order to build OST image:

cd <PATH TO OST>/docker
docker build --tag <IMAGE NAME> --build-arg OPENSTRUCTURE_VERSION=<VERSION> -f Dockerfile .

or if you downloaded the Dockerfile directly:

docker build --tag <IMAGE NAME> --build-arg OPENSTRUCTURE_VERSION=<VERSION> -f <DOCKERFILE NAME> <PATH TO DOCKERFILE DIR>

You can chose any image name (tag) eg. ost. The OPENSTRUCTURE_VERSION build argument is mandatory and image will not built without it. See CHANGELOG for current list of available releases. This is not expected to work for versions which are much older than the most recent one since the dependencies might have changed, but it should work for a few versions. If you need the recipe for an older version, we suggest to get an older recipe from the git history.

Testing the image

One can find a exemplary script (test_docker.py) in the downloaded directory. To run it do:

cd <PATH TO OST>/docker
docker run --rm -v $(pwd):/home <IMAGE NAME> test_docker.py

As the last line you should see OST is working!.

Run script and action with OST

Note

If script or action requires some external files eg. PDBs, they have to be located in the path accessible via mounted volume and should be accessed via docker (NOT LOCAL) path. Eg. assuming that we have a struc.pdb file in /home/user/pdbs directory and a script.py in /home/user we could mount the /home/user to /home in docker as above by specifying -v /home/user:/home. To run the script we thus need to provide the (relative) path to the script and (relative) path to the file eg:

docker run --rm -v /home/user:/home <IMAGE NAME> script.py pdbs/struct.pdb

or with absolute paths:

docker run --rm -v /home/user:/home <IMAGE NAME> /home/script.py /home/pdbs/struct.pdb

An easy solution to mount a CWD is to use $(pwd) command in the -v option of the Docker. For an example see the action exemplary run. The same reasoning is valid for the output files.

Actions

To see the list of available actions do:

docker run --rm <IMAGE NAME> -h

To run chosen action do:

docker run --rm <IMAGE NAME> <ACTION NAME>

Here is an example run of the compare-structures action:

docker run --rm -v $(pwd):/home <IMAGE NAME> compare-structures \
    --model model.pdb \
    --reference reference.pdb \
    --output output.json \
    --qs-score \
    --residue-number-alignment \
    --lddt \
    --structural-checks \
    --consistency-checks \
    --inclusion-radius 15.0 \
    --bond-tolerance 15.0 \
    --angle-tolerance 15.0 \
    --molck \
    --remove oxt hyd unk \
    --clean-element-column \
    --map-nonstandard-residues

In order to see all available options for this action run:

docker run --rm <IMAGE NAME> compare-structures -h

Scripts

In order to run OST script do:

docker run [DOCKER OPTIONS] --rm -v <PATH TO SCRIPT DIR>:/home <IMAGE NAME> /home/<SCRIPT NAME> [SCRIPT OPTIONS]

Run ost with utility command

One can also use provided utility bash script run_docker_ost to run basic scripts and actions:

<PATH TO OST>/docker/run_docker_ost <IMAGE_NAME> [<SCRIPT_PATH>] [SCRIPT OPTIONS]

One just needs to provide image name and optionally a script/action and its options. It is useful to link the command to the binary directory eg. in linux:

ln -s <PATH TO OST>/docker/run_docker_ost /usr/bin/run_docker_ost

In order to run an exemplary script (test_docker.py) do:

cd <PATH TO OST>/docker
./run_docker_ost <IMAGE NAME> test_docker.py

To see the help for compare-structures action run:

cd <PATH TO OST>/docker
./run_docker_ost <IMAGE NAME> compare-structures

Run GUI

In order to run GUI do (tested on linux machine):

xhost +local:docker
docker run -ti --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --entrypoint dng <IMAGE NAME>

Running other commands

The default entrypoint of the Docker image is "ost" thus in order to run other available commands (or other commands in general) one need to override the entrypoint:

docker run --rm -ti --entrypoint <COMMAND> <IMAGE NAME> [COMMAND OPTIONS]

Eg. to run molck type:

docker run --rm -ti --entrypoint molck <IMAGE NAME> --help

Note

Note how the options to the command are specified after the image name.