Outbreak analysis

What this exercise tests

You are given paired-end reads. Perform a consistent mapping-based analysis, build a tree and use the genomic evidence to assign analytical clusters. The tree is an analysis output: unless the exercise page explicitly says otherwise, submit only the completed CSV or TSV result sheet.

The commands below form a worked example. Equivalent validated bacterial variant-calling workflows are acceptable unless the exercise specifies one.

1. Inspect every read pair

Use BactScout before mapping:

pixi run bactscout qc /absolute/path/to/reads \
  -o /absolute/path/to/bactscout_results \
  -t 8

Remove or flag a sample only with a recorded reason. Different species or strong contamination signals should not silently enter the same phylogeny.

2. Install the worked-example tools

conda create -n outbreak -c conda-forge -c bioconda \
  --strict-channel-priority snippy iqtree
conda activate outbreak

snippy --version
snippy --check
iqtree2 --version

3. Use one reference for the cohort

Use the reference specified by the exercise. If none is specified, select a high-quality, closely related reference and record its accession and version. All samples must use the same reference and filtering rules.

Example for one sample:

snippy \
  --cpus 8 \
  --outdir work/sample_01 \
  --ref reference/reference.gbk \
  --R1 reads/sample_01_R1.fastq.gz \
  --R2 reads/sample_01_R2.fastq.gz

Repeat consistently for each sample. Review snps.txt, snps.log, BAM/VCF outputs and coverage evidence before building a shared alignment.

4. Build the core SNP alignment

snippy-core \
  --prefix results/core \
  work/sample_01 \
  work/sample_02 \
  work/sample_03

Confirm that core.aln contains every expected sample and enough callable sites. A single poor sample can greatly reduce the shared core.

5. Infer a tree

For a SNP-only alignment, include an ascertainment-bias correction:

iqtree2 \
  -s results/core.aln \
  -m GTR+ASC \
  -B 1000 \
  -T AUTO

Retain the .treefile, .iqtree report and logs. Review branch support and investigate unusually long branches before assigning clusters.

6. Review the tree and assign clusters

Tree tip names must match the public sample identifiers exactly. A tree visualisation tool can be useful for reviewing topology, branch lengths and support. Before assigning clusters:

  • confirm that every passing sample is represented once;
  • investigate unexpectedly long branches or weakly supported groupings;
  • keep failed samples out of the cluster interpretation; and
  • confirm that the tree supports the cluster labels entered in the result sheet.

Assign clusters

Do not apply a universal SNP threshold unless the exercise defines one. Consider genetic distance, topology, branch support and QC limitations together. A phylogenetic tree does not prove direct transmission.

Use stable labels such as Cluster 1, Cluster 2 and Unclustered, unless the result sheet requests another vocabulary.

Common problems

Low mapping: Check species, contamination, reference distance and read quality.

Very small shared core: Identify divergent or low-coverage samples and review filtering.

Extremely long branch: Investigate contamination, mixed reads and calling errors.

Tree tip mismatch: Normalise identifiers once and reuse the public sample identifiers throughout the analysis.

Next: submission and troubleshooting.