Nanopore Sequencing

Nanopore-based sequencing: introduction

Overview

Teaching: 20 min
Exercises: 0 min
Questions
  • What is nanopore-based sequencing?

Objectives
  • Understand details of ONT sequencing platforms.

What is this module about?

ONT platforms

The MinION

http://www.nature.com/news/data-from-pocket-sized-genome-sequencer-unveiled-1.14724

https://nanoporetech.com https://nanoporetech.com/products/specifications

The MinION Mk1D

https://nanoporetech.com/products/minion





MinION flow cells


The GridION

https://nanoporetech.com/products/gridion

PromethION

https://nanoporetech.com/products/promethion



A “mini-PromethION”: the P2

Smaller device (standalone or connect to host computer) that can run Promethion flow cells.

https://nanoporetech.com/products/p2

Flowcell characteristics

Nanopore technology

https://nanoporetech.com/how-it-works

Nanopore technology

https://nanoporetech.com/how-it-works

More information

For more detailed information about ONT sequencing:

Technological advances…

https://nanoporetech.com/resource-centre/london-calling-2022-update-oxford-nanopore-technologies

Pore imporvements: the R10 pore

https://nanoporetech.com/about-us/news/r103-newest-nanopore-high-accuracy-nanopore-sequencing-now-available-store

Nanopore workflow

https://nanoporetech.com/nanopore-sequencing-data-analysis

Basecalling: dorado

10.4.1 flowcells + v14 chemistry: accuracy



https://nanoporetech.com/accuracy

OLDER INFORMATION

10.4.1 flowcells + v14 chemistry: simplex

10.4.1 flowcells + v14 chemistry: duplex

More Nanopore: London Calling 2026

https://www.youtube.com/playlist?list=PLxpxXZj-IgXyh79ddDNm7mM0W0jFtKPnr

Key Points

  • ONT produce a range of popular sequencing platforms.

  • This technology is constantly advancing.


Data Transfer

Overview

Teaching: 10 min
Exercises: 0 min
Questions
  • How do I get data to and from REANNZ?

Objectives
  • Understand how to transfer data with scp.

  • Understand how to transfer data within JupyterHub.

  • Understand how to transfer data with Globus.

Up until now all the data that we have used for the Otago Bioinformatics Spring School has been either already on REANNZ or able to be downladed there from the internet. With bioinformatics workflows we usually start with needing to get our data from our computer to the computers being used for processing and analysis and then once that is done, we need to transfer it back.

There are three main ways to go about transferring data between your computer and REANNZ. These are using scp on the commandline, through the upload/download option when running a Jupyter notebook session on REANNZ, or through Globus.

Both scp and Jupyter methods are only really suitable for small data transfers (< 1 GB). For anything larger, it is recommended to use Globus.

Generating FASTQ data - basecalling

During the ONT sequencing run, the electrical trace (“squiggle”) data generated by the flowcell are stored in POD5 format (or FAST5, if using older data). In order to perform further analysis, the POD5 data needs to basecalled. Previously ONT basecalling software (guppy) output to FASTQ format (base calls plus associated quality information), but dorado outputs to (unaligned) .bam format by default (although you can still choose FASTQ by changing the output settings).

Basecalling usually occurs while a sequencing run is underway, but there are some specific situations that will require you to “re-basecall” your data:

  1. You didn’t perform any basecalling while sequencing - e.g., a MinION being run from a computer without a GPU (so real-time basecalling not possible)

  2. You performed basecalling in FAST mode while sequencing, and now you would like to “re-basecall” using a more accurate model (e.g., super-high accuracy mode: SUP)

You may also have downloaded some POD5 or FAST5 data (i.e., without basecalls), or have access to some older POD5/FAST5 data, and you would like re-basecall using a more recent version of ONT’s software.

In all of these cases, we need to get the POD5/FAST5 data onto a compute system where you have access to a GPU.

Today (later in this lesson) we will use REANNZ for this.

The first step in the process is usually to transfer POD5 data to REANNZ.

scp

From a terminal, scp can be used to transfer files to a remote computer.

The documentation for how to use scp specifically with REANNZ can be found at https://docs.nesi.org.nz/Data_Transfer/SCP/. There are some configuration steps that need to be done to make this a bit easier.

The general format is scp <local file to transfer> mahuika:<path to copy file to> to send a file to REANNZ, and scp mahuika:<path to file> <local path to copy to> to copy a file from REANNZ to your machine.

Jupyter

Jupyter can be used to both upload and download data, however similar to scp it’s not ideal for sending large quantities of data.

Downloading data

To download a file using Jupyter, you will need to use the explorer panel and navigate to the file there. Then, right-click on the file and a menu will pop up. Select “Download” from this menu and your browser will start downloading it.

Downloading data in Jupyter

Uploading data

Similar to downloading through Juptyer, you first need to use the explorer panel to navigate to the directory where you would like the file to be uploaded to. From there click the upload button in the top left corner and select the file you wish to upload from your computer.

Uploading data in Jupyter

Globus

Globus is specialised software that can handle the transfer of large amounts of data between two ‘endpoints’. As part of the transfer it can automatically perform the file integrity checks to ensure the file was correctly transferred. The documentation for using Globus with REANNZ is found at https://docs.nesi.org.nz/Data_Transfer/Globus/Globus_Overview/.

REANNZ provides an endpoint, and you need to provide the second - this might be the globus software running on a different server, or the globus software running on your computer.

Globus Personal Connect

If you need to transfer data from your own machine, you can create your own endpoint by installing and running the Globus Personal Connect software avaiable from https://www.globus.org/globus-connect-personal.

Key Points

  • There are multiple methods to transfer data to and from REANNZ.

  • The method of choice depends on the size of the data.


Nanopore - Basecalling

Overview

Teaching: 15 min
Exercises: 15 min
Questions
  • How do you perform offline (i.e., non-live) basecalling for ONT data?

Objectives
  • Understand POD5/FASTQ format.

  • Use dorado on REANNZ HPC to generate basecalled data from POD5 or FAST5 output files.

FAST5 / HDF5 data

“Hierarchical Data Format (HDF) is a set of file formats (HDF4, HDF5) designed to store and organize large amounts of data. Originally developed at the National Center for Supercomputing Applications, it is supported by The HDF Group, a non-profit corporation whose mission is to ensure continued development of HDF5 technologies and the continued accessibility of data stored in HDF.”

https://www.neonscience.org/resources/learning-hub/tutorials/about-hdf5

POD5 format


Python-based tools for working with POD5:

https://github.com/nanoporetech/pod5-file-format


Automatic local conversion of FAST5 to POD5:

https://pod5.nanoporetech.com/

Basecalling workflow

In order to analyse the data from a sequencing run, the POD5/FAST5 “squiggle” data needs to be converted to base calls. The ONT software application dorado can be used to process POD5/FAST5 data and generate basecalls and quality information.

Previously this was output as FASTQ - a widely used format for storage of sequence data and associated base-level quality scores. This same information is now stored in (unaligned) BAM format (BAM is a binary version of SAM format, which was created for storing aligment information, along with sequence data and quality scores for reads, but it can also be used to stored unaligned data: basecalls and quality scores).



https://nanoporetech.com/nanopore-sequencing-data-analysis

The current version of the dorado software can be downloaded from GitHub:

https://github.com/nanoporetech/dorado

Today we will be using dorado on the REANNZ HPC system to generate FASTQ data from a set of POD5 files.

Recap: FASTQ data format

Assessing sequence quality: phred scores


Ewing B, Green P. (1998): Base-calling of automated sequencer traces using phred. II. Error probabilities. Genome Res. 8(3):186-194.


Can use ASCII to represent quality scores by adding 33 to the phred score and converting to ASCII.

http://en.wikipedia.org/wiki/Phred_quality_score

FASTQ format:

http://en.wikipedia.org/wiki/FASTQ_format

BAM instead of FASTQ

dorado outputs sequence and quality information to BAM format by default.

BAM is a binary (compressed) version of the text-based SAM format (warning, not a thrilling read):

https://samtools.github.io/hts-specs/SAMv1.pdf

ONT: “NO-MISS Bacterial isolate dataset”

For this part of the workshop we are using a subset of this data set provided by Oxford Nanopore Technologies:

https://epi2me.nanoporetech.com/nomiss_96bc_p2i_sup_2026/

The data consist of a Promethion run where barcoding was used to run 96 samples on a single flowcell. The samples represent a collection of 24 bacterial isolates, each procesed in quadruplicate (i.e., four replicates of each: 4 x 24 = 96 barcodes).

The samples comprise 15 distinct species representing the following genera:

Bacillus, Cronobacter, Citrobacter, Enterobacter, Klebsiella, Listeria, Pseudomonas, Salmonella, Shigella, Staphylococcus, and Vibrio.

The full dataset can be downloaded from https://aws.amazon.com/opendata/, or you can view/download files via web browser at 42basepairs.

The raw data are roughly 1.6TB though, so we won’t be using all of that today…

Instead, I’ve created a cut-down data set that contains just a (very small) subset of the data, and only includes reads from the first three barcoded samples (plus some random unclassified reads) - they are all Salmonella samples, and mainly comprise Salmonella enterica.

Bacterial data set on REANNZ

We’ll be working at:

~/obss_2026/nanopore/bacteria-data/

Let’s change to that directory now:

cd ~/obss_2026/nanopore/bacteria-data/

POD5 files from sequencing E. coli are available in the directory:

pod5_files
ls -1 pod5_files
PBK98658_853a956f_57f83f46_0_subset.pod5
PBK98658_853a956f_57f83f46_1_subset.pod5
PBK98658_853a956f_57f83f46_2_subset.pod5

Basecalling: dorado

On REANNZ:

module spider dorado
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  dorado: dorado/2.1.2-foss-2026-CUDA-13.2.1
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Description:
      Dorado is a high-performance, easy-to-use, open source basecaller for Oxford Nanopore reads.
     Other possible modules matches:
        Dorado, slow5-dorado
    This module can be loaded directly: module load dorado/2.1.2-foss-2026-CUDA-13.2.1
    Help:
      Description
      ===========
      Dorado is a high-performance, easy-to-use, open source basecaller for Oxford Nanopore reads.
      
      
      More information
      ================
       - Homepage: https://github.com/nanoporetech/dorado
      
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  To find other possible module matches execute:
      $ module -r spider '.*dorado.*'
module load dorado

dorado --help
Usage: dorado [options] subcommand
Positional arguments:
aligner
basecaller
correct
demux
download
duplex
polish
smallvar
summary
trim
Optional arguments:
-h --help               shows help message and exits
-l --licences           prints third party licences and exits
-v --version            prints version information and exits
-vv                     prints verbose version information and exits

Using dorado on REANNZ

Information about using dorado on REANNZ can be found at:

https://docs.nesi.org.nz/Software/Available_Applications/Dorado/

In order to use dorado to generate basecalls from POD5 or FAST5 data, we need to select a “model”.

Each model has been trained to generate specific types of basecalls (i.e., unmodified DNA, RNA, modified DNA: 5mC, 5hmC, 6mA), for specific types of data (flowcell version: 9.4.1, 10.4.1; *plex: simplex, duplex; speed: 260bps, 400bps or 70bps/130bp for RNA), at differing levels of accuracy (FAST, HAC, SUP).

We can see what models are available via:

dorado download --list
[2026-11-11 14:48:23.584] [info] Running: "download" "--list"
[2026-11-11 14:48:23.584] [info] > variant models
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_hac@v5.2.0_smallvar@v1.0
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_hac@v6.0.0_smallvar@v1.0
[2026-11-11 14:48:23.584] [info] > polish models
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_hac@v5.0.0_polish_rl
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_hac@v5.0.0_polish_rl_mv
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_sup@v5.0.0_polish_rl
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_sup@v5.0.0_polish_rl_mv
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_hac@v5.2.0_polish_rl
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_hac@v5.2.0_polish_rl_mv
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_sup@v5.2.0_polish_rl
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_sup@v5.2.0_polish_rl_mv
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_hac@v6.0.0_polish_rl
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_hac@v6.0.0_polish_rl_mv
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_polish_bacterial_methylation_v5.0.0
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_hac@v4.2.0_polish
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_sup@v4.2.0_polish
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_hac@v4.3.0_polish
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_sup@v4.3.0_polish
[2026-11-11 14:48:23.584] [info] > correction models
[2026-11-11 14:48:23.584] [info]  - herro-v1.1
[2026-11-11 14:48:23.584] [info] > modification models
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_fast@v4.2.0_5mCG_5hmCG@v2
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_hac@v4.2.0_5mCG_5hmCG@v2
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_sup@v4.2.0_5mCG_5hmCG@v2
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_sup@v4.2.0_5mCG_5hmCG@v3.1
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_sup@v4.2.0_5mC@v2
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_sup@v4.2.0_6mA@v2
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_sup@v4.2.0_6mA@v3
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_sup@v4.2.0_5mC_5hmC@v1
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_hac@v4.3.0_5mC_5hmC@v1
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_sup@v4.3.0_5mC_5hmC@v1
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_hac@v4.3.0_6mA@v1
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_sup@v4.3.0_6mA@v1
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_hac@v4.3.0_6mA@v2
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_sup@v4.3.0_6mA@v2
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_hac@v4.3.0_5mCG_5hmCG@v1
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_sup@v4.3.0_5mCG_5hmCG@v1
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_hac@v5.0.0_4mC_5mC@v1
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_sup@v5.0.0_4mC_5mC@v1
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_hac@v5.0.0_4mC_5mC@v2
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_hac@v5.0.0_4mC_5mC@v3
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_sup@v5.0.0_4mC_5mC@v2
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_sup@v5.0.0_4mC_5mC@v3
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_hac@v5.0.0_5mC_5hmC@v1
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_sup@v5.0.0_5mC_5hmC@v1
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_hac@v5.0.0_5mC_5hmC@v2
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_hac@v5.0.0_5mC_5hmC@v3
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_sup@v5.0.0_5mC_5hmC@v2.0.1
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_sup@v5.0.0_5mC_5hmC@v3
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_hac@v5.0.0_5mCG_5hmCG@v1
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_sup@v5.0.0_5mCG_5hmCG@v1
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_hac@v5.0.0_5mCG_5hmCG@v2
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_hac@v5.0.0_5mCG_5hmCG@v3
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_sup@v5.0.0_5mCG_5hmCG@v2.0.1
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_sup@v5.0.0_5mCG_5hmCG@v3
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_hac@v5.0.0_6mA@v1
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_sup@v5.0.0_6mA@v1
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_hac@v5.0.0_6mA@v2
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_hac@v5.0.0_6mA@v3
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_sup@v5.0.0_6mA@v2
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_sup@v5.0.0_6mA@v3
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_hac@v5.2.0_4mC_5mC@v1
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_sup@v5.2.0_4mC_5mC@v1
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_hac@v5.2.0_5mC_5hmC@v1
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_hac@v5.2.0_5mC_5hmC@v2
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_sup@v5.2.0_5mC_5hmC@v1
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_sup@v5.2.0_5mC_5hmC@v2
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_hac@v5.2.0_5mCG_5hmCG@v1
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_hac@v5.2.0_5mCG_5hmCG@v2
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_sup@v5.2.0_5mCG_5hmCG@v1
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_sup@v5.2.0_5mCG_5hmCG@v2
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_hac@v5.2.0_6mA@v1
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_sup@v5.2.0_6mA@v1
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_hac@v6.0.0_4mC_5mC@v1
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_hac@v6.0.0_5mC_5hmC@v1
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_hac@v6.0.0_5mCG_5hmCG@v1
[2026-11-11 14:48:23.585] [info]  - dna_r10.4.1_e8.2_400bps_hac@v6.0.0_6mA@v1
[2026-11-11 14:48:23.585] [info]  - rna004_130bps_sup@v3.0.1_m6A_DRACH@v1
[2026-11-11 14:48:23.585] [info]  - rna004_130bps_hac@v5.0.0_m6A@v1
[2026-11-11 14:48:23.585] [info]  - rna004_130bps_sup@v5.0.0_m6A@v1
[2026-11-11 14:48:23.585] [info]  - rna004_130bps_hac@v5.0.0_m6A_DRACH@v1
[2026-11-11 14:48:23.585] [info]  - rna004_130bps_sup@v5.0.0_m6A_DRACH@v1
[2026-11-11 14:48:23.585] [info]  - rna004_130bps_hac@v5.0.0_pseU@v1
[2026-11-11 14:48:23.585] [info]  - rna004_130bps_sup@v5.0.0_pseU@v1
[2026-11-11 14:48:23.585] [info]  - rna004_130bps_hac@v5.1.0_m5C@v1
[2026-11-11 14:48:23.585] [info]  - rna004_130bps_sup@v5.1.0_m5C@v1
[2026-11-11 14:48:23.585] [info]  - rna004_130bps_hac@v5.1.0_inosine_m6A@v1
[2026-11-11 14:48:23.585] [info]  - rna004_130bps_sup@v5.1.0_inosine_m6A@v1
[2026-11-11 14:48:23.585] [info]  - rna004_130bps_hac@v5.1.0_m6A_DRACH@v1
[2026-11-11 14:48:23.585] [info]  - rna004_130bps_sup@v5.1.0_m6A_DRACH@v1
[2026-11-11 14:48:23.585] [info]  - rna004_130bps_hac@v5.1.0_pseU@v1
[2026-11-11 14:48:23.585] [info]  - rna004_130bps_sup@v5.1.0_pseU@v1
[2026-11-11 14:48:23.586] [info]  - rna004_130bps_sup@v5.2.0_2OmeG@v1
[2026-11-11 14:48:23.586] [info]  - rna004_130bps_hac@v5.2.0_m5C@v1
[2026-11-11 14:48:23.586] [info]  - rna004_130bps_sup@v5.2.0_m5C_2OmeC@v1
[2026-11-11 14:48:23.586] [info]  - rna004_130bps_hac@v5.2.0_inosine_m6A@v1
[2026-11-11 14:48:23.586] [info]  - rna004_130bps_sup@v5.2.0_inosine_m6A_2OmeA@v1
[2026-11-11 14:48:23.586] [info]  - rna004_130bps_hac@v5.2.0_m6A_DRACH@v1
[2026-11-11 14:48:23.586] [info]  - rna004_130bps_sup@v5.2.0_m6A_DRACH@v1
[2026-11-11 14:48:23.586] [info]  - rna004_130bps_hac@v5.2.0_pseU@v1
[2026-11-11 14:48:23.584] [info]  - dna_r10.4.1_e8.2_400bps_hac@v5.0.0_4mC_5mC@v1
[2026-11-11 14:48:23.586] [info]  - rna004_130bps_sup@v5.2.0_pseU_2OmeU@v1
[2026-11-11 14:48:23.586] [info]  - rna004_130bps_sup@v5.3.0_2OmeG@v1
[2026-11-11 14:48:23.586] [info]  - rna004_130bps_hac@v5.3.0_m5C@v1
[2026-11-11 14:48:23.586] [info]  - rna004_130bps_sup@v5.3.0_m5C_2OmeC@v1
[2026-11-11 14:48:23.586] [info]  - rna004_130bps_hac@v5.3.0_inosine_m6A@v1
[2026-11-11 14:48:23.586] [info]  - rna004_130bps_sup@v5.3.0_inosine_m6A_2OmeA@v1
[2026-11-11 14:48:23.586] [info]  - rna004_130bps_hac@v5.3.0_m6A_DRACH@v1
[2026-11-11 14:48:23.586] [info]  - rna004_130bps_sup@v5.3.0_m6A_DRACH@v1
[2026-11-11 14:48:23.586] [info]  - rna004_130bps_hac@v5.3.0_pseU@v1
[2026-11-11 14:48:23.586] [info]  - rna004_130bps_sup@v5.3.0_pseU_2OmeU@v1
[2026-11-11 14:48:23.586] [info]  - rna004_sup@v6.0.0_2OmeG@v1
[2026-11-11 14:48:23.586] [info]  - rna004_hac@v6.0.0_m5C@v1
[2026-11-11 14:48:23.586] [info]  - rna004_sup@v6.0.0_m5C_2OmeC@v1
[2026-11-11 14:48:23.586] [info]  - rna004_hac@v6.0.0_inosine_m6A@v1
[2026-11-11 14:48:23.586] [info]  - rna004_sup@v6.0.0_inosine_m6A_2OmeA@v1
[2026-11-11 14:48:23.586] [info]  - rna004_hac@v6.0.0_m6A_DRACH@v1
[2026-11-11 14:48:23.586] [info]  - rna004_sup@v6.0.0_m6A_DRACH@v1
[2026-11-11 14:48:23.586] [info]  - rna004_hac@v6.0.0_pseU@v1
[2026-11-11 14:48:23.586] [info]  - rna004_sup@v6.0.0_pseU_2OmeU@v1
[2026-11-11 14:48:23.586] [info] > stereo models
[2026-11-11 14:48:23.586] [info]  - dna_r10.4.1_e8.2_5khz_stereo@v1.1
[2026-11-11 14:48:23.586] [info]  - dna_r10.4.1_e8.2_5khz_stereo@v1.2
[2026-11-11 14:48:23.586] [info]  - dna_r10.4.1_e8.2_5khz_stereo@v1.3
[2026-11-11 14:48:23.586] [info]  - dna_r10.4.1_e8.2_5khz_stereo@v1.4
[2026-11-11 14:48:23.586] [info]  - dna_r10.4.1_e8.2_5khz_stereo@v1.5
[2026-11-11 14:48:23.586] [info] > simplex models
[2026-11-11 14:48:23.586] [info]  - dna_r10.4.1_e8.2_400bps_fast@v4.2.0
[2026-11-11 14:48:23.586] [info]  - dna_r10.4.1_e8.2_400bps_hac@v4.2.0
[2026-11-11 14:48:23.586] [info]  - dna_r10.4.1_e8.2_400bps_sup@v4.2.0
[2026-11-11 14:48:23.586] [info]  - dna_r10.4.1_e8.2_400bps_fast@v4.3.0
[2026-11-11 14:48:23.586] [info]  - dna_r10.4.1_e8.2_400bps_hac@v4.3.0
[2026-11-11 14:48:23.586] [info]  - dna_r10.4.1_e8.2_400bps_sup@v4.3.0
[2026-11-11 14:48:23.586] [info]  - dna_r10.4.1_e8.2_400bps_fast@v5.0.0
[2026-11-11 14:48:23.586] [info]  - dna_r10.4.1_e8.2_400bps_hac@v5.0.0
[2026-11-11 14:48:23.586] [info]  - dna_r10.4.1_e8.2_400bps_sup@v5.0.0
[2026-11-11 14:48:23.586] [info]  - dna_r10.4.1_e8.2_apk_sup@v5.0.0
[2026-11-11 14:48:23.586] [info]  - dna_r10.4.1_e8.2_400bps_fast@v5.2.0
[2026-11-11 14:48:23.586] [info]  - dna_r10.4.1_e8.2_400bps_hac@v5.2.0
[2026-11-11 14:48:23.586] [info]  - dna_r10.4.1_e8.2_400bps_sup@v5.2.0
[2026-11-11 14:48:23.586] [info]  - dna_r10.4.1_e8.2_400bps_hac@v6.0.0
[2026-11-11 14:48:23.586] [info]  - rna004_130bps_fast@v3.0.1
[2026-11-11 14:48:23.586] [info]  - rna004_130bps_hac@v3.0.1
[2026-11-11 14:48:23.586] [info]  - rna004_130bps_sup@v3.0.1
[2026-11-11 14:48:23.587] [info]  - rna004_130bps_fast@v5.0.0
[2026-11-11 14:48:23.587] [info]  - rna004_130bps_hac@v5.0.0
[2026-11-11 14:48:23.587] [info]  - rna004_130bps_sup@v5.0.0
[2026-11-11 14:48:23.587] [info]  - rna004_130bps_fast@v5.1.0
[2026-11-11 14:48:23.587] [info]  - rna004_130bps_hac@v5.1.0
[2026-11-11 14:48:23.587] [info]  - rna004_130bps_sup@v5.1.0
[2026-11-11 14:48:23.587] [info]  - rna004_130bps_fast@v5.2.0
[2026-11-11 14:48:23.587] [info]  - rna004_130bps_hac@v5.2.0
[2026-11-11 14:48:23.587] [info]  - rna004_130bps_sup@v5.2.0
[2026-11-11 14:48:23.587] [info]  - rna004_130bps_fast@v5.3.0
[2026-11-11 14:48:23.587] [info]  - rna004_130bps_hac@v5.3.0
[2026-11-11 14:48:23.587] [info]  - rna004_130bps_sup@v5.3.0
[2026-11-11 14:48:23.587] [info]  - rna004_fast@v6.0.0
[2026-11-11 14:48:23.587] [info]  - rna004_hac@v6.0.0
[2026-11-11 14:48:23.587] [info]  - rna004_sup@v6.0.0

We can ask dorado to download a specific model via:

mkdir dorado-models
dorado download --model dna_r10.4.1_e8.2_400bps_fast@v5.2.0 --directory dorado-models/

Check the donload:

ls dorado-models/
dna_r10.4.1_e8.2_400bps_fast@v5.2.0

dorado can use GPUs to speed up the basecalling process.

On REANNZ, we can access the GPUs by submitting a job to the cluster using a slurm script.

The slurm script we will use can be found at:

scripts/dorado_fastmodel.sl

Let’s have a look at the content:

more scripts/dorado_fastmodel.sl
#!/bin/bash -e 

#SBATCH --job-name      dorado_basecalling
#SBATCH --time          00:15:00
#SBATCH --mem           6G
#SBATCH --cpus-per-task 4
#SBATCH --output        dorado_%j.out
#SBATCH --error         dorado_%j.err
#SBATCH --account       nesi02659
#SBATCH --gpus-per-node l4:1

module load dorado

dorado basecaller  --device 'cuda:all' dorado-models/dna_r10.4.1_e8.2_400bps_fast@v5.2.0 pod5_files --kit-name SQK-RBK114-96 --output-dir bam-unaligned

Let’s have a closer look at the dorado basecaller command:

dorado basecaller  --device 'cuda:all' \
  dorado-models/dna_r10.4.1_e8.2_400bps_fast@v5.2.0 \
  pod5_files \
  --kit-name SQK-RBK114-96 \
  --output-dir bam-unaligned

Options used:

Before running the script, we need to create the directory where the output files will be written:

mkdir bam-unaligned

To submit the script, we use the sbatch command, and run it from the ~/obss_2026/nanopore/bacteria-data directory. You can check if you are in that directory with pwd. If not:

cd ~/obss_2026/nanopore/bacteria-data/

To run the script:

sbatch scripts/dorado_fastmodel.sl

Once the script has been submitted, you can check to make sure it is running via:

# This shows all your current jobs
squeue --me
JOBID         USER     ACCOUNT   NAME        CPUS MIN_MEM PARTITI START_TIME     TIME_LEFT STATE    NODELIST(REASON)    
10901129      michael. nesi02659 dorado_basec   4      1G genoa   Nov 18 14:12        8:43 RUNNING  g12             

It also writes “progress” output to a log file that contains the job ID (represented by XXXXXXX in the code below), although (unlike with the older guppy software, you don’t get any information about how far through the processing you are). You can check the file name using ls -ltr (list file details, in reverse time order).
Using the tail -f command, we can watch the “progress” (use control-c to exit):

ls -ltr
tail -f dorado_XXXXXXX.err

Example of output:

[2026-11-18 14:35:55.953] [info] > Creating basecall pipeline
[2026-11-18 14:36:15.222] [info] > Finished in (ms): 19218
[2026-11-18 14:36:15.222] [info] > Simplex reads basecalled: 32984
[2026-11-18 14:36:15.222] [info] > Simplex reads filtered: 124
[2026-11-18 14:36:15.222] [info] > Basecalled @ Samples/s: 4.017993e+07
[2026-11-18 14:36:15.222] [info] > 33541 reads demuxed @ classifications/s: 1.745291e+03
[2026-11-18 14:36:15.359] [info] > Finished

Use “Control-c” to exit (it’s okay, it won’t kill the job).

NOTE:

The job should take a few minutes to run.

Once the job has completed successfully, the bams files (one per barcode, plus “unclassified” reads) will be written to a rather convoluated directory structure under: ~/obss_2026/nanopore/bacteria-data/bam-unaligned/.

tree bam-unaligned/
bam-unaligned
└── NO_MISSV2_P2I
    └── P2I_96
        └── 20260413_1636_P2I-00014-B_PBK98658_853a956f
            └── bam_pass
                ├── barcode01
                │   └── PBK98658_pass_barcode01_853a956f_57f83f46_0.bam
                ├── barcode02
                │   └── PBK98658_pass_barcode02_853a956f_57f83f46_0.bam
                ├── barcode03
                │   └── PBK98658_pass_barcode03_853a956f_57f83f46_0.bam
                ├── barcode04
                │   └── PBK98658_pass_barcode04_853a956f_57f83f46_0.bam
                ├── barcode05
                │   └── PBK98658_pass_barcode05_853a956f_57f83f46_0.bam
                ├── barcode06
                │   └── PBK98658_pass_barcode06_853a956f_57f83f46_0.bam
.
.
.
                ├── barcode95
                │   └── PBK98658_pass_barcode95_853a956f_57f83f46_0.bam
                ├── barcode96
                │   └── PBK98658_pass_barcode96_853a956f_57f83f46_0.bam
                └── unclassified
                    └── PBK98658_pass_unclassified_853a956f_57f83f46_0.bam

101 directories, 97 files

Each .bam file contains the reads labelled with a specific DNA barcode (barcode01-barcode96) or reads whose barcodes could not be determined (unclassified).

Because I created a data subset that only contained reads from the first three barcodes (plus some unclassified reads), those are the only .bam files that contain data. We can check the size of each folder to confirm this (use du to find the size in MB of all the folders, then sort the results and look at the largest 10):

du -sm bam-unaligned/NO_MISSV2_P2I/P2I_96/20260413_1636_P2I-00014-B_PBK98658_853a956f/bam_pass/* | sort -n | tail -10
1       bam-unaligned/NO_MISSV2_P2I/P2I_96/20260413_1636_P2I-00014-B_PBK98658_853a956f/bam_pass/barcode91
1       bam-unaligned/NO_MISSV2_P2I/P2I_96/20260413_1636_P2I-00014-B_PBK98658_853a956f/bam_pass/barcode92
1       bam-unaligned/NO_MISSV2_P2I/P2I_96/20260413_1636_P2I-00014-B_PBK98658_853a956f/bam_pass/barcode93
1       bam-unaligned/NO_MISSV2_P2I/P2I_96/20260413_1636_P2I-00014-B_PBK98658_853a956f/bam_pass/barcode94
1       bam-unaligned/NO_MISSV2_P2I/P2I_96/20260413_1636_P2I-00014-B_PBK98658_853a956f/bam_pass/barcode95
1       bam-unaligned/NO_MISSV2_P2I/P2I_96/20260413_1636_P2I-00014-B_PBK98658_853a956f/bam_pass/barcode96
9       bam-unaligned/NO_MISSV2_P2I/P2I_96/20260413_1636_P2I-00014-B_PBK98658_853a956f/bam_pass/unclassified
13      bam-unaligned/NO_MISSV2_P2I/P2I_96/20260413_1636_P2I-00014-B_PBK98658_853a956f/bam_pass/barcode03
17      bam-unaligned/NO_MISSV2_P2I/P2I_96/20260413_1636_P2I-00014-B_PBK98658_853a956f/bam_pass/barcode01
17      bam-unaligned/NO_MISSV2_P2I/P2I_96/20260413_1636_P2I-00014-B_PBK98658_853a956f/bam_pass/barcode02

Key Points

  • POD5/FAST5 data can be converted to BAM or FASTQ via the dorado software.

  • dorado has different models (FAST, HAC and SUP) that provide increasing basecall accuracy (and take increasing amounts of computation).

  • Once bascalling has been done, standard tasks such as QA/QC, mapping and variant calling can be performed.


Nanopore: quality assessment

Overview

Teaching: 15 min
Exercises: 15 min
Questions
  • How can I perform quality assessment of ONT data?

Objectives
  • Assess the quality of reads.

  • Generate summary metrics.

Software for quality assessment

In this part of the module, we’ll look at software applications that can be used to assess the quality of data from ONT sequencing runs. We’ll be focussing on two pieces of software: FastQC and NanoPlot.

Reminder; .bam file location

tree bam-unaligned
bam-unaligned/
└── NO_MISSV2_P2I
    └── P2I_96
        └── 20260413_1636_P2I-00014-B_PBK98658_853a956f
            └── bam_pass
                ├── barcode01
                │   └── PBK98658_pass_barcode01_853a956f_57f83f46_0.bam
                ├── barcode02
                │   └── PBK98658_pass_barcode02_853a956f_57f83f46_0.bam
                ├── barcode03
                │   └── PBK98658_pass_barcode03_853a956f_57f83f46_0.bam
.
.
.
                └── unclassified
                    └── PBK98658_pass_unclassified_853a956f_57f83f46_0.bam

NanoPlot

Let’s use the NanoPlot software to assess the quality of our unaligned .bam data. We can run NanoPlot interactively (i.e., we don’t need to submit it as a slurm job), and it wil produce an HTML-based report that can be viewed in a browser.

Specify a .bam file to run NanoPlot on (PLEASE: use TAB COMPLETE to move down through the directories):

BAMFILE=bam-unaligned/NO_MISSV2_P2I/P2I_96/20260413_1636_P2I-00014-B_PBK98658_853a956f/bam_pass/barcode01/PBK98658_pass_barcode01_853a956f_57f83f46_0.bam 

Running Nanoplot

Load the NanoPlot module:

module load NanoPlot

Run NanoPlot on a single .bam file:

NanoPlot -o nanoplot_fastmodel/barcode01 \
         -p bacteria_fastmodel_barcode01_ \
         --ubam $BAMFILE

Command syntax:

Let’s check what output was generated:

ls -1 nanoplot_fastmodel/barcode01
bacteria_fastmodel_barcode01_LengthvsQualityScatterPlot_dot.html
bacteria_fastmodel_barcode01_LengthvsQualityScatterPlot_dot.png
bacteria_fastmodel_barcode01_LengthvsQualityScatterPlot_kde.html
bacteria_fastmodel_barcode01_LengthvsQualityScatterPlot_kde.png
bacteria_fastmodel_barcode01_NanoPlot_20261113_1235.log
bacteria_fastmodel_barcode01_NanoPlot-report.html
bacteria_fastmodel_barcode01_NanoStats.txt
bacteria_fastmodel_barcode01_Non_weightedHistogramReadlength.html
bacteria_fastmodel_barcode01_Non_weightedHistogramReadlength.png
bacteria_fastmodel_barcode01_Non_weightedLogTransformed_HistogramReadlength.html
bacteria_fastmodel_barcode01_Non_weightedLogTransformed_HistogramReadlength.png
bacteria_fastmodel_barcode01_WeightedHistogramReadlength.html
bacteria_fastmodel_barcode01_WeightedHistogramReadlength.png
bacteria_fastmodel_barcode01_WeightedLogTransformed_HistogramReadlength.html
bacteria_fastmodel_barcode01_WeightedLogTransformed_HistogramReadlength.png
bacteria_fastmodel_barcode01_Yield_By_Length.html
bacteria_fastmodel_barcode01_Yield_By_Length.png

The file that we are interested in is the HTML report: bacteria_fastmodel_barcode01_NanoPlot-report.html

To view this in your browser:

  1. Use the file browser (left panel of Jupyter window) to navigate to the nanoplot_fastmodel/barcode01 folder.
  2. Control-click (Mac) or right-click (Windows/Linux) on the “bacteria_fastmodel_barcode01_NanoPlot-report.html” file and choose “Open in New Browser Tab”.
  3. The report should now be displayed in a new tab in your browser.

Processing multiple .bam files

Nanoplot doesn’t have a built-in mechanism for processing multiple .bam files and keeping the output separate for each. If you give it multiple .bam files (e.g., via Nanoplot --ubam *.bam) it will combine all of the results into a single report.

In order to process each of the .bam files separately, you can use a loop:

FOLDER=bam-unaligned/NO_MISSV2_P2I/P2I_96/20260413_1636_P2I-00014-B_PBK98658_853a956f/bam_pass/

for i in barcode02  barcode03 unclassified 
do 
    NanoPlot -o nanoplot_fastmodel/$i \
             -p bacteria_fastmodel_$i_ \
             --ubam $FOLDER/$i/*.bam
done

Once this has completed, we can check to see what has been created:

ls -1 nanoplot_fastmodel
barcode01
barcode02
barcode03
unclassified

There is now one folder of Nanoplot output for each barcoded sample.

FastQC

Load the FastQC module:

module load FastQC

Make a folder for the FastQC output to written to:

mkdir fastqc_fastmodel

Unlike Nanoplot, FastQC can handle multiple .bam files at once (so a command like his will work: fastqc -t 4 -o fastqc_fastmodel $FOLDER/*/*.bam).

BUT, because we’ve also got all of the .bam files from the other barcodes (and we don’t want to run FastQC for these empty files), can can use the same approach as above.

Let’s re-use the $FOLDER variable we created.

Reminder:

tree $FOLDER
bam-unaligned/NO_MISSV2_P2I/P2I_96/20260413_1636_P2I-00014-B_PBK98658_853a956f/bam_pass/
├── barcode01
│   ├── PBK98658_pass_barcode01_853a956f_57f83f46_0.bam
│   └── PBK98658_pass_barcode01_853a956f_57f83f46_0.bam.bai
├── barcode02
│   ├── PBK98658_pass_barcode02_853a956f_57f83f46_0.bam
│   └── PBK98658_pass_barcode02_853a956f_57f83f46_0.bam.bai
├── barcode03
│   ├── PBK98658_pass_barcode03_853a956f_57f83f46_0.bam
│   └── PBK98658_pass_barcode03_853a956f_57f83f46_0.bam.bai
.
.
.
└── unclassified
    ├── PBK98658_pass_unclassified_853a956f_57f83f46_0.bam
    └── PBK98658_pass_unclassified_853a956f_57f83f46_0.bam.bai

Fun fact - Nanoplot created a .bai (bam index) file for us when it processed the data.

Run FastQC on our data:

for i in barcode01 barcode02  barcode03 unclassified
do 
    fastqc -t 4 -o fastqc_fastmodel $FOLDER/$i/*.bam
done

Command syntax:

Check the output:

ls -1 fastqc_fastmodel
PBK98658_pass_barcode01_853a956f_57f83f46_0_fastqc.html
PBK98658_pass_barcode01_853a956f_57f83f46_0_fastqc.zip
PBK98658_pass_barcode02_853a956f_57f83f46_0_fastqc.html
PBK98658_pass_barcode02_853a956f_57f83f46_0_fastqc.zip
PBK98658_pass_barcode03_853a956f_57f83f46_0_fastqc.html
PBK98658_pass_barcode03_853a956f_57f83f46_0_fastqc.zip
PBK98658_pass_unclassified_853a956f_57f83f46_0_fastqc.html
PBK98658_pass_unclassified_853a956f_57f83f46_0_fastqc.zip

As we did with the NanoPlot output, we can view the HTML report in the browser:

  1. Use the file browser (left panel of Jupyter window) to navigate to the fastqc_fastmodel folder.
  2. Control-click (Mac) or right-click (Windows/Linux) on the “PBK98658_pass_barcode01_853a956f_57f83f46_0_fastqc.html” file and choose “Open in New Browser Tab”.
  3. The report should now be displayed in a new tab in your browser.

Key Points

  • FastQC and NanoPlot provide pre-formatted reports on run characteristics and read quality.


Nanopore - Variant Calling

Overview

Teaching: 15 min
Exercises: 15 min
Questions
  • How can I use nanopore data for variant calling?

Objectives
  • Align reads from long-read data.

  • Perform variant calling using nanopore data.

Sequence alignment

Tools for generating alignments

Alignment with dorado and minimap2 on REANNZ

Check that we’ve got a reference genome:

ls genome
GCF_000006945.2_ASM694v2_genomic.fna

What does the genome look like (spolier alert: kind of boring…):

head genome/GCF_000006945.2_ASM694v2_genomic.fna
>NC_003197.2 Salmonella enterica subsp. enterica serovar Typhimurium str. LT2, complete genome
AGAGATTACGTCTGGTTGCAAGAGATCATGACAGGGGGAATTGGTTGAAAATAAATATATCGCCAGCAGCACATGAACAA
GTTTCGGAATGTGATCAATTTAAAAATTTATTGACTTAGGCGGGCAGATACTTTAACCAATATAGGAATACAAGACAGAC
AAATAAAAATGACAGAGTACACAACATCCATGAACCGCATCAGCACCACCACCATTACCACCATCACCATTACCACAGGT
AACGGTGCGGGCTGACGCGTACAGGAAACACAGAAAAAAGCCCGCACCTGAACAGTGCGGGCTTTTTTTTCGACCAGAGA
TCACGAGGTAACAACCATGCGAGTGTTGAAGTTCGGCGGTACATCAGTGGCAAATGCAGAACGTTTTCTGCGTGTTGCCG
ATATTCTGGAAAGCAATGCCAGGCAAGGGCAGGTAGCGACCGTACTTTCCGCCCCCGCGAAAATTACCAACCATCTGGTG
GCAATGATTGAAAAAACTATCGGCGGCCAGGATGCTTTGCCGAATATCAGCGATGCAGAACGTATTTTTTCTGACCTGCT
CGCAGGACTTGCCAGCGCGCAGCCGGGATTCCCGCTTGCACGGTTGAAAATGGTTGTCGAACAAGAATTCGCTCAGATCA
AACATGTTCTGCATGGTATCAGCCTGCTGGGTCAGTGCCCGGATAGCATCAACGCCGCGCTGATTTGCCGTGGCGAAAAA

Load the SAMtools module:

module load SAMtools

Load the Dorado module:

module load dorado

Make a folder for our aligned data:

mkdir bam-aligned

Reminder: our unaligned .bam files are located at:

bam-unaligned/NO_MISSV2_P2I/P2I_96/20260413_1636_P2I-00014-B_PBK98658_853a956f/bam_pass/

We still have our $FOLDER variable from earlier:

echo $FOLDER
bam-unaligned/NO_MISSV2_P2I/P2I_96/20260413_1636_P2I-00014-B_PBK98658_853a956f/bam_pass/
tree $FOLDER
bam-unaligned/NO_MISSV2_P2I/P2I_96/20260413_1636_P2I-00014-B_PBK98658_853a956f/bam_pass/
├── barcode01
│   ├── PBK98658_pass_barcode01_853a956f_57f83f46_0.bam
│   └── PBK98658_pass_barcode01_853a956f_57f83f46_0.bam.bai
├── barcode02
│   ├── PBK98658_pass_barcode02_853a956f_57f83f46_0.bam
│   └── PBK98658_pass_barcode02_853a956f_57f83f46_0.bam.bai
├── barcode03
│   ├── PBK98658_pass_barcode03_853a956f_57f83f46_0.bam
│   └── PBK98658_pass_barcode03_853a956f_57f83f46_0.bam.bai
.
.
.
└── unclassified
    ├── PBK98658_pass_unclassified_853a956f_57f83f46_0.bam
    └── PBK98658_pass_unclassified_853a956f_57f83f46_0.bam.bai

The first three barcodes relate to Salmonella isolates. Let’s copy those to a separate folder to make them a little easier to find. By using the barcode* pattern, we can select just the files whose barcodes were reliably detected (i.e., not the “unclassified” reads).

mkdir salmonella-bamfiles

cp $FOLDER/barcode01/*.bam salmonella-bamfiles/ 
cp $FOLDER/barcode02/*.bam salmonella-bamfiles/ 
cp $FOLDER/barcode03/*.bam salmonella-bamfiles/ 

ls -1 salmonella-bamfiles/
PBK98658_pass_barcode01_853a956f_57f83f46_0.bam
PBK98658_pass_barcode02_853a956f_57f83f46_0.bam
PBK98658_pass_barcode03_853a956f_57f83f46_0.bam

We can use dorado again to align the reads to our reference genome (note, this can also be done as part of the basecalling process, but that means you’re performing alignemnt prior to having done any QC checking).

dorado uses the minimap2 aligner (another software tool from ONT). The syntax for performing alignemnt on basecalled data is (-t 4 specifies four threads: faster):

dorado aligner -t 4 \
  genome/GCF_000006945.2_ASM694v2_genomic.fna \
  salmonella-bamfiles/ | \
  samtools sort -o bam-aligned/salmonella-aligned-sort.bam 

Index the bam file:

samtools index bam-aligned/salmonella-aligned-sort.bam 

Generate basic mapping information using samtools:

samtools coverage bam-aligned/salmonella-aligned-sort.bam 
#rname       startpos      endpos  numreads   covbases  coverage  meandepth    meanbaseq    meanmapq
NC_003197.2         1     4857450     19698    4661869   95.9736    8.08004         19.4        57.3
NC_003277.2         1       93933       110      16030   17.0654    1.31684         19.5        50.4

Variant calling

NB - code below is taken from the “Variant Calling Workflow” section of the Genomic Data Carpentry course:

https://datacarpentry.org/wrangling-genomics/04-variant_calling/index.html

Load the BCFtools module:

module load BCFtools

Make a folder for the output data:

mkdir bcf-files

Generate a “pileup” file to enable variant calling (might take a little bit of time):

bcftools mpileup --threads 4 \
   -B -Q5 --max-BQ 30 -I \
   -o bcf-files/salmonella-pass.bcf \
   -f genome/GCF_000006945.2_ASM694v2_genomic.fna  \
   bam-aligned/salmonella-aligned-sort.bam

Make a folder to hold vcf (variant call format) files:

mkdir vcf-files

Use bcftools to call variants in the salmonella data:

bcftools call --ploidy 1 -m -v \
   -o vcf-files/salmonella-variants.vcf \
   bcf-files/salmonella-pass.bcf 

Use vcfutils.pl to filter the variants (in this case, everything gets kept):

vcfutils.pl varFilter vcf-files/salmonella-variants.vcf  > vcf-files/salmonella-final-variants.vcf
head -40 vcf-files/salmonella-final-variants.vcf
##fileformat=VCFv4.2
##FILTER=<ID=PASS,Description="All filters passed">
##bcftoolsVersion=1.22+htslib-1.22
##bcftoolsCommand=mpileup --threads 4 -B -Q5 --max-BQ 30 -I -o bcf-files/salmonella-pass.bcf -f genome/GCF_000006945.2_ASM694v2_genomic.fna bam-aligned/salmonella-aligned-sort.bam
##reference=file://genome/GCF_000006945.2_ASM694v2_genomic.fna
##contig=<ID=NC_003197.2,length=4857450>
##contig=<ID=NC_003277.2,length=93933>
##ALT=<ID=*,Description="Represents allele(s) other than observed.">
##INFO=<ID=INDEL,Number=0,Type=Flag,Description="Indicates that the variant is an INDEL.">
##INFO=<ID=IDV,Number=1,Type=Integer,Description="Maximum number of raw reads supporting an indel">
##INFO=<ID=IMF,Number=1,Type=Float,Description="Maximum fraction of raw reads supporting an indel">
##INFO=<ID=DP,Number=1,Type=Integer,Description="Raw read depth">
##INFO=<ID=VDB,Number=1,Type=Float,Description="Variant Distance Bias for filtering splice-site artefacts in RNA-seq data (bigger is better)",Version="3">
##INFO=<ID=RPBZ,Number=1,Type=Float,Description="Mann-Whitney U-z test of Read Position Bias (closer to 0 is better)">
##INFO=<ID=MQBZ,Number=1,Type=Float,Description="Mann-Whitney U-z test of Mapping Quality Bias (closer to 0 is better)">
##INFO=<ID=BQBZ,Number=1,Type=Float,Description="Mann-Whitney U-z test of Base Quality Bias (closer to 0 is better)">
##INFO=<ID=MQSBZ,Number=1,Type=Float,Description="Mann-Whitney U-z test of Mapping Quality vs Strand Bias (closer to 0 is better)">
##INFO=<ID=SCBZ,Number=1,Type=Float,Description="Mann-Whitney U-z test of Soft-Clip Length Bias (closer to 0 is better)">
##INFO=<ID=SGB,Number=1,Type=Float,Description="Segregation based metric, http://samtools.github.io/bcftools/rd-SegBias.pdf">
##INFO=<ID=MQ0F,Number=1,Type=Float,Description="Fraction of MQ0 reads (smaller is better)">
##FORMAT=<ID=PL,Number=G,Type=Integer,Description="List of Phred-scaled genotype likelihoods">
##FORMAT=<ID=AD,Number=R,Type=Integer,Description="Allelic depths (high-quality bases)">
##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes for each ALT allele, in the same order as listed">
##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
##INFO=<ID=DP4,Number=4,Type=Integer,Description="Number of high-quality ref-forward , ref-reverse, alt-forward and alt-reverse bases">
##INFO=<ID=MQ,Number=1,Type=Integer,Description="Average mapping quality">
##bcftools_callVersion=1.22+htslib-1.22
##bcftools_callCommand=call --ploidy 1 -m -v -o vcf-files/salmonella-variants.vcf bcf-files/salmonella-pass.bcf; Date=Wed Nov 18 14:53:45 2026
#CHROM  POS     ID      REF     ALT     QUAL    FILTER  INFO    FORMAT  barcode01       barcode02       barcode03
NC_003197.2     18      .       G       T       28.1818 .       DP=3;VDB=0.0221621;SGB=-0.281359;MQSBZ=0;MQ0F=0;AC=2;AN=2;DP4=0,0,1,2;MQ=60   GT:PL:AD        1:22,0:0,1      .:0,0:0,0       1:34,0:0,2
NC_003197.2     43      .       G       A       3.4791  .       DP=5;VDB=0.02;SGB=0.366792;RPBZ=-0.816497;MQBZ=0;MQSBZ=0;BQBZ=0;SCBZ=-0.645497;MQ0F=0;AC=1;AN=3;DP4=1,2,1,1;MQ=60     GT:PL:AD        0:0,29:1,0      1:37,0:0,2      0:0,26:2,0
NC_003197.2     81      .       G       A       50.8935 .       DP=6;VDB=0.00766117;SGB=-0.374956;RPBZ=-0.5;MQBZ=0;MQSBZ=0;BQBZ=0.92582;SCBZ=0;MQ0F=0;AC=2;AN=3;DP4=1,1,1,3;MQ=60     GT:PL:AD        1:28,0:0,1      0:0,37:2,0      1:59,0:0,3
NC_003197.2     483     .       A       G       111.176 .       DP=8;VDB=0.0231369;SGB=-1.39713;MQSBZ=0;MQ0F=0;AC=3;AN=3;DP4=0,0,3,4;MQ=60    GT:PL:AD        1:47,0:0,2      1:29,0:0,2      1:63,0:0,3
NC_003197.2     507     .       C       T       66.0691 .       DP=7;VDB=0.178985;SGB=0.123302;RPBZ=1.0146;MQBZ=0;MQSBZ=0;BQBZ=1.1619;SCBZ=0.977008;MQ0F=0;AC=2;AN=3;DP4=0,2,2,3;MQ=60        GT:PL:AD        1:45,0:0,2      0:0,23:2,0      1:57,0:0,3
NC_003197.2     537     .       A       C       59.1756 .       DP=8;VDB=0.105075;SGB=-1.28032;MQSBZ=0;MQ0F=0;AC=3;AN=3;DP4=0,0,3,3;MQ=60     GT:PL:AD        1:37,0:0,2      1:44,0:0,3      1:6,0:0,1
NC_003197.2     649     .       C       T       120.176 .       DP=8;VDB=0.128485;SGB=-1.45883;MQSBZ=0;MQ0F=0;AC=3;AN=3;DP4=0,0,3,5;MQ=60     GT:PL:AD        1:38,0:0,2      1:72,0:0,3      1:38,0:0,3
NC_003197.2     684     .       T       C       36.8834 .       DP=8;VDB=0.0433485;SGB=1.07566;RPBZ=-0.458258;MQBZ=0;MQSBZ=0;BQBZ=0;SCBZ=-0.150878;MQ0F=0;AC=1;AN=3;DP4=2,3,1,2;MQ=60 GT:PL:AD        0:0,40:2,0      1:73,0:0,3      0:0,72:3,0
NC_003197.2     796     .       T       C       36.9004 .       DP=7;VDB=0.0506481;SGB=1.07566;RPBZ=0.178377;MQBZ=0;MQSBZ=0;BQBZ=1.60539;SCBZ=-0.178377;MQ0F=0;AC=1;AN=3;DP4=1,3,1,2;MQ=60    GT:PL:AD        0:0,21:1,0      1:73,0:0,3      0:0,48:3,0
NC_003197.2     810     .       C       T       9.71231 .       DP=6;VDB=0.18;SGB=0.346553;RPBZ=0;MQBZ=0;MQSBZ=0;BQBZ=1.85164;SCBZ=0.234834;MQ0F=0;AC=1;AN=3;DP4=1,3,1,1;MQ=60        GT:PL:AD        0:0,8:1,0       1:45,0:0,2      0:0,29:3,0

How many variants are there?

bcftools view -H -Ov vcf-files/salmonella-final-variants.vcf | wc -l
50899

Key Points

  • Long-read based algorithms (e.g., the minimap2 aligner used by dorado) need to be used when aligning long read data.

  • Post-alignment, standard software tools (e.g., samtools, bcftools, etc) can be used to perform variant calling.