OCDocker.OCScore.Utils.RawModelingInput module

Load and validate raw unreduced OCScore modeling inputs.

Training must start from pipeline-wide tables before any data-dependent feature cleaning, selection, or reduction. Precomputed global reduction artifacts are rejected for training.

class OCDocker.OCScore.Utils.RawModelingInput.RawModelingInput(merged, pdbbind_source, dudez_source, merged_source, pdbbind_hash, dudez_hash, merged_hash, artifact_paths=<factory>)[source]

Bases: object

Validated raw wide tables for staged OCScore training.

Parameters:
  • merged (pd.DataFrame) – Aligned raw PDBbind+DUDEz wide table.

  • pdbbind_source (str | None) – Source path when separate raw PDBbind input was supplied.

  • dudez_source (str | None) – Source path when separate raw DUDEz input was supplied.

  • merged_source (str | None) – Source path when a merged raw CSV was supplied directly.

  • pdbbind_hash (str | None) – Content hash of the raw PDBbind source file, if applicable.

  • dudez_hash (str | None) – Content hash of the raw DUDEz source file, if applicable.

  • merged_hash (str) – Content hash of the merged raw table or composite hash for separate inputs.

  • artifact_paths (dict[str, str]) – Resolved filesystem paths for provenance logging.

merged: DataFrame
pdbbind_source: str | None
dudez_source: str | None
merged_source: str | None
pdbbind_hash: str | None
dudez_hash: str | None
merged_hash: str
artifact_paths: dict[str, str]
OCDocker.OCScore.Utils.RawModelingInput.align_and_concatenate_inputs(pdbbind_df, dudez_df)[source]

Align raw PDBbind and DUDEz tables to a shared column schema and concatenate.

Parameters:
  • pdbbind_df (pd.DataFrame) – Prepared raw PDBbind table.

  • dudez_df (pd.DataFrame) – Prepared raw DUDEz table.

Returns:

Wide merged table with union-of-columns alignment and NaN padding.

Return type:

pd.DataFrame

OCDocker.OCScore.Utils.RawModelingInput.discover_raw_modeling_input_columns(*, merged_input=None, pdbbind_input=None, dudez_input=None, raw_input_dir=None)[source]

Discover modeling column names from CSV headers without loading rows.

Parameters:
  • merged_input (str or pathlib.Path, optional) – Path to a merged raw unreduced CSV.

  • pdbbind_input (str or pathlib.Path, optional) – Path to a raw unreduced PDBbind pipeline CSV or archive.

  • dudez_input (str or pathlib.Path, optional) – Path to a raw unreduced DUDEz pipeline CSV or archive.

  • raw_input_dir (str or pathlib.Path, optional) – Directory containing merged_input_dataset.csv or separate raw tables.

Returns:

PDBbind/DUDEz column lists and resolved provenance paths.

Return type:

tuple[dict[str, list[str] | None], dict[str, str]]

OCDocker.OCScore.Utils.RawModelingInput.load_raw_modeling_input(*, merged_input=None, pdbbind_input=None, dudez_input=None, raw_input_dir=None)[source]

Load raw unreduced modeling inputs from merged and/or separate pipeline tables.

Exactly one input mode must be supplied:

  • merged_input

  • pdbbind_input + dudez_input

  • raw_input_dir containing merged or separate raw CSVs

Parameters:
  • merged_input (str or pathlib.Path, optional) – Path to a merged raw unreduced CSV.

  • pdbbind_input (str or pathlib.Path, optional) – Path to a raw unreduced PDBbind pipeline CSV or archive.

  • dudez_input (str or pathlib.Path, optional) – Path to a raw unreduced DUDEz pipeline CSV or archive.

  • raw_input_dir (str or pathlib.Path, optional) – Directory containing merged_input_dataset.csv or separate raw tables.

Returns:

Validated raw modeling input with content hashes and provenance paths.

Return type:

RawModelingInput

Raises:
  • ValueError – If input modes are ambiguous, forbidden artifacts are present, or schema checks fail.

  • FileNotFoundError – If raw_input_dir does not contain the required raw tables.

OCDocker.OCScore.Utils.RawModelingInput.reject_precomputed_training_artifacts(source)[source]

Fail when a path contains global/precomputed reduction training artifacts.

Parameters:

source (pathlib.Path) – Directory to inspect for forbidden training artifacts.

Raises:

ValueError – If any forbidden precomputed reduction artifact is present.

Return type:

None

OCDocker.OCScore.Utils.RawModelingInput.validate_raw_schema(pdbbind, dudez)[source]

Run schema-only checks allowed before train/validation/test splitting.

Parameters:
  • pdbbind (pd.DataFrame) – Prepared raw PDBbind table.

  • dudez (pd.DataFrame) – Prepared raw DUDEz table.

Raises:

ValueError – If required columns are missing or duplicate column names are present.

Return type:

None

OCDocker.OCScore.Utils.RawModelingInput.write_prepare_manifest(output_dir, payload)[source]

Write prepare_manifest.json to output_dir.

Parameters:
  • output_dir (str or pathlib.Path) – Directory where the manifest is written.

  • payload (dict[str, Any]) – JSON-serializable prepare-stage metadata.

Returns:

Path to the written manifest file.

Return type:

pathlib.Path