Skip to content
Snippets Groups Projects
Commit 1497ee88 authored by Gerardo Tauriello's avatar Gerardo Tauriello
Browse files

Merge branch 'dockerize' into develop

Recipes to build containers for Docker and Singularity.
parents cf65c48e 374eb5f8
Branches
Tags
No related merge requests found
FROM ubuntu:16.04
# ARGUMENTS
###########
# OBLIGATORY
ARG OPENSTRUCTURE_VERSION
RUN if [ -z "${OPENSTRUCTURE_VERSION}" ]; then \
echo "OPENSTRUCTURE_VERSION argument is obligatory. Run with --build-arg OPENSTRUCTURE_VERSION=<VERSION>"; \
exit 1; \
else : ; fi
# OPTIONAL
ARG SRC_FOLDER="/usr/local/src"
ARG CPUS_FOR_MAKE=8
ARG PYTHONPATH="/usr/local/lib64/python2.7/site-packages:${PYTHONPATH}"
ARG OPENSTRUCTURE_SHARE="/usr/local/share/ost"
ARG MSMS_VERSION="2.6.1"
ARG OPENMM_VERSION="7.1.1"
ARG DSSP_VERSION="2.2.1"
ARG OPENMM_INCLUDE_PATH="/usr/local/openmm/include/"
ARG OPENMM_LIB_PATH="/usr/local/openmm/lib/"
# 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 \
python-all \
python2.7 \
python-qt4 \
qt4-qtconfig \
qt4-qmake \
libqt4-dev \
libpng-dev \
wget \
git \
gfortran \
python-pip \
tar \
libbz2-dev \
doxygen \
swig \
clustalw \
python-virtualenv \
locales && \
# CLEANUP
rm -rf /var/lib/apt/lists/*
# INSTALL SOME PYTHON PACKAGES GLOBALY
######################################
RUN pip install -U pip==9.0.3 && \
pip install -U setuptools==39.0.1 && \
pip install --no-cache-dir numpy==1.10.4 \
scipy==1.0.0 \
pandas==0.22.0
# 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
# DOWNLOAD AND INSTALL MSMS
###########################
RUN cd ${SRC_FOLDER} && \
mkdir -p msms && \
cd ${SRC_FOLDER}/msms && \
wget http://mgltools.scripps.edu/downloads/tars/releases/MSMSRELEASE/REL${MSMS_VERSION}/msms_i86_64Linux2_${MSMS_VERSION}.tar.gz && \
tar -xvzf msms_i86_64Linux2_${MSMS_VERSION}.tar.gz && \
cp -v ${SRC_FOLDER}/msms/msms.x86_64Linux2.${MSMS_VERSION} /usr/local/bin/msms && \
cp -v ${SRC_FOLDER}/msms/pdb_to_xyzr /usr/local/bin/pdb_to_xyzr && \
cp -v ${SRC_FOLDER}/msms/pdb_to_xyzrn /usr/local/bin/pdb_to_xyzrn && \
rm -rf ${SRC_FOLDER}/msms
# 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 && \
rm -rf ${SRC_FOLDER}/openmm-${OPENMM_VERSION}.tar.gz && \
rm -rf ${SRC_FOLDER}/openmm-${OPENMM_VERSION}
# COMPILE AND INSTALL DSSP
##########################
RUN cd ${SRC_FOLDER} && \
wget ftp://ftp.cmbi.ru.nl/pub/software/dssp/dssp-${DSSP_VERSION}.tgz && \
tar -xvzf dssp-${DSSP_VERSION}.tgz && \
cd dssp-${DSSP_VERSION} && \
make -j ${CPUS_FOR_MAKE} && \
make install && \
rm -rf ${SRC_FOLDER}/dssp-${DSSP_VERSION}.tgz && \
rm -rf ${SRC_FOLDER}/dssp-${DSSP_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
WORKDIR ${SRC_FOLDER}/openstructure-${OPENSTRUCTURE_VERSION}/build
# cmake ost
RUN cmake .. -DPYTHON_LIBRARIES=/usr/lib/x86_64-linux-gnu/libpython2.7.so \
-DOPTIMIZE=ON \
-DENABLE_MM=ON \
-DCOMPILE_TMTOOLS=1 \
-DUSE_NUMPY=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 && \
# Build chemdict_tool
make -j ${CPUS_FOR_MAKE} chemdict_tool
# get the compound library
RUN wget ftp://ftp.wwpdb.org/pub/pdb/data/monomers/components.cif.gz
RUN stage/bin/chemdict_tool create components.cif.gz compounds.chemlib pdb && stage/bin/chemdict_tool update modules/conop/data/charmm.cif compounds.chemlib charmm
RUN mkdir -p $OPENSTRUCTURE_SHARE && chmod a+rw -R $OPENSTRUCTURE_SHARE && mv compounds.chemlib $OPENSTRUCTURE_SHARE
# Build and install OST
RUN cmake .. -DPYTHON_LIBRARIES=/usr/lib/x86_64-linux-gnu/libpython2.7.so \
-DOPTIMIZE=ON \
-DENABLE_MM=ON \
-DCOMPILE_TMTOOLS=1 \
-DUSE_NUMPY=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 \
-DCOMPOUND_LIB=$OPENSTRUCTURE_SHARE/compounds.chemlib && \
# Build OST with compound library
make -j ${CPUS_FOR_MAKE} && make check && make install
# GO HOME AND CLEANUP
#####################
# RUN apt-get purge -y cmake \
# wget \
# git \
# gfortran \
# python-pip \
# libbz2-dev \
# doxygen \
# swig
# RUN apt-get clean
# RUN apt-get autoremove -y
#
# WORKDIR $SRC_FOLDER
# RUN rm -rf $SRC_FOLDER/*
WORKDIR /home
# ENVIRONMENT
##############################################################################
ENV OST_ROOT="/usr/local"
ENV OPENSTRUCTURE_VERSION="1.7.1"
ENV PYTHONPATH="/usr/local/lib64/python2.7/site-packages:${PYTHONPATH}"
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib64"
ENV QT_X11_NO_MITSHM=1
ENTRYPOINT ["ost"]
CMD ["-i"]
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:
.. code-block:: bash
cd <PATH TO OST>/docker
docker build --tag <IMAGE NAME> --build-arg OPENSTRUCTURE_VERSION=<VERSION> -f Dockerfile .
or if you downloaded the Dockerfile directly:
.. code-block:: bash
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 <https://git.scicore.unibas.ch/schwede/openstructure/blob/master/CHANGELOG.txt>`_
for current list of available releases.
Testing the image
-----------------
One can find a exemplary script (`test_docker.py`) in the downloaded directory.
To run it do:
.. code-block::
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:
.. code-block:: bash
docker run --rm -v /home/user:/home <IMAGE NAME> script.py pdbs/struct.pdb
or with absolute paths:
.. code-block:: bash
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:
.. code-block::
docker run --rm <IMAGE NAME> -h
To run chosen action do:
.. code-block::
docker run --rm <IMAGE NAME> <ACTION NAME>
Here is an example run of compare-structures action mimicking CAMEO evaluation:
.. code-block::
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:
.. code-block::
docker run --rm <IMAGE NAME> compare-structures -h
Scripts
#######
In order to run OST script do:
.. code-block:: bash
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:
.. code-block:: bash
<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:
.. code-block:: bash
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:
.. code-block::
cd <PATH TO OST>/docker
./run_docker_ost <IMAGE NAME> test_docker.py
To see the help for compare-structures action run:
.. code-block::
cd <PATH TO OST>/docker
./run_docker_ost <IMAGE NAME> compare-structures
Run GUI
-------
In order to run GUI do (tested on linux machine):
.. code-block:: bash
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:
.. code-block::
sudo docker run --rm -ti --entrypoint <COMMAND> <IMAGE NAME> [COMMAND OPTIONS]
Eg. to run molck type:
.. code-block::
sudo docker run --rm -ti --entrypoint molck <IMAGE NAME> --help
.. note::
Note how the options to the command are specified after the image name.
#!/bin/bash
# end when error
set -e
image_name=$1
script_path=$2
if [[ ${#@} -lt 1 ]]; then
echo "Usage: run_docker_ost <IMAGE_NAME> [<SCRIPT_PATH>]"
exit 1
fi
if [[ -z ${script_path} ]]; then
docker run -ti --rm -v $(pwd):/home ${image_name}
else
if [[ -e $script_path ]]; then
abspath=$(readlink -f $script_path)
dirpath=$(dirname $abspath)
name=$(basename $script_path)
docker run --rm -v ${dirpath}:/home ${image_name} /home/${name} ${@:3}
else
# it is maybe an action if it does not exist
docker run --rm -v $(pwd):/home ${image_name} ${script_path} ${@:3}
fi
fi
import ost
from ost.mol.alg import qsscoring
# load two biounits to compare
ent_full = ost.io.LoadPDB('3ia3', remote=True)
ent_1 = ent_full.Select('cname=A,D')
ent_2 = ent_full.Select('cname=B,C')
# get score
ost.PushVerbosityLevel(3)
try:
qs_scorer = qsscoring.QSscorer(ent_1, ent_2)
ost.LogScript('QSscore:', str(qs_scorer.global_score))
ost.LogScript('Chain mapping used:', str(qs_scorer.chain_mapping))
except qsscoring.QSscoreError as ex:
# default handling: report failure and set score to 0
ost.LogError('QSscore failed:', str(ex))
qs_score = 0
print "OST is working!"
OST Singularity
===============
Building Singularity image
--------------------------
In order to build OST Singularity image:
.. code-block:: bash
cd <OST ROOT>/singularity
sudo singularity build ost.img Singularity.1.7.1
.. note::
Running singularity build command requires root permissions (sudo).
One can chose any name for an image. For the purose of this file we will assume
that the image name is `ost.img`.
Available apps
--------------
This container includes the following apps:
* **OST** - OpenStructure binary
* **IPython** - OST-powered iPython shell
* **Notebook** - A Jupyter notebook palyground with OST and nglview
* **lDDT** - The Local Distance Difference Test
* **Molck** - Molecular checker
* **ChemdictTool** - Creating or update a compound library
To see the help for each individual app run:
.. code-block:: bash
singularity help --app <APP NAME> <PATH TO OST IMAGE>
Eg.:
.. code-block:: bash
singularity help --app OST ost.img
Facilitating the usage
----------------------
For each of these apps it is useful to create an alias if they will be
frequently used. Eg. to create an alias for IPython app one can run:
.. code-block::
alias ost_ipython="singularity run --app IPython <PATH TO OST IMAGE>"
Then (in the same terminal window) to invoke IPython app one can just type:
.. code-block::
ost_ipython
To make the alias permanent put it into your `.bashrc` file or whatever file you
use to store the aliases.
\ No newline at end of file
BootStrap: docker
From: ubuntu:16.04
%post
##############################################################################
# POST
##############################################################################
# CHANGE DASH TO BASH
rm /bin/sh
ln -sf /bin/bash /bin/sh
# DEFINE SOME ENV VARS USED DURING THE IMAGE BUILD
##########################
export SRC_FOLDER="/usr/local/src"
export CPUS_FOR_MAKE=8
export PYTHONPATH="/usr/local/lib64/python2.7/site-packages:${PYTHONPATH}"
export OPENSTRUCTURE_VERSION="1.7.1"
export OPENSTRUCTURE_SHARE="/usr/local/share/ost"
export MSMS_VERSION="2.6.1"
export OPENMM_VERSION="7.1.1"
export DSSP_VERSION="2.2.1"
export OPENMM_INCLUDE_PATH=/usr/local/openmm/include/
export OPENMM_LIB_PATH=/usr/local/openmm/lib/
export JUPYTER_CONFIG_DIR="/usr/local/etc/jupyter"
export JUPYTER_PATH="/usr/local/share/jupyter"
export JUPYTER_RUNTIME_DIR="$JUPYTER_PATH/runtime"
export VIRTUALENV_DIR="/usr/local/share/ost_venv"
# INSTALL SYSTEM DEPS
#####################
apt-get update -y && apt-get install -y cmake \
sip-dev \
libtiff-dev \
libfftw3-dev \
libeigen3-dev \
libboost-all-dev \
libpng-dev \
python-all \
python2.7 \
python-qt4 \
qt4-qtconfig \
qt4-qmake \
libqt4-dev \
libpng-dev \
wget \
git \
gfortran \
python-pip \
tar \
libbz2-dev \
doxygen \
swig \
clustalw \
python-virtualenv \
locales
# SET LOCALE
############
echo "LC_ALL=en_US.UTF-8" >> /etc/environment
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf
locale-gen en_US.UTF-8
# INSTALL SOME PYTHON PACKAGES GLOBALY
######################################
pip install --upgrade pip && pip install --no-cache-dir numpy==1.10.4 \
scipy==1.0.0 \
pandas==0.22.0
# SET UP VIRTUALENV
###################
virtualenv --system-site-packages $VIRTUALENV_DIR
. $VIRTUALENV_DIR/bin/activate
# INSTALL REQUIRED PYTHON PACKAGES
##################################
pip install jupyter==1.0.0 \
nglview==1.0
# DOWNLOAD AND INSTALL MSMS
##############
cd ${SRC_FOLDER}
if [ ! -f msms_i86_64Linux2_${MSMS_VERSION}.tar.gz ]; then
mkdir -p msms
cd msms
wget http://mgltools.scripps.edu/downloads/tars/releases/MSMSRELEASE/REL${MSMS_VERSION}/msms_i86_64Linux2_${MSMS_VERSION}.tar.gz
tar -xvzf msms_i86_64Linux2_${MSMS_VERSION}.tar.gz
cp -v ${SRC_FOLDER}/msms/msms.x86_64Linux2.${MSMS_VERSION} /usr/local/bin/msms
cp -v ${SRC_FOLDER}/msms/pdb_to_xyzr /usr/local/bin/pdb_to_xyzr
cp -v ${SRC_FOLDER}/msms/pdb_to_xyzrn /usr/local/bin/pdb_to_xyzrn
fi
# COMPILE OPENMM FROM SOURCES. INSTALL TO /usr/local
############################
cd ${SRC_FOLDER}
if [ ! -f openmm-${OPENMM_VERSION}.tar.gz ]; then
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
fi
# COMPILE AND INSTALL DSSP
##############
cd ${SRC_FOLDER}
if [ ! -f dssp-${DSSP_VERSION}.tgz ]; then
wget ftp://ftp.cmbi.ru.nl/pub/software/dssp/dssp-${DSSP_VERSION}.tgz
tar -xvzf dssp-${DSSP_VERSION}.tgz
cd dssp-${DSSP_VERSION}
make -j ${CPUS_FOR_MAKE}
make install
fi
# INSTALL OST
#############
cd ${SRC_FOLDER}
if [ ! -f openstructure-${OPENSTRUCTURE_VERSION}.tar.gz ]; then
# 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 \
-DUSE_NUMPY=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
# Build chemdict_tool
make -j ${CPUS_FOR_MAKE} chemdict_tool
# 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 $OPENSTRUCTURE_SHARE
chmod a+rw -R $OPENSTRUCTURE_SHARE
mv compounds.chemlib $OPENSTRUCTURE_SHARE
# Build and install OST
cmake .. -DPYTHON_LIBRARIES=/usr/lib/x86_64-linux-gnu/libpython2.7.so \
-DOPTIMIZE=ON \
-DENABLE_MM=ON \
-DCOMPILE_TMTOOLS=1 \
-DUSE_NUMPY=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 \
-DCOMPOUND_LIB=$OPENSTRUCTURE_SHARE/compounds.chemlib
# Build chemdict_tool
make -j ${CPUS_FOR_MAKE}
make check
make install
fi
# SETUP JUPYTER
###############
mkdir -p /usr/local/share/ipython
mkdir -p $JUPYTER_PATH
mkdir -p $JUPYTER_RUNTIME_DIR
mkdir -p $JUPYTER_CONFIG_DIR
mkdir -p $JUPYTER_PATH/kernels/ost-kernel
chmod a+rw -R /usr/local/share/ipython
chmod a+rw -R $JUPYTER_PATH
chmod a+rw -R $JUPYTER_CONFIG_DIR
chmod a+rw -R $JUPYTER_RUNTIME_DIR
cat > $JUPYTER_PATH/kernels/ost-kernel/kernel.json <<EOF
{
"display_name": "OST",
"language": "python",
"argv": [
"python",
"-m", "ipykernel",
"-f", "{connection_file}",
"--InteractiveShellApp.exec_PYTHONSTARTUP=False",
"--InteractiveShellApp.exec_files=['/usr/local/lib64/python2.7/site-packages/ost/ost_startup.py']"
],
"env": {
}
}
EOF
jupyter nbextension enable nglview --py --sys-prefix
# GO HOME AND CLEANUP
#####################
apt-get purge -y cmake \
wget \
git \
gfortran \
python-pip \
libbz2-dev \
doxygen \
swig
apt-get clean
apt-get autoremove -y
cd $SRC_FOLDER && rm -rf $SRC_FOLDER/*
cd /home
%environment
##############################################################################
# ENVIRONMENT
##############################################################################
export OST_ROOT="/usr/local"
export OPENSTRUCTURE_VERSION="1.7.1"
export PYTHONPATH="/usr/local/lib64/python2.7/site-packages:${PYTHONPATH}"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib64"
export QT_X11_NO_MITSHM=1
export IPYTHONDIR="/usr/local/share/ipython"
export JUPYTER_CONFIG_DIR="/usr/local/etc/jupyter"
export JUPYTER_PATH="/usr/local/share/jupyter"
export JUPYTER_RUNTIME_DIR="$JUPYTER_PATH/runtime"
export VIRTUALENV_DIR="/usr/local/share/ost_venv"
%apprun ChemdictTool
##############################################################################
# CHEMDICT TOOL APP
##############################################################################
$OST_ROOT/bin/chemdict_tool "$@"
%apprun lDDT
##############################################################################
# lDDT APP
##############################################################################
$OST_ROOT/bin/lddt "$@"
%apphelp lDDT
The Local Distance Difference Test.
Usage:
singularity run --app lDDT <IMAGE> [options] <mod1> [mod1 [mod2]] <re1>[,ref2,ref3]
Options:
-s selection performed on ref
-c use Calphas only
-f perform structural checks and filter input data
-t fault tolerant parsing
-p <file> use specified parmeter file. Mandatory
-v <level> verbosity level (0=results only,1=problems reported, 2=full report)
-b <value> tolerance in stddevs for bonds
-a <value> tolerance in stddevs for angles
-r <value> distance inclusion radius
-i <value> sequence separation
-e print version
-x ignore residue name consistency checks
%apprun Molck
##############################################################################
# MOLCK APP
##############################################################################
$OST_ROOT/bin/molck "$@"
%apphelp Molck
This is molck - the molecule checker
Usage:
singularity run --app Molck <IMAGE> [options] file1.pdb [file2.pdb [...]]
Options:
--complib=path location of the compound library file. If not provided, the
following locations are searched in this order:
1. Working directory, 2. OpenStructure standard library location (if the
executable is part of a standard OpenStructure installation)
--rm=<a>,<b> remove atoms and residues matching some criteria
zeroocc - Remove atoms with zero occupancy
hyd - Remove hydrogen atoms
oxt - Remove terminal oxygens
nonstd - Remove all residues not one of the 20 standard amino acids
unk - Remove unknown and atoms not following the nomenclature
--fix-ele clean up element column
--stdout write cleaned file(s) to stdout
--out=filename write cleaned file(s) to disk. % characters in the filename are
replaced with the basename of the input file without extension.
Default: %-molcked.pdb
--color=auto|on|off
whether output should be colored
--map-nonstd maps modified residues back to the parent amino acid, for example
MSE -> MET, SEP -> SER.
%apprun OST
##############################################################################
# OST APP
##############################################################################
$OST_ROOT/bin/ost "$@"
%apphelp OST
The OST app exposes OpenStructure binary and can be used to run interactive shell
and scripts.
Usage:
singularity run --app OST <IMAGE> [ost options] [script to execute] [script parameters]
Options:
-i, --interactive start interpreter interactively (must be first
parameter, ignored otherwise)
-h, --help show this help message and exit
-v VLEVEL, --verbosity_level=VLEVEL
sets the verbosity level [default: 2]
If script requires some external files eg. PDBs, they have to be located in the
path accessible via mounted volumes. By default Singularity mounts $HOME and
goes to CWD. Thus this sould work as expected out of the box.
%appenv IPython
##############################################################################
# NOTEBOOK ENV
##############################################################################
export DNG_ROOT=$OST_ROOT
export DNG_INITDIR=${DNG_ROOT}/lib64/python2.7/site-packages/ost
%apprun IPython
##############################################################################
# OST IPYTON APP
##############################################################################
. $VIRTUALENV_DIR/bin/activate && ipython -i $DNG_INITDIR/ost_startup.py "$@"
%apphelp IPython
OST-powered iPython shell.
Usage:
singularity run --app IPython <IMAGE> [options]
Detailed help:
singularity run --app IPython <IMAGE> --help
%appenv Notebook
##############################################################################
# NOTEBOOK ENV
##############################################################################
export BIN_DIR=$OST_ROOT/bin
export XDG_RUNTIME_DIR=""
. $OST_ROOT/libexec/openstructure/ost_config
%apprun Notebook
##############################################################################
# NOTEBOOK APP
##############################################################################
. $VIRTUALENV_DIR/bin/activate && jupyter notebook --NotebookApp.iopub_data_rate_limit=10000000 --no-browser "$@"
%apphelp Notebook
A Jupyter notebook palyground with OST and nglview.
Usage:
singularity run --app Notebook <IMAGE> [options]
The Jupyter notebook is run by default with `--NotebookApp.iopub_data_rate_limit=10000000`
and `--no-browser` options.
Useful options when running on remote server:
--ip=<Unicode> (NotebookApp.ip)
Default: 'localhost'
The IP address the notebook server will listen on.
--port=<Integer> (NotebookApp.port)
Default: 8888
The port the notebook server will listen on.
Copy the URL to the browser and launch the notebook with OST kernel. This will
load all necessary OST components just like in the OST shell. We also enabled
the nglview widget to interactively view molecular structures and trajectories.
For more details on how to use nglview see http://nglviewer.org/nglview/latest/.
As the Singularity mounts $HOME by default Jupyter and Ipython config files
are moved to separate directories. Proper environmental variables are also set.
In addition, Jupyter is run in a separate virtualenv to not interact with possibly
installed host version.
To list of all available options:
singularity run --app Notebook <IMAGE> --help
%runscript
##############################################################################
# RUNSCRIPT
##############################################################################
cat << EOF
Singularity container for OST $OPENSTRUCTURE_VERSION.
This container includes the following apps:
* OST - OpenStructure binary
* IPython - OST-powered iPython shell
* Notebook - A Jupyter notebook palyground with OST and nglview
* lDDT - The Local Distance Difference Test
* Molck - Molecular checker
* ChemdictTool - Creating or update a compound library
To see the help for each individual app run:
singularity help --app <APP NAME> <IMAGE NAME>
EOF
%help
Singularity container for OST.
This container includes the following apps:
* OST - OpenStructure binary
* IPython - OST-powered iPython shell
* Notebook - A Jupyter notebook palyground with OST and nglview
* lDDT - The Local Distance Difference Test
* Molck - Molecular checker
* ChemdictTool - Creating or update a compound library
To see the help for each individual app run:
singularity help --app <APP NAME> <IMAGE NAME>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment