GooglingTheCancerGenome/sv-gen

Snakemake-based workflow for generating artificial genomes with structural variants

Overview

Topics: bioinformatics structural-variants cancer-genomics wgs simulator workflow snakemake hpc-applications

Latest release: v1.1.0, Last update: 2023-01-19

Linting: linting: failed, Formatting:formatting: failed

Deployment

Step 1: Install Snakemake and Snakedeploy

Snakemake and Snakedeploy are best installed via the Mamba package manager (a drop-in replacement for conda). If you have neither Conda nor Mamba, it is recommended to install Miniforge. More details regarding Mamba can be found here.

When using Mamba, run

mamba create -c conda-forge -c bioconda --name snakemake snakemake snakedeploy

to install both Snakemake and Snakedeploy in an isolated environment. For all following commands ensure that this environment is activated via

conda activate snakemake

Step 2: Deploy workflow

With Snakemake and Snakedeploy installed, the workflow can be deployed as follows. First, create an appropriate project working directory on your system and enter it:

mkdir -p path/to/project-workdir
cd path/to/project-workdir

In all following steps, we will assume that you are inside of that directory. Then run

snakedeploy deploy-workflow https://github.com/GooglingTheCancerGenome/sv-gen . --tag v1.1.0

Snakedeploy will create two folders, workflow and config. The former contains the deployment of the chosen workflow as a Snakemake module, the latter contains configuration files which will be modified in the next step in order to configure the workflow to your needs.

Step 3: Configure workflow

To configure the workflow, adapt config/config.yml to your needs following the instructions below.

Step 4: Run workflow

The deployment method is controlled using the --software-deployment-method (short --sdm) argument.

To run the workflow with automatic deployment of all required software via conda/mamba, use

snakemake --cores all --sdm conda

Snakemake will automatically detect the main Snakefile in the workflow subfolder and execute the workflow module that has been defined by the deployment in step 2.

For further options such as cluster and cloud execution, see the docs.

Step 5: Generate report

After finalizing your data analysis, you can automatically generate an interactive visual HTML report for inspection of results together with parameters and code inside of the browser using

snakemake --report report.zip

Configuration

The following section is imported from the workflow’s config/README.md.

sv-gen

DOI CI Codacy Badge Codacy Badge

Structural variants (SVs) are an important class of genetic variation implicated in a wide array of genetic diseases. sv-gen is a Snakemake-based workflow to generate artificial short-read alignments based on a reference genome with(out) SVs. The workflow is easy to use and deploy on any Linux-based machine. In particular, the workflow supports automated software deployment, easy configuration and addition of new analysis tools as well as enables to scale from a single computer to different HPC clusters with minimal effort.

Dependencies

  • Python 3
  • Conda - package/environment management system
  • Snakemake - workflow management system
  • Xenon CLI - command-line interface to compute and storage resources
  • jq - command-line JSON processor (optional)
  • YAtiML - library for YAML type inference and schema validation

The workflow (DAG) includes the following tools:

The software dependencies and versions can be found in the conda environment.yaml files (1, 2).

1. Clone this repo.

git clone https://github.com/GooglingTheCancerGenome/sv-gen.git
cd sv-gen

2. Install dependencies.

# download Miniconda3 installer
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
# install Conda (respond by 'yes')
bash miniconda.sh
# update Conda
conda update -y conda
# install Mamba
conda install -n base -c conda-forge -y mamba
# create a new environment with dependencies & activate it
mamba env create -n wf -f environment.yaml
conda activate wf

3. Configure the workflow.

4. Execute the workflow.

cd workflow
# 'dry' run only checks I/O files
snakemake -np

# run the workflow locally snakemake –use-conda –cores

Submit jobs to Slurm/GridEngine-based cluster

SCH=slurm   # or gridengine
snakemake --use-conda --latency-wait 30 --jobs \
--cluster "xenon scheduler $SCH --location local:// submit --name smk.{rule} --inherit-env --max-run-time 5 --working-directory . --stderr stderr-%j.log --stdout stdout-%j.log" &>smk.log&

Query job accounting information

SCH=slurm   # or gridengine
xenon --json scheduler $SCH --location local:// list --identifier [jobID] | jq ...

Linting and formatting

Linting results

ModuleNotFoundError in file /tmp/tmp9qfamm6o/GooglingTheCancerGenome-sv-gen-cb57bbf/workflow/Snakefile, line 1:
No module named 'pyfaidx'
  File "/tmp/tmp9qfamm6o/GooglingTheCancerGenome-sv-gen-cb57bbf/workflow/Snakefile", line 1, in <module>
  File "/tmp/tmp9qfamm6o/GooglingTheCancerGenome-sv-gen-cb57bbf/workflow/helper_functions.py", line 5, in <module>

Formatting results

[DEBUG] 
[DEBUG] In file "/tmp/tmp9qfamm6o/GooglingTheCancerGenome-sv-gen-cb57bbf/workflow/Snakefile":  Formatted content is different from original
[DEBUG] 
[DEBUG] In file "/tmp/tmp9qfamm6o/GooglingTheCancerGenome-sv-gen-cb57bbf/workflow/rules/sim_genomes.smk":  Formatted content is different from original
[DEBUG] 
[DEBUG] In file "/tmp/tmp9qfamm6o/GooglingTheCancerGenome-sv-gen-cb57bbf/workflow/rules/sim_reads.smk":  Formatted content is different from original
[DEBUG] 
[DEBUG] In file "/tmp/tmp9qfamm6o/GooglingTheCancerGenome-sv-gen-cb57bbf/workflow/rules/map_reads.smk":  Formatted content is different from original
[INFO] 4 file(s) would be changed 😬

snakefmt version: 0.8.0