meta
Create a DuckDB database from the session directory, including all CSV files and the RO-Crate metadata.
DDLStatement = tuple[str, DDLParameters]
module-attribute
¶
SQL DDL statement and named parameters (use $ prefix in SQL) to be passed to DuckDB connection.execute()
DDLParameters = dict[str, str | list[str] | None]
¶
Named DuckDB parameters; None binds as SQL NULL.
create_meta_duckdb(session_dir)
¶
Generate a DuckDB metadata database for a Protein Detective session.
Filesystem paths are relative to the session directory. Raw CAPRI model
values retain their source meaning; use refined_fitted_structure and
refined_known_structure for reconstructed partners.
Recorded commands and other provenance text retain their original values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_dir
|
Annotated[Path, Parameter(validator=Path(file_okay=False, dir_okay=True, exists=True))]
|
Session directory containing the files to include. |
required |
execute_ddl_statements(con, statements)
¶
Execute parameterized DDL statements in order.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
con
|
DuckDBPyConnection
|
DuckDB connection on which to execute the statements. |
required |
statements
|
list[DDLStatement]
|
SQL statements paired with their named parameters. |
required |
Raises:
| Type | Description |
|---|---|
ExecuteError
|
A statement fails; includes its SQL and parameters. |
powerfit_metadata_as_duckdb_ddl(session_dir)
¶
Load existing fitting indexes for metadata joins and refinement reporting.
powerfit_runs_as_duckdb_ddl(session_dir)
¶
Load fitting run identities, explicit provenance targets and options.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_dir
|
Path
|
Session directory containing workflow files and provenance. |
required |
Returns:
| Type | Description |
|---|---|
list[DDLStatement]
|
Statements creating and populating |
list[DDLStatement]
|
and existing run directories. Unrecorded directories have null provenance |
list[DDLStatement]
|
fields. Returns an empty list when neither recorded runs nor run |
list[DDLStatement]
|
directories exist. |
refinement_run_io_paths(session_dir, refine_run_id=None)
¶
Find paths to refinement run IO mapping files.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_dir
|
Path
|
Session directory containing refinement runs. |
required |
refine_run_id
|
str | None
|
Run to select; when omitted, include all runs. |
None
|
Returns:
| Type | Description |
|---|---|
list[Path]
|
Matching per-run IO indexes, ordered by path; empty if no runs exist. |
refinement_runs_query(session_dir)
¶
Select recorded refinement runs and both known partner paths from IO indexes.
refinements_io_as_duckdb_ddl(session_dir)
¶
Build the statements that load refinement input/output mappings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_dir
|
Path
|
Session directory containing refinement runs. |
required |
Returns:
| Type | Description |
|---|---|
list[DDLStatement]
|
SQL statements and bound parameters for creating refinements_io from |
list[DDLStatement]
|
matching run indexes; empty if no indexes exist. |
refinements_powerfit_rescores_as_duckdb_ddl(session_dir)
¶
Load before/after fixed-coordinate PowerFit scores for each refined member.
refinements_runs_as_duckdb_ddl(session_dir)
¶
Join refinement IO indexes with recorded command options.