SNIFFLES
Call structural variants from long reads (single- or multi-sample) with Sniffles2.
URL: https://github.com/fritzsedlazeck/Sniffles
Example
This wrapper can be used in the following way:
rule sniffles_single_sample:
input:
samples="mapped/{sample}.bam",
# optional
ref="genome.fasta",
output:
vcf="calls/{sample}.vcf",
snf="calls/{sample}.snf",
log:
"logs/{sample}.log",
threads: 4
params:
extra="", # optional parameters for sniffles (except --input/--vcf/--snf)
wrapper:
"v9.14.0/bio/sniffles"
rule sniffles_multi_sample:
input:
samples=["calls/a.snf", "calls/b.snf"],
output:
vcf="calls/multisample.vcf",
log:
"logs/sniffles_multi.log",
threads: 4
params:
extra="", # optional parameters for sniffles (except --input/--vcf/--snf)
wrapper:
"v9.14.0/bio/sniffles"
Note that input, output and log file paths can be chosen freely.
When running with
snakemake --use-conda
the software dependencies will be automatically deployed into an isolated environment before execution.
Software dependencies
sniffles=2.8
Input/Output
Input:
samples: BAM/CRAM of aligned long reads, or one or more .snf files / a .tsv list for multi-sample calling (samples)ref: reference genome FASTA (optional; required to emit deletion sequences)tandem_repeats: tandem repeats BED file (optional)genotype_vcf: VCF of known SVs to force-genotype (optional)
Output:
vcf: VCF of structural variants (optional, vcf)snf: SNF file for multi-sample merging (optional, snf)
Params
extra: additional program arguments, e.g. –mosaic, –minsupport, –output-rnames.
Code
__author__ = "Kateřina Havlová"
__copyright__ = "Copyright 2026, Kateřina Havlová"
__email__ = "katkahemalova@gmail.com"
__license__ = "MIT"
from snakemake.shell import shell
extra = snakemake.params.get("extra", "")
log = snakemake.log_fmt_shell(stdout=True, stderr=True)
# Input: a single BAM/CRAM, or one or more .snf files / a .tsv list (multi-sample).
samples = snakemake.input.get("samples")
samples = " ".join(samples) if isinstance(samples, list) else samples
reference = snakemake.input.get("ref", "")
if reference:
reference = f"--reference {reference}"
tandem_repeats = snakemake.input.get("tandem_repeats", "")
if tandem_repeats:
tandem_repeats = f"--tandem-repeats {tandem_repeats}"
genotype_vcf = snakemake.input.get("genotype_vcf", "")
if genotype_vcf:
genotype_vcf = f"--genotype-vcf {genotype_vcf}"
vcf = snakemake.output.get("vcf", "")
if vcf:
vcf = f"--vcf {vcf}"
snf = snakemake.output.get("snf", "")
if snf:
snf = f"--snf {snf}"
shell(
"sniffles"
" --input {samples}"
" {vcf}"
" {snf}"
" {reference}"
" {tandem_repeats}"
" {genotype_vcf}"
" --threads {snakemake.threads}"
" {extra}"
" {log}"
)