Skip to content

Choosing a mode

Select mode according to the available input: Illumina paired-end reads, Oxford Nanopore Technologies (ONT) reads, both read types from the same isolate, or an existing assembly. The modes share analysis rules but differ in assembly processing and in the read-dependent analyses they can perform.

Terms used on this page

QC quality control
AMR antimicrobial resistance
IS insertion sequence — the smallest mobile element, carrying only the genes it needs to move
DAG directed acyclic graph — the job graph Snakemake plans a run from
mode You have File names BacFlux looks for Input key
illumina Illumina paired-end reads {sample}_R1.<ext> and {sample}_R2.<ext> input.illumina_dir
nanopore ONT long reads {sample}_ont.<ext> input.nanopore_dir
hybrid Both, for the same isolates both of the above both directories
contigs A finished assembly and no reads {sample}.<fasta|fa|fna> input.contigs_dir

<ext> for reads is one of fastq, fq, fastq.gz, fq.gz, and every sample in one batch must share the same one — a directory holding both .fastq and .fastq.gz stops the run and lists what it found. The same applies to the FASTA extension in contigs mode. Sample names may contain underscores and dots; spaces and the characters * # @ % ^ / ! ? & : ; | < > are rejected.

Configure the input mode

Two keys in config/config.yaml pick the front end: mode, and the input directory or directories that mode reads. The input directories it does not read can stay empty — the output directory and the database paths under directories: are needed whichever mode you pick.

mode: illumina                 # illumina | nanopore | hybrid | contigs

input:
  illumina_dir: "/data/run1/illumina"
  nanopore_dir: ""
  contigs_dir:  ""

Both are checked before any job starts, so a mistake costs you seconds rather than hours. Write mode: ilumina — one l short — and the run stops with:

config.mode must be one of illumina | nanopore | hybrid | contigs (got: 'ilumina')

A valid run echoes the mode and every sample it found, so the batch can be confirmed from the top of the log:

Mode: illumina — Genomic analysis of bacterial Illumina reads.
Sample isolate_01 will be processed.
Sample isolate_02 will be processed.

The mode can be overridden for a single run with --config mode=contigs, but the matching input.*_dir almost always has to change with it, so editing the file is usually simpler.

Mode-specific input processing

illumina nanopore hybrid contigs
Read QC PhiX removal with Bowtie2, then fastp adapter and barcode trimming with fastplong, NanoPlot before and after, Filtlong both of those none
Assembler SPAdes --isolate, k chosen from read length Flye Flye, over the ONT reads none
After assembly keep contigs ≥ 500 bp and ≥ 2× coverage dnaapler reorientation, then Medaka (optional — parameters.<mode>.medaka_model: false skips it) dnaapler and Medaka as in nanopore, then Polypolish correction with the Illumina reads SPAdes-style headers: the same 500 bp / 2× filter, headers left as they are. Any other header: trimmed to its first whitespace token, nothing filtered
Contamination screen SPAdes draft; retained contigs form the final assembly Reoriented assembly, before optional Medaka polishing Primary filter on the Illumina draft; optional short-read guidance for Filtlong; advisory screen of the final assembly Supplied contigs; retained contigs form the final assembly
Delivered genome the screened SPAdes contigs the Flye assembly, reoriented, screened and polished the ONT assembly corrected by Polypolish the screened input contigs
Also produced — — the Illumina draft, kept as a comparator, and a Snippy comparison of the two —

Hybrid mode assembles the Illumina reads with SPAdes and the Nanopore reads with Flye, so it requires more computation than either single-technology mode. Reads mapping to the decontaminated Illumina draft support Polypolish correction. They also guide Filtlong when parameters.hybrid.short_read_guidance: true; this option is disabled by default. The final assembly receives a separate advisory taxonomic screen that reports decisions without removing contigs.

Everything after the assembly is shared

Each front end ends by writing one file, contigs_final.fasta, and from there the shared analysis stages assess the final assembly: assembly QC, completeness and contamination, taxonomic placement, annotation, AMR and virulence screening, plasmids, prophages, the optional mobilome module, and one MultiQC report. See Output files for what each stage writes.

Decontamination is the one shared step that is not downstream of that file. It is the same screening code in every mode, but it sits inside the front end, at the different points the table above gives — which is why in illumina and contigs its output is contigs_final.fasta. See Decontamination.

What the mode still decides downstream

A few shared steps need something a given mode does not have. They are gated on the capability — short reads, long reads, any reads — rather than on the mode name, and when the capability is absent the rule is not defined, so it does not appear in the DAG and nothing waits for it.

Shared step Needs illumina nanopore hybrid contigs
CARD read mapping (05.amr/mapping) short reads ✓ — ✓ —
Qualimap mapping evaluation any reads ✓ ✓ ✓ —
Coverage that carries information for BlobTools any reads ✓ ✓ ✓ —
Circular-replicon table handed to Bakta Flye's topology calls — ✓ ✓ —
Second BLAST of the final assembly, for the plasmid stage long reads — ✓ ✓ —
IS copy number from reads (mobilome, optional) short reads ✓ — ✓ —
Two genomes through QC and taxonomy, plus the Snippy comparison both technologies — — ✓ —

The same table appears on Modes, which is where it is maintained. Four consequences worth knowing before you choose:

  • contigs mode cannot separate contaminants by coverage. BlobTools needs a BAM, and with no reads the contigs are mapped against themselves, which gives a self-alignment coverage value rather than independent sequencing depth. Taxonomic evidence determines contig selection in all modes. See Decontamination.
  • nanopore and contigs lose the read-based AMR analysis. Mapping reads to CARD side-steps the assembly, so a resistance gene present in several copies, or sitting on a repeat that broke the contig, can be visible in the reads and absent from the assembly. The separate CARD mapping analysis requires Illumina reads and is unavailable in these two modes. ABRicate screening of the contigs still runs in every mode. See Antimicrobial resistance.
  • Only the long-read modes know that a contig is circular. Flye reports it per contig, and Bakta is told through --replicons, so a gene that runs across the start of a circular sequence is called whole. In illumina and contigs mode Bakta treats every sequence as linear.
  • The mobilome module is available in all four modes, with confidence affected by assembly structure. On a fragmented assembly the located insertion-sequence count is a floor rather than a count, because the elements being detected are a leading cause of the contig breaks. Every call therefore carries its distance to the contig end, and anything spanning contigs is capped at low confidence. In the short-read modes, and only when an ISOSDB source is configured, read-based analysis provides an additional copy-number estimate. See Draft assemblies.

Input-mode errors

Usually it stops within seconds, because the four filename conventions do not overlap. Pointing illumina at a directory of {sample}_ont.fastq.gz:

[BacFlux] No suitable illumina input files found.

and hybrid at two directories that do not describe the same isolates:

[BacFlux] hybrid mode needs Illumina and ONT reads for every sample.
Missing ONT files for the following samples:
  - isolate_03

An unset or non-existent input directory is caught in the same pass:

[BacFlux] mode=nanopore requires 'input.nanopore_dir' to be set in the config.

Each of these stops Snakemake with exit status 1, before any job has started.

Two cases that do not stop the run

illumina on a dataset that also has long reads. It runs to the end and quietly ignores nanopore_dir. There is nothing to detect: the Illumina half is a valid illumina run. If you meant to use both, the mode is hybrid.

contigs on an assembly whose headers are not SPAdes-style. No length filter and no coverage filter are applied — only the headers are trimmed to their first whitespace token, which every later step keys on. That is deliberate, because the length and coverage of each contig are read out of the SPAdes header and inventing them for another assembler would silently delete real sequence. But it means the only contigs that can leave the assembly are the ones the contamination screen drops. The rule logs which branch it took.

Recommendations

  • Reads from one instrument — use that instrument's mode. hybrid adds nothing to a dataset with only one technology.
  • Both technologies for the same isolates — hybrid, and give it two directories in which every isolate appears in both. A sample present in only one of them stops the run rather than being silently dropped, so filter the directories to the complete isolates first.
  • Assembly of repetitive regions or assessment of replicon topology — use nanopore or hybrid when suitable long reads are available. These modes use Flye topology calls to provide circular-replicon information to Bakta. Long reads do not guarantee a complete or correctly resolved assembly.
  • A genome from a collaborator, a database, or an earlier assembly — contigs. It runs every analysis stage, but cannot re-examine evidence that only exists in reads.
  • Something already analysed with a workflow older than v2.0.0 — these four modes replace the separate repositories that used to do these jobs. See Coming from v1.

Next