Skip to content

feat(drug-discovery): unify ProteinPrep with Target Preparation 2.0 - #626

Open
sg-s wants to merge 9 commits into
mainfrom
structure-report-polish
Open

sg-s wants to merge 9 commits into
mainfrom
structure-report-polish

Conversation

@sg-s

@sg-s sg-s commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR drifted from Structure Report / Protein Prep polish into the locked one-class preparation contract paired with Target Preparation 2.0 (DDOS-7091).

  • Keep ProteinPrep + StructureReport as the public surface; do not ship a public TargetPrep.
  • Add nested PocketFinderConfig; optional pocket on ProteinPrep.
  • Routing:
    • recommend() → always deeporigin.protein-prep
    • loops off + no pocket → deeporigin.protein-prep (run())
    • loops on or pocket set → deeporigin.target-preparation v2 (start() / quote / confirm())
  • get_results() → prepared Protein for either Tool key.
  • Composite getters: get_report() / get_pockets() (raise if excluded; None if pending; [] for valid zero-pocket).
  • Dual-key from_id / list / from_last_run; pin Target Preparation major 2.
  • Docs/CONTEXT updated; draft TargetPrep API removed from the product surface.
  • Also includes earlier pocket-finder notebook / Structure Report polish on this branch.

Depends on platform-toolbox Target Preparation 2.0.0 registration on the environment under test (toolbox PR #1016).

Jira: DDOS-7091

Test plan

  • uv run pytest --env local -x tests/test_protein_prep.py (routing, getters, quote)
  • Mock server action-less target-preparation 2.0 payloads
  • Against dev after TP 2.0.0 is registered: loops-on/no-pocket and loops-off/with-pocket via ProteinPrep
  • Quote/confirm for pocket-bearing runs; verify get_report / get_pockets
  • Promote ProteinPrep demo notebook via scripts/notebooks.sh if dirty notebook is refreshed

@sg-s
sg-s requested a lite review from Copilot September 3, 2026 18:16
@sg-s sg-s self-assigned this Sep 3, 2026
@sg-s
sg-s requested a review from a team as a code owner September 3, 2026 18:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR tightens result retrieval across drug-discovery execution types by consistently scoping result-explorer queries to the producing tool’s tool_key, and improves interactive usability of Structure Report results via richer representations.

Changes:

  • Add tool_key scoping to client.results.get(...) calls across Execution.get_results and several tool-specific workflows (Protein Prep, ABFE, Metabolism).
  • Add interactive-friendly __repr__ and _repr_html_ to StructureReportResult, with tests asserting output shape.
  • Update the Protein Prep notebook content and extend Copilot guidance to codify the tool_key filtering expectation.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/drug_discovery/execution.py Injects a default tool_key filter into get_results() calls to avoid cross-tool result mixing.
src/drug_discovery/protein_prep.py Scopes prepared-protein result lookup to the Protein Prep tool’s tool_key.
src/drug_discovery/metabolism.py Scopes ligand-id result queries to the Metabolism tool’s tool_key.
src/drug_discovery/abfe.py Scopes ABFE visualization/result lookups to the ABFE tool’s tool_key.
src/drug_discovery/structure_report.py Adds concise __repr__ and rich HTML rendering for StructureReportResult.
tests/test_executions.py Adds unit tests asserting Execution.get_results() tool_key scoping behavior.
tests/test_structure_report.py Adds assertions for StructureReportResult text/HTML representations.
docs/notebooks/clean/protein-prep.ipynb Expands the notebook to include Structure Report usage and updates Protein Prep flow examples.
.github/copilot-instructions.md Documents the project expectation to include tool_key filters when the producing tool is known.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread docs/notebooks/clean/protein-prep.ipynb Outdated
Comment on lines +34 to +38
"from deeporigin.drug_discovery import BRD_DATA_DIR, Protein, ProteinPrep, StructureReport\n",
"from deeporigin.platform import DeepOriginClient\n",
"\n",
"client = DeepOriginClient.from_disk()\n",
"protein = Protein.from_file(BRD_DATA_DIR / \"brd.pdb\")"
"client"
Comment on lines +786 to +790
request_kwargs = dict(kwargs)
if self.tool_key:
filter_dict = dict(request_kwargs.get("filter_dict") or {})
filter_dict.setdefault("tool_key", {"eq": self.tool_key})
request_kwargs["filter_dict"] = filter_dict
Make ProteinPrep the sole preparation session: nested PocketFinderConfig,
route loops-on/pocket runs to deeporigin.target-preparation v2, keep
recommend and light prepare on protein-prep, and expose get_report /
get_pockets with dual-key history. Drop the draft TargetPrep public API.
@sg-s sg-s changed the title fix: more protein prep fixes feat(drug-discovery): unify ProteinPrep with Target Preparation 2.0 Sep 9, 2026
Emit find_pockets instead of nested pocket for target-preparation and
protein-prep 8.0.0, route loops-off crystal pockets through direct
protein-prep, and reject define-by-selection on the composite path.
@sg-s

sg-s commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator Author

Stacked the flat find_pockets contract work here (was briefly opened as #635 by mistake). Depends on platform-toolbox https://github.com/deeporiginbio/platform-toolbox/pull/1053 (protein-prep 8.0.0 / target-preparation 7.0.0).

Remove Protein.register(); sync stages files and calls served
import-dataset. Mock server register_protein updates the canonical protein row.
@sg-s

sg-s commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator Author

Latest commit on this branch: Protein.sync() now stages to UFA and calls served import-dataset register_protein (entities API; Protein.register() removed).

Companion toolbox PR: will link after creation — search feat/protein-entity-import-dataset on platform-toolbox.

@sg-s

sg-s commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator Author

…ataset plumbing runs

Fail closed without a resolved project, stamp projectId on the execution, and
set visibility=hidden so register_protein/register_pose do not clutter Activity.
Pin import-dataset tool version to major 2.
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