Skip to content

[ENH] Add minimal AptaMCTS pipeline (MCTS-based aptamer recommendation)#525

Open
kris70lesgo wants to merge 3 commits into
gc-os-ai:mainfrom
kris70lesgo:feat/aptamcts-minimal
Open

[ENH] Add minimal AptaMCTS pipeline (MCTS-based aptamer recommendation)#525
kris70lesgo wants to merge 3 commits into
gc-os-ai:mainfrom
kris70lesgo:feat/aptamcts-minimal

Conversation

@kris70lesgo

Copy link
Copy Markdown

Reference Issues/PRs

Fixes #21


What does this implement/fix? Explain your changes.

This PR adds a minimal implementation of AptaMCTS, an aptamer recommendation pipeline that combines a scoring model with the existing Monte Carlo Tree Search (MCTS) algorithm.

Key additions:

  • AptaMCTSPipeline: inference-first pipeline with predict() and recommend() methods
  • AptamerEvalAptaMCTS: experiment adapter bridging the pipeline with MCTS via evaluate()
  • Minimal feature encoder in utils: placeholder iCTF-style encoding (pairs_to_features)
  • Integration with existing MCTS without modifying its implementation

The pipeline follows the AptaTrans-style design:

  • Uses MCTS through experiment.evaluate() only
  • Does not require training inside the pipeline
  • Assumes a pre-trained model exposing predict_proba()

What should a reviewer concentrate their feedback on?

  • Correctness of MCTS integration via experiment adapter
  • API consistency with AptaTrans (predict, recommend)
  • Output format of recommend() (candidate, sequence, score)
  • Placement and minimal design of preprocessing in utils
  • Overall alignment with repository architecture (no MCTS modifications)

Did you add any tests for the change?

Yes.

Added focused tests covering:

  • predict() returns correct type (np.float64) and uses predict_proba
  • recommend() output structure and MCTS integration
  • AptamerEvalAptaMCTS.evaluate() correctness
  • Edge cases (invalid inputs, model validation)

All tests pass successfully.


Any other comments?

  • The current feature encoding is a minimal placeholder, not a full iCTF implementation, as no reference implementation exists in the repository.
  • This is intended to enable integration and can be extended in future work.
  • MCTS implementation remains unchanged.

PR checklist

  • The PR title starts with [ENH]
  • Added/modified tests
  • Used pre-commit hooks when committing to ensure that code is compliant with hooks

@NennoMP NennoMP self-requested a review April 26, 2026 17:12

@NennoMP NennoMP left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The issue specifically mentions to look at AptaNet interface (quoting myself I would expect a very similar interface to that of AptaNet) rather than AptaTrans. Indeed, I don't see methods such as fit or predict_proba. AptaTrans was mentioned purely in terms of compatibility w.r.t. MCTS.

Comment thread pyaptamer/aptamcts/_pipeline.py Outdated
from pyaptamer.utils._aptamcts_utils import pairs_to_features


class AptaMCTSPipeline:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Interface is not in line with AptaNet, please look carefully at the description.

from pyaptamer.experiments._aptamer import BaseAptamerEval


class AptamerEvalAptaMCTS(BaseAptamerEval):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Once the interface is similar to AptaNet as specified in the issue, this could easily be one single class that works for both AptaMCTS and AptaNet, since we expect a very similar interface.

@kris70lesgo kris70lesgo force-pushed the feat/aptamcts-minimal branch from 574d814 to 4ab7bcd Compare April 28, 2026 07:06
@kris70lesgo kris70lesgo force-pushed the feat/aptamcts-minimal branch from db039ff to 303a07f Compare April 28, 2026 12:22
@kris70lesgo

kris70lesgo commented Apr 28, 2026

Copy link
Copy Markdown
Author

@NennoMP Thanks for the review

  • I’ve refactored the AptaMCTS pipeline to align with the AptaNet interface:
  • Added fit, predict_proba, and predict methods
  • Updated the experiment adapter to use predict_proba on (aptamer, target) pairs
  • Ensured compatibility with MCTS via experiment.evaluate
  • Updated tests accordingly

Would appreciate another review

@NennoMP

NennoMP commented May 5, 2026

Copy link
Copy Markdown
Collaborator

I don't see a module in line with what _feature_classifier.py does for AptaNet, i.e. defining a classifier and regressor.

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.

Clean implementation of AptaMCTS

2 participants