美文网首页
2018-07-19 singularity 使用

2018-07-19 singularity 使用

作者: e8a37405cb53 | 来源:发表于2018-07-19 10:45 被阅读0次

singularity is awesome!

singularity 类似docker,和docker不同的一点是不需要进入root环境,而且可以将docker的镜像转换为singularity。
https://www.sylabs.io/docs/
https://www.nextflow.io/docs/latest/singularity.html#singularity-page

ENABLE OVERLAY (boolean, default=’no’)

The overlay file system creates a writable substrate to create bind points if necessary. This feature is very useful when implementing bind points within containers where the bind point may not already exist so it helps with portability of containers. Enabling this option has been known to cause some kernels to panic as this feature maybe present within a kernel, but has not proved to be stable as of the time of this writing (e.g. the Red Hat 7.2 kernel).

Singularity Recipes

For a reproducible, production-quality container, we recommend that you build a container with the default (squashfs) file format using a Singularity recipe file. This also makes it easy to add files, environment variables, and install custom software, and still start from your base of choice (e.g., Singularity Hub). A recipe file has a header and a body. The header determines what kind of base container to begin with, and the body is further divided into sections (called scriptlets) that do things like install software, setup the environment, and copy files into the container from the host system. Here is an example of a recipe file:

https://www.sylabs.io/guides/2.5.1/user-guide/singularity_flow.html#singularity-flow

创建一个sandox 目录

sudo singularity build --sandbox ubuntu/ docker://ubuntu
#安装,然后生成镜像
sudo singularity build ubuntu.simg ubuntu/

或者直接生成镜像

sudo singularity build --writable ubuntu.img docker://ubuntu
#选择Ubuntu 版本
sudo /usr/local/bin/singularity build --writable ubuntu.16.06.img docker://ubuntu:16.04

配置Ubuntu

edit source list, 选择清华镜像源 https://mirror.tuna.tsinghua.edu.cn/help/ubuntu/
vi /etc/apt/sources.list

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse

然后

 apt-get update

Executing Commands

singularity exec hello-world.simg ls /
singularity exec scilifelab-ngi-rnaseq-1.4.img STAR --version

workflow

from conda

sudo /usr/local/bin/singularity build --sandbox conda-circexplorer2 python-conda.simg
sudo /usr/local/bin/singularity shell --writable conda-circexplorer2

now you are in the sanbox, config conda
add circexplorer2,

conda install circexplorer2 --channel bioconda
conda install bowtie bowtie2 tophat
conda install -c bioconda ucsc-genepredtogtf ucsc-gtftogenepred  ucsc-bedgraphtobigwig ucsc-bedtobigbed

build reproduceable singularity images

sudo singularity build ubuntu.simg ubuntu/

相关文章

网友评论

      本文标题:2018-07-19 singularity 使用

      本文链接:https://www.haomeiwen.com/subject/yfgzpftx.html