kackle
Kmer Artifact Correction (KACkle) -- A small python utility for eliminating k-mer artifacts caused by primer mismatching.
Installation
Requires Python 3.10-3.13. 3.14 isn't supported yet because pybigtools'
PyO3 bindings don't have a 3.14 build; the ceiling will be raised once an
updated pybigtools release lands.
Install with pip:
pip install kackle
kackle --help
Or with uv:
uv tool install kackle
kackle --help
Execution
Run with precomputed BED6 motif sites:
kackle -i plus.bw -I minus.bw -b sites.bed6 -o out.plus.bw -O out.minus.bw -c chrom.sizes
Or let kackle locate the original artifact motifs directly from FASTA. By default,
FASTA mode corrects exact TGG matches first, then TGGAA matches with up to one
mismatch:
kackle -i plus.bw -I minus.bw -f genome.fa -o out.plus.bw -O out.minus.bw -c chrom.sizes
FASTA mode locates motif sites one chromosome at a time to avoid materializing
whole-genome BED tables for common short motifs. It uses indexed pyfastx
FASTA access and ahocorasick-rs multi-pattern matching by default:
kackle -i plus.bw -I minus.bw -f genome.fa \
--fasta-backend pyfastx --motif-match-backend ahocorasick \
-o out.plus.bw -O out.minus.bw -c chrom.sizes
Custom motif order can be supplied with repeated --motif KMER[:MISMATCHES] flags.
To save the generated motif sites while using FASTA mode, add
--out-bed6-prefix PREFIX. This writes one BED6 file per motif pass, such as
PREFIX.1.TGG.m0.bed6 and PREFIX.2.TGGAA.m1.bed6.
By default, kackle uses --chrom-workers auto to process multiple chromosomes
concurrently. Auto mode uses up to four chromosome workers, honors
NUMBA_NUM_THREADS as the total thread budget, and divides numba threads across
the chromosome workers. The CLI uses --worker-backend process by default so
FASTA matching, pandas filtering, and numba kernels can run in separate Python
interpreters. Set --worker-backend thread for lower process overhead, set
--chrom-workers 1 for serial chromosome processing, or tune
--numba-threads N explicitly.
kackle processes chromosomes present in the intersection of chrom.sizes, both
input bigWigs, and the FASTA file when FASTA mode is used. Chromosomes absent
from any required source are skipped.
Generate before/after metaplots centered on motif starts:
kackle-metaplot \
--before-pl-bw plus.bw --before-mn-bw minus.bw \
--after-pl-bw out.plus.bw --after-mn-bw out.minus.bw \
-f genome.fa -c chrom.sizes -o correction.metaplot
This writes correction.metaplot.plus.png and correction.metaplot.minus.png.
BED6 motif sites can be supplied with -b sites.bed6 instead of FASTA.
Benchmarking
To reproduce motif-backend timings:
uv run python benchmarks/motif_backends.py
Metadata
Release files for kackle 0.2.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 | |
|---|---|---|---|
| kackle-0.2.0.tar.gz | 96.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kackle-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 116.9 kB
Release files / kackle-0.2.0.tar.gz
| Download URL | kackle-0.2.0.tar.gz |
|---|---|
| Size | 96.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e1d438756d64546b229700627caa1df9c6522bfa557daf60f884bde9839c9ee3
|
|
BLAKE2b-256 checksum How to use checksums |
d9b2f9cf6caf955e57d036807a063f9f67d79fec1ab3fe49c71d57d07237f09d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / kackle-0.2.0-py3-none-any.whl
| Download URL | kackle-0.2.0-py3-none-any.whl |
|---|---|
| Size | 20.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1c32a817bb44563fe6fe92105b430a0f8eb9c66b1c9cad63bdb70cbd7cbf138e
|
|
BLAKE2b-256 checksum How to use checksums |
800f73123f7a3e3be281df9c09682bd0172721bbab3b62249a8e8afb88d56ef8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.1 {"installer":{"name":"uv","version":"0.12.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|