Context
Astra's --write_macsyfinder flag produces hmmsearch output files named by the HMM internal NAME field (via hits.query.name), but MacSyFinder --previous-run expects filenames matching the HMM filename stem. For DefenseFinder, 182/1178 profiles have mismatched internal NAMEs vs filenames, causing MacSyFinder to re-run hmmsearch from scratch (hours on large datasets).
Fixes applied in local Astra (to port to Aksha)
1. write_macsyfinder_hit() filename mapping (NEW)
parse_hmms() now builds a {internal_name → filename_stem} mapping dict
- This mapping is threaded through
hmmsearch() to write_macsyfinder_hit()
- Output files use the filename stem instead of the internal NAME
- Safe fallback: if no mapping exists for a name, falls back to internal NAME
2. Previously applied fixes (already in local ~/astra/astra/search.py)
_write_macsyfinder_conf: db_type = ordered_replicon (was unordered)
write_macsyfinder_hit: open("a") with header-once guard (was open("w"), overwrote per-FASTA)
finalize_macsyfinder_files(): appends // end markers after all writes
main(): cleans hmmer_results/ before new run to avoid stale appends
initialize.py: GitHub API pagination (?per_page=1000 + Link header loop)
Why this matters
Without these fixes, MacSyFinder --previous-run silently falls back to running hmmsearch itself, which is orders of magnitude slower than Astra/PyHMMER. On DPANN (3.5M proteins, 1178 HMMs), this turns a ~5 minute job into a multi-hour job.
Affected databases
- DefenseFinder (182/1178 mismatched)
- TXSScan (not yet audited — likely similar issues)
- Any future HMM set where internal NAME ≠ filename
Context
Astra's
--write_macsyfinderflag produces hmmsearch output files named by the HMM internalNAMEfield (viahits.query.name), but MacSyFinder--previous-runexpects filenames matching the HMM filename stem. For DefenseFinder, 182/1178 profiles have mismatched internal NAMEs vs filenames, causing MacSyFinder to re-run hmmsearch from scratch (hours on large datasets).Fixes applied in local Astra (to port to Aksha)
1.
write_macsyfinder_hit()filename mapping (NEW)parse_hmms()now builds a{internal_name → filename_stem}mapping dicthmmsearch()towrite_macsyfinder_hit()2. Previously applied fixes (already in local
~/astra/astra/search.py)_write_macsyfinder_conf:db_type = ordered_replicon(wasunordered)write_macsyfinder_hit:open("a")with header-once guard (wasopen("w"), overwrote per-FASTA)finalize_macsyfinder_files(): appends//end markers after all writesmain(): cleanshmmer_results/before new run to avoid stale appendsinitialize.py: GitHub API pagination (?per_page=1000+ Link header loop)Why this matters
Without these fixes, MacSyFinder
--previous-runsilently falls back to running hmmsearch itself, which is orders of magnitude slower than Astra/PyHMMER. On DPANN (3.5M proteins, 1178 HMMs), this turns a ~5 minute job into a multi-hour job.Affected databases