Skip to main content
Documentation

Engine swap layer

OpenDDE is designed with a modular “engine swap” architecture. Each computational tool is accessed through a standardized adapter interface, making it easy to replace any engine without changing the rest of the system.

Why engine swapping?

Computational biology moves fast. New tools emerge regularly (Boltz-2, Chai-1, ESMFold). Rather than being locked into specific tools, OpenDDE lets you swap engines as better alternatives become available.

The adapter pattern

Each engine type defines an abstract interface:

# backend/engines/base.py
from abc import ABC, abstractmethod

class PocketEngine(ABC):
    @abstractmethod
    async def predict(self, structure_path: str) -> list[dict]:
        """Predict binding pockets from a structure file."""
        ...

class StructureEngine(ABC):
    @abstractmethod
    async def predict_complex(self, protein_seq: str, ligand_smiles: str) -> str:
        """Predict protein-ligand complex. Returns path to CIF file."""
        ...

class AntibodyEngine(ABC):
    @abstractmethod
    async def predict(self, heavy: str, light: str) -> str:
        """Predict antibody structure. Returns path to PDB file."""
        ...

Example: adding Boltz-2

To add a new structure prediction engine:

# backend/engines/boltz2.py
from .base import StructureEngine
import httpx

class Boltz2Engine(StructureEngine):
    def __init__(self, base_url: str = "http://boltz2:5004"):
        self.base_url = base_url

    async def predict_complex(self, protein_seq: str, ligand_smiles: str) -> str:
        async with httpx.AsyncClient() as client:
            resp = await client.post(
                f"{self.base_url}/predict",
                json={"sequence": protein_seq, "ligand": ligand_smiles}
            )
            return resp.json()["structure_path"]

Then update the dependency injection in the backend configuration to use the new engine. No router changes needed.

Current engines

FunctionCurrent enginePossible alternatives
Pocket predictionP2RankFPocket, DeepSite, SiteMap
Structure predictionAlphaFold 3Boltz-2, Chai-1, ESMFold
Antibody modelingImmuneBuilderABodyBuilder3, IgFold
CheminformaticsRDKitOpenBabel, CDK

Next: Microservices →