.. role:: bash(code) :language: bash Overview ######### .. Benchpress is a Snakemake workflow based on a collection of modules which stem from various different packages, libraries, and open-source software. Benchpress is a `Snakemake `_ workflow based on a collection of packages, libraries, and open-source software related to structure learning for graphical models. It is designed in a modular way, separating graph (:ref:`graph`), parameterization (:ref:`parameters`), and data sampling (:ref:`data`), from structure learning (:ref:`structure_learning_algorithms`) and performance evaluation (:ref:`evaluation`), so that it *"..can be seamlessly scaled to server, cluster, grid and cloud environments, without the need to modify the workflow definition."*, following the `Snakemake `_ principles. In order to maintain reproducibility and to save the user from manually installing each of the used software, Benchpress relies on `Snakemake `_'s support for `Apptainer `_ and runs by default each of the modules in separate containers. Installation ####################### .. The first alternative is to use the official `Snakemake Docker image `_, where `Apptainer `_ is installed, and run Benchpress through an interactive `Docker `_ container. .. The second alternative is to install `Apptainer `_ natively on a `Linux `_ system. .. For either of the alternatives, The first step is to install `git `_ and to clone the Benchpress repository to a directory of choice (*path/to/benchpress*) .. Ones `Apptainer `_ and Snakemake is in place, there is no further installation of the workflow as such. .. prompt:: bash git clone https://github.com/felixleopoldo/benchpress.git path/to/benchpress To keep you up-to-date with the latest updates you simply do the *git pull* command in the benchpress directory. .. Note that, `git `_ is not a requirement but it is highly recommended as it will make it easier to keep you updated with the latest updates using the command *git pull* and to add new modules. As soon as `Apptainer `_ and `Snakemake `_ are available, no further installation is required and you are ready to run Benchpress. Here we describe two ways to get these in place. .. on your server or local machine. Linux/macOS/Windows (Docker) -------------------------------- For this alternative, you only need to install `Docker `_, following the instructions for your specific system. This is usually the easiest way to get started and it works for any platform supporting `Docker `_. You may configure the resources (memory, cores, disk,... ) to be used through the `Docker `_ interface. .. _linuxx: Linux (Native) ----------------------------- This alternative is preferred e.g. if you will add new modules or if you are working on a server that doesn't support `Docker `_ (typically for security reasons). 1. Install `Anaconda `_ (or miniconda) from `here `_. 2. Install `Snakemake >= 7.30.1 `_ following the `installation instructions `_. 3. Install `Apptainer (former Singularity) `_ following the `installation instructions `_. .. note:: If `Snakemake `_ was installed with `Mamba `_ (as suggested on `Snakemakes' `_ homepage) you may update it to the latest version by running .. prompt:: bash mamba update snakemake .. note:: Some systems require explicit installation of *squashfs-tools*, which can be installed by conda as .. prompt:: bash conda install -c conda-forge squashfs-tools .. note:: For cloud or cluster execution however, software such as `Kubernetes `_ or `Slurm `_ may also be required. See the `Snakemake documentation `_ for further information. Windows (WSL) ------------------- Widows users may also use the `Windows Subsystem for Linux (WSL) `_ to run Benchpress on their system. For this alternative, you will need to install `Snakemake `_ and `Apptainer `_ in the WSL environment, and run the workflow as if you were using a `Linux `_ system. The files will be stored in the WSL file system, but can be accessed from the Windows file system as well among network devices. To install WSL type the following command in a PowerShell terminal with administrator rights: .. prompt:: powershell wsl --install To start the WSL terminal, type *wsl* as: .. prompt:: powershell wsl or search for *Ubuntu* in the start menu. .. note:: The `Windows Subsystem for Linux (WSL) `_ is only available for Windows 10, 11, and Windows Server 2019, and requires a 64-bit version of Windows. It is also recommended to use WSL2 for better performance. Usage ###### Here we describe some basic commands to get you started using Benchpress. Depending on if you use `Docker `_ or if you have installed `Snakemake `_ and `Apptainer `_ natively, follow one of the alternatives below. Docker -------- Start an interactive `Docker `_ container (based on the `official Snakemake docker image `_) in privileged mode, where the benchpress folder (absolute path) is shared as a volume, here to the folder /mnt which is also set to the working directory. .. prompt:: bash docker run -it -w /mnt --privileged -v /absolute/path/to/benchpress:/mnt bpimages/snakemake:v9.7.1 Depending on your system, you may have to prepend the above command by *sudo*. On Windows, you may have to escape spaces in the benchpress path using ^ or \`. Linux without Docker ---------------------- If you installed `Snakemake `_ by using `Conda `_ as suggested by `Snakemake `_, you first need to activate the conda environment called *snakemake*. First head into the benchpress folder by .. prompt:: bash cd path/to/benchpress then run .. prompt:: bash conda activate snakemake Run config file ---------------- Benchpress is designed to handle all the user interaction through a `JSON `__ config file, on a specific format that is described in :ref:`json_config`. The following command runs the config file `config/config.json `_, whether you use `Docker `_ or run natively on your machine, using *all* available cores .. prompt:: bash snakemake --cores all --use-singularity --configfile config/config.json The output is stored in subfolders of *path/to/benchpress/results/output* named by the evaluation modules. Note that the first run will take some longer time, as about 5-10 GB of `Docker `_ images will be downloaded. To use other modules, you may copy the `JSON `__ snippets from the documentation (:ref:`graph`, :ref:`parameters`, :ref:`data`, :ref:`structure_learning_algorithms`, :ref:`evaluation`) and paste them into your config file. It may also be helpful to look into the other config files in `config/ `_. .. note:: For `cluster `__ and `cloud `__ execution, please review the `Snakemake documentation `__ for the commands to use. .. Depending on if you are using `Docker `_ or run directly on `Linux `_ you need to perform one of the initial steps below.