Python bindings for the GuppyClient library.
Project description
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.1.4-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a74560aa8b35c885ffa24fab10bc30daf3b777cd6503468a846b5a75f4c1d667 |
|
MD5 | 44085d4f9bc0bc03bd67f3746c083b12 |
|
BLAKE2b-256 | cc9fd7f85c6b6fc730e806bc222ee0b982afb4eaaaf241828903f6b8bdd0451b |
Hashes for ont_pyguppy_client_lib-7.1.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8aecb7737998fefc468f19c2790eefa54487d2fed12edd7198cce3baa7ffa5fb |
|
MD5 | 0419e3fa19f0d807e68238f20d745fd0 |
|
BLAKE2b-256 | c37d8ad4f390241d3e87b96eb559390174d8c89e11afefeb4804f4aa99f547cd |
Hashes for ont_pyguppy_client_lib-7.1.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed1799dfd2a5dce811232a72fbb3122fc7ad2d17d752946ca9c0df1408115910 |
|
MD5 | 91833cd671cfcd56cdb2b3f65dea63ef |
|
BLAKE2b-256 | 3ab049b88f3636013f60f1f9a95fd279358ae40953b37033bf17159ece93d046 |
Hashes for ont_pyguppy_client_lib-7.1.4-cp311-cp311-macosx_12_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e8cbe2a477f0b0f4ec06af01ff1d262b6bca0adaaa355cf66168536f1818956f |
|
MD5 | cf080f672aa972c7d92e69124a5d5b62 |
|
BLAKE2b-256 | b96ae3a78bc09b9ec497cd2574d3e848d47c80e697f88ec240de90359e293512 |
Hashes for ont_pyguppy_client_lib-7.1.4-cp311-cp311-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f48813f1de174cda7c7f274a69989afdd2db8d242f62363d45b6f63a998f84fd |
|
MD5 | 77b9b343d5ba1b2190e941974d58af36 |
|
BLAKE2b-256 | 1418c3ea53ae420d1fdcb1ce293e6f77aa6b4423eea6b9ccce706796b973b0e5 |
Hashes for ont_pyguppy_client_lib-7.1.4-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 806de032865754acbca3299f6c38d170eb84d03e6f3617607ff77ed0555c6e28 |
|
MD5 | a05e13c5f8947dfa8e736c98c369ada3 |
|
BLAKE2b-256 | 202614465b44df2cf1a0c11b017300b2e91b4a94819d26b9004e4d8c5bfb536f |
Hashes for ont_pyguppy_client_lib-7.1.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dbb52793db4b30bc08bb67c8422a8c8069d83bce083a88c17ec095ed4a8c4655 |
|
MD5 | b83d1fa86c1ea9bc8e1ffd8ff07d8983 |
|
BLAKE2b-256 | ec0af90f89cd93581c24dbe2ff0f874cdc0fac2271c337b4bbfb30d96b814760 |
Hashes for ont_pyguppy_client_lib-7.1.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4578bc16db8f6770520e3a04bc428abec68ad6690b2f0d4c8c1bd6d60471f120 |
|
MD5 | 19c12b3f6b23767ce0a485dc9e9d86f4 |
|
BLAKE2b-256 | cdbaaa33b2144c670bb7a531392827654f0429998f8ea7e568def75d889b01f0 |
Hashes for ont_pyguppy_client_lib-7.1.4-cp310-cp310-macosx_12_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3781579890a7e9832fd897a8962907c273549833ff6a0d39c15dcef8e4ba177b |
|
MD5 | 236506f3d5569c7194be46f3125fb481 |
|
BLAKE2b-256 | 89ab3036bd16a60756e7ad2746e9a9789b96db29e2cd42f69bb39d1e30951b22 |
Hashes for ont_pyguppy_client_lib-7.1.4-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 180381e9ce0a4760a81417ddd20fb1d7874c64987fcf567b2e4f8e57cf11bac9 |
|
MD5 | 458daf465dfce0fa416234b414f6007d |
|
BLAKE2b-256 | d3615c9d028099a2990672844211fb480a83e1f8423a29a1c610c4908e3f346a |
Hashes for ont_pyguppy_client_lib-7.1.4-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | da526fe6e0dfece2e18e88ae276441282bd9e7e4e8450e2096c6e8ba2224a463 |
|
MD5 | 0cecd678a41c23e3c214f66a94901f46 |
|
BLAKE2b-256 | 18d1d22a017c2bd5d10a69c3d1126d01974460e26232f5c6c73754c78009edb1 |
Hashes for ont_pyguppy_client_lib-7.1.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 039c828d98e41f634da5ce49a2b6e073160a524131f2c351ac8fbb55a1ca8cf0 |
|
MD5 | 3657f95cae1d604c22dc408c4553345e |
|
BLAKE2b-256 | 49e7993cb2331adc0ce3364ba361bb894669098cb58d383bcffd3f08d23b1519 |
Hashes for ont_pyguppy_client_lib-7.1.4-cp39-cp39-macosx_12_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c89394d6fb6146718af74c839d92db5a0ec8963665eb35a1223fcea0425149b5 |
|
MD5 | 7c64563db04bc513347e31cad937f96e |
|
BLAKE2b-256 | e60337a5567eaec4f0356896fa8078de46f5b1953605d500bf53b5c85e0eae84 |
Hashes for ont_pyguppy_client_lib-7.1.4-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d6d94622644af2cabdf787d73e7d9ca13a970b8f86cabe2520dc65ab713dd631 |
|
MD5 | a536e866792222b8a54ba153f8e865f1 |
|
BLAKE2b-256 | d1e85652716ea8b870a38b177226adcffefd1e88e21e813f7c4d584c78536763 |
Hashes for ont_pyguppy_client_lib-7.1.4-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e50b89ca6454431d484a872fdbc89fb7f8a96d283300dcc9deb3cdcc72f1578 |
|
MD5 | ba8a05f04c00852abecea3f93caf3980 |
|
BLAKE2b-256 | 311c892a401a2a12454335e6b16f7d5587cbbe130b91ae0226cc540503ee2232 |
Hashes for ont_pyguppy_client_lib-7.1.4-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e94ab9ae73f7a0d975f9d060307488ea632d321bb8dfc562ad347414aaebdf0 |
|
MD5 | bfe283c5b3112eb3e243db3f0c386232 |
|
BLAKE2b-256 | aacd9f29baf1eb75b0ab35e98bbeb7bb8a146efa640c74b58b25a2f9c7d09def |
Hashes for ont_pyguppy_client_lib-7.1.4-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ef8a193a3c88ab94daba3bda27b0e3183375d45587dab8d108dd265a58baf55 |
|
MD5 | 8ecbe1efc5b496016044e36be4a50d58 |
|
BLAKE2b-256 | 13cbf3a37660bb951b2a22f66caef742922a1e86f59cc0ff657fd39541a865bd |
Hashes for ont_pyguppy_client_lib-7.1.4-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f21746d292a72d9ab10a97f1f1a781c414210ef52636786c78effd3d4be3c5f |
|
MD5 | fa048347518156a6fb07fe0249c856b0 |
|
BLAKE2b-256 | 444abd1bab4462771451ad2ef8eec9b734ecd6f648435b96076552002efcfd05 |
Hashes for ont_pyguppy_client_lib-7.1.4-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7de1d2539e29ccc6a495c2d744cd5e04ce0321cd9027c0f004d4ad51d137aab1 |
|
MD5 | a6cd1e7447b45d42de0a905d98bc559a |
|
BLAKE2b-256 | 461162201c6f4ad8c94ba54245fd1ce59bc967056b8f1e72494e51e40dd115c8 |
Hashes for ont_pyguppy_client_lib-7.1.4-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44adc014cec1bbd4cd9545f98ccf7fe26abce91e197ef42a43cc5651f63f6ce2 |
|
MD5 | 6df06f4d49f6f06a4b78a023ec00a9ce |
|
BLAKE2b-256 | 11cb618b4151860091f1422d81d1912b57c48056e06997adc92d273572dd611f |