Skip to content

Latest commit

 

History

History
134 lines (89 loc) · 5.99 KB

README.md

File metadata and controls

134 lines (89 loc) · 5.99 KB

Source files

Singularity containers

This repository directory is used to develop and document Docker and Singularity containers with various software and analytical tools.

Software versions

Below is the list of tools included in the different Dockerfiles and installer bash scripts for each container. Please keep up to date (and update the main <ldpred2_standalone>/README.md when pushing new container builds):

ldpred2 container

OS/tool Version/Git tag License Source
Ubuntu 22.04 (LTS) Creative Commons CC-BY-SA version 3.0 UK licence Ubuntu.com
Rocker/r-ver 3.2.1 GPL rocker-project.org
R 4.3.1 (2023-06-16) GPL-* r-project.org
Python 3.11 PSF python.org
PLINK-1.9 v2.00a4.5 GPL-3 https://www.cog-genomics.org/plink/
PLINK-2.0 v2.00a4.5 GPL-3 https://www.cog-genomics.org/plink/

Feedback

If you face any issues, or if you need additional software, please let us know by creating an issue.

Build instructions

For most users there is little reason to build the container from scratch, as pre-built containers are available from the GitHub Container Registry. The following instructions are for those who wish to build the container locally or to modify the container.

The easy(er) way

For convenience, a Makefile is provided in this directory in order to build Singularity containers from Dockerfiles (as <ldpred2_standalone/src/dockerfiles/ldpred2/Dockerfile>). Using this file assumes that a working Docker and Singularity or Apptainer installation, as well as the GNU make utility is available on the host computer/build system. On Debian-based Linux OS, this utility can usually be installed by issuing apt-get install -y make; on MacOS with Homebrew asbrew install make. Prefixsudo if necessary.

Then, the container can be built by issuing:

make ldpred2.sif

If all went well, the built file should be located as <ldpred2_standalone/containers/ldpred2.sif>. In case super-user (sudo) privileges are required, issue:

sudo make ldpred2.sif

Manual builds

To build the container manually, this is possible via the following steps

docker build -t ldpred2 -f dockerfiles/ldpred2/Dockerfile .  # build docker container

In case you do not want to use Singularity (e.g., for testing locally), the build can be used e.g., by issuing

docker run -it -p 5001:5001 ldpred2 R --version

which should return the currently installed R version incorporated into the container. You may replace the port numbers (5001) by another (e.g., 5000).

To convert, and relocate the Singularity container file generated from the Docker image, issue

bash scripts/convert_docker_image_to_singularity.sh ldpred2  # produces ldpred2.sif
bash scripts/scripts/move_singularity_file.sh.sh ldpred2  # put ldpred2.sif file to <ldpred2_standalone>/containers/ directory

Again, super-user (sudo) privileges may be required on the host computer. In that case, prefix sudo on the line(s) that fail. For further details on the commands that are run within each bash file, open the .sh files in a code editor.

Clean up

The above steps may leave a collection of images in the Docker registry, wasting drive space. To list them, issue

docker images -a

Chosen images can be removed by issuing:

docker rmi <image-id-1> <image-id-2> ... 

For more info, see docker rm

Testing container builds

Some basic checks for the functionality of the different container builds are provided in <ldpred2_standalone>/tests/, implemented in Python. The tests can be executed using the Pytest testing framework.

In case singularity is not found in PATH, tests will fall back to docker. In case docker is not found, no tests will run.

To install Pytest in the current Python environment, issue:

pip install pytest  # --user optional

New virtual environment using conda:

conda create -n pytest python=3 pytest -y  # creates env "pytest"
conda activate pytest  # activates env "pytest"

Then, all checks can be executed by issuing:

cd <ldpred2_standalone>
py.test -v tests  # with verbose output

Checks for individual containers (e.g., ldpred2.sif) can be executed by issuing:

py.test -v tests/test_ldpred2.py

Note that the proper container files (*.sif files) corresponding to the different test scripts must exist in <ldpred2_standalone>/containers/, not only git LFS pointer files.

MacOS Notes

If running Docker on MacOS with a modern M1/M2/M3 chip, include --platform linux/amd64 in the docker run command (and similar) to execute the container for the correct architecture.