Prepared Protein stamp¶
Helpers that detect and preserve the file-borne Prepared Protein stamp on structure files.
| Format | Stamp |
|---|---|
| PDB | REMARK 99 DO_PREPARED |
| mmCIF | _deeporigin.prepared DO_PREPARED |
Protein Prep writes this stamp onto the prepared structure before upload. Downstream tools (Pocket Finder, Docking, System Prep) skip automatic protein cleanup when the stamp is present. The CLI must not drop it when rewriting or syncing a protein that already points at a stamped remote file.
Marking a protein as prepared¶
If you prepare a protein outside Deep Origin and want downstream tools to treat
it as already prepared, stamp the on-disk file with
Protein.mark_as_prepared():
from deeporigin.drug_discovery import Protein
protein = Protein.from_file("my_prepared.cif") # or .pdb
protein.mark_as_prepared() # mutates the local file in its native format
protein.sync() # uploads the stamped bytes to UFA
mark_as_prepared() never converts CIF to PDB (or vice versa). Prefer platform
Protein Prep when you want Deep Origin to prepare the
structure for you.
Client to_pdb() / to_cif() translate the stamp across formats when the
source was stamped. External converters (for example PyMOL “save as”) may still
drop it — re-run mark_as_prepared() on the saved file if needed.
Toolbox AUTO cleanup for stamped mmCIF is rolled out separately; stamped PDBs are already honoured.
Prepared Protein stamp: file-borne DO_PREPARED token for PDB and mmCIF.
Mirrors the platform-toolbox stamp helper so the CLI can detect and preserve
the stamp without depending on toolbox_core. Downstream Pocket Finder,
Docking, and System Prep skip AUTO protein cleanup when the token is present.
PDB uses REMARK 99 DO_PREPARED. mmCIF uses
_deeporigin.prepared DO_PREPARED (a private data item — not a PDB
REMARK line embedded in CIF text).
Functions:¶
has_prepared_protein_stamp
¶
has_prepared_protein_stamp(path: str | Path) -> bool
Return True if the file carries a Prepared Protein stamp for its format.
PDB/.pdb files use the REMARK 99 token. CIF/.cif / .mmcif files
use _deeporigin.prepared. When the suffix is ambiguous, sniff the
contents (data_ ⇒ CIF, otherwise PDB).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Local structure file path to inspect. |
required |
stamp_prepared_protein
¶
stamp_prepared_protein(path: str | Path) -> None
Stamp a structure file in its native format (PDB or mmCIF).
Dispatches on file extension (and content sniff when needed). Never converts CIF to PDB or vice versa.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Local PDB or mmCIF path to stamp. |
required |
Raises:
| Type | Description |
|---|---|
OSError
|
If the file cannot be read or written. |
FileNotFoundError
|
If path does not exist. |
ValueError
|
If the format cannot be determined. |
stamp_prepared_protein_cif
¶
stamp_prepared_protein_cif(path: str | Path) -> None
Insert the canonical mmCIF Prepared Protein stamp if not already present.
Inserts _deeporigin.prepared DO_PREPARED immediately after the first
data_ line when present, otherwise at the start of the file. Does not
rewrite atom sites. Idempotent when the CIF stamp is already present.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Local mmCIF path to stamp. |
required |
Raises:
| Type | Description |
|---|---|
OSError
|
If the file cannot be read or written. |
FileNotFoundError
|
If path does not exist. |
stamp_prepared_protein_pdb
¶
stamp_prepared_protein_pdb(path: str | Path) -> None
Prepend the canonical Prepared Protein PDB stamp if not already present.
Uses a text prepend, not a structure rewrite, so ATOM/HETATM bytes are unchanged. Idempotent when a PDB stamp is already present.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Local PDB path to stamp. |
required |
Raises:
| Type | Description |
|---|---|
OSError
|
If the file cannot be read or written. |
FileNotFoundError
|
If path does not exist. |
text_has_prepared_protein_cif_stamp
¶
text_has_prepared_protein_cif_stamp(text: str) -> bool
Return True if the canonical mmCIF Prepared Protein stamp is present.
Matches _deeporigin.prepared with value DO_PREPARED. Does not treat
PDB-style REMARK 99 DO_PREPARED text inside CIF as prepared.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
mmCIF file contents as text. |
required |
text_has_prepared_protein_stamp
¶
text_has_prepared_protein_stamp(text: str) -> bool
Return True if a REMARK 99 DO_PREPARED token appears before ATOM/HETATM.
Whitespace around the remark number is lenient so a one-space rewrite still matches. The writer always emits the canonical two-space line.
This is PDB-only. Accidental REMARK text inside an mmCIF file must not be
treated as prepared — use :func:text_has_prepared_protein_cif_stamp for
CIF.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
PDB file contents as text. |
required |