Skip to main content

Z-Hunt[rs]

This repository contains a Rust port of the Z-Hunt algorithm, which is designed to predict the propensity of DNA to adopt a left-handed Z-DNA conformation. Unlike the original implementation, this version is intended to be used as a standalone Python library.

This Rust port is fully compatible with the original C implementation. Please refer to the Compatibility section for more details.

Installation

The library can be installed from PyPI using pip:

pip install zhuntrs

Usage

Here is a simple example of how to use the library in Python:

import zhuntrs

sequence = "nATGCGCGCGGCATGC".encode("ASCII")  # The target sequence (only ATGCN are accepted, case insensitive)
mindn, maxdn = 3, 6  # Minimum and maximum length of evaluated DNA windows in dinucleotides
threshold = 1_000  # Windows with a ZH-score below this threshold will not be reported

# Make a prediction
start, end, score, window, conformation = zhuntrs.predict(sequence, mindn, maxdn, threshold)

# start: start coordinates of evaluated DNA windows
assert start == [0, 1, 2]

# end: end coordinates of DNA windows starting at the above coordinates and 
#      having the highest ZH-score among [mindn; maxdn] windows
assert end == [10, 11, 10]

# score: ZH-score for each window
assert [int(zh) for zh in score] == [2220, 1057, 3428]

# window: DNA sequence for each window:
#         window[i] = sequence[start[i]:end[i]]
assert window == ['NATGCGCGCG', 'ATGCGCGCGG', 'TGCGCGCG']

# conformation: DNA conformation (anti/syn) for each window
assert conformation == ['ASASASASAS', 'SASASASASA', 'ASASASAS']

Note: the default behaviour of the original implementation is to "wrap around" windows at the end of the sequence. It can be enabled by passing wrap=True to the predict function.

The library also supports stream predictions, wherein the sequence is evaluated slice by slice to minimize the memory footprint and allow interruption when required. This feature is especially useful when processing large sequences:

slice_size = 512  # Size of each slice, default is 1024

for start, end, score, window, conformation in zhuntrs.stream(sequence, mindn, maxdn, threshold, ssize=slice_size):
    length = len(start)
    # The last slice may be shorter than slice_size but not empty
    assert 0 < length <= slice_size
    # All arrays have the same length and semantics as before
    assert len(start) == len(end) == len(score) == len(window) == len(conformation)
    ...

This mode is equivalent to calling zhuntrs.predict on the entire sequence and processing the output slice by slice, where each slice has a size equal to ssize, except, perhaps, for the last one. Note that the 'wrapping around' of the sequence in this mode occurs as usual, i.e., only once, and all coordinates are provided relative to the original sequence.

Compatibility

This version has been tested against the original C implementation compiled with all compile optimizations turned off. The output for human mtDNA, a random 1kb sequence, and subsequences of human chrY or HSV-1 genome matches the output of the C implementation (see tests; 12 digits after the decimal point are identical).

Reference outputs were generated using the tests/resources/make-references.sh script. The reference implementation used is also provided in the same folder (zhunt3-reference.c).

Development

Publishing to PyPI is done automatically by the CI pipeline. To publish a new version, simply create a new tag and push it to the repository. The CI pipeline will take care of the rest.

Release files for zhuntrs 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for zhuntrs 0.0.6
File Size Uploaded
zhuntrs-0.0.6.tar.gz 1.5 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for zhuntrs 0.0.6
File
zhuntrs-0.0.6-cp314-cp314-win_amd64.whl CPython 3.14 CPython 3.14 Windows x86-64 Details
zhuntrs-0.0.6-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.14 CPython 3.14 Linux glibc 2.17+ x86-64 Details
zhuntrs-0.0.6-cp314-cp314-macosx_10_12_x86_64.whl CPython 3.14 CPython 3.14 macOS 10.12+ x86-64 Details
zhuntrs-0.0.6-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
zhuntrs-0.0.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details
zhuntrs-0.0.6-cp313-cp313-macosx_10_12_x86_64.whl CPython 3.13 CPython 3.13 macOS 10.12+ x86-64 Details
zhuntrs-0.0.6-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
zhuntrs-0.0.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
zhuntrs-0.0.6-cp312-cp312-macosx_10_12_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.12+ x86-64 Details
zhuntrs-0.0.6-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
zhuntrs-0.0.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
zhuntrs-0.0.6-cp311-cp311-macosx_10_12_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.12+ x86-64 Details
zhuntrs-0.0.6-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
zhuntrs-0.0.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
zhuntrs-0.0.6-cp310-cp310-macosx_10_12_x86_64.whl CPython 3.10 CPython 3.10 macOS 10.12+ x86-64 Details

Total release size: 5.2 MB

Release files / zhuntrs-0.0.6.tar.gz

Download URL zhuntrs-0.0.6.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
c50db213cc7fb2517aa0003938b3f22043c6711d030b3ac143e7e14050febfc0
BLAKE2b-256 checksum
How to use checksums
af8071b19d75f8af31858481dd3b1c583ea34d5908fadbe6b43a0b624a96cd30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.2

Release files / zhuntrs-0.0.6-cp314-cp314-win_amd64.whl

Download URL zhuntrs-0.0.6-cp314-cp314-win_amd64.whl
Size 154.0 kB
Tags CPython 3.14 Windows x86-64
SHA-256 checksum
How to use checksums
9a9acb89fc4d8829bdc8a7b2123b8ef5b74688feed6fbe8013f7016404f9da74
BLAKE2b-256 checksum
How to use checksums
83ca14256accc130b8a1370c8af03537123ac48a0b6ae8c6bf389d76ebfec819
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.2

Release files / zhuntrs-0.0.6-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL zhuntrs-0.0.6-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 304.1 kB
Tags CPython 3.14 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
dff49a14dd8da6c8325338c6b87ed17fd04715da68f65b8809a13587bb9e797d
BLAKE2b-256 checksum
How to use checksums
4fc99c5347b895dba0a3ef0eb9417101058e1e273353611118e1c85fa95dd8e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.2

Release files / zhuntrs-0.0.6-cp314-cp314-macosx_10_12_x86_64.whl

Download URL zhuntrs-0.0.6-cp314-cp314-macosx_10_12_x86_64.whl
Size 270.2 kB
Tags CPython 3.14 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
5d2aa47f6ee97a7e122411b2d21a156c4080dee6f328712324f82a8e04124523
BLAKE2b-256 checksum
How to use checksums
efbae916d908140cb3933dd8095b03885b530bd8fe2f4b6125a8443a998907f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.2

Release files / zhuntrs-0.0.6-cp313-cp313-win_amd64.whl

Download URL zhuntrs-0.0.6-cp313-cp313-win_amd64.whl
Size 153.9 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
1e0aad44d13717ef47f01505a4ba5fb383a3ea70680a0d7e70ac5454483beeb6
BLAKE2b-256 checksum
How to use checksums
6d0449a9e2b07c0148224231d76c3863c64004016e099b539e9a0bacbadde1df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.2

Release files / zhuntrs-0.0.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL zhuntrs-0.0.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 304.1 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
5a018835d288e38dda12d474931fa63529b54224fe7ffd7267a6d4298d11aa2a
BLAKE2b-256 checksum
How to use checksums
143eb1f7a61ac3ff0d8df866afd869a93db6dfd08a19d06720949a3f7b5319c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.2

Release files / zhuntrs-0.0.6-cp313-cp313-macosx_10_12_x86_64.whl

Download URL zhuntrs-0.0.6-cp313-cp313-macosx_10_12_x86_64.whl
Size 270.5 kB
Tags CPython 3.13 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
5d05aa59c47ab4743e2985e19486d9d574452b2ccf98051c1e0a91b2344420d5
BLAKE2b-256 checksum
How to use checksums
8f7c86f740ee6fb62e9dfb9e17b5a14a2d5480869be7049af7a87fbc421ba8e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.2

Release files / zhuntrs-0.0.6-cp312-cp312-win_amd64.whl

Download URL zhuntrs-0.0.6-cp312-cp312-win_amd64.whl
Size 154.3 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
f35b9225280ca3f054115fdbb33706c8449e4620090531cd9eb911f79e3f9e53
BLAKE2b-256 checksum
How to use checksums
0a581a15e38a84b1860ef31e1bd3317ef98307487e4a7f6b69efa77ad4e2be6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.2

Release files / zhuntrs-0.0.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL zhuntrs-0.0.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 304.7 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
cee1ec7fc0b455190e530a48aa07b0ec2d9d1a0c13ea2a2af3a75816777f87d0
BLAKE2b-256 checksum
How to use checksums
3b64ed587f0560de58732f3db694cc4698a922fbc1ac6ffa25e1ccdae5fb27f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.2

Release files / zhuntrs-0.0.6-cp312-cp312-macosx_10_12_x86_64.whl

Download URL zhuntrs-0.0.6-cp312-cp312-macosx_10_12_x86_64.whl
Size 270.5 kB
Tags CPython 3.12 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
3323ffa6dbef752ba621ec4e725f8c3dad353c8befecf1ff4a4fd9246b54a3be
BLAKE2b-256 checksum
How to use checksums
0b16e70c137d2944ef383560c3792b1ab252e3e3324ab522edfee90c6648c769
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.2

Release files / zhuntrs-0.0.6-cp311-cp311-win_amd64.whl

Download URL zhuntrs-0.0.6-cp311-cp311-win_amd64.whl
Size 155.8 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
ae49bfd176bfffcb810aca8a345111ede7f2e95c64f08a88fefd06c028da8ae5
BLAKE2b-256 checksum
How to use checksums
e792cd418bd86f21fb70cea7b6c223f7f17700b6de6b2983770f975c733a94bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.2

Release files / zhuntrs-0.0.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL zhuntrs-0.0.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 307.1 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
5c54630a5343f9c79376c4892ffcadfdda8394175ed50943b35b90bb2b1033c3
BLAKE2b-256 checksum
How to use checksums
64f8984d5892cdbd60a95933b6e0ade20378671fa3b36b490d4b5ac08fec4d07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.2

Release files / zhuntrs-0.0.6-cp311-cp311-macosx_10_12_x86_64.whl

Download URL zhuntrs-0.0.6-cp311-cp311-macosx_10_12_x86_64.whl
Size 271.6 kB
Tags CPython 3.11 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
06dc0fd460e8c276ddec1d7ddaba1dad115d3f105d1b48ed060e19da439f3168
BLAKE2b-256 checksum
How to use checksums
2293bc853457bf880da586eb4d4bb069451d4cb72dba4a86b17d9ccef137996f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.2

Release files / zhuntrs-0.0.6-cp310-cp310-win_amd64.whl

Download URL zhuntrs-0.0.6-cp310-cp310-win_amd64.whl
Size 155.1 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
5196d2947069fd9d9ccdeff0708fb1099e225c70201efb22e55d653ddb50f0f3
BLAKE2b-256 checksum
How to use checksums
637b39174575922a0130bc2981c1f7d1ef0a968168c59bdf3e6a9db26214b857
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.2

Release files / zhuntrs-0.0.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL zhuntrs-0.0.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 306.7 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
b7157e9506b0272d77fa39efa746fafd9200e83a6a8e281e794940d0f6488ce5
BLAKE2b-256 checksum
How to use checksums
532f43a45051c0bf1df8c2e541cda2ec9673644cf62519dbfca85f891c5290b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.2

Release files / zhuntrs-0.0.6-cp310-cp310-macosx_10_12_x86_64.whl

Download URL zhuntrs-0.0.6-cp310-cp310-macosx_10_12_x86_64.whl
Size 272.4 kB
Tags CPython 3.10 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
b8f5b5c3cb1831aedd3ebbc02ad2d595192f22a665a79895c64246f755da178c
BLAKE2b-256 checksum
How to use checksums
a1a25376e07ad9abccb596560fda0d918742fcbca9eebdf35a029a6a12d8e5bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via maturin/1.10.2

Release history Release notifications | RSS feed

This release

0.0.6 This release

16 release files

0.0.5

8 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page