Skip to content

Instantly share code, notes, and snippets.

@sirselim
Created August 31, 2021 08:37
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save sirselim/e9ba8e54c894c760b21942f6b24a794a to your computer and use it in GitHub Desktop.
Save sirselim/e9ba8e54c894c760b21942f6b24a794a to your computer and use it in GitHub Desktop.
Small bash script to automate MinKNOW and GPU Guppy set up on 21.04 based systems
#!/bin/bash
# author: Miles Benton
# created: 31st Aug 2021
# modified: 31st Aug 2021
#
# Notes:
# small bash script that automates installing and setting up ONT minknow and GPU
# guppy for live basecalling and GPU processing of nanopore data on Ubuntu 21.04
# based releases.
#
# Warning:
# This has currently been tested and is working on Pop!_OS 21.04. It should work
# on other 21.04 releases but has not been confirmed.
## 1.
# update system packages list
sudo apt-get update
# check for and install wget if needed
if [ $(dpkg-query -W -f='${Status}' wget 2>/dev/null | grep -c "ok installed") -eq 0 ];
then
sudo apt --yes install wget;
fi
# add the ONT key
wget -O- https://mirror.oxfordnanoportal.com/apt/ont-repo.pub | sudo apt-key add -
# add the focal 20.04 repo
echo "deb http://mirror.oxfordnanoportal.com/apt focal-stable non-free" | sudo tee /etc/apt/sources.list.d/nanoporetech.sources.list
## 2.
# write focal sources for Pop!_OS
sudo tee -a /etc/apt/sources.list.d/system-focal.sources >/dev/null <<<'X-Repolib-Name: Pop_OS System Sources
Enabled: yes
Types: deb deb-src
URIs: http://us.archive.ubuntu.com/ubuntu/
Suites: focal focal-security focal-updates focal-backports
Components: main restricted universe multiverse
X-Repolib-Default-Mirror: http://us.archive.ubuntu.com/ubuntu/'
## 3.
# write pinning rule for focal
sudo tee -a /etc/apt/preferences.d/focal-default-settings >/dev/null <<<'Package: *
Pin: release n=focal*
Pin-Priority: 10'
## 4.
# install minknow and related packages but not guppy at this stage
sudo apt --yes install \
minknow-core-minion-nc \
ont-kingfisher-ui-minion \
ont-bream4-minion \
ont-configuration-customer-minion \
ont-jwt-auth \
ont-vbz-hdf-plugin
## 5.
# install GPU guppy from ONT focal repo
sudo apt install ont-guppy
## 6.
# use ONT config_editor to ensure correct linking of guppy binaries to minknow
sudo /opt/ont/minknow/bin/config_editor --conf application \
--filename /opt/ont/minknow/conf/app_conf \
--set guppy.server_executable="/opt/ont/guppy/bin/guppy_basecall_server" \
--set guppy.client_executable="/opt/ont/guppy/bin/guppy_basecall_client" \
--set guppy.gpu_calling=1 \
--set guppy.num_threads=16 \
--set guppy.ipc_threads=2
## 7.
# restart the minknow.service after making modifications
sudo systemctl restart minknow.service
## 8.
# create the guppyd.service at the correct location
sudo tee -a /lib/systemd/system/guppyd.service >/dev/null <<<'[Unit]
Description=Service to manage the guppy basecall server.
Documentation=https://community.nanoporetech.com/protocols/Guppy-protocol/v/GPB_2003_v1_revQ_14Dec2018
[Service]
Type=simple
ExecStart=/opt/ont/guppy/bin/guppy_basecall_server --log_path /var/log/guppy --config dna_r9.4.1_450bps_fast.cfg --port 5555 -x cuda:all
Restart=always
User=root
MemoryLimit=8G
MemoryHigh=8G
CPUQuota=200%
[Install]
Alias=guppyd.service
WantedBy=multi-user.target'
## 9.
# enable guppyd.service to start/load automatically
sudo systemctl enable guppyd.service
# restart the guppyd.service after making modifications
sudo systemctl restart guppyd.service
# completed
echo -e "... installation and setup finished ..."
##/END
@sirselim
Copy link
Author

Small bash script to automate MinKNOW and GPU Guppy set up on 21.04 based systems

This is an attempt to automate the process of setting up MinKNOW with GPU basecalling on systems running 21.04 into a single bash script that can be run (with sudo) to make set up easier and faster.

There is a link to documentation that steps through this process in more detail here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment