HMMER-powered sequence search with a clean Python API and CLI. Built on PyHMMER, supports protein and nucleotide workflows, and manages reference databases for you.
Requires Python 3.10+.
pip install -e . # editable install
pip install -e .[dev] # with dev/test extrasaksha database install PFAM # one-time setup
aksha search --sequences dummy_dataset --hmms PFAM --cut_ga -o results.tsv
head results.tsvAdd -v for verbose logging.
aksha search– hmmsearch style: protein sequences vs HMM profiles.aksha scan– hmmscan style: HMM profiles vs protein sequences.aksha phmmer– protein vs protein DB.aksha jackhmmer– iterative protein search.aksha nhmmer– nucleotide sequences vs nucleotide HMMs.aksha database– list/install databases (e.g., PFAM); custom paths also supported.
- Sequences: file or directory; accepts
.faa .fa .fasta .fas .fna. Default mode is protein; usenhmmerfor nucleotide. - HMMs: single
.hmmfile, directory of.hmmfiles, or installed DB name (e.g.,PFAM). - Threads:
--threads 0uses all available cores.
--cut_ga,--cut_tc,--cut_nc: use gathering/trusted/noise cutoffs if present in the HMMs.--cascade: tries trusted → gathering → noise → none (first available).- Numeric:
-E/--evalue,-T/--bitscore,--domE,--domT. - If nothing is given, PyHMMER inclusion defaults apply.
- File layout:
- If
-oends with.tsv, results are written there. - If
-ois a directory, it is created if missing andsearch_results.tsv(orscan_results.tsv, etc.) is written inside.
- If
- Columns:
sequence_id, hmm_name, evalue, bitscore, c_evalue, i_evalue, dom_bitscore, env_from, env_to, ali_from, ali_to. - Large runs: when hits exceed ~100k, collection spills to disk (
.aksha_temp_results.tsvin the output dir) before finalizing.
- Default directories follow platform conventions via platformdirs:
- Linux:
~/.local/share/aksha,~/.config/aksha - macOS:
~/Library/Application Support/aksha - Windows:
%APPDATA%\aksha
- Linux:
- Environment overrides:
AKSHA_DATA_DIR,AKSHA_CONFIG_DIR. - Installed DB metadata is tracked in
databases.jsonin the data dir.
- 0 or very few hits: thresholds too strict (
--cut_gacan be tight); try-E 1e-3or-T 20. Ensure protein vs nucleotide mode matches your sequences/HMMs. - HMM parse count looks too small: your input might be a directory with a single multi-model
.hmm; we parse all models. Re-run with-vto see the “Parsed N HMMs” log. - Slow searches: use
--threads 0(all cores) and keep sequences grouped by file; avoid extremely small files in large counts.
Everything is importable from aksha directly.
import aksha
# Search protein sequences against an HMM database
result = aksha.search(
sequences="dummy_dataset",
hmms="PFAM",
thresholds=aksha.ThresholdOptions(cut_ga=True),
threads=4,
)
# Results as a pandas DataFrame (one row per domain hit)
df = result.to_dataframe()
# Or write straight to TSV (disk-backed results skip the DataFrame entirely)
result.to_csv("results.tsv")
# Iterate over hits lazily — works for both in-memory and disk-backed results
for hit in result:
print(hit.sequence_id, hit.hmm_name, hit.bitscore)
for dom in hit.domains:
print(f" {dom.env_from}-{dom.env_to} {dom.bitscore:.1f}")Other search modes follow the same pattern:
# hmmscan (sequences as queries against HMM DB)
result = aksha.scan("proteins.faa", "PFAM")
# Nucleotide search
result = aksha.nhmmer("genomes/", "rRNA_HMMs/")
# Protein-vs-protein (no HMMs needed)
result = aksha.phmmer("query.faa", "target.faa")
# Iterative search (builds HMM from hits each round)
result = aksha.jackhmmer("query.faa", "target.faa", max_iterations=5)Database management:
aksha.install_database("PFAM")
aksha.list_databases() # returns list of DatabaseInfo
aksha.register_custom_database( # bring your own HMMs
name="my_db",
path="/path/to/models.hmm",
molecule_type=aksha.MoleculeType.PROTEIN,
)- Tests:
pytest - Lint:
ruff check - Type check:
mypy
For deeper design notes and module-by-module behavior, see AKSHA_SPEC.md.