Skip to content

deeporigin.drug_discovery.protein_prep

ProteinPrep drives platform tool deeporigin.protein-prep. Recommend inventories components, returns a RecommendationView table, and updates the same object with an editable Selection. Prepare applies resolved keep/skip decisions and cleans the structure. run() is loops-off and blocking; start() submits asynchronous prepare with loop modelling either off or on. There is no quote.

Recommend settings and prepare a protein with one mutable configuration.

Protein Prep uses two platform operations behind one user-facing object:

  1. action="recommend" inventories chains, ligands, cofactors, and waters.
  2. action="prepare" applies a digest-bound Selection, then runs loop modelling (unless model_missing_loops=False) and protonation.

Usage::

prep = ProteinPrep(protein)
prep.recommend()
prep.keep(kind="water")
prep.skip(decision="review")
prep.model_missing_loops = False
prepared = prep.run()

Attributes

ProteinPrepAction module-attribute

ProteinPrepAction = Literal['recommend', 'prepare']

Classes

ProteinPrep

Bases: Execution, SyncExecutableMixin, AsyncExecutableMixin, NotebookWatchMixin

Recommend settings and prepare a protein.

:meth:recommend blocks, updates :attr:recommendation and :attr:selection, and deliberately leaves :attr:id unset. Resolve review decisions with :meth:keep and :meth:skip, then call :meth:run for blocking loops-off preparation or :meth:start for asynchronous preparation.

A prepare submission binds the object to its durable execution. Once :attr:id is set, configuration is permanently frozen.

Attributes:

Name Type Description
protein Protein

Constructor-only input protein structure.

pdb_id str | None

Mutable 4-character PDB ID for loop-modelling templates.

selection dict[str, Any] | None

Editable keep/review/skip map. Reads return a copy.

recommendation RecommendationView | None

Callable Component table, or None before recommend. Analyzer payload is :attr:RecommendationView.raw.

model_missing_loops bool

Whether prepare models missing loops.

Attributes

model_missing_loops property writable
model_missing_loops: bool

Whether prepare will run loop modelling (unused for recommend).

pdb_id property writable
pdb_id: str | None

4-character PDB ID used for loop-modelling templates, if set.

protein property
protein: Protein

Constructor-only protein used for recommendation and preparation.

recommendation property
recommendation: RecommendationView | None

Callable Component table, or None when analyzer evidence is missing.

selection property writable
selection: dict[str, Any] | None

Editable Selection copy, or None before recommendation.

tool_key class-attribute instance-attribute
tool_key: str = TOOL_KEYS_AND_VERSIONS["protein_prep"][
    "tool_key"
]
tool_version instance-attribute
tool_version = tool_version

Methods:

from_dto classmethod
from_dto(
    dto: dict[str, Any],
    *,
    client: DeepOriginClient | None = None
) -> Self

Construct a ProteinPrep from a tools execution DTO.

Rehydrates historical recommendation and preparation executions while keeping their operation kind private.

Parameters:

Name Type Description Default
dto dict[str, Any]

Execution payload (same shape as client.executions.get).

required
client DeepOriginClient | None

Optional API client. Uses the default if not provided.

None

Returns:

Type Description
Self

A ProteinPrep with id, lifecycle fields, and domain inputs

Self

set.

Raises:

Type Description
ValueError

If stored inputs are missing protein or use an unknown action.

get_results
get_results(dto: dict[str, Any] | None = None) -> Protein

Load the prepared protein as an in-memory :class:Protein.

Tries result-explorer rows for this execution (result_type=preparedprotein), then jobOutputs.protein. Does not PATCH or create a proteins-table record; the returned Protein has id is None and remote_path set to the prepared PDB.

Parameters:

Name Type Description Default
dto dict[str, Any] | None

Optional execution payload. Passing it avoids an extra GET when the result-explorer path fails but jobOutputs is already in hand.

None

Returns:

Type Description
Protein

An in-memory :class:Protein for the prepared structure.

Raises:

Type Description
ValueError

If :attr:id is unset.

DeepOriginException

If this was a recommend run, or no prepared PDB path could be loaded.

keep
keep(
    component_ids: (
        str | Iterable[str] | DataFrame | None
    ) = None,
    *,
    kind: str | None = None,
    subtype: str | None = None,
    decision: str | None = None
) -> Self

Mark matching Selection components to keep.

Pass ids (a string, iterable, or DataFrame id column) or keyword matchers, not both. kind="water" is equivalent to passing every water component id.

Parameters:

Name Type Description Default
component_ids str | Iterable[str] | DataFrame | None

Component ids to keep.

None
kind str | None

Keep every Component of this kind.

None
subtype str | None

Keep every Component of this subtype.

None
decision str | None

Keep every Component with this live Decision.

None

Returns:

Name Type Description
This Self

class:ProteinPrep (for chaining).

recommend
recommend() -> RecommendationView

Recommend settings into this object without binding an execution ID.

The platform operation is synchronous and persisted by the backend, but its execution ID is deliberately not copied onto this object. Repeated calls atomically replace :attr:recommendation and :attr:selection only after a complete recommendation is available.

Returns:

Name Type Description
The RecommendationView

class:RecommendationView table for this inventory.

Raises:

Type Description
AttributeError

If this object is already bound to prepare.

DeepOriginException

If recommendation output is unavailable.

run
run() -> Protein

Execute loops-off prepare synchronously (blocking).

Only valid when :attr:model_missing_loops is False.

Returns:

Type Description
Protein

An in-memory prepared :class:Protein.

Raises:

Type Description
ValueError

If already submitted or this is not loops-off prepare.

DeepOriginException

If no prepared PDB path could be loaded.

skip
skip(
    component_ids: (
        str | Iterable[str] | DataFrame | None
    ) = None,
    *,
    kind: str | None = None,
    subtype: str | None = None,
    decision: str | None = None
) -> Self

Mark matching Selection components to skip.

Same calling styles as :meth:keep.

Parameters:

Name Type Description Default
component_ids str | Iterable[str] | DataFrame | None

Component ids to skip.

None
kind str | None

Skip every Component of this kind.

None
subtype str | None

Skip every Component of this subtype.

None
decision str | None

Skip every Component with this live Decision.

None

Returns:

Name Type Description
This Self

class:ProteinPrep (for chaining).

start
start() -> None

Submit preparation asynchronously and bind this object to it.

Raises:

Type Description
ValueError

If already submitted or settings cannot prepare.

RecommendationView

Callable notebook table of Protein Prep Components.

Uncalled, Jupyter displays the full inventory. Calling AND-filters rows and returns a :class:~pandas.DataFrame. Live Selection Decisions are read from the parent :class:ProteinPrep on each access.

Attributes:

Name Type Description
raw dict[str, Any]

Deep copy of the analyzer recommendation payload.

Attributes

raw property
raw: dict[str, Any]

Deep copy of the analyzer recommendation payload.