Metagenome宏基因组 singularity 容器安装使用 2022.12.29 -2022.01.01

时间:2023-01-01 21:58:53
export PATH=/home/ubuntu/software:$PATH  #PATH=PWD:$PATH
conda creat -c bioconda -n name_envs fastqc #conda子环境安装fastqc
conda activate name_envs #切换到子环境
which -a fastqc #a
*****Singularity 安装和使用 *****
1.安装依赖
sudo apt-get update && sudo apt-get install -y \
build-essential \
uuid-dev \
libgpgme-dev \
squashfs-tools \
libseccomp-dev \
wget \
pkg-config \
git \
cryptsetup-bin
2.安装 GO 语言
https://zhuanlan.zhihu.com/p/399172488
wget https://go.dev/dl/go1.14.12.linux-amd64.tar.gz
tar -xzvf go1.14.12.linux-amd64.tar.gz
rm go1.14.12.linux-amd64.tar.gz
/home/ubuntu/software/go/bin
****
sudo vi /etc/profile.d/env.sh
export PATH=/home/ubuntu/software/go/bin:$PATH
source /etc/profile.d/env.sh
****
echo 'export PATH=/home/ubuntu/software/go/bin:$PATH' >> /etc/profile.d/env.sh
source /etc/profile.d/env.sh

which go #测试安装是否成功
3.下载singularity
下载解压安装到home目录下
wget https://github.com/hpcng/singularity/releases/download/v3.7.2/singularity-3.7.2.tar.gz
tar -xzf singularity-3.7.2.tar.gz
cd singularity
4.安装singularity 并添加到环境变量
$ ./mconfig
$ cd builddir
$ make
$ sudo make install
singularity version #测试安装是否成功
echo "export PATH=/usr/local/bin:$PATH" >> /etc/profile.d/env.sh
which singularity
/usr/local/bin/singularity
source /etc/profile.d/env.sh
**快速上手
2.1 下载images
singularity pull --arch amd64 library://library/default/ubuntu:20.04
2.2 创建沙箱
singularity build --sandbox blast ubuntu_20.04.sif
2.3 进入容器
singularity shell --writable --fakeroot blast
singularity shell --writable blast
Singularity> apt install wget
Singularity> apt install ncbi-blast+
Singularity> wget http://ncbi-blast+
Singularity> chmod a+x fastp
Singularity> cp /home/ubuntu/ncbi-blast+ /opt
Singularity> tar -zxfv ncbi-blast+.tar.gz
Singularity> cd ncbi-blast+ cd bin
Singularity> pwd /opt/ncbi-blast-2.13.0+/bin #安装到容器的bin目录下
#添加环境变量
/home/ubuntu/blast/environment
export PATH=/opt/ncbi-blast-2.13.0+/bin:$PATH
#测试运行
singularity shell blast
which blastp #交互式运行
singularity exec blast blstp -help #直接运行
#封装成标准模式
singularity build -f blast.sif blast
singularity exec blast.sif blastP
#使用
singularity exec blast.sif makeblastdb -dbtype prot -in sind.fasta -out sind
singularity exec blast.sif blastp -query atha_FAD4.fa -db sind -out blast.out -outfmt 7