Skip to main content

snippy

Tags: snp variant-calling phylogeny core-genome snippy bactopia-tool

Rapid haplotype variant calling and core genome alignment.

This Bactopia Tool uses Snippy to find SNPs between a reference genome and a set of reads, perform core genome alignment, and generate phylogenetic trees. It includes optional recombination detection with Gubbins and phylogenetic tree construction with IQ-Tree.

Usage

Bactopia CLI:

bactopia --wf snippy \
--bactopia /path/to/your/bactopia/results

Nextflow:

nextflow run bactopia/bactopia/workflows/bactopia-tools/snippy/main.nf \
--bactopia /path/to/your/bactopia/results

Outputs

Expected Output Files

<BACTOPIA_DIR>
├── <SAMPLE_NAME>
│ └── tools
│ └── snippy-<TIMESTAMP>
│ └── GCF_000292685
│ ├── <SAMPLE_NAME>.aligned.fa.gz
│ ├── <SAMPLE_NAME>.annotated.vcf.gz
│ ├── <SAMPLE_NAME>.bam
│ ├── <SAMPLE_NAME>.bam.bai
│ ├── <SAMPLE_NAME>.bed.gz
│ ├── <SAMPLE_NAME>.consensus.fa.gz
│ ├── <SAMPLE_NAME>.consensus.subs.fa.gz
│ ├── <SAMPLE_NAME>.consensus.subs.masked.fa.gz
│ ├── <SAMPLE_NAME>.coverage.txt.gz
│ ├── <SAMPLE_NAME>.csv.gz
│ ├── <SAMPLE_NAME>.filt.vcf.gz
│ ├── <SAMPLE_NAME>.gff.gz
│ ├── <SAMPLE_NAME>.html
│ ├── <SAMPLE_NAME>.raw.vcf.gz
│ ├── <SAMPLE_NAME>.subs.vcf.gz
│ ├── <SAMPLE_NAME>.tab
│ ├── <SAMPLE_NAME>.txt
│ ├── <SAMPLE_NAME>.vcf.gz
│ └── logs
│ ├── <SAMPLE_NAME>.log
│ ├── nf.command.{begin,err,log,out,run,sh,trace}
│ └── versions.yml
├── ERR6005894
│ └── tools
│ └── snippy-<TIMESTAMP>
│ └── GCF_000292685
│ ├── ERR6005894.aligned.fa.gz
│ ├── ERR6005894.annotated.vcf.gz
│ ├── ERR6005894.bam
│ ├── ERR6005894.bam.bai
│ ├── ERR6005894.bed.gz
│ ├── ERR6005894.consensus.fa.gz
│ ├── ERR6005894.consensus.subs.fa.gz
│ ├── ERR6005894.consensus.subs.masked.fa.gz
│ ├── ERR6005894.coverage.txt.gz
│ ├── ERR6005894.csv.gz
│ ├── ERR6005894.filt.vcf.gz
│ ├── ERR6005894.gff.gz
│ ├── ERR6005894.html
│ ├── ERR6005894.raw.vcf.gz
│ ├── ERR6005894.subs.vcf.gz
│ ├── ERR6005894.tab
│ ├── ERR6005894.txt
│ ├── ERR6005894.vcf.gz
│ └── logs
│ ├── ERR6005894.log
│ ├── nf.command.{begin,err,log,out,run,sh,trace}
│ └── versions.yml
├── ERR6005894SE
│ └── tools
│ └── snippy-<TIMESTAMP>
│ └── GCF_000292685
│ ├── ERR6005894SE.aligned.fa.gz
│ ├── ERR6005894SE.annotated.vcf.gz
│ ├── ERR6005894SE.bam
│ ├── ERR6005894SE.bam.bai
│ ├── ERR6005894SE.bed.gz
│ ├── ERR6005894SE.consensus.fa.gz
│ ├── ERR6005894SE.consensus.subs.fa.gz
│ ├── ERR6005894SE.consensus.subs.masked.fa.gz
│ ├── ERR6005894SE.coverage.txt.gz
│ ├── ERR6005894SE.csv.gz
│ ├── ERR6005894SE.filt.vcf.gz
│ ├── ERR6005894SE.gff.gz
│ ├── ERR6005894SE.html
│ ├── ERR6005894SE.raw.vcf.gz
│ ├── ERR6005894SE.subs.vcf.gz
│ ├── ERR6005894SE.tab
│ ├── ERR6005894SE.txt
│ ├── ERR6005894SE.vcf.gz
│ └── logs
│ ├── ERR6005894SE.log
│ ├── nf.command.{begin,err,log,out,run,sh,trace}
│ └── versions.yml
├── SRR2838702
│ └── tools
│ └── snippy-<TIMESTAMP>
│ └── GCF_000292685
│ ├── SRR2838702.aligned.fa.gz
│ ├── SRR2838702.annotated.vcf.gz
│ ├── SRR2838702.bam
│ ├── SRR2838702.bam.bai
│ ├── SRR2838702.bed.gz
│ ├── SRR2838702.consensus.fa.gz
│ ├── SRR2838702.consensus.subs.fa.gz
│ ├── SRR2838702.consensus.subs.masked.fa.gz
│ ├── SRR2838702.coverage.txt.gz
│ ├── SRR2838702.csv.gz
│ ├── SRR2838702.filt.vcf.gz
│ ├── SRR2838702.gff.gz
│ ├── SRR2838702.html
│ ├── SRR2838702.raw.vcf.gz
│ ├── SRR2838702.subs.vcf.gz
│ ├── SRR2838702.tab
│ ├── SRR2838702.txt
│ ├── SRR2838702.vcf.gz
│ └── logs
│ ├── SRR2838702.log
│ ├── nf.command.{begin,err,log,out,run,sh,trace}
│ └── versions.yml
├── SRR2838702SE
│ └── tools
│ └── snippy-<TIMESTAMP>
│ └── GCF_000292685
│ ├── SRR2838702SE.aligned.fa.gz
│ ├── SRR2838702SE.annotated.vcf.gz
│ ├── SRR2838702SE.bam
│ ├── SRR2838702SE.bam.bai
│ ├── SRR2838702SE.bed.gz
│ ├── SRR2838702SE.consensus.fa.gz
│ ├── SRR2838702SE.consensus.subs.fa.gz
│ ├── SRR2838702SE.consensus.subs.masked.fa.gz
│ ├── SRR2838702SE.coverage.txt.gz
│ ├── SRR2838702SE.csv.gz
│ ├── SRR2838702SE.filt.vcf.gz
│ ├── SRR2838702SE.gff.gz
│ ├── SRR2838702SE.html
│ ├── SRR2838702SE.raw.vcf.gz
│ ├── SRR2838702SE.subs.vcf.gz
│ ├── SRR2838702SE.tab
│ ├── SRR2838702SE.txt
│ ├── SRR2838702SE.vcf.gz
│ └── logs
│ ├── SRR2838702SE.log
│ ├── nf.command.{begin,err,log,out,run,sh,trace}
│ └── versions.yml
├── SRR2838702SE_2
│ └── tools
│ └── snippy-<TIMESTAMP>
│ └── GCF_000292685
│ ├── SRR2838702SE_2.aligned.fa.gz
│ ├── SRR2838702SE_2.annotated.vcf.gz
│ ├── SRR2838702SE_2.bam
│ ├── SRR2838702SE_2.bam.bai
│ ├── SRR2838702SE_2.bed.gz
│ ├── SRR2838702SE_2.consensus.fa.gz
│ ├── SRR2838702SE_2.consensus.subs.fa.gz
│ ├── SRR2838702SE_2.consensus.subs.masked.fa.gz
│ ├── SRR2838702SE_2.coverage.txt.gz
│ ├── SRR2838702SE_2.csv.gz
│ ├── SRR2838702SE_2.filt.vcf.gz
│ ├── SRR2838702SE_2.gff.gz
│ ├── SRR2838702SE_2.html
│ ├── SRR2838702SE_2.raw.vcf.gz
│ ├── SRR2838702SE_2.subs.vcf.gz
│ ├── SRR2838702SE_2.tab
│ ├── SRR2838702SE_2.txt
│ ├── SRR2838702SE_2.vcf.gz
│ └── logs
│ ├── SRR2838702SE_2.log
│ ├── nf.command.{begin,err,log,out,run,sh,trace}
│ └── versions.yml
├── SRR2838702_2
│ └── tools
│ └── snippy-<TIMESTAMP>
│ └── GCF_000292685
│ ├── SRR2838702_2.aligned.fa.gz
│ ├── SRR2838702_2.annotated.vcf.gz
│ ├── SRR2838702_2.bam
│ ├── SRR2838702_2.bam.bai
│ ├── SRR2838702_2.bed.gz
│ ├── SRR2838702_2.consensus.fa.gz
│ ├── SRR2838702_2.consensus.subs.fa.gz
│ ├── SRR2838702_2.consensus.subs.masked.fa.gz
│ ├── SRR2838702_2.coverage.txt.gz
│ ├── SRR2838702_2.csv.gz
│ ├── SRR2838702_2.filt.vcf.gz
│ ├── SRR2838702_2.gff.gz
│ ├── SRR2838702_2.html
│ ├── SRR2838702_2.raw.vcf.gz
│ ├── SRR2838702_2.subs.vcf.gz
│ ├── SRR2838702_2.tab
│ ├── SRR2838702_2.txt
│ ├── SRR2838702_2.vcf.gz
│ └── logs
│ ├── SRR2838702_2.log
│ ├── nf.command.{begin,err,log,out,run,sh,trace}
│ └── versions.yml
└── bactopia-runs
└── snippy-<TIMESTAMP>
├── GCF_000292685.samples.txt
├── core-snp-clean.full.aln.gz
├── core-snp.distance.tsv
├── core-snp.full.aln.gz
├── core-snp.masked.aln.gz
├── core-snp.masked.distance.tsv
├── gubbins
│ ├── core-snp.branch_base_reconstruction.embl.gz
│ ├── core-snp.filtered_polymorphic_sites.fasta.gz
│ ├── core-snp.filtered_polymorphic_sites.phylip
│ ├── core-snp.final_tree.tre
│ ├── core-snp.node_labelled.final_tree.tre
│ ├── core-snp.per_branch_statistics.csv
│ ├── core-snp.recombination_predictions.embl.gz
│ ├── core-snp.recombination_predictions.gff.gz
│ ├── core-snp.summary_of_snp_distribution.vcf.gz
│ └── logs
│ ├── core-snp.log
│ ├── nf.command.{begin,err,log,out,run,sh,trace}
│ └── versions.yml
├── nf-reports
│ ├── snippy-dag.dot
│ ├── snippy-report.html
│ └── snippy-timeline.html
├── snippy-core
│ ├── core-snp.aln.gz
│ ├── core-snp.tab.gz
│ ├── core-snp.txt
│ ├── core-snp.vcf.gz
│ └── logs
│ ├── nf.command.{begin,err,log,out,run,sh,trace}
│ └── versions.yml
├── snpdists
│ └── logs
│ ├── nf.command.{begin,err,log,out,run,sh,trace}
│ └── versions.yml
└── snpdists-masked
└── logs
├── nf.command.{begin,err,log,out,run,sh,trace}
└── versions.yml

Variant Calling

FileDescription
*.vcfVariant calls in VCF format
*.bamAlignment file
*.txtSnippy summary report

Core Genome Alignment

FileDescription
core.full.alnFull core genome alignment
core.snps.alnCore SNP alignment

Recombination Analysis

note

Only created if recombination analysis is enabled

FileDescription
*.filtered.alnAlignment with recombination regions removed
*.gffRecombination predictions

Phylogeny

note

Only created if phylogeny analysis is enabled

FileDescription
*.treefilePhylogenetic tree in Newick format

Merged Results

FileDescription
snippy.tsvMerged summary of Snippy analyses

Audit Trail

Below are files that can assist you in understanding which parameters and program versions were used.

Logs

Each process that is executed will have a folder named logs. In this folder are helpful files for you to review if the need ever arises.

ExtensionDescription
.beginAn empty file used to designate the process started
.errContains STDERR outputs from the process
.logContains both STDERR and STDOUT outputs from the process
.outContains STDOUT outputs from the process
.runThe script Nextflow uses to stage/unstage files and queue processes based on given profile
.shThe script executed by bash for the process
.traceThe Nextflow trace report for the process
versions.ymlA YAML formatted file with program versions

Nextflow Reports

These Nextflow reports provide great a great summary of your run. These can be used to optimize resource usage and estimate expected costs if using cloud platforms.

FilenameDescription
snippy-dag.dotThe Nextflow DAG visualization
snippy-report.htmlThe Nextflow Execution Report
snippy-timeline.htmlThe Nextflow Timeline Report
snippy-trace.txtThe Nextflow Trace report

Parameters

Required Parameters

Define where the pipeline should find input data and save output data.

ParameterTypeDefaultDescription
--bactopiastringThe path to bactopia results to use as inputs

NCBI Genome Download Parameters

ParameterTypeDefaultDescription
--speciesstringName of the species to download assemblies
--accessionstringAn NCBI Assembly accession to be downloaded
--accessionsstringAn file of NCBI Assembly accessions (one per line) to be downloaded
--formatstringfastaComma separated list of formats to download
--sectionstringrefseqNCBI section to download
--assembly_levelstringcompleteComma separated list of assembly levels to download
--kingdomstringbacteriaComma separated list of formats to download
--limitstringLimit the number of assemblies to download
--keep_downloadsbooleanfalseSave downloaded files into the bactopia-runs folder

Snippy Run Parameters

ParameterTypeDefaultDescription
--referencestringReference genome in GenBank format
--snippy_mapqualinteger60Minimum read mapping quality to consider
--snippy_basequalinteger13Minimum base quality to consider
--snippy_mincovinteger10Minimum site depth to for calling alleles
--snippy_minfracinteger0Minimum proportion for variant evidence (0=AUTO)
--snippy_minqualinteger100Minimum QUALITY in VCF column 6
--snippy_maxsoftinteger10Maximum soft clipping to allow
--snippy_bwaoptstringExtra BWA MEM options, eg. -x pacbio
--snippy_fboptstringExtra Freebayes options, eg. --theta 1E-6 --read-snp-limit 2
--snippy_remove_bambooleanfalseDelete BAM files after variant calling
--snippy_optsstringExtra options in quotes for Snippy

Snippy-Core Parameters

ParameterTypeDefaultDescription
--snippy_core_maxhapinteger100Largest haplotype to decompose
--snippy_core_maskstringBED file of sites to mask
--snippy_core_mask_charstringXMasking character
--snippy_core_optsstringExtra options in quotes for snippy-core

SNP-Dists Parameters

ParameterTypeDefaultDescription
--snpdists_abooleanfalseCount all differences not just [AGTC]
--snpdists_bbooleanfalseKeep top left corner cell
--snpdists_csvbooleanfalseOutput CSV instead of TSV
--snpdists_kbooleanfalseKeep case, don't uppercase all letters

Gubbins Parameters

ParameterTypeDefaultDescription
--gubbins_iterationsinteger5Maximum number of iterations
--gubbins_min_snpsinteger3Min SNPs to identify a recombination block
--gubbins_min_window_sizeinteger100Minimum window size
--gubbins_max_window_sizeinteger10000Maximum window size
--gubbins_filter_percentagenumber25.0Filter out taxa with more than this percentage of gaps
--gubbins_remove_identical_sequencesbooleanfalseRemove identical sequences
--gubbins_optsstringExtra Gubbins options in quotes
--skip_recombinationbooleanfalseSkip Gubbins execution in subworkflows

IQ-TREE Parameters

ParameterTypeDefaultDescription
--iqtree_modelstringHKYSubstitution model name
--iqtree_bbinteger1000Ultrafast bootstrap replicates
--iqtree_alrtinteger1000SH-like approximate likelihood ratio test replicates
--iqtree_asrbooleanfalseAncestral state reconstruction by empirical Bayes
--iqtree_optsstringExtra IQ-TREE options in quotes.
--skip_phylogenybooleanfalseSkip IQ-TREE execution in subworkflows
Filtering Parameters

Use these parameters to specify which samples to include or exclude.

ParameterTypeDefaultDescription
--includestringA text file containing sample names (one per line) to include from the analysis
--excludestringA text file containing sample names (one per line) to exclude from the analysis
Optional Parameters

These optional parameters can be useful in certain settings.

ParameterTypeDefaultDescription
--outdirstringbactopiaBase directory to write results to
--skip_compressionbooleanfalseOutput files will not be compressed
--datasetsstringThe path to cache datasets to
--keep_all_filesbooleanfalseKeeps all analysis files created
Max Job Request Parameters

Set the top limit for requested resources for any single job.

ParameterTypeDefaultDescription
--max_retryinteger3Maximum times to retry a process before allowing it to fail.
--max_cpusinteger4Maximum number of CPUs that can be requested for any single job.
--max_memorystring128.GBMaximum amount of memory that can be requested for any single job.
--max_timestring240.hMaximum amount of time that can be requested for any single job.
--max_downloadsinteger3Maximum number of samples to download at a time
Nextflow Configuration Parameters

Parameters to fine-tune your Nextflow setup.

ParameterTypeDefaultDescription
--nfconfigstringA Nextflow compatible config file for custom profiles, loaded last and will overwrite existing variables if set.
--publish_dir_modestringcopyMethod used to save pipeline results to output directory. (choices: symlink, rellink, link, copy, copyNoFollow, move)
--infodirstring${params.outdir}/pipeline_infoDirectory to keep pipeline Nextflow logs and reports.
--forcebooleanfalseNextflow will overwrite existing output files.
--cleanup_workdirbooleanfalseAfter Bactopia is successfully executed, the work directory will be deleted.
Institutional config options

Parameters used to describe centralized config profiles. These should not be edited.

ParameterTypeDefaultDescription
--custom_config_versionstringmasterGit commit id for Institutional configs.
--custom_config_basestringhttps://raw.githubusercontent.com/nf-core/configs/masterBase directory for Institutional configs.
--config_profile_namestringInstitutional config name.
--config_profile_descriptionstringInstitutional config description.
--config_profile_contactstringInstitutional config contact information.
--config_profile_urlstringInstitutional config URL link.
Nextflow Profile Parameters

Parameters to fine-tune your Nextflow setup.

ParameterTypeDefaultDescription
--condadirstringDirectory to Nextflow should use for Conda environments
--registrystringquay.ioRegistry to pull Docker containers from.
--datasets_cachestring<HOME>/.bactopia/datasetsDirectory where downloaded datasets should be stored.
--singularity_cachestringDirectory where remote Singularity images are stored.
--singularity_pull_docker_containerbooleanInstead of directly downloading Singularity images for use with Singularity, force the workflow to pull and convert Docker containers instead.
--force_rebuildbooleanfalseForce overwrite of existing pre-built environments.
--queuestringgeneral,high-memoryComma-separated name of the queue(s) to be used by a job scheduler (e.g. AWS Batch or SLURM)
--cluster_optsstringAdditional options to pass to the executor. (e.g. SLURM: '--account=my_acct_name'
--container_optsstringAdditional options to pass to Apptainer, Docker, or Singularity. (e.g. Singularity: '-D pwd'
--disable_scratchbooleanfalseAll intermediate files created on worker nodes of will be transferred to the head node.
Helpful Parameters

Uncommonly used parameters that might be useful.

ParameterTypeDefaultDescription
--monochrome_logsbooleanDo not use coloured log outputs.
--nfdirbooleanPrint directory Nextflow has pulled Bactopia to
--sleep_timeinteger5The amount of time (seconds) Nextflow will wait after setting up datasets before execution.
--validate_paramsbooleantrueBoolean whether to validate parameters against the schema at runtime
--helpbooleanDisplay help text.
--wfstringbactopiaSpecify which workflow or Bactopia Tool to execute
--list_wfsbooleanList the available workflows and Bactopia Tools to use with '--wf'
--show_hidden_paramsbooleanShow all params when using --help
--help_allbooleanAn alias for --help --show_hidden_params
--versionbooleanDisplay version text.

Composition

This workflow uses the following subworkflows:

  • gubbins - Detect and filter recombination regions in bacterial alignments.
  • iqtree - Construct maximum likelihood phylogenetic trees from alignments.
  • ncbigenomedownload - Download bacterial genomes from NCBI's RefSeq database.
  • snippy_core - Generate core-genome SNP alignment from per-sample Snippy outputs.
  • snippy_run - Call variants against a reference genome using Snippy.

Citations

If you use this in your analysis, please cite the following.

Source

View source on GitHub