IHGGM-Aachen/CNVand

A snakemake workflow to analyse and annotate copy number variants

Overview

Topics:

Latest release: 0.4, Last update: 2024-11-07

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/IHGGM-Aachen/CNVand . --tag 0.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

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.

CNVand Configuration Instructions

Configuration File

The configuration file (config/config.yaml) contains various settings that the CNVand pipeline requires. Below is an example of a typical configuration file along with an explanation of each parameter.

Example Configuration File

### Samplesheet
samples: config/samplesheet.tsv

### Output directory outdir: output/

### Reference data ref: genome: workflow/resources/Homo_sapiens_assembly38.fasta # Take care you’re using the same reference in your full workflow target_bed: .tests/integration/input/target.bed antitarget_bed: .tests/integration/input/antitarget.bed

### Toolkit parameter settings params: cnvkit: target_coverage: extra: -q 20 antitarget_coverage: extra: -q 20 reference: extra: call: ploidy: 2 extra: bintest: extra: breaks: extra: genemetrics: extra: scatter: y_min: -2.5 extra: export_vcf: extra: segment: extra: merge_vcf_cnr: False annotsv: annotations: workflow/data/annotations/ # Annotations to be downloaded externally - see README.md for more details extra:

Parameter Explanations

Samplesheet

  • samples: Path to the samplesheet file that contains information about the samples to be processed. This should be set to config/samplesheet.tsv.

Output Directory

  • outdir: Path to the directory where the output files will be stored. This is set to output/.

Reference Data

  • ref:
    • genome: Path to the reference genome file. Ensure that the reference genome used here is consistent throughout your workflow. Example: workflow/resources/Homo_sapiens_assembly38.fasta.
    • target_bed: Path to the target BED file. Example: .tests/integration/input/target.bed.
    • antitarget_bed: Path to the antitarget BED file. Example: .tests/integration/input/antitarget.bed.

Toolkit Parameter Settings

  • params:
    • cnvkit: Parameters for CNVkit tools.
      • target_coverage: Additional parameters for target coverage calculations. Example: -q 20.
      • antitarget_coverage: Additional parameters for antitarget coverage calculations. Example: -q 20.
      • reference: Additional parameters for reference generation.
      • call: Parameters for CNV calling.
        • ploidy: Ploidy level to be used. Example: 2.
        • extra: Additional parameters for the call step.
      • bintest: Additional parameters for bin testing.
      • breaks: Additional parameters for breakpoints detection.
      • genemetrics: Additional parameters for gene metrics calculation.
      • scatter: Parameters for scatter plot generation.
        • y_min: Minimum y-axis value for scatter plots. Example: -2.5.
        • extra: Additional parameters for scatter plots.
      • export_vcf: Additional parameters for VCF export.
      • segment: Additional parameters for segmentation.
    • merge_vcf_cnr: Flag to activate experimental merge of VCF and CNR data before annotation.
    • annotsv: Parameters for AnnotSV tool.
      • annotations: Path to the directory containing annotation files. Example: workflow/data/annotations/.
      • extra: Additional parameters for AnnotSV.

Samplesheet

The samplesheet (config/samplesheet.tsv) contains information about the samples to be processed by the CNVand pipeline. It includes the sample name, path to the BAM file, and path to the VCF file.

Example Samplesheet

sample  bam_path                                vcf_path
M24352  .tests/integration/input/M24352_CHR21.bam  .tests/integration/input/M24352_CHR21.vcf.gz

Column Explanations

  • sample: Unique identifier for the sample. Example: M24352.
  • bam_path: Path to the BAM file for the sample. Example: .tests/integration/input/M24352_CHR21.bam.
  • vcf_path: Path to the VCF file for the sample. Example: .tests/integration/input/M24352_CHR21.vcf.gz.

Summary

  1. Configuration File: Ensure all paths and parameters are correctly set in the config/config.yaml file.
  2. Samplesheet: Ensure the config/samplesheet.tsv file contains accurate paths to the BAM and VCF files for each sample.

By following these instructions, you will set up the CNVand pipeline correctly, ensuring accurate CNV analysis and annotation.

Linting and formatting

Linting results

None

Formatting results

[DEBUG] 
[DEBUG] In file "/tmp/tmpvo__agw_/IHGGM-Aachen-CNVand-d2cb340/workflow/rules/annotation.smk":  Formatted content is different from original
[DEBUG] 
[DEBUG] In file "/tmp/tmpvo__agw_/IHGGM-Aachen-CNVand-d2cb340/workflow/rules/common.smk":  Formatted content is different from original
[DEBUG] 
[DEBUG] In file "/tmp/tmpvo__agw_/IHGGM-Aachen-CNVand-d2cb340/workflow/rules/cnv.smk":  Formatted content is different from original
[DEBUG] 
[DEBUG] 
[INFO] 3 file(s) would be changed 😬
[INFO] 2 file(s) would be left unchanged 🎉

snakefmt version: 0.10.2