sirselim / jetson_nanopore_sequencing

A place to collate notes and resources of our journey into porting nanopore sequencing over to accessible, portable technology.
107 stars 11 forks source link

DOI

:exclamation: DISCLAIMER: Oxford Nanopore Technologies is in no way endorsing or supporting this method of installation of MinKNOW, or the devices that it is installed on. Also, please be fore warned that by following this set up guide neither the authors or Oxford Nanopore Technology (ONT) are liable for any hardware/consumable damage or data loss that may arise.
:memo: for more detailed information please feel free to browse the wiki pages here.

UPDATE 15th Nov 2023: these notes have been updated to support the latest updates in the ONT software stack, namely the introduction of dorado as the new production basecaller. This means that it is now possible to get a fully working install for sequencing with live basecalling on Jetson Orin based devices. This has been tested and confirmed working on an Nvidia Jetson Orin AGX.


UPDATE: [21st Sept 2021] we are transitioning from the old MinIT software to the Mk1c software. This is now fully working and is the recommended software to use on Nvidia Jetson devices (and any arm based device) moving forward. The old MinIT repository will eventually be removed by ONT, while the Mk1c repo will be maintained and updated. Please follow the guide detailed in setup-guide-mk1c.txt. This is still a little rough and will benefit from community testing.


Nvidia Jetson Nanopore Sequencing

A place to collate notes and resources of our journey into porting nanopore sequencing over to accessible, portable technology - Nvidia Jetson embedded computing.

xavier-minknow

(click for video) NX1c

A sample of hardware images (for those so inclined)

...and some pictures of the final set up in action

What's this about?

A little story
This project came about as a thought that I had whilst sitting in hospital waiting for test results from my son's lumbar puncture in late 2017. It ended up taking 48 hrs to return a negative result. At this stage I knew Nanopore sequencing was cheap and fast, and (back then) doable in hours. So why couldn't we easily get this sort of technology into hospitals? Why stop there, surely we could continue in the disruptive vein that ONT are paving and really democratise next-generation sequencing, providing it to the masses, think cheap 'off-the-shelf' parts that start to make this accessible to communities and developing countries. So that's what got the ball rolling, and it's been incredible seeing and meeting all the like-minded people on this journey to where we are now.

Introducing the Nvidia Jetson embedded compute family
It wasn't until a year or so later that things really started to align. One factor was my increased involvement with nanopore data and realising the advantages of GPUs, the other was finding out about the Nvidia Jetson family. From Nvidia themselves:

"NVIDIA® Jetson™ systems provide the performance and power efficiency to run autonomous machines software, faster and with less power. Each is a complete System-on-Module (SOM), with CPU, GPU, PMIC, DRAM, and flash storage—saving development time and money. Jetson is also extensible. Just select the SOM that’s right for the application, and build the custom system around it to meet its specific needs."
(source: link)

Knowing that these affordable but powerful (think Raspberry Pi on steroids) compute units were available, had Nvidia GPUs, and actually made up the 'heart' of the ONT MinIT (Jetson TX2), it was time to start exploring. There were a lot of bumps along the way (mainly due to the lack of ARM builds of various pieces of software), but long story short we are now at a point where MinKnow with live base calling works on the majority of the Jetson family.

This has been greatly contribution to by numerous community members from around the globe, if you're interested in the in-depth development story told through gist comments check it out here - be ready for a long read! (no pun intended...)

Getting started

Chances are that if you are here you are interested in setting up your own Jetson-based system. If so please read on. First this to note is that this is still very much under construction and will be continually developing. I'm aiming to create a more robust website to support the project, but for now this README will suffice.

Where it started (paving the way)

Please feel free to look over various notes and presentations that we've put together over the last 12-18 months that directly support the current 'product':

Jetson Xavier AGX/NX specs

Here is a very quick overview of the 'compute' specs for each Xavier developer kit. Links to Nvidia provide much more detail.

Xavier AGX Dev Kit (Nvidia link)

Xavier NX Dev Kit (Nvidia link)

Parts list (Hardware)

I've been asked about part's lists, what are we using, where do we get if from? So the below is an attempt to address this. If others have confirmed working hardware please feel free to make a PR/issue or similar.

Note: in the below I have highlighted which components are confirmed as working by our team.
Warning: all prices are in New Zealand dollars unless otherwise stated. For us in New Zealand we need to import the Jetson boards, there are no local resellers.

Main components

The components listed below act as a replacement for a desktop computer or laptop to run MinKnow and interface with the ONT MinION. The benefit of the Nvidia Jetson family of 'single board computers' is in their price and performance. The key feature being the onboard GPU, which, on the Xavier models at least, is more than able to keep up with live base calling a MinION flow cell. They also act as nice little headless base call servers.

Portability components

Below is a list of what we are currently using to have a fully portable sequencing unit. This is ideally what you're wanting to add if you plan to take a MinION out into the field (from a compute perspective, wet-lab reagents and equipment are also required). There is obviously a wide range of components that can be mixed and matched here, but the below are confirmed compatible and working in our hands - see the above picture gallery for our set up.

File description

A brief description of the included files in this repo. These are included to easy the initial installation and set up of the computing environment. To understand more please look at the setup-guide.txt file. This approach is currently confirmed working on both the Jetson Xavier NX and AGX systems, being replicated on multiple devices around the globe (New Zealand, Italy, Switzerland, USA).

Available:

Incoming (these files will be added eventually):

Could be useful:

notes and caveats

optimising Guppy Base Calling on Jetson Xavier NX

General formula:

runners * chunks_per_runner * chunk_size < 100'000 * [max GPU memory in GB] * 2

Xavier NX

So the current settings I am running on the Xavier NX are:

4 * 256 * 1000 ~= 100'000 * 8 * 2 which is 1'024'000 < 1'600'000

this is leaving some overhead for the likes of the OS and MinKnow.

Running with the default settings (as above) took ~5.3 mins on a test data set. Running with the selected settings reduced this down to ~2.7 mins.

Increasing the chunks_per_runner led to the largest gains in speed.

Xavier AGX

The current 'optimal' settings I am running on the Xavier AGX are:

3 * 1024 * 1000 ~= 100'000 * 16 * 2 which is 3'072'000 < 3'200'000

This is giving me a base calling rate of ~9.43x106 samples/s.

testing Readfish

Readfish is a software tool for selective sequencing (based on the read until API), more details here.

# ensure you have a version of python3.7 with require dev libs
sudo apt install python3.7 python3.7-dev python3.7-venv
# Make a virtual environment
python3.7 -m venv readfish
. envs/readfish/bin/activate
pip install --upgrade pip
# install required packages/wheels/libs
pip install wheel
pip install Downloads/xavier_minit_build/ont_pyguppy_client_lib-4.0.15-cp37-cp37m-linux_aarch64.whl
pip install git+https://github.com/nanoporetech/read_until_api@v3.0.0
pip install git+https://github.com/LooseLab/readfish@dev
# check readfish is installed
readfish --version

Building minimap2 for arm:

git clone https://github.com/lh3/minimap2.git
cd minimap2
make arm_neon=1 aarch64=1

MinKnow / Guppy compatibility

It's a rather unspoken topic, but the issues that arise between ONT software versions are rather 'fun' to deal with. The below table is a start at documenting the known versions of MinKnow, Kingfisher UI and Guppy that play nicely together on the Jetson Xavier.

MinION Release MinKnow Core version GUI version Guppy version working
18.12.4 3.1.8 3.0.13 1.8.7
18.12.6 3.1.13 3.0.13 1.8.7
18.12.9 3.1.19 3.0.16 1.8.10
19.05.0 3.3.2 3.3.16 3.0.3
19.06.7 3.4.5 3.4.12 3.0.4
19.06.8 3.4.8 3.4.15 3.0.7
19.10.1 3.5.5 3.5.10 3.2.6
19.12.2 3.6.0 3.6.14 3.2.8
19.12.5 3.6.5 3.6.16 3.2.10
20.06.4 4.0.4 3.5.10 4.0.9
20.06.5 4.0.5 4.0.21 4.0.9
20.06.17 4.0.5 4.0.21 4.0.11, 4.0.14, 4.0.15
20.10.3 4.1.2 4.1.22 4.2.2, 4.2.3
21.02.1 4.2.5 4.2.8 4.3.4
21.06.0/21.06.2 (21.05.20 MinIT) 4.3.11 4.3.20/4.3.22 5.0.11, 5.0.12, 5.0.13, 5.0.14
21.06.13 4.3.12 4.3.28 5.0.12, 5.0.13, 5.0.14
21.10.04 4.4.3 4.4.16 5.0.17
21.11.07 4.5.4 4.5.5 5.1.12