Python bindings for the GuppyClient library.
Project description
ont-pyguppy-client-lib
ont-pyguppy-client-lib provides python bindings for connecting to a Guppy basecall server. It allows you to interact with the server to do anything you could normally do using the guppy 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 Guppy basecall server is running. Guppy may be obtained from the Oxford Nanopore Community
The version of ont-pyguppy-client-lib should exactly match the version of Guppy being used. You can find your Guppy version like this:
$ <location of guppy_basecall_server>/guppy_basecall_server --version
For example, this Guppy basecall server is version 4.2.2:
$ ./ont-guppy/bin/guppy_basecall_server --version : Guppy Basecall Service Software, (C) Oxford Nanopore Technologies, Limited. Version 4.2.2+effbaf8, client-server API version 3.2.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 Guppy basecall server.
client_lib A compiled library which provides direct Python bindings to Guppy’s C++ API.
helper_functions A set of functions for running a Guppy basecall server and loading reads from fast5 and/or pod5 files.
Starting a basecall server
There must be a Guppy 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 # guppy_basecall_server executable is found. Update this as # appropriate. helper_functions.run_server(server_args, "/home/myuser/ont-guppy/bin")
See the Guppy protocol 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:
Guppy - 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.0.8-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f79be80ccaead10cc4665919864bb6ee3cd8363f8d0ea69d0c2ddc033f8c25c4 |
|
MD5 | 9cfc31c8a8898d6f8225a42d119fcc7c |
|
BLAKE2b-256 | fcf5f8c932aded837ccc2947d20b4a3b8ce9502bf017a4ab6adc2bd40ce25297 |
Hashes for ont_pyguppy_client_lib-7.0.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aef8a91fee7fe5664ee9e2d7bbae136bcda22525321a0953b30420e254b9de60 |
|
MD5 | 8c88263b6c301ca85b3e3cfd0e350e29 |
|
BLAKE2b-256 | dce739c7572943080fb1e69cc4ab5156191e1d57f3032c0ff30e3a39a0757727 |
Hashes for ont_pyguppy_client_lib-7.0.8-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30b00d3e63946a7119f35d77dc2d0d85f9d32c188b9dface4b84c9f14ddf4773 |
|
MD5 | 207a07e119f9f7bd2cc8510d5c955836 |
|
BLAKE2b-256 | cd8fd46347963f0ba34a24cca18c9b9805b9b082449a548b3b95deba8f5625ab |
Hashes for ont_pyguppy_client_lib-7.0.8-cp311-cp311-macosx_12_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8d4058cbfdbb3f674360d2fadda6feacf2b0fbdcfb6577b4e3e78c5f0dcb89d |
|
MD5 | 2cf028d2acc0eac0c6305403f06da6cb |
|
BLAKE2b-256 | 398c7aeb392c19732c59861054f2fe88aad4c3082ca94574dd67d783bc33025d |
Hashes for ont_pyguppy_client_lib-7.0.8-cp311-cp311-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24c21c212e096b116bb5a3c115d1cef472260938e2d32b87ebb961332893d615 |
|
MD5 | 0701d5a0d075cd8314b1a5aa2c621f8a |
|
BLAKE2b-256 | bef3768aefc09964fcabbd602bf89fcf4096c3162414c024d7f2fa961ffbba6b |
Hashes for ont_pyguppy_client_lib-7.0.8-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | efbf63d70c01d95a33118b5c547445c309fecd92bc78d9c6add448a1ae0249c8 |
|
MD5 | 64f9b32e97a01b8110ce14cd960c0c17 |
|
BLAKE2b-256 | 0a220713dae6a909d8440b33192eb010271393e77b6cbaf9139d98e9fb7d81db |
Hashes for ont_pyguppy_client_lib-7.0.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34d4a1414c953f8c3111fb1467512b02c5e18d4b6ff505ec5335869adf5c54e2 |
|
MD5 | 5110e7451ac29c6cf29e6af0388e5a0a |
|
BLAKE2b-256 | eb45885c9a8a6a8921a46ea6444073c7ce3c169ee789e45a9fd445260d50296c |
Hashes for ont_pyguppy_client_lib-7.0.8-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 025c99939c3f03e237cdbb22ca0a39d83f867862671546d43840ce778fc01338 |
|
MD5 | 786394f396e1cac27c2417af2a6e3813 |
|
BLAKE2b-256 | b46ca650d01f6b30eb227407309919bac6c31fb140461370e5d71f37253435ca |
Hashes for ont_pyguppy_client_lib-7.0.8-cp310-cp310-macosx_12_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 645d8710b962d40446fdec59a389dd2ed068f39a3812b2deaa0b007a3f49dd68 |
|
MD5 | c7cdc89683cfff8fa5c0ac5862e154c4 |
|
BLAKE2b-256 | d409922b8e09837af05ad656653c4f85809e9ae73ca2cf0dafa4238df7e2e4da |
Hashes for ont_pyguppy_client_lib-7.0.8-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4b4ccd35600b234bf66f67a33ec0a30afa1ef3ad8331ccbe6bf9490d5c5569d |
|
MD5 | d8b18285f0114adda298dd67d75a7d95 |
|
BLAKE2b-256 | cdb2e86d01f5b974d9ffc793518b3fc85f9389b93586d87ef497a13c6048d65b |
Hashes for ont_pyguppy_client_lib-7.0.8-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34ff7e2f748fe0053f24e93cd7df6b9e814934134b33fd3a0a37ccae92019263 |
|
MD5 | 16bfbb1357587fa72f0c1fc2d5779b43 |
|
BLAKE2b-256 | a41b1a71d59903e1ec46cc46ecb5a025980da80219cf181a6de5cfaf8015503a |
Hashes for ont_pyguppy_client_lib-7.0.8-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac9a65f96f97a6aeecf7c1494c00f18f514e1f2761d67602b1bc4898045e00b3 |
|
MD5 | 9d1f8eed5cb5d720d396aedaf92a79bd |
|
BLAKE2b-256 | a13aa0e8d790f5b0404c87a3ab2e0614738449ff269d884ab3a11f08837dc2cd |
Hashes for ont_pyguppy_client_lib-7.0.8-cp39-cp39-macosx_12_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3e7517b8fe7b684dcf746fede6f46f9b81cbcb5ef9184b324d26a4da4f6850d |
|
MD5 | fab150b0bb2675ce0953b32c7752b475 |
|
BLAKE2b-256 | fd30913e4038ecc50b995d6a89eb6170bf661dc64eabe71f93cc36f002feed16 |
Hashes for ont_pyguppy_client_lib-7.0.8-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2d81b1a27cf435d9a8806e8c14cc11028dc80073099a0abf7d0a99ec3ba385c |
|
MD5 | 27c3553a92dde45625b878b367920468 |
|
BLAKE2b-256 | d73eacd377a181dbdfc1123ba4b5bde9ca7088a48777323a049274c7fea50d98 |
Hashes for ont_pyguppy_client_lib-7.0.8-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5ada6b1e0ad809c4d7f4b6d0fb75239f284a5b01286194297fa2fcb131df073 |
|
MD5 | eed8ec2248bfde8075a1dd004b866725 |
|
BLAKE2b-256 | f312fabf52094a88e4ac0b8c41829b9139a49b3484f38f8dd11d87714b430ee8 |
Hashes for ont_pyguppy_client_lib-7.0.8-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eadc71d6df2059675a2d497b2c9086a31b3a404527b774acf3b36db38ff35d66 |
|
MD5 | cfdf0a0db0892f82f8ea39e93cd0e647 |
|
BLAKE2b-256 | 3bd3b06d3d316725e762eb511903655fe11ad11a7d444f0d02d592639fd7910a |
Hashes for ont_pyguppy_client_lib-7.0.8-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b1ed1097ba89f8a89b580df47108ad5e69e05bc8875b0cdd00b5abed3b63895 |
|
MD5 | 997393518eb0bf9995034b1ff91dac5f |
|
BLAKE2b-256 | 46dff163d4ac53a4e9e0f60f2b97abdcb0bfca6ca2e441e55baa2fad1258e335 |
Hashes for ont_pyguppy_client_lib-7.0.8-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24f0df92a93fa91372c2d83120430aabb3311d9d094c0092e888d17a38c00ffe |
|
MD5 | 2bbb7715b381b9096ed7ea7b8394c1d3 |
|
BLAKE2b-256 | aee2e3599ffbb5f2ade45ac80af60ab634ba3281ad2288e12518168c89527a08 |
Hashes for ont_pyguppy_client_lib-7.0.8-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f994ac1a84b380911c2016f6e5162d3c27fe2bba6fde7a8a9dfc1c876cd3e88a |
|
MD5 | 808d8d68543100a955a43aca0f358da9 |
|
BLAKE2b-256 | 8c600970c40458196a04e7e84f9358429668872e4da62ac0298ebe1e448d584c |
Hashes for ont_pyguppy_client_lib-7.0.8-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fdad22e6ad8ea6a7b8872a9b8d2491fb54ebff01dec2680c8879cd9cec5a91cd |
|
MD5 | 25a51ef9bda88b43d7e8752b88223f7b |
|
BLAKE2b-256 | df61d90658e4ba71f18576d4ded79aa7aa0b67df1e538c9367595095b3d1b71c |