Visualizing ABFE Trajectories¶
This guide explains how to visualize molecular dynamics trajectories from Absolute Binding Free Energy (ABFE) simulations in Deep Origin.
Deprecated: Complex in examples
Older examples referenced a legacy Complex. Prefer the ABFE class directly for new code.
Overview¶
ABFE simulations generate molecular dynamics trajectories that show how ligands interact with proteins over time. Visualizing these trajectories can provide valuable insights into binding mechanisms, protein-ligand interactions, and conformational changes.
Use :meth:ABFE.show_trajectory <deeporigin.drug_discovery.abfe.ABFE.show_trajectory> on a completed execution. Each ABFE job is tied to one prepared system (one primary ligand leg), so you do not pass a separate ligand object: the execution already identifies the run.
Prerequisites¶
- A completed ABFE simulation run (
statusisSucceeded) PreparedSystemused for the run should include eithersystem_pdb_pathorbinding_xml_path(the latter is used to resolvesystem.pdbnext to the binding XML on the file store)- The Deep Origin Python package properly installed and configured
Visualizing trajectories¶
show_trajectory¶
The method loads the data-platform result row for this job (the same shape as client.results.get(compute_job_id=abfe.id)), reads remote file paths from that payload, downloads the structure (PDB) and trajectory (XTC), and opens a Mol* viewer in the notebook via :func:deeporigin.utils.notebook.render_html.
Steps
step value |
What is shown |
|---|---|
md |
Post-prep MD under tool-runs/<id>/protein/ligand/simple_md/.../_allatom_trajectory_40ps.xtc (path derived from binding/solvation trajectory paths in results). |
binding |
binding_analysis[*].trajectories["window_<n>"] — e.g. solute_trajectory_20ps.xtc per lambda window. |
solvation |
Same layout under solvation_analysis. |
Parameters
step:"md","binding", or"solvation".window: Lambda window index, starting at1. Used forbindingandsolvationonly; ignored formd.repeat: Which repeat block to use insidebinding_analysis/solvation_analysis(matches therepeatfield when present, otherwise 1-based index in the list).
Behind the scenes¶
- Sync execution status and require
Succeeded. - Fetch results with
compute_job_idset to the execution id. - Resolve the XTC path from the result
data(per step/window/repeat as above). - Resolve the system PDB from
PreparedSystem(system_pdb_path, ordirname(binding_xml_path)/system.pdb). - Download PDB and XTC (lazy skip if already cached under
~/.deeporigin/). - Render with
deeporigin_molstar.ProteinViewer.render_trajectoryand display in the notebook.
Examples¶
Assume abfe is an :class:~deeporigin.drug_discovery.abfe.ABFE instance that has finished successfully.
# Post-prep MD trajectory
abfe.show_trajectory(step="md")
# Binding leg, default window 1
abfe.show_trajectory(step="binding")
# Binding leg, window 5
abfe.show_trajectory(step="binding", window=5)
# Solvation leg, second repeat if present
abfe.show_trajectory(step="solvation", window=3, repeat=2)
If window is not present in the results trajectories map, the error lists the valid window indices.
Troubleshooting¶
- Ensure the ABFE run completed successfully (
Succeeded). - Ensure
PreparedSystem.system_pdb_pathorbinding_xml_pathis set so the viewer can load the topology. - For binding/solvation, use a
windowthat exists in the resultstrajectorieskeys (window_1, …). - Ensure you have disk space and network access for downloads into the local Deep Origin cache.
Additional resources¶
- ABFE tutorial
- ABFE reference (generated API docs)