展开

snakemake软件环境管理

最后发布时间 : 2022-12-08 17:23:23 浏览量 :

https://snakemake.readthedocs.io/en/stable/snakefiles/deployment.html#running-jobs-in-containers

https://snakemake.readthedocs.io/en/stable/snakefiles/rules.html#jupyter-notebook-integration

singularity exec --home /data3/cluster/workspace/STAR --bind /data3/cluster/anaconda3/lib/python3.9/site-packages:/mnt/snakemake /data3/cluster/workspace/STAR/.snakemake/singularity/b8b08b39684a8fd3fece5421fbc3d7c3.simg bash -c 'set -euo pipefail; python /data3/cluster/workspace/STAR/.snakemake/scripts/tmp2f6oc5nr.wrapper.py'

singularity cmd

 cmd = singularity.shellcmd(
                container_img,
                cmd,
                singularity_args,
                envvars=None,
                shell_executable=cls._process_args["executable"],
                container_workdir=shadow_dir,
                is_python_script=context.get("is_python_script", False),
            )
singularity  
exec --home /home/wangyang/workspace/snakemake-main 
--bind /home/wangyang/workspace/snakemake-main:/mnt/snakemake 
/home/wangyang/workspace/snakemake-main/.snakemake/singularity/0dce7c65c8a559e3c24ed8b6244ff322.simg 
bash -c 'set -euo pipefail;  python /home/wangyang/workspace/snakemake-main/.snakemake/scripts/tmp_ij2ge_y.hello.py'

Ad-hoc combination of Conda package management with containers

Snakemake will first pull the defined container image, and then create the requested conda environment from within the container. The conda environments will still be stored in your working environment, such that they don’t have to be recreated unless they have changed. The hash under which the environments are stored includes the used container image url, such that changes to the container image also lead to new environments to be created. When a job is executed, Snakemake will first enter the container and then activate the conda environment.

singularity exec --home /data3/cluster/workspace/STAR --bind /data3/cluster/anaconda3/lib/python3.9/site-packages:/mnt/snakemake /data3/cluster/workspace/STAR/.snakemake/singularity/b8b08b39684a8fd3fece5421fbc3d7c3.simg bash -c 'set -euo pipefail; python /data3/cluster/workspace/STAR/a.py'

External scripts

图片alt

图片alt

snakemake  -p --use-envmodules  -c50  results/index/bowtie2/genome_.1.bt2

snakemake -p --use-singularity --singularity-args  "--bind /data:/data" --rerun-incomplete -c50 results/index/bowtie2/genome_.1.bt2