NT count test
Just little test to see how fast we can count nucleotides, this optimizes the original code
to use SIMD instructions reaching around 15GB/s. For the viral genomes that is around 50k
genomes in 0.2s (or 1GB sequences in 0.2 sec). The main speed up actually comes here where we loop 5 times per nucleotide. This seems worse than just saying if nt == a increment count but the branches for this have a huge impact
when mis-predicted for each nucleotide.
Usage
If you do not have Cargo yet see here: curl https://sh.rustup.rs -sSf | sh.
Then you can install the binary directly using:
cargo install --git ssh://git@github.com/rickbeeloo/viral-nt-counts.git
Then you can run it with:
nuc-count-test --output output.tsv --threads 4 genomes.fasta
Python bindings
Built with maturin (pip install maturin):
maturin develop --release # into the current venv
maturin build --release # or a wheel in target/wheels/
The module exposes a single function:
import nuc_count
nuc_count.count("genomes.fasta", "output.tsv", threads=4) # threads=0 = all cores
It writes the same TSV as the CLI and releases the GIL while counting, so it does
not block other Python threads. Errors come back as RuntimeError.
You can increase the threads but if this helps (or harms) mostly depends on the IO speed as the code itself is much faster than the read speed. So likely around 3-4 threads will work best but you can play with it.
Metadata
Release files for nuc-count 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nuc_count-0.1.0.tar.gz | 1.0 MB | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nuc_count-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| nuc_count-0.1.0-cp38-abi3-macosx_11_0_arm64.whl | CPython 3.8 | abi3 | macOS 11.0+ ARM64 | Details |
Total release size: 2.0 MB
Release files / nuc_count-0.1.0.tar.gz
| Download URL | nuc_count-0.1.0.tar.gz |
|---|---|
| Size | 1.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
670f2c114bcdb01358d48fde4cbcb65743aeac5a987248abb9fecaa51724411e
|
|
BLAKE2b-256 checksum How to use checksums |
acf530ba9d4f1eee2c60d05a6e7201553dd400a7f76365a0dcae9c5e20bc47d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / nuc_count-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | nuc_count-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 579.8 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
11f343a56cb51f58c35e716d3609d7f69a2c25be05dd77c13f54297779e9f361
|
|
BLAKE2b-256 checksum How to use checksums |
5a0ff3317b2bbd848a738229b95bcec31d21d0ee2225965ccedfb744085c411a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / nuc_count-0.1.0-cp38-abi3-macosx_11_0_arm64.whl
| Download URL | nuc_count-0.1.0-cp38-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 425.3 kB |
| Tags | CPython 3.8 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b645e4ba23e222b30948ac7c5ac95163d4ed7bc4f569a708ed337f7445fa9f48
|
|
BLAKE2b-256 checksum How to use checksums |
9a3a7b72940188b265da684742bef17aea2ac7069d284776ee0d3dac88d5540c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|