Skip to content

Commit

Permalink
[MODIF] update singularity
Browse files Browse the repository at this point in the history
  • Loading branch information
nservant committed Aug 27, 2021
1 parent 3407fad commit 6624df2
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 120 deletions.
153 changes: 80 additions & 73 deletions Singularity
Original file line number Diff line number Diff line change
@@ -1,73 +1,80 @@
BootStrap: docker
From: ubuntu:latest

%labels
AUTHOR Nicolas Servant

%pre
apt-get install -y debootstrap

%files
environment.yml /opt/environment.yml

%post
apt-get update
apt-get install -y wget
apt-get install -y gzip
apt-get install -y bzip2
apt-get install -y curl
apt-get install -y unzip

## g++
apt-get install -y build-essential

# install anaconda
if [ ! -d /usr/local/anaconda ]; then
wget https://repo.continuum.io/miniconda/Miniconda3-4.5.4-Linux-x86_64.sh \
-O ~/anaconda.sh && \
bash ~/anaconda.sh -b -p /usr/local/anaconda && \
rm ~/anaconda.sh
fi

# set anaconda path
export PATH=$PATH:/usr/local/anaconda/bin
conda update conda

conda config --add channels r
conda config --add channels defaults
conda config --add channels conda-forge
conda config --add channels bioconda

# Let us save some space
conda clean --packages -y

# external tools
echo "Installing conda environment ... "
conda env create -f /opt/environment.yml
echo "source activate HiC-Pro_v3.1.0" > ~/.bashrc

# Install HiC-pro
echo "Installing latest HiC-Pro release ..."
VERSION=$(curl -s https://github.com/nservant/HiC-Pro/releases/latest | egrep -o 'v3.[0-9]*.[0-9]*')
echo "v"$VERSION".zip" | wget --base=http://github.com/nservant/HiC-Pro/archive/ -i - -O hicpro_latest.zip && unzip hicpro_latest.zip
#VERSION="devel_py3"
#echo $VERSION".zip" | wget --base=http://github.com/nservant/HiC-Pro/archive/ -i - -O hicpro_latest.zip && unzip hicpro_latest.zip

cd $(echo HiC-Pro-$VERSION)
make configure
make install

# Let us save some space
conda clean --packages -y
conda clean --all -y
rm -rf /usr/local/anaconda/pkgs

%test
INSTALLED_HICPRO_VERSION=$(find /usr/local/bin -name HiC-Pro | xargs dirname)
$INSTALLED_HICPRO_VERSION/HiC-Pro -h

%environment
export PATH=$PATH:/usr/local/anaconda/bin
INSTALLED_VERSION=$(find /usr/local/bin -name HiC-Pro | xargs dirname)
export PATH=$PATH:$INSTALLED_VERSION
export LANG=C
BootStrap: docker
From: ubuntu:latest

%labels
AUTHOR Nicolas Servant

%files
environment.yml /opt/environment.yml

%environment
export LANG=en_US.utf-8
export INSTALLED_VERSION=$(find /usr/local/bin -name HiC-Pro | xargs dirname)
export PATH=$PATH:${INSTALLED_VERSION}:${INSTALLED_VERSION}/utils/
export PATH=/usr/local/conda/bin:$PATH
source /opt/etc/bashrc

%post
apt-get update && \
apt-get install -y \
wget \
debootstrap \
gzip \
bzip2 \
curl \
unzip \
g++ \

# use bash as /bin/sh instead of dash (otherwise source /opt/etc/bashrc will not work)
echo "dash dash/sh boolean false" | debconf-set-selections
DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash

# install miniconda
if [ ! -d /usr/local/miniconda ]; then
wget https://repo.continuum.io/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh -O miniconda.sh && \
sh miniconda.sh -b -p /usr/local/conda && \
rm miniconda.sh && \
ln -s /usr/local/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh && \
find /usr/local/conda/ -follow -type f -name '*.a' -delete && \
find /usr/local/conda/ -follow -type f -name '*.js.map' -delete && \
/usr/local/conda/bin/conda clean -afy
fi

# set miniconda path
export PATH=/usr/local/conda/bin:$PATH
conda update conda
conda clean --packages -y

#bashrc
echo "#! /bin/bash\n\n" > ~/.bashrc
conda init bash

# external tools
echo "Installing conda environment ... "
conda env create -f /opt/environment.yml -n hicpro
echo "conda activate hicpro" >> ~/.bashrc

# Install HiC-pro
export PATH=/usr/local/conda/envs/hicpro/bin:$PATH
echo "Installing latest HiC-Pro release ..."
#VERSION=$(curl -s https://github.com/nservant/HiC-Pro/releases/latest | egrep -o 'v3.[0-9]*.[0-9]*')
VERSION="3.1.0"
echo "v"$VERSION".zip" | wget --base=http://github.com/nservant/HiC-Pro/archive/ -i - -O hicpro_latest.zip && unzip hicpro_latest.zip

cd $(echo HiC-Pro-$VERSION)
make configure
make install

# Let us save some space
conda clean --packages -y
conda clean --all -y
rm -rf /usr/local/miniconda/pkgs
apt-get clean

mkdir /opt/etc/
cp ~/.bashrc /opt/etc/bashrc

%test
INSTALLED_HICPRO_VERSION=$(find /usr/local/bin -name HiC-Pro | xargs dirname)
${INSTALLED_HICPRO_VERSION}/HiC-Pro -h

Loading

0 comments on commit 6624df2

Please sign in to comment.