Python bindings for the GuppyClient library.
Project description
Important notice
ont-pyguppy-client-lib has been renamed to ont-pybasecall-client-lib. This project will no longer be updated but is provided in order to support basecall servers up to version 7.2.x. For python bindings to dorado_basecall_server 7.3.0 onwards, please use ont-pybasecall-client-lib.
ont-pyguppy-client-lib
ont-pyguppy-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 pyguppy_client_lib.pyclient import PyGuppyClient >>> client = PyGuppyClient( "127.0.0.1:5555", "dna_r9.4.1_450bps_fast", align_ref="/path/to/index.mmi", bed_file="/path/to/targets.bed" ) >>> client.connect()
Getting started
ont-pyguppy-client-lib is available on PyPI and may be installed via pip:
pip install ont-pyguppy-client-lib
ont-pyguppy-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-pyguppy-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-pyguppy-client-lib like this:
pip install ont-pyguppy-client-lib==<version>
Dependencies
ont-pyguppy-client-lib requires numpy in order to run. In order to use included helper functions for reading data from fast5 and/or pod5 files it is also necessary to manually install ont-fast5-api and/or pod5:
pip install ont-fast5-api pod5
Documentation and help
Information on the methods available may be viewed through Python’s help command::
>>> from pyguppy_client_lib import pyclient >>> help(pyclient) >>> from pyguppy_client_lib import client_lib >>> help(client_lib)
Interface / Examples
ont-pyguppy-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++ GuppyClient API.
helper_functions A set of functions for running a Dorado basecall server and loading reads from fast5 and/or 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 pyguppy_client_lib import helper_functions # A basecall server requires: # * A location to put log files (on your PC) # * An initial config file to load # * A port to run on server_args = ["--log_path", "/home/myuser/guppy_server_logs", "--config", "dna_r9.4.1_450bps_fast.cfg", "--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 PyGuppyClient
from pyguppy_client_lib.pyclient import PyGuppyClient client = PyGuppyClient( "127.0.0.1:5555", "dna_r9.4.1_450bps_fast", align_ref = "/path/to/align_ref.fasta", bed_file = "/path/to/bed_file.bed" ) client.connect()
Note that the helper_functions module requires that ont-fast5-api and/or pod5 is installed.:
from pyguppy_client_lib.helper_functions import basecall_with_pyguppy # Using the client generated in the previous example called_reads = basecall_with_pyguppy( 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 GuppyClient
In order to retrieve the movement dataset, the move_and_trace_enabled option must be set to True; analogously, for the state_data one, post_out must be turned on. NOTE: You shouldn’t turn on post_out if you don’t need the states, because it generates a LOT of extra output data so it can really hurt performance. Likewise with move_and_trace_enabled, although that’s much less expensive.
options = {'priority': GuppyClient.high_priority, 'client_name': "test_client", 'move_and_trace_enabled': True, 'post_out':True } client = GuppyClient(port_path, 'dna_r9.4.1_e8.1_modbases_5mc_cg_fast') result = client.set_params(options) result = client.connect() called_reads = basecall_with_pyguppy(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'] state_data = read['datasets']['state_data'] 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}, state_data size is {state_data.shape}, " f"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.
Fast5 - an implementation of the HDF5 file format, with specific data schemas for Oxford Nanopore Technologies sequencing data.
Pod5 - a file format for storing nanopore dna data in an easily accessible way.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for ont_pyguppy_client_lib-7.2.15-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26fecf4f64719d7c3d88ed7507bff747fcbd108bd97148570afbe400d26f0f6f |
|
MD5 | edf39511299a8bd067f8fe5c9f3eaf69 |
|
BLAKE2b-256 | 073f1c966965868ac404f7fae22241fa5c68363c1db5ac0bbce18385c6c72db4 |
Hashes for ont_pyguppy_client_lib-7.2.15-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61699eb122e2c12e97b6f2e22f79b4b26c44cdec640fe0d72765ccfd35e0c09b |
|
MD5 | e6ca2f8ed592b633701644b8c48a86fb |
|
BLAKE2b-256 | b28109b21c8c9db1edf57b39a83f7b6d5ea0e3f2fc615d7036256f47454e51e9 |
Hashes for ont_pyguppy_client_lib-7.2.15-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d4c0056726003ce43ce57ee57d96c5a21e104b981242580c3e5250d981f6707 |
|
MD5 | cef4fd96e661aba6bfb36b24f183f7d9 |
|
BLAKE2b-256 | ca6af5793155309a0c0e8d98b27c4018587d41543ac081eaf7de390416e31b9c |
Hashes for ont_pyguppy_client_lib-7.2.15-cp311-cp311-macosx_12_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 257ed84bf0515ed168823c8ca2af8caca87084bf710f6326705e508f5baedcde |
|
MD5 | 74020cc540d73bc694adbe1145cd27b9 |
|
BLAKE2b-256 | 52ad4ff80ae9ae404364286565df2effa2e37a9791a252bf6ca1a9a43aba8b23 |
Hashes for ont_pyguppy_client_lib-7.2.15-cp311-cp311-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94e6cb7afaa30a2843299f34d86ef5b7f0dd9b99f7fb79388b7be64cc8c7a45d |
|
MD5 | e4b2030721a74478a4f935ce38a75122 |
|
BLAKE2b-256 | 7dc3b2a6255a75248f72f3b54df06f051789a59f72fb8c07cccd3b3bd7b1ae44 |
Hashes for ont_pyguppy_client_lib-7.2.15-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0dfd470410ebcc4a9fcc7ce3f8fa0a6dad42168fa5d8de259b0bddf251848703 |
|
MD5 | c7f44cb99e964b28e66f035b6dda79ec |
|
BLAKE2b-256 | 81c8246f1dd97911ea89b1a02ea4976e59a14524f291f855dfbfa4aba7005b99 |
Hashes for ont_pyguppy_client_lib-7.2.15-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 027282c6d3255be59529ad599d632df37529f80ecca136035cbdb6a92aa43104 |
|
MD5 | e45c6be102aab25bf95a61c50483cf51 |
|
BLAKE2b-256 | 9471afe1768334199cd5544eac1cbb8f06ec9bdfd7289ef9bb2be008e4b54799 |
Hashes for ont_pyguppy_client_lib-7.2.15-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e45cdaea31a9ca76e27662093f5ec5dce2b1897df7617d98ff09b90f5b5c93d |
|
MD5 | 5ec40fdb6818d3abdfcd640af5184f72 |
|
BLAKE2b-256 | c852a7dceaf40588ad8a4187901043dabc790894299e5b856c6b9435d76da8ab |
Hashes for ont_pyguppy_client_lib-7.2.15-cp310-cp310-macosx_12_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff8bce9fd2767eaf14d40d198eaeb48113f7bdd7d3292212acd38ba90589d448 |
|
MD5 | e8a055ee0d152dad630ba0fa9cfce296 |
|
BLAKE2b-256 | cf1214205c1fa065c4488e2e067575d70fc6c40e9152a353217ccde4870230ff |
Hashes for ont_pyguppy_client_lib-7.2.15-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e345d28aec74639f4e5247c0a3f543858f1858f444ad641b197c0429c3727e3 |
|
MD5 | d69592d16b339567399324b93c1d06b6 |
|
BLAKE2b-256 | 7179ebbb800a364834986ec40a24eb3e51eec62ef4cdb2e65d8e040189456d21 |
Hashes for ont_pyguppy_client_lib-7.2.15-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ea5bb8e59d39d0c8fda0591a915f3dc6b09737672c3e16bad04e382f49dea08 |
|
MD5 | 4b523ced75b3e8e7e3e300f169bdc0dd |
|
BLAKE2b-256 | 985530164175d7876f1bcc4b330f20ce8332698414dc99bf383579be3a65dafa |
Hashes for ont_pyguppy_client_lib-7.2.15-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c8de5f53b4934414320205cf913fe9655e9e28597b66b77ad810c0fdd03910ff |
|
MD5 | c425aac433b9bbcccf42eb869727705d |
|
BLAKE2b-256 | c96566c1e675df3c1bc4c39b00cab122aac1e3c6c959fa2b7166795d4c03fccf |
Hashes for ont_pyguppy_client_lib-7.2.15-cp39-cp39-macosx_12_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36e2646773e3dc302fb7bd6004911709961854179b7182f1c2af494d091d86e4 |
|
MD5 | 96af9a0091cf86602b009d4350403fba |
|
BLAKE2b-256 | 5318508a461ddb51b4546105a19e5711add37b11081fcb559270810cea980871 |
Hashes for ont_pyguppy_client_lib-7.2.15-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af5e24d4b5b396647b43a1ef8481d40137c5183b840d8d595e90661b56692385 |
|
MD5 | d1a1aedf15b5686273052dd993b5dd51 |
|
BLAKE2b-256 | b0f69c906ce3bb6086bccd07b8bb0ed2acf3e123854b55573f8b1466296f46f2 |
Hashes for ont_pyguppy_client_lib-7.2.15-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab7b147a8c7ce8705fd7503805e4380af3e369a903115d0ebb834a7b66712687 |
|
MD5 | 61b0d79688053b736382ff0c6220bede |
|
BLAKE2b-256 | f4331d90b4f6055821420d4e6c869998c2355bea642eef8ce47006a6745729ab |
Hashes for ont_pyguppy_client_lib-7.2.15-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68ea9a62aa88cb029394fe550b2f94705c6b9808e3215b8fb085abd155a563c7 |
|
MD5 | 9c9119739f9a82e27af611ff4cbe6171 |
|
BLAKE2b-256 | ed0df352ab843164c7bb7eb49d5a244674987712b4bbef7ea9c9d13198964885 |
Hashes for ont_pyguppy_client_lib-7.2.15-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | edc40401bee037dc23eae974f5489674edb3727660cf4d0b1f8801ac9f42c22b |
|
MD5 | e8d28cc31cb0eb998df197779f227c96 |
|
BLAKE2b-256 | 2fc43c23da88516cf526e5fbd31b2b92218fad943cc2ca87f33b5205dc1388a5 |
Hashes for ont_pyguppy_client_lib-7.2.15-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 206970f41a3d3e359556496ab5023ddff1cd9493d11333aa07a2f28869f56a57 |
|
MD5 | 7819d1c59aca04aea35ef2d62a9f908a |
|
BLAKE2b-256 | f202fb36c2c8b7db1ca266356a5068e521005b968ca4815c89a857078e55dade |
Hashes for ont_pyguppy_client_lib-7.2.15-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5ed4243264ff0c8efecf03c7835c6350463909360211b4f24ca5fd10f3e5a35 |
|
MD5 | cdb1961c0f62416c720fc5516155cea2 |
|
BLAKE2b-256 | d8b00a0fd884c869a13619d35dbb38756a257069256962baf32b527e69f5b8ab |
Hashes for ont_pyguppy_client_lib-7.2.15-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f307e22915133da628d17f0c0be5493e05f16e0a8b4fdcfb1b2d755ee866203 |
|
MD5 | 518f1e97962d6425cea75ad100ead517 |
|
BLAKE2b-256 | 5772012776babfd2e87e30fededb577373988fee0b61ea5d7f4ce55c807dc78d |