首页 > 解决方案 > 文件存在于 Singularity 容器中,但在执行时不会产生此类文件错误

问题描述

尽管能够在容器中看到文件,但我无法在Singularity -s exec.

首先,我们将构建映像并调查 Python 脚本的位置fasta_generate_regions.py

$ sudo docker pull alice0812ki/freebayes
$ sudo docker run -it --entrypoint /bin/bash alice0812ki/freebayes
root@ae2f1c94be30:/# find . -name "fasta_generate_regions.py"
./usr/local/bin/fasta_generate_regions.py
./usr/local/pkgs/freebayes-1.3.2-py27h49fb759_2/bin/fasta_generate_regions.py

因为我使用的是 HPC,所以我需要使用它Singularity,所以让我们先为其构建一个图像。

$ sudo singularity build freebayes.sif docker://alice0812ki/freebayes:latest

现在,通过仅运行命令的第一部分(注意:您不需要任何输入文件来解决此问题),您可以看到我们在查找存在No such file or directory的 Python 脚本时遇到错误:

$ singularity -s exec freebayes.sif freebayes-parallel <(fasta_generate_regions.py )
fasta_generate_regions.py: command not found
usage: /usr/local/bin/freebayes-parallel [regions file] [ncpus] [freebayes arguments]

Run freebayes in parallel over regions listed in regions file, using ncpus processors.
Will merge and sort output, producing a uniform VCF stream on stdout.  Flags to freebayes
which would write to e.g. a particular file will obviously cause problms, so caution is
encouraged when using this script.

examples:

Run freebayes in parallel on 100000bp chunks of the ref (fasta_generate_regions.py is also
located in the scripts/ directory in the freebayes distribution).  Use 36 threads.

    freebayes-parallel <(fasta_generate_regions.py ref.fa.fai 100000) 36 -f ref.fa aln.bam >out.vcf

标签: dockersingularity-container

解决方案


似乎是,对于您要在容器中执行的每个脚本,它都需要在调用之前singularity调用exec.

因此它看起来像:

singularity -s exec freebayes.sif freebayes-parallel \
     <(singularity -s exec fasta_generate_regions.py ... )

推荐阅读