Skip to content

Add initial CLI test and exports - #29

Open
ShinThomas wants to merge 2 commits into
refactor-v2from
lverage-command-line
Open

ShinThomas wants to merge 2 commits into
refactor-v2from
lverage-command-line

Conversation

@ShinThomas

@ShinThomas ShinThomas commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Added a command-line interface for the pipeline.

Changes

  • Accept per-gene nucleotide FASTA files, local BLAST/Pfam databases, species mapping, and analysis settings.
  • Export results.tsv, unique candidate proteins in orfs.fasta, and run information in metadata.json.
  • Preserve BLAST identifiers and metrics, Pfam domains, domain-alignment identities, and motif results when available.
  • Retain below-threshold comparisons and partial results, with explicit statuses and diagnostics.
  • Continue processing subsequent genes after a gene fails.
  • Add --stop-after alignment for runs that intentionally exclude JASPAR.
  • Preserve the existing longest-first, single-ORF selection behavior.

Limitations

  • Live JASPAR execution was intentionally excluded.
  • BLAST and PfamScan executable versions currently appear as unknown in metadata (will be changed)
  • Metadata JSON also refers back to SCC which will be cleaned up
  • Documentation not yet built (will be filled in with next PR)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved issues can misreport reached stages, omit captured tool-error diagnostics, and cause quadratic export I/O and cubic selection work as runs grow.

4 open issues
What changed in this PR

Adds a command-line interface to the modular V2 pipeline, with evidence exports and per-gene failure handling while preserving longest-first, single-ORF selection.

Changes:

  • Accepts per-gene FASTA inputs, local database settings, and an alignment-only stopping option.
  • Exports results, unique candidate proteins, and run metadata while retaining partial evidence.
  • Adds regression tests and documents the V2 CLI separately from the legacy workflow.
File Description
tests/​v2/​test_pipeline.py Tests evidence retention, no-hit outcomes, and alignment-only runs.
tests/​v2/​test_local_blast.py Tests incremental retrieval evidence and distinct failure statuses.
tests/​v2/​test_cli.py Adds CLI export, validation, and failure-handling tests.
src/​lverage/​pipeline.py Emits incremental evidence and supports stopping after alignment.
src/​lverage/​ortholog_searcher.py Adds native hit identifiers to ortholog records.
src/​lverage/​evidence.py Introduces the per-run evidence collector.
src/​lverage/​cli.py Implements input validation, pipeline execution, and bundle exports.
src/​lverage/​blast.py Reports retrieval progress, diagnostics, and native identifiers.
README.md Introduces the V2 CLI and distinguishes legacy requirements.
pyproject.toml Registers the installed lverage command.
docs/​user_guide.rst Documents CLI inputs, outputs, options, and statuses.
docs/​api/​pipeline.rst Documents evidence collection and alignment-only execution.
docs/​api/​index.rst Points to CLI documentation while retaining module-level imports.
docs/​api/​blast.rst Documents incremental reporting and portable database setup.

Review effort: Balanced

Comment thread src/lverage/cli.py


def _redact_error(error):
text = re.sub(r"https?://[^\s]+", "<url-redacted>", str(error))
Comment thread src/lverage/cli.py
Comment on lines +349 to +351
self._write_results()
self._write_orfs()
self.flush_metadata()
Comment thread src/lverage/cli.py
Comment on lines +360 to +363
selected_by_gene = {
gene: any(status == "selected" for (event_gene, _), status in selection.items() if event_gene == gene)
for gene, _ in self.events
}
Comment thread src/lverage/cli.py

def _stage_completion_events(final_status, last_stage):
stages = ("orf", "query_pfam", "blast", "ortholog_pfam", "alignment", "motif")
last_index = stages.index(last_stage) if last_stage in stages else -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants