snakemake-workflows/microsatellite-instability-detection-with-msisensor-pro

Best practices snakemake workflow for microsatellite instability (MSI) detection with msisensor-pro.

Overview

Latest release: None, Last update: 2025-08-08

Linting: linting: failed, Formatting: formatting: failed

Wrappers: bio/reference/ensembl-sequence bio/samtools/index

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/snakemake-workflows/microsatellite-instability-detection-with-msisensor-pro . --tag None

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 using apptainer/singularity, use

snakemake --cores all --sdm apptainer

To run the workflow using a combination of conda and apptainer/singularity for software deployment, use

snakemake --cores all --sdm conda apptainer

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.

Workflow overview

This workflow is a best-practice workflow for microsatellite instability (MSI) detection with msisensor-pro, following best practices for standardized workflows. The workflow is built using snakemake and consists of the following steps:

  1. Download genome reference from NCBI

  2. Validate downloaded genome (python script)

  3. Simulate short read sequencing data on the fly (dwgsim)

  4. Check quality of input read data (FastQC)

  5. Collect statistics from tool output (MultiQC)

Workflow setup

Setting up this workflow requires three steps:

  1. Create a sample sheet as described below.

  2. Ensure that input SAM/BAM/CRAM files exist with the given file name pattern.

  3. Go through the config/config.yaml file adjusting all configurations as outlined in the extensive comments.

Sample sheet

The sample sheet has the following layout:

sample

alias

group

sample1

tumor

patient_A

sample2

normal

patient_A

sample3

tumor

patient_B

sample4

normal

patient_B

This follows the same naming scheme that a number of other standardized snakemake workflows for DNA sequencing data also follow, for example the dna-seq-varlociraptor workflow.

Input data

This workflow assumes that you have already mapped / aligned your read data to the reference genome that you specify in the config/config.yaml file, and performed quality score recalibration on them. So it starts from SAM/BAM/CRAM files, and assumes that these follow this file path and naming scheme (where {sample} are entries from the sample column in your sample sheet):

If your input files do not follow this scheme, we suggest that you add a rule that creates symbolic links with the correct {sample}.bam naming scheme in the subfolder results/recal/. This could for example look like this:

rule link_input_data:
    input:
        original="../../path/to/other/workflow/results/mapped_and_recalibrated/{sample}",
    output:
        compliant="results/recal/{sample}.bam,
    log:
        "logs/link_input_data/{sample}.log",
    shell:
        "( ln --symbolic {input.original} {output.compliant} "
        ") >{log} 2>&1 "

Linting and formatting

Linting results

1Workflow defines that rule download_genome is eligible for caching between workflows (use the --cache argument to enable this).
2Lints for rule create_baseline_samples_list (line 28, /tmp/tmpcoitmzjb/workflow/rules/msisensor_pro_tumor_only.smk):
3    * Specify a conda environment or container for each rule.:
4      This way, the used software for each specific step is documented, and the
5      workflow can be executed on any machine without prerequisites.
6      Also see:
7      https://snakemake.readthedocs.io/en/latest/snakefiles/deployment.html#integrated-package-management
8      https://snakemake.readthedocs.io/en/latest/snakefiles/deployment.html#running-jobs-in-containers

Formatting results

 1[DEBUG] 
 2[DEBUG] In file "/tmp/tmpcoitmzjb/workflow/Snakefile":  Formatted content is different from original
 3[DEBUG] 
 4[DEBUG] 
 5[DEBUG] In file "/tmp/tmpcoitmzjb/workflow/rules/reference.smk":  Formatted content is different from original
 6[DEBUG] 
 7[DEBUG] In file "/tmp/tmpcoitmzjb/workflow/rules/msisensor_pro_tumor_only.smk":  Formatted content is different from original
 8[DEBUG] 
 9[DEBUG] In file "/tmp/tmpcoitmzjb/workflow/rules/common.smk":  Formatted content is different from original
10[DEBUG] 
11[DEBUG] In file "/tmp/tmpcoitmzjb/workflow/rules/results.smk":  Formatted content is different from original
12[INFO] 5 file(s) would be changed 😬
13[INFO] 1 file(s) would be left unchanged 🎉
14
15snakefmt version: 0.11.0