ont-pybasecall-client-lib
ont-pybasecall-client-lib provides python bindings for connecting to a Dorado basecall server. It allows you to interact with the server to do anything you could normally do using the ont_basecall_client. This includes:
Basecalling
Barcoding / demultiplexing
Alignment
For example:
>>> from pybasecall_client_lib.pyclient import PyBasecallClient
>>> client = PyBasecallClient(
"127.0.0.1:5555",
"dna_r10.4.1_e8.2_400bps_5khz_fast",
align_ref="/path/to/index.mmi",
bed_file="/path/to/targets.bed"
)
>>> client.connect()
Getting started
ont-pybasecall-client-lib is available on PyPI and may be installed via pip:
pip install ont-pybasecall-client-lib
ont-pybasecall-client-lib requires an instance of the Dorado basecall server is running. ont-dorado-server may be obtained from the Oxford Nanopore Community
The version of ont-pybasecall-client-lib should exactly match the version of ont-dorado-server being used. You can find your ont-dorado-server version like this:
$ <location of dorado_basecall_server>/dorado_basecall_server --version
For example, this Dorado basecall server is version 7.1.1:
$ ./ont-dorado-server/bin/dorado_basecall_server --version : Dorado Basecall Service Software, (C) Oxford Nanopore Technologies, Limited. Version 7.1.1+effbaf8, client-server API version 16.0.0
Install a specific version of ont-pybasecall-client-lib like this:
pip install ont-pybasecall-client-lib==<version>
Dependencies
ont-pybasecall-client-lib requires numpy in order to run. In order to use included helper functions for reading data from pod5 files it is also necessary to manually install pod5:
pip install pod5
Documentation and help
Information on the methods available may be viewed through Python’s help command::
>>> from pybasecall_client_lib import pyclient >>> help(pyclient) >>> from pybasecall_client_lib import client_lib >>> help(client_lib)
Interface / Examples
ont-pybasecall-client-lib comprises three Python modules:
pyclient A user-friendly wrapper around client_lib. This is what you should use to interact with a Dorado basecall server.
client_lib A compiled library which provides direct Python bindings to Dorado’s C++ BasecallClient API.
helper_functions A set of functions for running a Dorado basecall server and loading reads from pod5 files.
Starting a basecall server
There must be a Dorado basecall server running in order to communicate with it. On most Oxford Nanopore devices a basecall server is always running on port 5555. On other devices, or if you want to run a separate basecall server, you must start one yourself:
from pybasecall_client_lib import helper_functions
# A basecall server requires:
# * A location to put log files (on your PC)
# * A port to run on
server_args = ["--log_path", "/home/myuser/basecall_server_logs",
"--port", 5556]
# The second argument is the directory where the
# dorado_basecall_server executable is found. Update this as
# appropriate.
helper_functions.run_server(server_args, "/home/myuser/ont-dorado/bin")
See the the DOCUMENTATION.md file in the ont-dorado-server archive for more information on server arguments.
Basecall and align using PyBasecallClient
from pybasecall_client_lib.pyclient import PyBasecallClient
client = PyBasecallClient(
"127.0.0.1:5555",
"dna_r10.4.1_e8.2_400bps_5khz_fast",
align_ref = "/path/to/align_ref.fasta",
bed_file = "/path/to/bed_file.bed"
)
client.connect()
It is also possible to start the PyBasecallClient using a dorado model set, e.g:
from pybasecall_client_lib.pyclient import PyBasecallClient
client = PyBasecallClient(
"127.0.0.1:5555",
"dna_r10.4.1_e8.2_400bps_hac@v4.3.0|dna_r10.4.1_e8.2_400bps_hac@v4.3.0_5mC_5hmC@v1|",
)
client.connect()
Note that the helper_functions module requires that pod5 is installed.:
from pybasecall_client_lib.helper_functions import basecall_with_pybasecall_client
# Using the client generated in the previous example
called_reads = basecall_with_pybasecall_client(
caller,
"/path/to/input_folder"
)
for read in called_reads:
read_id = read['metadata']['read_id']
alignment_genome = read['metadata']['alignment_genome']
sequence = read['datasets']['sequence']
print(f"{read_id} sequence length is {len(sequence)}"
f"alignment_genome is {alignment_genome}")
Basecall and get states, moves and modbases using BasecallClient
In order to retrieve the movement dataset, the move_enabled option must be set to True. NOTE: You shouldn’t turn on move_enabled if you don’t need it, because it generates a LOT of extra output data so it can hurt performance.
options = {'priority': PyBasecallClient.high_priority,
'client_name': "test_client",
'move_enabled': True }
client = PyBasecallClient(port_path, 'dna_r10.4.1_e8.2_400bps_5khz_modbases_5hmc_5mc_cg_hac')
result = client.set_params(options)
result = client.connect()
called_reads = basecall_with_pybasecall_client(client, input_path)
for read in called_reads:
base_mod_context = read['metadata']['base_mod_context']
base_mod_alphabet = read['metadata']['base_mod_alphabet']
sequence = read['datasets']['sequence']
movement = read['datasets']['movement']
base_mod_probs = read['datasets']['base_mod_probs']
print(f"{read_id} sequence length is {len(sequence)}, "
f"base_mod_context is {base_mod_context}, base_mod_alphabet is {base_mod_alphabet}, "
f"movement size is {movement.shape}, base_mod_probs size is {base_mod_probs.shape}")
Glossary of Terms:
Dorado - Oxford Nanopore Technologies’ production basecaller, which translates electrical signals measured from nanopores into DNA or RNA bases.
Pod5 - a file format for storing nanopore dna data in an easily accessible way.
Metadata
Release files for ont-pybasecall-client-lib 7.13.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 46.8 MB
Release files / ont_pybasecall_client_lib-7.13.6-cp313-cp313-win_amd64.whl
| Download URL | ont_pybasecall_client_lib-7.13.6-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
c862bdaf917e2f7eff96363dc705634dd509d6da702ca76091895083e8950c96
|
|
BLAKE2b-256 checksum How to use checksums |
047ba64e27d5b2c182ba1e789840742dbcc045128a93f2615adbb991fd5e95ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / ont_pybasecall_client_lib-7.13.6-cp313-cp313-manylinux_2_28_aarch64.whl
| Download URL | ont_pybasecall_client_lib-7.13.6-cp313-cp313-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 2.4 MB |
| Tags | CPython 3.13 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
f171446519a8d79a6689ded424e95aaea69321d4e1a3d518caacace0760a071d
|
|
BLAKE2b-256 checksum How to use checksums |
ed78a78d7a578ac7c4a166f9631636d3ac3ceafa0a6df622df8a5b93fdbb843b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / ont_pybasecall_client_lib-7.13.6-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | ont_pybasecall_client_lib-7.13.6-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.5 MB |
| Tags | CPython 3.13 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
4032a8c8540873ba8219627e4328c7231c091a41a83b64fdb39cf9818e2f414e
|
|
BLAKE2b-256 checksum How to use checksums |
34a841dd4a5f86a33013a7eab140676fb50b65bf217033082a3719af1fb74a71
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / ont_pybasecall_client_lib-7.13.6-cp313-cp313-macosx_14_0_arm64.whl
| Download URL | ont_pybasecall_client_lib-7.13.6-cp313-cp313-macosx_14_0_arm64.whl |
|---|---|
| Size | 3.6 MB |
| Tags | CPython 3.13 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
a923c97383661905fca75bcb5b7dc7833b99629940a026db38b9bd28014fc09f
|
|
BLAKE2b-256 checksum How to use checksums |
7dfa3e35e87d23346fc7876876141ad35f503bb64a8ff93051d81de5f738dbac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / ont_pybasecall_client_lib-7.13.6-cp312-cp312-win_amd64.whl
| Download URL | ont_pybasecall_client_lib-7.13.6-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
4d99e74d9542095705b53dd944f3150484584370362282abf872923a4b94247b
|
|
BLAKE2b-256 checksum How to use checksums |
4462f6074eec3498878a5928a8a286a2015961f741e43049cd8383b2df3f23c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / ont_pybasecall_client_lib-7.13.6-cp312-cp312-manylinux_2_28_aarch64.whl
| Download URL | ont_pybasecall_client_lib-7.13.6-cp312-cp312-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 2.4 MB |
| Tags | CPython 3.12 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
796d1071bfb74663a01ca2386751563f1cf5b3c9e62065ce32865097c38c840d
|
|
BLAKE2b-256 checksum How to use checksums |
85b27a756e27be1a4637794b65e8a4cc5bb67a31c5706c71c854fd711d8cdb6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / ont_pybasecall_client_lib-7.13.6-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | ont_pybasecall_client_lib-7.13.6-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.5 MB |
| Tags | CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
5230d117731f91d7530863af64f140f666a38f32e1726dd7fa1a77f0ce9547dc
|
|
BLAKE2b-256 checksum How to use checksums |
17f5471e48b7826c6168669a977b2dd6ff3f09b70a995fcb8a009fe1c7282f13
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / ont_pybasecall_client_lib-7.13.6-cp312-cp312-macosx_14_0_arm64.whl
| Download URL | ont_pybasecall_client_lib-7.13.6-cp312-cp312-macosx_14_0_arm64.whl |
|---|---|
| Size | 3.6 MB |
| Tags | CPython 3.12 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
935cdd82ce22293137607b1a92c4046fdcb301c5f84b02e00dfdc59649c7d270
|
|
BLAKE2b-256 checksum How to use checksums |
a5e70eb67634401deefa252fbb4d398705f667e81f9e8af39b0a43d1024f4031
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / ont_pybasecall_client_lib-7.13.6-cp311-cp311-win_amd64.whl
| Download URL | ont_pybasecall_client_lib-7.13.6-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
4984d27b6a8062851844c12eb136579642d5e5241ac48c5bba972bd8bf183353
|
|
BLAKE2b-256 checksum How to use checksums |
622907857529ee6034391cc7767052634a72b6ae7db2b9578a0aa7b6cd3da487
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / ont_pybasecall_client_lib-7.13.6-cp311-cp311-manylinux_2_28_aarch64.whl
| Download URL | ont_pybasecall_client_lib-7.13.6-cp311-cp311-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 2.4 MB |
| Tags | CPython 3.11 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
379480d197afa6ae7ae11bc6da914538df9d229bc3e599902282ecf9a81443ad
|
|
BLAKE2b-256 checksum How to use checksums |
5d7f3b17a5bca63441bd566ba9b488d509ab8e3648783ca380c6da9128644793
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / ont_pybasecall_client_lib-7.13.6-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | ont_pybasecall_client_lib-7.13.6-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.5 MB |
| Tags | CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
05de8be02def39e85729c1a459f99da72247da78094e2c2365741548e07d17f7
|
|
BLAKE2b-256 checksum How to use checksums |
54e57f855a2d2b7774885e5627ff69c506a610be3d6b599459ad77af6aca3570
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / ont_pybasecall_client_lib-7.13.6-cp311-cp311-macosx_14_0_arm64.whl
| Download URL | ont_pybasecall_client_lib-7.13.6-cp311-cp311-macosx_14_0_arm64.whl |
|---|---|
| Size | 3.6 MB |
| Tags | CPython 3.11 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
0b057d721a8a2b99ffb60b78f41ebbadd889f3813a89e7cbc9a08890844ad21e
|
|
BLAKE2b-256 checksum How to use checksums |
78ed5fefe1634edd472673ec806ed32bfab9346daba7693e1e734f1d51dc62f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / ont_pybasecall_client_lib-7.13.6-cp310-cp310-win_amd64.whl
| Download URL | ont_pybasecall_client_lib-7.13.6-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
e7dddecfb7c3a1a343b4808e7b6eb91d7f1458ad9094b8ff555d4d6c370e9f4c
|
|
BLAKE2b-256 checksum How to use checksums |
62483e7afaf5a4f056998685c32949126cf38e384f392b3495281c7cb4f03108
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / ont_pybasecall_client_lib-7.13.6-cp310-cp310-manylinux_2_28_aarch64.whl
| Download URL | ont_pybasecall_client_lib-7.13.6-cp310-cp310-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 2.4 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
6f3d46c66bbfed603adcc153589f09b3386508e1b123d0c425bdc92bc650bf9b
|
|
BLAKE2b-256 checksum How to use checksums |
8754f32db1803d7627c90ba273b49700910d6446dd2f95716b23f4e6674ab140
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / ont_pybasecall_client_lib-7.13.6-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | ont_pybasecall_client_lib-7.13.6-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.5 MB |
| Tags | CPython 3.10 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
d1dda524196ff8462cece6d3242d31da6c57138efa817618aa0a15c5843f79b3
|
|
BLAKE2b-256 checksum How to use checksums |
ef4d9fa709b26925463f6f965b40468e4edbd8cb4836bed750383c0a501fa4c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / ont_pybasecall_client_lib-7.13.6-cp310-cp310-macosx_14_0_arm64.whl
| Download URL | ont_pybasecall_client_lib-7.13.6-cp310-cp310-macosx_14_0_arm64.whl |
|---|---|
| Size | 3.6 MB |
| Tags | CPython 3.10 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
72aeb9dc326fe12a1b56c061f89e25b78cba8ce987ca2f1f36223700cf177fb7
|
|
BLAKE2b-256 checksum How to use checksums |
91f176c7fbd735c7afd500b51f8bd0c666a6a3148a3fea979f00f6a65d16a636
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / ont_pybasecall_client_lib-7.13.6-cp39-cp39-win_amd64.whl
| Download URL | ont_pybasecall_client_lib-7.13.6-cp39-cp39-win_amd64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.9 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
9f436e19b4790b613f52e6328316f8494b6dd846082903b5135e67f055890d45
|
|
BLAKE2b-256 checksum How to use checksums |
f91ada5fc44850ec086f4455df74f51087a039b7bf82b68610ebe71c8671f1bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / ont_pybasecall_client_lib-7.13.6-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | ont_pybasecall_client_lib-7.13.6-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 2.5 MB |
| Tags | CPython 3.9 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
5ffe26ed73472b62babe1b6959873730691f5ff4fc580fa4c906b78d33b391c2
|
|
BLAKE2b-256 checksum How to use checksums |
e7a767ed67ee91cb63258a8dd369e40a54cda6d3b45c35e7c64caa567b260973
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / ont_pybasecall_client_lib-7.13.6-cp39-cp39-macosx_14_0_arm64.whl
| Download URL | ont_pybasecall_client_lib-7.13.6-cp39-cp39-macosx_14_0_arm64.whl |
|---|---|
| Size | 3.6 MB |
| Tags | CPython 3.9 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
383b290d77585b00cd643729bcc8bb595debc82655778722e713a6d268f4c120
|
|
BLAKE2b-256 checksum How to use checksums |
fa8b9b145be48c7ab929fd7aa654096ce04fa6e722224c8e0c0aaa3c1d7942da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|