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.2.13-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94494e5d95ae1de94c9c84debb5e1dbbf1c052f76d1bcce4604958bcbf9a14a9 |
|
MD5 | 5693c1a55ff2bac0706144975b1f232f |
|
BLAKE2b-256 | 21bca2d61cbf8392ef9bce3fdef2471a7965eaedfe6d3bf51b102377c11a9f5c |
Hashes for ont_pyguppy_client_lib-7.2.13-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 63f38299dcb44bccac659e6c0e560f5fd655b04a6179517b4ec73946b91c328d |
|
MD5 | 4d3890100d7bb0ce1a7fa655b953f00b |
|
BLAKE2b-256 | 4d0b85088e359ad93ea391a698cd95846686dc34a8b444ac0369ce5432427288 |
Hashes for ont_pyguppy_client_lib-7.2.13-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d06e65988c8a2214a43312919a55999d7e2bf83ef6e993faecfda72f932a059c |
|
MD5 | 741458c7781a762009c10a1a2192e242 |
|
BLAKE2b-256 | 6b914a14ff5fb7f9c2441e8712ebdf782c9ab13c13fb1322c1f47f7058170a74 |
Hashes for ont_pyguppy_client_lib-7.2.13-cp311-cp311-macosx_12_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c850f6883672bfb4d2d70a4b8c821e008c1f6adbc05e8c0d8770248abe8b5b30 |
|
MD5 | 2ada9a2766b168ae586722bc9c16636d |
|
BLAKE2b-256 | 76da1eb6e037e66c7e7b8557ace8c22b86c37fe02614805442b1ec7dd84a0e1f |
Hashes for ont_pyguppy_client_lib-7.2.13-cp311-cp311-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dbeab5a2b732fbddabb94460bd1dbb8a0e47f709daf3762fdd14800a479158d9 |
|
MD5 | 568a4bcb69d7146ed2188be19189b63e |
|
BLAKE2b-256 | 33c16c0b091632ce19152ce79a56a2bae5cee7553876a2ef33e5d94c879ef29d |
Hashes for ont_pyguppy_client_lib-7.2.13-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec18835c5c465e5b013d00131de9c397d8335dcb4b4bb74f929194e2c6721e3d |
|
MD5 | c4eda0557f91a0401b1b13a463170f5b |
|
BLAKE2b-256 | ce049e06f1251f748931c19a67f23cbffc184b3caf95ed22fc05c6ae966ab655 |
Hashes for ont_pyguppy_client_lib-7.2.13-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 115fd64db8c1047bd7659cb129ece4220985140fe6b0fb1fd17d588350c1f059 |
|
MD5 | ab2adc7c44b308ad24ba0efe12caeb9e |
|
BLAKE2b-256 | e05fcb0ae0da67e56008c858a254f730c296f1108a918528419977eeb01b82b6 |
Hashes for ont_pyguppy_client_lib-7.2.13-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | edd47d421f225277394b363b1330449b459ce9a919b8f1e0487846f7863cee28 |
|
MD5 | 9e6939ecd8a3d65496c5b5dbdf0f98d8 |
|
BLAKE2b-256 | 101f347179c8396513f13c5a7096acc7d0fec5a50fa725008a95babb35aeac11 |
Hashes for ont_pyguppy_client_lib-7.2.13-cp310-cp310-macosx_12_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab21832853278470533679e39dbbde5e4930e908bbd05fa9e39b227528dc5cb0 |
|
MD5 | 10d198baf7e6eb7867cd47263cccc464 |
|
BLAKE2b-256 | b27f9f105600319b962231d187bd2b83211661739d5171ae7ff8bf918ffd9be7 |
Hashes for ont_pyguppy_client_lib-7.2.13-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e43ac712b1c8e40eea6c4fdaea245e151c0a369a869f60c3b21469c0290f46b9 |
|
MD5 | 14c16f550e7a1ca96336fa607922ab9f |
|
BLAKE2b-256 | 85df0ee9506977df656c83b22998b78c0b030c0bd294ea57bff74bde1e4cad27 |
Hashes for ont_pyguppy_client_lib-7.2.13-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8b566c3702b8dff358fe7e30e9f85be8533934fb56fb6e84958b94cd3b0894d |
|
MD5 | f0e0527c787944f8558829362959b67b |
|
BLAKE2b-256 | b1012bdfe9b52ab20f0c232ecd4b3452e84e3f2052ab0e8c26d23eb40fa90eba |
Hashes for ont_pyguppy_client_lib-7.2.13-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e95f71598e3273fd3b9edf87b6b65bcc341d40b90d803115a4670a6d507c4d9 |
|
MD5 | c887530cac1cc5d2e10b8e2f9a846ef6 |
|
BLAKE2b-256 | bf9690986d618b708fab43f9f42f2f822510ba86203ec3c26ec92e0f0ee5da0f |
Hashes for ont_pyguppy_client_lib-7.2.13-cp39-cp39-macosx_12_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9015fd8ba818da5c40f0c9f7756a9d1c28ed66783e58b87b427a082b6d252572 |
|
MD5 | bbad75e82acfc409582479d49c9238af |
|
BLAKE2b-256 | 737ad67ba0f0e986336e8ee8a768e01d144eb0babb262262347e80d30c1a46db |
Hashes for ont_pyguppy_client_lib-7.2.13-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | be8053c6be6a712587fb9983f63821de47dd134d37c1b251fbf12920660308df |
|
MD5 | 2e173d2033b9e38447439c3df49232a6 |
|
BLAKE2b-256 | d6dfcf9e8d1a5468c8996ea9eb7d8fc4a546fa7a3c7678a4440ffe356e1fe1ee |
Hashes for ont_pyguppy_client_lib-7.2.13-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 556b7dba9280442858a25b9c2fa36e153a8e02e340f30442d92a05c367c998f1 |
|
MD5 | 30990d37952b00721e52a3d8a7812ea4 |
|
BLAKE2b-256 | 12696999a4c72708c0a6cd88cd017b13423099a40549cf08d85c6dd0fcbcfe55 |
Hashes for ont_pyguppy_client_lib-7.2.13-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2c906e4182f912bcde7ad203d2d0e08879b17b40cdeeeccb6a55227de17b81c1 |
|
MD5 | 4648cc76368dede19efc6e065f5dab63 |
|
BLAKE2b-256 | 53fd41b14ed4cb8d11a6c1cb89c9a924d9524ec2d267e5ed9e843cd8ae323ffa |
Hashes for ont_pyguppy_client_lib-7.2.13-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b33c16cfcd69a58112d58cf69ed71b013a62fc2e857a52077ceb71c9cd6bc04 |
|
MD5 | 3f46b94711ff26b840dda2d740a5260f |
|
BLAKE2b-256 | 124f79e39cabed27fcb1c084f1452ac95cc2952c0e29b4c2069dd20eb101da37 |
Hashes for ont_pyguppy_client_lib-7.2.13-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b10fe39ea4974c2bfd53fa2c3aaa0071c3a38b5c0b14e6e0c9f4f5324361f00 |
|
MD5 | 64fbb121b89d75274649d365188a6b14 |
|
BLAKE2b-256 | 4d05ca602e03cec363a5ca44f4b3a33f036e842cb652edbcef1d27a4688a660e |
Hashes for ont_pyguppy_client_lib-7.2.13-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b12a183b457fb84d3bd858a2c5c53e561c705ffaa071647f022c32bd4138754 |
|
MD5 | 7f14bf18a8d71d36ed273d58bba2e3ec |
|
BLAKE2b-256 | aecfaeceab26a1a5d44e509dba70b9f7ded753d51fde3025f136f082e5e7cc63 |
Hashes for ont_pyguppy_client_lib-7.2.13-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e114fded88924c040695aef0c3c953e020b4ab3ba48cb247f6bb32ac41fb451b |
|
MD5 | 2a798f3e5742cf1254759f19edddf470 |
|
BLAKE2b-256 | 861a26404fa921b353818b8f2626523d09869aea1085186644e79c68183f5420 |