Skip to content
Snippets Groups Projects
Commit b1a01851 authored by Studer Gabriel's avatar Studer Gabriel
Browse files

Dockerfile for ProMod3

This Dockerfile is a bit optimistic but will hopefully work next week.
- It requires Openstructure 1.9.0 tag to be around
- It requires ProMod3 repository to be public
- It requires ProMod3 1.3.0 tag to be around
parent 346d90c4
No related branches found
No related tags found
No related merge requests found
FROM ubuntu:18.04
# ARGUMENTS
###########
ARG OPENSTRUCTURE_VERSION="1.9.0"
ARG PROMOD_VERSION="1.3.0"
ARG SRC_FOLDER="/usr/local/src"
ARG CPUS_FOR_MAKE=2
ARG COMPLIB_DIR="/usr/local/share/ost_complib"
ARG OPENMM_VERSION="7.1.1"
ARG OPENMM_INCLUDE_PATH="/usr/local/openmm/include/"
ARG OPENMM_LIB_PATH="/usr/local/openmm/lib/"
ENV DEBIAN_FRONTEND=noninteractive
# INSTALL SYSTEM DEPS
#####################
RUN apt-get update -y && apt-get install -y cmake \
sip-dev \
libtiff-dev \
libfftw3-dev \
libeigen3-dev \
libboost-all-dev \
libpng-dev \
python2.7 \
python-qt4 \
python-numpy \
python-scipy \
python-pandas \
python-matplotlib \
qt4-qtconfig \
qt4-qmake \
libqt4-dev \
libpng-dev \
wget \
gfortran \
python-pip \
python-sphinx \
tar \
libbz2-dev \
doxygen \
swig \
clustalw \
dssp \
locales && \
# CLEANUP
rm -rf /var/lib/apt/lists/*
# SET LOCALE
############
# RUN echo "LC_ALL=en_US.UTF-8" >> /etc/environment
# RUN echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
# RUN echo "LANG=en_US.UTF-8" > /etc/locale.conf
# RUN locale-gen en_US.UTF-8
# ENVIRONMENT
##############################################################################
ENV OPENSTRUCTURE_VERSION="${OPENSTRUCTURE_VERSION}"
ENV PROMOD_VERSION="${PROMOD_VERSION}"
ENV OST_ROOT="/usr/local"
ENV DNG_ROOT="/usr/local"
ENV PROMOD_ROOT="/usr/local"
ENV PYTHONPATH="/usr/local/lib64/python2.7/site-packages:${PYTHONPATH}"
ENV LD_LIBRARY_PATH="/usr/local/lib64:/usr/local/openmm/lib/$LD_LIBRARY_PATH"
ENV QT_X11_NO_MITSHM=1
# COMPILE OPENMM FROM SOURCES. INSTALL TO /usr/local
####################################################
RUN cd ${SRC_FOLDER} && \
wget -O openmm-${OPENMM_VERSION}.tar.gz -nc https://github.com/pandegroup/openmm/archive/${OPENMM_VERSION}.tar.gz && \
mkdir ${SRC_FOLDER}/openmm-${OPENMM_VERSION} && \
tar xf openmm-${OPENMM_VERSION}.tar.gz -C ${SRC_FOLDER}/openmm-${OPENMM_VERSION} --strip-components=1 && \
mkdir -p ${SRC_FOLDER}/openmm-${OPENMM_VERSION}/build && \
cd ${SRC_FOLDER}/openmm-${OPENMM_VERSION}/build && \
cmake .. && make -j $CPUS_FOR_MAKE && make install && \
cd ${SRC_FOLDER}/openmm-${OPENMM_VERSION}/build/python && \
python setup.py build && python setup.py install && \
cd ${SRC_FOLDER} && rm ${SRC_FOLDER}/openmm-${OPENMM_VERSION}.tar.gz && \
rm -rf ${SRC_FOLDER}/openmm-${OPENMM_VERSION}
# INSTALL OST
#############
RUN cd ${SRC_FOLDER} && \
# copy ost release
wget -O openstructure-${OPENSTRUCTURE_VERSION}.tar.gz -nc https://git.scicore.unibas.ch/schwede/openstructure/repository/${OPENSTRUCTURE_VERSION}/archive.tar.gz && \
mkdir openstructure-${OPENSTRUCTURE_VERSION} && \
tar xf openstructure-${OPENSTRUCTURE_VERSION}.tar.gz -C ${SRC_FOLDER}/openstructure-${OPENSTRUCTURE_VERSION} --strip-components=1 && \
mkdir -p ${SRC_FOLDER}/openstructure-${OPENSTRUCTURE_VERSION}/build && \
cd ${SRC_FOLDER}/openstructure-${OPENSTRUCTURE_VERSION}/build && \
# cmake ost
cmake .. -DPYTHON_LIBRARIES=/usr/lib/x86_64-linux-gnu/libpython2.7.so \
-DOPTIMIZE=ON \
-DENABLE_MM=ON \
-DCOMPILE_TMTOOLS=1 \
-DOPEN_MM_LIBRARY=$OPENMM_LIB_PATH/libOpenMM.so \
-DOPEN_MM_INCLUDE_DIR=$OPENMM_INCLUDE_PATH \
-DOPEN_MM_PLUGIN_DIR=$OPENMM_LIB_PATH/plugins \
-DENABLE_GFX=ON \
-DENABLE_GUI=ON && \
make -j ${CPUS_FOR_MAKE} &&\
# get the compound library \
wget ftp://ftp.wwpdb.org/pub/pdb/data/monomers/components.cif.gz &&\
stage/bin/chemdict_tool create components.cif.gz compounds.chemlib pdb && stage/bin/chemdict_tool update modules/conop/data/charmm.cif compounds.chemlib charmm &&\
mkdir -p $COMPLIB_DIR && chmod a+rw -R $COMPLIB_DIR && mv compounds.chemlib $COMPLIB_DIR && \
# rerun cmake and specify compount lib location
cmake .. -DCOMPOUND_LIB=$COMPLIB_DIR/compounds.chemlib && \
# Build OST with compound library
make -j ${CPUS_FOR_MAKE} && make check && make install && \
# cleanup
cd ${SRC_FOLDER} && rm ${SRC_FOLDER}/openstructure-${OPENSTRUCTURE_VERSION}.tar.gz && \
rm -rf ${SRC_FOLDER}/openstructure-${OPENSTRUCTURE_VERSION} && \
# BEND AROUND COMPOUND LIB
# By default, the compound library is moved to
# /usr/local/share/openstructure/compounds.chemlib upon building
# We replace that file with a symbolic link to the compound.chemlib in
# $COMPLIB_DIR
# The advantage is that we can later on mount any directory containing this file
# in that directory and override the compound lib with updated versions.
rm /usr/local/share/openstructure/compounds.chemlib && \
ln -s $COMPLIB_DIR/compounds.chemlib /usr/local/share/openstructure/compounds.chemlib
# INSTALL ProMod3
#################
RUN cd ${SRC_FOLDER} && \
# copy promod release
wget -O promod-${PROMOD_VERSION}.tar.gz -nc https://git.scicore.unibas.ch/schwede/ProMod3/repository/${PROMOD_VERSION}/archive.tar.gz && \
mkdir promod-${PROMOD_VERSION} && \
tar xf promod-${PROMOD_VERSION}.tar.gz -C ${SRC_FOLDER}/promod-${PROMOD_VERSION} --strip-components=1 && \
mkdir -p ${SRC_FOLDER}/promod-${PROMOD_VERSION}/build && \
cd ${SRC_FOLDER}/promod-${PROMOD_VERSION}/build && \
# Build and install ProMod3
cmake .. -DOST_ROOT=/usr/local \
-DPYTHON_LIBRARIES=/usr/lib/x86_64-linux-gnu/libpython2.7.so \
-DOPTIMIZE=ON \
-DENABLE_SSE=1 && \
make && make codetest && make install && \
# cleanup
cd ${SRC_FOLDER} && rm ${SRC_FOLDER}/promod-${PROMOD_VERSION}.tar.gz && \
rm -rf ${SRC_FOLDER}/promod-${PROMOD_VERSION}
WORKDIR /home
......@@ -2,4 +2,105 @@ ProMod3 and Containers
======================
Here comes some fantastic documentation on how to build ProMod3 containers...
ProMod3 offers build recipes for Docker and Singularity in
<PATH_TO_PROMOD3_CHECKOUT>/container. To avoid code duplication,
the Singularity container bootstraps from the Docker one and adds
some sugar on top.
Docker
------
Build image
-----------
In order to build the image:
.. code-block:: bash
docker build --tag <IMAGE_NAME> -f Dockerfile <PATH TO DOCKERFILE DIR>
You can chose any image name (tag) eg. promod.
Run script and actions with OST/PM
----------------------------------
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:
.. code-block:: bash
docker run --rm -v /home/<USER>:/home <IMAGE_NAME> pm script.py pdbs/struct.pdb
or with absolute paths:
.. code-block:: bash
docker run --rm -v /home/<USER>:/home <IMAGE_NAME> pm /home/script.py /home/pdbs/struct.pdb
An alternative is to mount the current working directory into the docker home:
.. code-block:: bash
docker run --rm -v $(pwd):/home <IMAGE_NAME> pm script.py pdbs/struct.pdb
The Compound Library
--------------------
At build time of the container, a :class:`~ost.conop.CompoundLib` is generated.
Compound libraries contain information on chemical compounds, such as their
connectivity, chemical class and one-letter-code. The compound library has
several uses, but the most important one is to provide the connectivy
information for the rule-based processor.
The compound library is generated with the components.cif dictionary provided by
the PDB. As the PDB updates regularly, the compound library shipped with the
container is quickly outdated. For most use cases, this is not problematic.
However, if you rely on correct connectivity information of the latest and
greatest compounds, you have to keep the compound library up to date manually.
The suggested way of doing this is to generate your own compound library and
mount it into the container where the original compound lib resides to
override it.
The simplest way to create compound library is to use the
:program:`chemdict_tool` available in the container. The programs allows you
to import the chemical description of the compounds from a MMCIF dictionary,
e.g. the components.cif dictionary provided by the PDB.
The latest dictionary can be downloaded from the
`wwPDB site <http://www.wwpdb.org/ccd.html>`_.
The files are rather large, it is therefore recommended to download the
gzipped version.
After downloading the file use :program:`chemdict_tool` in the container to
convert the MMCIF dictionary into our internal format:
.. code-block:: bash
docker run --rm -v $(pwd):/home <IMAGE_NAME> chemdict_tool create components.cif compounds.chemlib
To run a script with the upated compound library, use the -v option for overriding:
.. code-block:: bash
docker run --rm -v /home/user:/home -v <COMPLIB_DIR_LOCALHOST>:<COMPLIB_DIR_CONTAINER> <IMAGE_NAME> script.py pdbs/struct.pdb
with COMPLIB_DIR_LOCALHOST being the directory that contains the newly generated
compound library and COMPLIB_DIR_CONTAINER the according path in the container.
If you didnt change anything in the Dockerfile, the latter should be
/usr/local/share/ost_complib
You can check whether the default lib is successfully overriden by looking at the
output when running a Python script with following code in the container:
.. code-block:: python
import promod3 # required to setup default lib
from ost import conop
lib = conop.GetDefaultLib()
print lib.GetCreationDate()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment