Last active
April 20, 2024 12:05
-
-
Save arraytools/fa6352953678e4182920fd4eb50e1cfd to your computer and use it in GitHub Desktop.
Corrected singularity definition file for RNA-Seq analysis. The original file is available from https://hpc.nih.gov/apps/singularity.html. Especially, From: is changed to use miniconda3. I have to comment out sailfish installation.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Test on Debian 12/Ubuntu 22.04 (Desktop/server, LXC has a mksquashfs issue) | |
# Assume to install by a user with sudo right | |
# Eg. apt update; apt install sudo; adduser USERNAME; usermod -aG sudo USERNAME | |
# 2024/4/19 | |
# Install Dependencies | |
# Ensure repositories are up-to-date | |
sudo apt-get update | |
# Install debian packages for dependencies | |
sudo apt-get install -y \ | |
autoconf \ | |
automake \ | |
cryptsetup \ | |
fuse \ | |
fuse2fs \ | |
git \ | |
libfuse-dev \ | |
libglib2.0-dev \ | |
libseccomp-dev \ | |
libtool \ | |
make \ | |
pkg-config \ | |
runc \ | |
squashfs-tools \ | |
squashfs-tools-ng \ | |
uidmap \ | |
wget \ | |
zlib1g-dev | |
# Install Go | |
export VERSION=1.22.2 OS=linux ARCH=amd64 && \ | |
wget https://dl.google.com/go/go$VERSION.$OS-$ARCH.tar.gz && \ | |
sudo tar -C /usr/local -xzvf go$VERSION.$OS-$ARCH.tar.gz && \ | |
rm go$VERSION.$OS-$ARCH.tar.gz | |
echo 'export GOPATH=${HOME}/go' >> ~/.bashrc && \ | |
echo 'export PATH=/usr/local/go/bin:${PATH}:${GOPATH}/bin' >> ~/.bashrc && \ | |
source ~/.bashrc | |
# Download SingularityCE from a release | |
export VERSION=4.1.0 && # adjust this as necessary \ | |
wget https://github.com/sylabs/singularity/releases/download/v${VERSION}/singularity-ce-${VERSION}.tar.gz && \ | |
tar -xzf singularity-ce-${VERSION}.tar.gz && \ | |
cd singularity-ce-${VERSION} | |
./mconfig && \ | |
make -C ./builddir && \ | |
sudo make -C ./builddir install | |
# singularity run docker://hello-world |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bootstrap: docker | |
From: continuumio/miniconda3 | |
IncludeCmd: yes | |
%post | |
apt-get -y update | |
apt-get -y install wget libncurses5-dev libbz2-dev liblzma-dev zlib1g-dev \ | |
autoconf automake make gcc perl zlib1g-dev libbz2-dev liblzma-dev \ | |
libcurl4-gnutls-dev libssl-dev libdeflate-dev | |
# Install samtools | |
wget https://github.com/samtools/samtools/releases/download/1.10/samtools-1.10.tar.bz2 | |
tar -vxjf samtools-1.10.tar.bz2 | |
cd samtools-1.10 | |
make | |
make install | |
cd .. | |
export PATH=/opt/conda/bin:$PATH | |
conda install --yes -c conda-forge -c bioconda \ | |
star=2.5.2b \ | |
# sailfish \ | |
fastqc=0.12.1 \ | |
kallisto=0.50.1 \ | |
subread=2.0.6 | |
conda clean --index-cache --tarballs --packages --yes | |
mkdir /data /resources | |
%runscript | |
#!/bin/bash | |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
# this text code will run whenever the container | |
# is called as an executable or with `singularity run` | |
function usage() { | |
cat <<EOF | |
NAME | |
rnaseq - rnaseq pipeline tools 0.1 | |
SYNOPSIS | |
rnaseq tool [tool options] | |
rnaseq list | |
rnaseq help | |
DESCRIPTION | |
Singularity container with tools to build rnaseq pipeline. | |
EOF | |
} | |
function tools() { | |
echo "conda: $(which conda)" | |
echo "---------------------------------------------------------------" | |
conda list | |
echo "---------------------------------------------------------------" | |
echo "samtools: $(samtools --version | head -n1)" | |
} | |
arg="${1:-none}" | |
case "$arg" in | |
none) usage; exit 1;; | |
help) usage; exit 0;; | |
list) tools; exit 0;; | |
# just try to execute it then | |
*) $@;; | |
esac | |
%environment | |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
# This sets global environment variables for anything run within the container | |
export PATH="/opt/conda/bin:/usr/local/bin:/usr/bin:/bin:" | |
unset CONDA_DEFAULT_ENV | |
export ANACONDA_HOME=/opt/conda |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo singularity build rnaseq3 rnaseq3.def | |
./rnaseq3 cat /etc/os-release # debian 11, host=ubuntu 2204 | |
./rnaseq3 samtools --version # 1.10 | |
./rnaseq3 STAR --version # 2.5.2b | |
./rnaseq3 fastqc -v # v0.12.1 | |
./rnaseq3 kallisto | head 1 # 0.50.1 | |
./rnaseq3 subread # command not found | |
./rnaseq3 featureCounts -v | head # v2.0.6 | |
./rnaseq3 ls /opt/conda/bin | |
./rnaseq3 which gcc # 10.2.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment