report
Report final members of every refinement cluster using session metadata.
refinement_report(session_dir, refine_run_id=None, top=1, *, group_by_structure=True)
¶
Report the best final members of every cluster for each fitted input.
By default, select the best N final-stage members from every cluster, independently for each fitted input and refinement run, using CAPRI's model-cluster_ranking. The generated workflow clusters every final model, including isolated models in single-member clusters. With --no-group-by-structure, select the best N models overall across all fitted inputs and selected refinement runs. Rank by refined_score ascending and keep the usual report order for score ties. Reporting does not change the workflow's top_clusters or top_models options.
Include UniProt accessions, fitted rank, source and refinement run IDs, cluster summaries, and individual model scores in separate columns. All file paths and refine_run_dir are prefixed with session_dir. Relative session paths remain relative to the current working directory; absolute session paths remain absolute. Model paths reference compressed PDBs produced by HADDOCK cleanup with clean = True.
Require powerfit/fitted_models.csv and powerfit/fittable_structures.csv to contain data rows matching each refined input. Discover final results directly in refinement/8_caprieval and join PowerFit CSVs in memory. Read recorded refinement runs from RO-Crate and input mappings from refine/*/io.csv. No persistent database is needed.
Run the report after all refinement runs have completed, including baseline scoring. The CLI writes CSV to stdout or the --output path. Use --refine-run-id to select one refinement run, independently of the source PowerFit run.
Report columns and their sources (CAPRI files are in each model run's last caprieval directory):
- refine_run_id: refinement ID from the refine/{refine_run_id} directory name.
- powerfit_run_id: source fitting ID from the next directory component.
- structure: source structure directory name, joined to powerfit/fittable_structures.csv column structure.
- fitted_rank: powerfit/fitted_models.csv column rank, matched through its fitted_model_file column.
- uniprot_accessions: powerfit/fittable_structures.csv column uniprot_accessions, joined by structure; accessions are colon-separated.
- cluster_id: capri_ss.tsv column cluster_id.
- cluster_rank: capri_clt.tsv column cluster_rank.
- population: capri_clt.tsv column n, before report member selection.
- under_eval: capri_clt.tsv column under_eval.
- cluster_score: capri_clt.tsv column score.
- cluster_score_std: capri_clt.tsv column score_std.
- modelcluster_ranking: capri_ss.tsv column modelcluster_ranking.
- refined_score: capri_ss.tsv column score.
- unrefined_score: HADDOCK score of unrefined structure and the known structure.
- before_cc, after_cc: fixed-coordinate PowerFit CC before and after refinement.
- cc_change: after_cc minus before_cc.
- before_fishz, after_fishz: PowerFit Fisher z before and after refinement.
- before_relative_z, after_relative_z: PowerFit relative z before and after refinement. PowerFit scores are read from each model run's powerfit-recscores.csv.
- density: path to the density map used to fit the model; empty when it was not recorded.
- unrefined_fitted_model: path to the fitted model before refinement.
- original_known_structure: path to the supplied known structure before chain removal or renaming.
- refined_complex: path to the refined complex containing both the fitted and known structures.
- refined_fitted_structure: path to the fitted structure after refinement, extracted from the refined complex.
- refined_known_structure: path to the known structure after refinement, with its original chain identifiers and residue numbers restored.
- refine_run_dir: model run directory containing baseline and refinement/8_caprieval, discovered as refine/{refine_run_id}/{powerfit_run_id}/{structure}/{fitted_model_name}.
Cluster summary columns are joined from capri_clt.tsv using cluster_id within the same model run, and are repeated for each selected member. Missing values are empty in CSV except cluster_id, which is '-'.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
session_dir
|
Path
|
Session directory containing refinement results and PowerFit metadata. |
required |
refine_run_id
|
str | None
|
Independent refinement run to select; defaults to all runs. |
None
|
top
|
int
|
Positive number of best members per cluster, or overall when grouping is disabled. |
1
|
group_by_structure
|
bool
|
Keep selection per fitted input and cluster when True; select the best models overall when False. |
True
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Member report DataFrame with paths prefixed with the supplied session_dir. |
DataFrame
|
Model paths reference compressed PDBs produced by HADDOCK cleanup. |
DataFrame
|
Model and cluster summary scores are kept in separate columns. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
A required PowerFit CSV is missing. |
ValueError
|
top is not positive, the requested refinement run is unknown. |