Docking Analysis#
- mockdock.analysis.unroll_multiconf_rdkit_mols(rdkit_mols)[source]#
Split one RDKit mol with multiple conformers into one mol per conformer.
Meeko/Vina often returns a single mol with N conformers; RMSD and pose indices are defined per conformer. This must match the logic in filter_poses_by_rmsd so export uses the same pose ordering as scoring.
- mockdock.analysis.aggregate_results_per_id(df, score_col='docking_score', valid_col='valid_pose_found', activity_col='pchembl_value')[source]#
Aggregate results to one row per compound ID. Enforces RMSD first, then takes best score (fallback to best_any).
- class mockdock.analysis.DockingAnalyzer(reference_ligand_path=None, fragment_smiles=None, rmsd_threshold=2.0)[source]#
Bases:
objectPost-docking analysis: RMSD filtering, pose extraction, etc.
- Parameters:
- calculate_rmsd(probe_mol, conf_id=-1)[source]#
Calculate RMSD of the fragment between probe_mol and self.ref_mol.
Returns NaN when the reference match or coordinates are unavailable so that pose filtering does not treat the pose as passing (NaN < threshold is False).
- filter_poses_by_rmsd(pose_file, smiles)[source]#
Parse DLG or PDBQT, filter poses by RMSD if applicable.
- Returns:
- (best_valid_score, passed_constraint, best_valid_mol,
best_any_score, best_any_mol, best_valid_pose_index, best_any_pose_index)
- Parameters:
- Return type:
pose_index values are 0-based indices into the list returned by RDKitMolCreate.from_pdbqt_mol (after Vina multi-conformer unrolling). -1 indicates no pose was found.
- save_best_poses_sdf(output_path, results_df, df_metadata=None, id_col='id', score_col='docking_score', dlg_col='dlg_path')[source]#
Extract the best pose from each successful docking run and save to an SDF. Adds metadata from df_metadata if provided.
- Pose selection strategy:
Parse all poses from the DLG/PDBQT file.
If RMSD checking is available, prefer the lowest-energy pose that passes the fragment-RMSD threshold.
Fall back to the best-energy pose regardless of RMSD, so the SDF always contains an entry for every molecule in the top-N list.