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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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 kackle-0.2.0.tar.gz.
File metadata
- Download URL: kackle-0.2.0.tar.gz
- Upload date:
- Size: 96.2 kB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1d438756d64546b229700627caa1df9c6522bfa557daf60f884bde9839c9ee3
|
|
| MD5 |
101ade5e201c3810782fec3e0876733d
|
|
| BLAKE2b-256 |
d9b2f9cf6caf955e57d036807a063f9f67d79fec1ab3fe49c71d57d07237f09d
|
File details
Details for the file kackle-0.2.0-py3-none-any.whl.
File metadata
- Download URL: kackle-0.2.0-py3-none-any.whl
- Upload date:
- Size: 20.7 kB
- Tags: Python 3
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c32a817bb44563fe6fe92105b430a0f8eb9c66b1c9cad63bdb70cbd7cbf138e
|
|
| MD5 |
17c97bcae11c0ac9074ab9056cc2e8e9
|
|
| BLAKE2b-256 |
800f73123f7a3e3be281df9c09682bd0172721bbab3b62249a8e8afb88d56ef8
|