Skip to content

Reference handling in an automated, multi-sample container setting (with workarounds) #25

Description

@ktpolanski

The SCAFE Docker image does not come with the references pre-downloaded, which is understandable. However, it expects the reference positioned in a very particular location within the container files, necessitating a fresh download each time the container is started up. This becomes doubly problematic when converting to Singularity, which is read-only (just adding --writable as indicated in the readme does not work) and my attempts to make it not be so resulted in conflicts with Nextflow.

The easiest resolution would be to allow specifying a path to the reference. This way it could be pre-downloaded ahead of time and provided directly to the container as part of the mount, simplifying the process considerably.

Current workarounds follow.

In Docker, the easiest way is to start an interactive session with a mount specified via -v, download the reference of interest, and then copy it to the mounted directory. Then the reference can be passed back in as part of the contents of the -v'd folder, and a symlink can be easily set up to the appropriate directory within the script:

#add scafe scripts to path
source ~/.bashrc
#symlink in the referece
ln -s /mnt/hg38.gencode_v32 resources/genome
#do your scafe stuff

For Singularity, the workaround I found involved turning the container to a sandbox, downloading the reference, and turning it back to a .sif file:

#get sif from docker
singularity pull docker://cchon/scafe:latest
#turn to sandbox to allow addition of files
singularity build --sandbox scafe-sandbox scafe_latest.sif
#start up sandboxed version which will allow storing stuff, with --writable
singularity shell --writable --env APPEND_PATH=/SCAFE/scripts --env LC_ALL=C scafe-sandbox
#run within container, download reference
scafe.download.resources.genome --genome=hg38.gencode_v32
#exit container, turn sandbox back into sif
singularity build scafe_hg38.sif scafe-sandbox/

The container can then be called like so, with the reference baked into the appropriate location:

singularity shell --env APPEND_PATH=/SCAFE/scripts --env LC_ALL=C scafe_hg38.sif

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions