-1

Despite being able to see a file within a container I'm not able to find it on Singularity -s exec.

First, we will build the image and investigate the location of the Python script 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

As I'm using an HPC I'll need to use Singularity so let's build an image for that first.

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

Now, by running only the first part of the command (Note: you don't need any input files for troubleshooting this problem) you can see that we get a No such file or directory error when it's looking for the Python script where it exists:

$ 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
  • 1
    You appear to be trying to run the `fasta_generate_regions.py` on your host, not inside the container. `<(somecommand)` is a shell expression that is interpreted by your local shell before the arguments are passed to the `singularity -s exec ...` command. – larsks Feb 04 '21 at 22:40

1 Answers1

0

Seems to be, that for every script you want to execute from within in a container, it needs to be preceded by a singularity call to exec.

Therefore it would look like:

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