Perform germline SV calling
masterTo call structural variants (SVs) from long-read alignments (PacBio or Oxford Nanopore), provide a BAM file as input and specify a VCF file for the output.
sniffles -i mapped_input.bam -v output.vcfrepository·master·Indexed 20 days ago
https://github.com/fritzsedlazeck/snifflesA high-performance structural variant (SV) caller for long-read sequencing data from PacBio and Oxford Nanopore. Sniffles2 supports germline, somatic (mosaic), and population-level SV calling. It provides tools for genotyping known SVs from VCF files and supports input formats including .bam, .cram, .snf, and .tsv, with outputs in .vcf and .snf formats.
To call structural variants (SVs) from long-read alignments (PacBio or Oxford Nanopore), provide a BAM file as input and specify a VCF file for the output.
sniffles -i mapped_input.bam -v output.vcfYou can install Sniffles2 using either pip or conda. If you are upgrading from Sniffles1 installed via conda, use the update command.
# Using pip
pip install sniffles
# Using conda
conda install sniffles=2.8.0
# Upgrading from Sniffles1 via conda
conda update sniffles=2.8.0To determine the genotype of a specific set of SVs from an existing VCF file for a given sample, use the --genotype-vcf option.
sniffles --input sample.bam --genotype-vcf input_known_svs.vcf --vcf output_genotypes.vcfTo detect mosaic structural variants (e.g., somatic SVs), add the --mosaic flag to your command.
sniffles --input mapped_input.bam --vcf output.vcf --mosaicMulti-sample calling is a two-step process. First, generate .snf files for each individual sample. Second, combine those files into a single multi-sample VCF.
Step 1: Create .snf files for each sample
sniffles --input <sample>.bam --snf <sample>.snf
Step 2: Combine files
You can combine files by listing them individually or by providing a .tsv file containing a list of .snf files (and optional custom sample IDs in a second column).
# Step 1: Generate .snf files
sniffles --input sample1.bam --snf sample1.snf
sniffles --input sample2.bam --snf sample2.snf
# Step 2a: Combine using individual .snf files
sniffles --input sample1.snf sample2.snf --vcf multisample.vcf
# Step 2b: Combine using a .tsv list
sniffles --input snf_files_list.tsv --vcf multisample.vcfWhen phasing is enabled in the configuration (config.phase), Sniffles2 modifies the VCF output in two ways:
/ (unphased) to | (phased) if the haplotype information is available.PS (Phase-block) tag is added to the FORMAT column.Phasing logic uses hp_i (the index of the haplotype in config.phase_identifiers) to determine the orientation of the phased genotype (e.g., 1|0 vs 0|1).
Mosaic mode is activated if mosaic_include_germline is set. When in mosaic mode, Sniffles2 adjusts several QC and clustering parameters:
qc_nm_measure: Uses mosaic_qc_nm if the standard qc_nm is not provided.cluster_merge_len: Uses default_cluster_merge_len_mosaic if the current cluster_merge_len matches the standard default_cluster_merge_len.Sniffles2 applies different coverage and support calculation strategies depending on the type of Structural Variant (SV) to ensure accuracy:
| SV Type | Genotyper Class | Coverage Calculation Strategy |
|---|---|---|
| INS (Insertion) | InsertionGenotyper | Uses rescale_support to handle long insertions and focuses on coverage_center. |
| DEL (Deletion) | DeletionGenotyper | Uses coverage_start, center, and end, potentially offset by SUPPORT_SA if available. |
| DUP (Duplication) | DuplicationGenotyper | Uses coverage_start and coverage_end plus a factor of support (support * 0.75). |
| INV (Inversion) | InversionGenotyper | Uses coverage_upstream and coverage_downstream plus a factor of support (support * 0.5). |
Sniffles2 uses a binomial probability model to estimate the likelihood of different genotypes (homozygous reference (0, 0), heterozygous (0, 1), and homozygous variant (1, 1)).
Key aspects of the calculation:
support (variant reads) and coverage (total reads spanning the SV).config.genotype_error (probability of error) and config.genotype_ploidy to determine the expected probabilities for each genotype.Multi-sample calling is a two-step process:
--snf flag to produce a .snf file containing SV candidates..snf files as input to produce a combined VCF.You can provide multiple .snf files directly or use a .tsv file containing a list of .snf files (one per line).
# Step 1: Create .snf for each sample
sniffles --input sample1.bam --snf sample1.snf
sniffles --input sample2.bam --snf sample2.snf
# Step 2: Combined calling
sniffles --input sample1.snf sample2.snf --vcf multisample.vcfWhen genotyping known structural variants, you can configure the output format and ploidy.
genotype_format: The VCF format string used for genotype information. The default is "GT:GQ:DR:DV".genotype_ploidy: Specifies the ploidy of the sample. Note: Currently only --genotype-ploidy 2 is supported.genotype_min_z_score: The minimum Z-score required for genotyping.# Example genotyping command
sniffles --genotype-ploidy 2 --genotype-format "GT:GQ:DR:DV" ...Consensus calling is governed by several parameters that define how k-mers are used to validate variants:
consensus_min_reads: Minimum reads required for consensus (default: 4).consensus_kmer_len: Length of the k-mer (default: 6).consensus_kmer_skip_base: Number of bases to skip between k-mers (default: 3).consensus_kmer_skip_seqlen_mult: Multiplier for skipping based on sequence length (default: 1.0 / 500.0).consensus_low_threshold: Threshold for low-confidence consensus (default: 0.0).