Commit 822f1a47 authored by Blaise Li's avatar Blaise Li
Browse files

Script to run interactive shell in the container.

parent 51089311
......@@ -6,10 +6,11 @@ endif
all: run_pipeline
install: run_pipeline
install: run_pipeline run_pipeline.sh workflows_shell.sh
install -d $(PREFIX)_$(VERSION)/bin
install run_pipeline $(PREFIX)_$(VERSION)/bin/.
install run_pipeline.sh $(PREFIX)_$(VERSION)/bin/.
install workflows_shell.sh $(PREFIX)_$(VERSION)/bin/.
for datatype in sRNA-seq smallRNA-seq RNA-seq GRO-seq PRO-seq Degradome-seq Ribo-seq iCLIP-seq iCLIP; \
do \
ln -sf $(PREFIX)_$(VERSION)/bin/run_pipeline.sh $(PREFIX)_$(VERSION)/bin/run_$${datatype}_pipeline; \
......
......@@ -34,6 +34,8 @@ From:python:3.7-buster
%post
apt-get -y update
# Useful for interactive work using the container
apt-get -y install vim
# run_pipeline.sh (and maybe other tools) needs bc
apt-get -y install bc rsync
apt-get -y install bedops bedtools bowtie2 cutadapt subread hisat2 parallel samtools
......
......@@ -42,18 +42,18 @@ container="${BASEDIR}/run_pipeline"
# Do we have singularity?
singularity --version 2> /dev/null && have_singularity=1
singularity --version 2> /dev/null && have_singularity=1
if [ ! ${have_singularity} ]
then
install_doc="https://sylabs.io/guides/3.4/user-guide/quick_start.html#quick-installation-steps"
# Do we have an environment modules system?
module --version 2> /dev/null && have_modules=1
module --version 2> /dev/null && have_modules=1
if [ ${have_modules} ]
then
module load singularity || error_exit "singularity is needed to run the pipelines (see ${install_doc})"
else
error_exit "singularity is needed to run the pipelines (see ${install_doc})"
error_exit "singularity is needed to run the pipelines (see ${install_doc})"
fi
fi
......
#!/bin/bash -l
# Usage: workflows_shell.sh
# Run an interactive shell in the same container that is used for the workflows.
# http://linuxcommand.org/wss0150.php
PROGNAME=$(basename "${0}")
function error_exit
{
# ----------------------------------------------------------------
# Function for exit due to fatal program error
# Accepts 1 argument:
# string containing descriptive error message
# ----------------------------------------------------------------
echo "${PROGNAME}: ${1:-"Unknown Error"}" 1>&2
exit 1
}
# https://stackoverflow.com/a/1638397/1878788
# Absolute path to this script
SCRIPT=$(readlink -f "${0}")
# Absolute path this script is in
BASEDIR=$(dirname "${SCRIPT}")
container="${BASEDIR}/run_pipeline"
# Do we have singularity?
singularity --version 2> /dev/null && have_singularity=1
if [ ! ${have_singularity} ]
then
install_doc="https://sylabs.io/guides/3.4/user-guide/quick_start.html#quick-installation-steps"
# Do we have an environment modules system?
module --version 2> /dev/null && have_modules=1
if [ ${have_modules} ]
then
module load singularity || error_exit "singularity is needed to run the pipelines (see ${install_doc})"
else
error_exit "singularity is needed to run the pipelines (see ${install_doc})"
fi
fi
if [ ! -e ${container} ]
then
if [ -e ${BASEDIR}/run_pipeline.def ]
then
echo "The container was not found. Trying to build it. This may take quite some time and requires sudoer's rights."
sudo singularity build ${BASEDIR}/run_pipeline ${BASEDIR}/run_pipeline.def || error_exit "The container could not be built."
else
error_exit "The container was not found, nor a definition file to build it."
fi
fi
# -B /pasteur will mount /pasteur in the container
# so that it finds the Genome configuration and gene lists
# that are expected to be in a specific location there.
singularity shell -B /pasteur -B /run/shm:/run/shm ${container} $@
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment