tdayris/fair_gatk_mutect2

Snakemake workflow used to call germline and/or somatic variants with GATK Mutect2

Overview

Topics: fair gatk-bestpractices mutect2 reproducible-workflows snakemake snakemake-workflow variant-calling

Latest release: 1.5.4, Last update: 2024-07-22

Linting: linting: passed, 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/tdayris/fair_gatk_mutect2 . --tag 1.5.4

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

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

snakemake --cores all --sdm conda apptainer

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.

This pipeline requires two configuration file:

config.yaml

A standard Snakemake configuration, yaml-formatted file containing a list of all parameters accepted in this workflow:

  • samples: Path to the file containing link between samples and their fastq file(s)
  • params: Per-tool list of optional parameters

Example:

samples: config/samples.csv

Optional parameters

params: fait_gatk_mutect2_gatk_filtermutectcalls: “–create-output-variant-index –min-median-mapping-quality 35 –max-alt-allele-count 3”

A complete list of accepted keys is available in schemas, with their default value, expected type, and human readable description.

samples.csv

A CSV-formatted text file containing the following mandatory columns:

  • sample_id: Unique name of the sample
  • upstream_file: Path to upstream fastq file
  • species: The species name, according to Ensembl standards
  • build: The corresponding genome build, according to Ensembl standards
  • release: The corresponding genome release, according to Ensembl standards
  • downstream_file: Optional path to downstream fastq file, leave it empty in case of single ended library
  • normal_sample_id: Optional identifier of a normal sample to be used in a tumor/normal pair

Example:

sample_id,upstream_file,downstream_file,species,build,release,normal_id
sac_a,data/reads/a.scerevisiae.1.fq,data/reads/a.scerevisiae.2.fq,saccharomyces_cerevisiae,R64-1-1,105,
sac_b,data/reads/b.scerevisiaeI.1.fq,data/reads/b.scerevisiaeI.2.fq,saccharomyces_cerevisiae,R64-1-1,105,sac_a

A complete list of accepted keys is available in schemas, with their default value, expected type, and human readable description.

While CSV format is tested and recommended, this workflow uses python csv.Sniffer() to detect column separator. Tabulation and semicolumn are also accepted as field separator. Remember that only comma-separator is tested.

genomes.csv

This file is fully optional. When missing, the genome sequences will be downloaded from Ensembl and indexed.

A CSV-formatted text file containing the following mandatory columns:

  • species: The species name, according to Ensembl standards
  • build: The corresponding genome build, according to Ensembl standards
  • release: The corresponding genome release, according to Ensembl standards

The following columns are optional and are used to avoid downloading genomes:

  • fasta: Path to the reference genome sequence (FASTA formatted)
  • fasta_index: Path to the reference genome sequence index (FAI formatted)
  • bowtie2_dna_index: Path to the main directory containing reference index

Example:

species,build,release,fasta,fasta_index,bowtie2_index
homo_sapiens,GRCh38,105,/path/to/sequence.fasta,/path/to/sequence.fasta.fai,/path/to/bowtie2_sequence/
mus_musculus,GRCm38,99,,,
mus_musculus,GRCm39,105,,,

A complete list of accepted keys is available in schemas, with their default value, expected type, and human readable description.

Linting and formatting

Linting results

None

Formatting results

[DEBUG] 
[DEBUG] 
[DEBUG] In file "/tmp/tmpv2d08lck/tdayris-fair_gatk_mutect2-cf334f3/workflow/rules/common.smk":  Formatted content is different from original
[DEBUG] 
[DEBUG] In file "/tmp/tmpv2d08lck/tdayris-fair_gatk_mutect2-cf334f3/workflow/rules/snpeff.smk":  Formatted content is different from original
[DEBUG] 
[DEBUG] 
[DEBUG] In file "/tmp/tmpv2d08lck/tdayris-fair_gatk_mutect2-cf334f3/workflow/rules/multiqc.smk":  Formatted content is different from original
[DEBUG] 
[DEBUG] 
[DEBUG] 
[DEBUG] In file "/tmp/tmpv2d08lck/tdayris-fair_gatk_mutect2-cf334f3/workflow/rules/fair_bowtie2_mapping_pipeline.smk":  Formatted content is different from original
[DEBUG] 
[DEBUG] In file "/tmp/tmpv2d08lck/tdayris-fair_gatk_mutect2-cf334f3/workflow/rules/gatk_mutect2_calling_meta.smk":  Formatted content is different from original
[DEBUG] 
[DEBUG] 
[INFO] 5 file(s) would be changed 😬
[INFO] 6 file(s) would be left unchanged 🎉

snakefmt version: 0.10.2