Z-Hunt[rs] is a Rust port of the Z-Hunt algorithm for predicting the propensity of DNA to adopt a left-handed Z-DNA conformation.
Project description
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.
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 Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zhuntrs-0.0.6.tar.gz.
File metadata
- Download URL: zhuntrs-0.0.6.tar.gz
- Upload date:
- Size: 1.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c50db213cc7fb2517aa0003938b3f22043c6711d030b3ac143e7e14050febfc0
|
|
| MD5 |
4f422fbc3c796b03d97ba03d62b3f312
|
|
| BLAKE2b-256 |
af8071b19d75f8af31858481dd3b1c583ea34d5908fadbe6b43a0b624a96cd30
|
File details
Details for the file zhuntrs-0.0.6-cp314-cp314-win_amd64.whl.
File metadata
- Download URL: zhuntrs-0.0.6-cp314-cp314-win_amd64.whl
- Upload date:
- Size: 154.0 kB
- Tags: CPython 3.14, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a9acb89fc4d8829bdc8a7b2123b8ef5b74688feed6fbe8013f7016404f9da74
|
|
| MD5 |
3953b1e199fcd831c4765d6f1d21fe90
|
|
| BLAKE2b-256 |
83ca14256accc130b8a1370c8af03537123ac48a0b6ae8c6bf389d76ebfec819
|
File details
Details for the file zhuntrs-0.0.6-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: zhuntrs-0.0.6-cp314-cp314-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 304.1 kB
- Tags: CPython 3.14, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dff49a14dd8da6c8325338c6b87ed17fd04715da68f65b8809a13587bb9e797d
|
|
| MD5 |
d84d59e92ee05ea2516e5545410f5927
|
|
| BLAKE2b-256 |
4fc99c5347b895dba0a3ef0eb9417101058e1e273353611118e1c85fa95dd8e5
|
File details
Details for the file zhuntrs-0.0.6-cp314-cp314-macosx_10_12_x86_64.whl.
File metadata
- Download URL: zhuntrs-0.0.6-cp314-cp314-macosx_10_12_x86_64.whl
- Upload date:
- Size: 270.2 kB
- Tags: CPython 3.14, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d2aa47f6ee97a7e122411b2d21a156c4080dee6f328712324f82a8e04124523
|
|
| MD5 |
1319280a1d58c1013c8f3db04c941ceb
|
|
| BLAKE2b-256 |
efbae916d908140cb3933dd8095b03885b530bd8fe2f4b6125a8443a998907f5
|
File details
Details for the file zhuntrs-0.0.6-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: zhuntrs-0.0.6-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 153.9 kB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e0aad44d13717ef47f01505a4ba5fb383a3ea70680a0d7e70ac5454483beeb6
|
|
| MD5 |
91968233e81fa1a33be0070d3b962044
|
|
| BLAKE2b-256 |
6d0449a9e2b07c0148224231d76c3863c64004016e099b539e9a0bacbadde1df
|
File details
Details for the file zhuntrs-0.0.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: zhuntrs-0.0.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 304.1 kB
- Tags: CPython 3.13, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a018835d288e38dda12d474931fa63529b54224fe7ffd7267a6d4298d11aa2a
|
|
| MD5 |
7afa1a3a154f981227ca1438e4c193df
|
|
| BLAKE2b-256 |
143eb1f7a61ac3ff0d8df866afd869a93db6dfd08a19d06720949a3f7b5319c2
|
File details
Details for the file zhuntrs-0.0.6-cp313-cp313-macosx_10_12_x86_64.whl.
File metadata
- Download URL: zhuntrs-0.0.6-cp313-cp313-macosx_10_12_x86_64.whl
- Upload date:
- Size: 270.5 kB
- Tags: CPython 3.13, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d05aa59c47ab4743e2985e19486d9d574452b2ccf98051c1e0a91b2344420d5
|
|
| MD5 |
e00a1dbe002d5bd5c204fcf6c84519ad
|
|
| BLAKE2b-256 |
8f7c86f740ee6fb62e9dfb9e17b5a14a2d5480869be7049af7a87fbc421ba8e6
|
File details
Details for the file zhuntrs-0.0.6-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: zhuntrs-0.0.6-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 154.3 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f35b9225280ca3f054115fdbb33706c8449e4620090531cd9eb911f79e3f9e53
|
|
| MD5 |
9d50674f7e2e0cee3de42977c47eb8bf
|
|
| BLAKE2b-256 |
0a581a15e38a84b1860ef31e1bd3317ef98307487e4a7f6b69efa77ad4e2be6e
|
File details
Details for the file zhuntrs-0.0.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: zhuntrs-0.0.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 304.7 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cee1ec7fc0b455190e530a48aa07b0ec2d9d1a0c13ea2a2af3a75816777f87d0
|
|
| MD5 |
b37ae44ea58dc1d22e8e91961d228d7f
|
|
| BLAKE2b-256 |
3b64ed587f0560de58732f3db694cc4698a922fbc1ac6ffa25e1ccdae5fb27f6
|
File details
Details for the file zhuntrs-0.0.6-cp312-cp312-macosx_10_12_x86_64.whl.
File metadata
- Download URL: zhuntrs-0.0.6-cp312-cp312-macosx_10_12_x86_64.whl
- Upload date:
- Size: 270.5 kB
- Tags: CPython 3.12, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3323ffa6dbef752ba621ec4e725f8c3dad353c8befecf1ff4a4fd9246b54a3be
|
|
| MD5 |
65a87ba083b79d8d1cebf7d8a6638536
|
|
| BLAKE2b-256 |
0b16e70c137d2944ef383560c3792b1ab252e3e3324ab522edfee90c6648c769
|
File details
Details for the file zhuntrs-0.0.6-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: zhuntrs-0.0.6-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 155.8 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae49bfd176bfffcb810aca8a345111ede7f2e95c64f08a88fefd06c028da8ae5
|
|
| MD5 |
82032203ca6ec1268e5143ec9af80538
|
|
| BLAKE2b-256 |
e792cd418bd86f21fb70cea7b6c223f7f17700b6de6b2983770f975c733a94bb
|
File details
Details for the file zhuntrs-0.0.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: zhuntrs-0.0.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 307.1 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c54630a5343f9c79376c4892ffcadfdda8394175ed50943b35b90bb2b1033c3
|
|
| MD5 |
bb4cfdd19203640bc5b42244578eb250
|
|
| BLAKE2b-256 |
64f8984d5892cdbd60a95933b6e0ade20378671fa3b36b490d4b5ac08fec4d07
|
File details
Details for the file zhuntrs-0.0.6-cp311-cp311-macosx_10_12_x86_64.whl.
File metadata
- Download URL: zhuntrs-0.0.6-cp311-cp311-macosx_10_12_x86_64.whl
- Upload date:
- Size: 271.6 kB
- Tags: CPython 3.11, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06dc0fd460e8c276ddec1d7ddaba1dad115d3f105d1b48ed060e19da439f3168
|
|
| MD5 |
2e85a4f5b3483c73c0a1dde33ea05b66
|
|
| BLAKE2b-256 |
2293bc853457bf880da586eb4d4bb069451d4cb72dba4a86b17d9ccef137996f
|
File details
Details for the file zhuntrs-0.0.6-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: zhuntrs-0.0.6-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 155.1 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5196d2947069fd9d9ccdeff0708fb1099e225c70201efb22e55d653ddb50f0f3
|
|
| MD5 |
29e569c9208b94390134c1639aa25b57
|
|
| BLAKE2b-256 |
637b39174575922a0130bc2981c1f7d1ef0a968168c59bdf3e6a9db26214b857
|
File details
Details for the file zhuntrs-0.0.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: zhuntrs-0.0.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 306.7 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7157e9506b0272d77fa39efa746fafd9200e83a6a8e281e794940d0f6488ce5
|
|
| MD5 |
fa8eadf27f3b6b52552d0e3e3824ac9a
|
|
| BLAKE2b-256 |
532f43a45051c0bf1df8c2e541cda2ec9673644cf62519dbfca85f891c5290b5
|
File details
Details for the file zhuntrs-0.0.6-cp310-cp310-macosx_10_12_x86_64.whl.
File metadata
- Download URL: zhuntrs-0.0.6-cp310-cp310-macosx_10_12_x86_64.whl
- Upload date:
- Size: 272.4 kB
- Tags: CPython 3.10, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8f5b5c3cb1831aedd3ebbc02ad2d595192f22a665a79895c64246f755da178c
|
|
| MD5 |
ac64c01bd711fed0a5b461ce0a67ac2a
|
|
| BLAKE2b-256 |
a1a25376e07ad9abccb596560fda0d918742fcbca9eebdf35a029a6a12d8e5bb
|