Skip to content

Commit 2b6042c

Browse files
authored
Add static and live dashboard outputs (#30)
* Add static and live dashboard outputs * Launch live dashboard from workflow commands * Fix dashboard output path resolution
1 parent 18ff2f8 commit 2b6042c

59 files changed

Lines changed: 8341 additions & 72 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
- Explore a protein's full dynamics with a single command, covering setup, simulation, analysis, and reporting
2323
- Probe protein-ligand binding automatically with analyses for pose stability, contacts, and protein-ligand hydrogen bonds
2424
- Reach beyond plain MD with built-in PLUMED enhanced sampling (metadynamics, umbrella sampling, steered MD) and a full analysis suite that turns trajectories into slide-ready, publication-quality figures
25+
- Highlight user-defined residue regions on RMSF report figures for loops, helices, active-site neighborhoods, or other known intervals
2526
- Scale from a quick single-protein exploration to large-scale parallel campaigns, driven the same way from the CLI or the Python API
2627

2728
## Phases of FastMDXplora
@@ -416,7 +417,7 @@ Each phase writes to a dedicated subdirectory under the project output root, wit
416417
| `setup` | `prepared.pdb`, `solvated.pdb`, `setup_parameters.json` |
417418
| `simulation` | `production.dcd`, `topology.pdb`, `simulation_parameters.json` |
418419
| `analysis` | `<analysis>/*.dat`, `<analysis>/*.png`, `analysis_manifest.json` |
419-
| `report` | `report.md`, `slides.pptx`, `project_bundle.zip` |
420+
| `report` | `report.md`, `dashboard.html`, `slides.pptx`, `project_bundle.zip` |
420421

421422
## Documentation
422423

docs/configuration.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ analysis:
4242
report:
4343
title: "My study"
4444
slides: true
45+
region_highlights:
46+
- label: "example region 1"
47+
start: 3
48+
end: 7
49+
color: "#4E79A7"
4550
```
4651
4752
## Protein-ligand studies
@@ -78,4 +83,12 @@ keys:
7883
- **analysis**: `scope`, `selection`, `include`, `exclude`, `stride`,
7984
`first`, `last`, `options`.
8085
- **report**: `title`, `author`, `document`, `slides`, `bundle`,
81-
`include_methods`, `include_reproducibility`, `comparison`.
86+
`include_methods`, `include_reproducibility`, `region_highlights`,
87+
`comparison`.
88+
89+
See [Region highlight figures](region_highlights.md) for RMSF-specific
90+
residue-region highlight examples and output paths.
91+
92+
`fastmdx report` also writes a static dashboard at
93+
`<output>/report/dashboard.html` using only metrics and plots present in
94+
the run outputs.

docs/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ installation
1515
phases
1616
usage_examples
1717
configuration
18+
region_highlights
19+
live_dashboard
1820
```
1921

2022
```{toctree}

docs/live_dashboard.md

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
# Live simulation dashboard
2+
3+
FastMDXplora has two dashboard views:
4+
5+
- **Results Dashboard**: the static `report/dashboard.html` written after
6+
analysis/report. It shows completed plots, generated files, report links,
7+
slides, and project bundles.
8+
- **Live Simulation**: a local-only localhost view that watches lightweight
9+
telemetry files while a simulation is running.
10+
11+
The live dashboard does not replace the static report dashboard. It adds a
12+
separate monitoring view for progress, health messages, recent events, and
13+
available energy/temperature samples.
14+
15+
## Recommended: start it with the workflow
16+
17+
For normal runs, add `--dashboard` to the command that creates or watches the
18+
output folder. FastMDXplora starts the localhost dashboard before setup or
19+
simulation begins, prints the URL, and automatically enables live telemetry
20+
when simulation runs:
21+
22+
```bash
23+
fastmdx explore --system local_pdbs/1L2Y.pdb \
24+
--output local_runs/trpcage_live_full \
25+
--include setup simulation analysis report \
26+
--simulate-preset gentle \
27+
--dashboard
28+
```
29+
30+
If the `fastmdx` console script is not on PATH, use the module entrypoint.
31+
This is also the recommended form for Windows PowerShell:
32+
33+
```powershell
34+
python -m fastmdxplora.cli.main explore `
35+
--system local_pdbs\1L2Y.pdb `
36+
--output local_runs\trpcage_live_full `
37+
--include setup simulation analysis report `
38+
--simulate-preset gentle `
39+
--dashboard
40+
```
41+
42+
The CLI prints the selected URL before the workflow starts:
43+
44+
```text
45+
Live dashboard running at: http://127.0.0.1:8765
46+
Watching output folder: local_runs/trpcage_live_full
47+
Open this URL in your browser to monitor the run.
48+
Press Ctrl+C to stop the dashboard after the workflow completes.
49+
```
50+
51+
By default the server binds to `127.0.0.1:8765`, so it is local to your
52+
machine. If the requested port is busy, FastMDXplora chooses the next
53+
available port and prints the actual URL:
54+
55+
```text
56+
Live dashboard running at: http://127.0.0.1:8766
57+
Requested port 8765 was busy, so FastMDXplora used 8766.
58+
Watching output folder: local_runs/my_run
59+
```
60+
61+
Use `--dashboard-port` or `--dashboard-host` to customize the bind address:
62+
63+
```bash
64+
fastmdx explore --system protein.pdb --output local_runs/my_run --dashboard --dashboard-port 8770
65+
```
66+
67+
Binding to all interfaces can expose the dashboard on your network:
68+
69+
```bash
70+
fastmdx explore --system protein.pdb --output local_runs/my_run --dashboard --dashboard-host 0.0.0.0
71+
```
72+
73+
FastMDXplora prints a warning when `--dashboard-host 0.0.0.0` is used. Prefer
74+
`--dashboard-host 127.0.0.1` for local-only access.
75+
76+
By default the dashboard stays open after the workflow completes so you can
77+
inspect final Analysis Plots and Generated Files. Press Ctrl+C to stop it. Use
78+
`--dashboard-stop-on-complete` when you want the command to exit immediately
79+
after the workflow finishes.
80+
81+
## Manual fallback for existing runs
82+
83+
You can still reopen an existing output directory without running a workflow:
84+
85+
```bash
86+
fastmdx dashboard serve --output local_runs/my_run
87+
```
88+
89+
If the `fastmdx` console script is not on PATH:
90+
91+
```bash
92+
python -m fastmdxplora.cli.main dashboard serve --output local_runs/my_run
93+
```
94+
95+
## Live telemetry
96+
97+
`--dashboard` automatically implies `--simulate-live-telemetry` when simulation
98+
runs. Existing explicit telemetry flags still work for tuning:
99+
100+
```bash
101+
fastmdx explore --system protein.pdb \
102+
--output local_runs/my_run \
103+
--include setup simulation \
104+
--dashboard \
105+
--simulate-telemetry-interval 1000
106+
```
107+
108+
The simulation phase writes:
109+
110+
- `simulation/live_status.json`
111+
- `simulation/live_metrics.csv`
112+
- `simulation/live_events.log`
113+
114+
Telemetry writing is intentionally lightweight and safe. If these files cannot
115+
be written, the simulation continues and the live dashboard simply reports
116+
unavailable data.
117+
118+
## What the Live Simulation tab shows
119+
120+
The live view polls the local output directory every few seconds and displays:
121+
122+
- current stage and status
123+
- current step and planned step count when known
124+
- frame count when known
125+
- elapsed wall time and simulation time
126+
- OpenMM platform
127+
- latest checkpoint path when available
128+
- energy/temperature trends when telemetry has those values
129+
- recent events from `live_events.log`
130+
- protein preview image when a topology/PDB is available
131+
- optional local interactive 3D preview when a topology/PDB is available
132+
- plain-language health explanations
133+
134+
Metrics are not invented. If a value has not been written yet, the dashboard
135+
shows `not available`.
136+
137+
## Protein preview
138+
139+
The Live Simulation tab tries to show a protein image as soon as a usable
140+
structure file exists. It checks common run artifacts such as
141+
`simulation/topology.pdb`, `setup/topology.pdb`, `setup/solvated.pdb`, and
142+
the original system path recorded in `manifest.json`.
143+
144+
If PyMOL is installed, FastMDXplora uses it for a cartoon/ribbon render and
145+
adds extra camera padding so the whole protein is visible in the dashboard
146+
frame. Install PyMOL from conda-forge:
147+
148+
```bash
149+
conda install -c conda-forge pymol-open-source
150+
```
151+
152+
or with micromamba:
153+
154+
```bash
155+
micromamba install -c conda-forge pymol-open-source
156+
```
157+
158+
Protein preview generation requires PyMOL so the static image is an actual
159+
cartoon/ribbon render rather than a schematic placeholder. Preview files are
160+
written to `report/dashboard_assets/protein_preview.png` when report assets
161+
exist, or to `simulation/protein_preview.png` during setup/simulation-only
162+
runs.
163+
164+
The preview panel uses a local vendored 3Dmol.js bundle for **Interactive 3D**
165+
when a structure file exists. That tab shows a rotatable cartoon representation
166+
with spectrum coloring and does not require a CDN or internet access. Use
167+
**Spin** to call the real 3Dmol viewer spin control, **Reset view** to zoom back
168+
to the full protein, and mouse controls to rotate or zoom.
169+
170+
The **PyMOL Preview** tab remains available whenever the PyMOL PNG exists. That
171+
tab shows the PyMOL-rendered cartoon/ribbon image. If the bundled 3Dmol viewer
172+
asset is unavailable, the dashboard can fall back to a schematic CA/backbone
173+
trace, but that fallback is labeled as a schematic fallback, not as PyMOL. If no
174+
usable structure file exists yet, the panel says that the preview is
175+
unavailable. The panel polls for updates and includes a **Regenerate preview**
176+
button.
177+
178+
The Results Dashboard tab also refreshes while the server is open. If analysis
179+
or report artifacts are generated after the server starts, the Generated Files,
180+
Analysis Plots, Report Artifacts, and embedded dashboard view update without
181+
restarting the server. Use the **Refresh** button for an immediate rescan.
182+
183+
## Health messages
184+
185+
FastMDXplora classifies common live issues:
186+
187+
- **Numerical instability**: NaN/Inf positions or energies. Try a smaller
188+
timestep, lower temperature, stronger friction, the gentle preset, or check
189+
the input structure for clashes.
190+
- **Energy spike**: energy changed sharply between samples. This can indicate
191+
bad contacts, an unstable timestep, or pressure/temperature coupling issues.
192+
- **Temperature drift/spike**: temperature is far from the target. Try gentler
193+
heating, stronger friction, or a smaller timestep.
194+
- **Stale telemetry**: no live update was seen recently. The simulation may be
195+
slow, paused, or crashed.
196+
197+
## Static dashboard behavior
198+
199+
Opening `report/dashboard.html` after a run still shows the completed Results
200+
Dashboard. It now also includes a Live Simulation sidebar entry:
201+
202+
- If telemetry exists, it shows the last recorded status.
203+
- If telemetry does not exist, it explains how to start
204+
`fastmdx explore ... --dashboard` or `fastmdx dashboard serve --output ...`.
205+
206+
## Demo or preview output
207+
208+
For a small demo run, use the gentle preset and telemetry:
209+
210+
```bash
211+
fastmdx explore --system local_pdbs/1L2Y.pdb \
212+
--output local_runs/live_demo \
213+
--include setup simulation analysis report \
214+
--simulate-preset gentle \
215+
--dashboard
216+
```

docs/phases.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ Key outputs: `<analysis>/*.dat`, `<analysis>/*.png`, `analysis_manifest.json`.
5252
## report
5353

5454
Assembles the results into shareable deliverables: a structured Markdown
55-
report, a slide deck, and a self-contained project bundle.
55+
report, a static browser dashboard, a slide deck, and a self-contained
56+
project bundle.
5657

57-
Key outputs: `report.md`, `slides.pptx`, `project_bundle.zip`.
58+
Key outputs: `report.md`, `dashboard.html`, `slides.pptx`, `project_bundle.zip`.

docs/region_highlights.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Region highlight figures
2+
3+
FastMDXplora can add user-defined residue-region highlights to report outputs.
4+
This is intended for loops, helices, active-site neighborhoods, or other
5+
regions you already know and want to call out visually.
6+
7+
Use RMSF for this view. RMSD is a frame/time metric that summarizes global
8+
deviation across a trajectory. RMSF is residue- or atom-indexed, so it is the
9+
right metric for highlighting residue intervals.
10+
11+
## YAML example
12+
13+
```yaml
14+
include: [analysis, report]
15+
16+
analysis:
17+
include: [rmsf]
18+
trajectory: simulation/production.dcd
19+
topology: simulation/topology.pdb
20+
21+
report:
22+
title: "Trp-cage RMSF region highlights"
23+
region_highlights:
24+
- label: "example region 1"
25+
start: 3
26+
end: 7
27+
color: "#4E79A7"
28+
- label: "example region 2"
29+
start: 12
30+
end: 16
31+
color: "#F28E2B"
32+
```
33+
34+
The labels are user-provided annotations. FastMDXplora does not infer that a
35+
range is biologically a loop, helix, catalytic motif, or binding site.
36+
37+
## Outputs
38+
39+
When `report.region_highlights` is configured and RMSF analysis output exists,
40+
the report phase writes:
41+
42+
- `analysis/rmsf/rmsf_region_highlights.png`
43+
- `report/structure_region_highlights.png` when PyMOL rendering succeeds
44+
- `report/structure_region_highlights.pml` when PyMOL rendering succeeds
45+
- `report/region_highlight_summary.png`
46+
- `report/region_highlight_manifest.json`
47+
48+
If PyMOL and a topology/PDB file are available, the summary includes a
49+
PyMOL-rendered cartoon/ribbon structure panel with the same regions
50+
highlighted. If PyMOL is unavailable, FastMDXplora still writes the RMSF
51+
highlight plot and records the skipped structure-rendering reason in
52+
`report/region_highlight_manifest.json`.
53+
54+
Install PyMOL into the environment that runs FastMDXplora when you want the
55+
cartoon structure panel:
56+
57+
```bash
58+
conda install -c conda-forge pymol-open-source
59+
```
60+
61+
With micromamba:
62+
63+
```bash
64+
micromamba install -c conda-forge pymol-open-source
65+
```
66+
67+
## Run examples
68+
69+
Bash:
70+
71+
```bash
72+
fastmdx explore --config region_highlights.yml
73+
```
74+
75+
Windows PowerShell fallback when `fastmdx` is not on PATH:
76+
77+
```powershell
78+
python -m fastmdxplora.cli.main explore --config region_highlights.yml
79+
```
80+
81+
For an analysis-only/report-only workflow, provide existing trajectory and
82+
topology paths in the `analysis:` block and set `include: [analysis, report]`.
83+
Setup and simulation will not be run.

docs/usage_examples.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,28 @@ artifacts the earlier phases wrote. `analyze` and `report` can infer the
104104
system from an existing run manifest; `setup` and `simulate` still need
105105
`--system` or `--config`.
106106

107+
The report phase writes `report/report.md`, `report/dashboard.html`,
108+
`report/slides.pptx`, and `report/project_bundle.zip`. Open
109+
`<output>/report/dashboard.html` directly in a browser for the static
110+
dashboard view.
111+
112+
For local live monitoring, add `--dashboard` to the workflow command. This
113+
starts the localhost dashboard before the workflow begins and automatically
114+
enables live telemetry when simulation runs:
115+
116+
```bash
117+
fastmdx explore --system protein.pdb --output ./trpcage_study --include setup simulation --dashboard
118+
```
119+
120+
PowerShell fallback when `fastmdx` is not on PATH:
121+
122+
```powershell
123+
python -m fastmdxplora.cli.main explore --system protein.pdb --output .\trpcage_study --include setup simulation --dashboard
124+
```
125+
126+
`fastmdx dashboard serve --output ./trpcage_study` remains available when you
127+
want to reopen an existing run folder manually.
128+
107129
### MD engine controls
108130

109131
Integrator, pressure (in bar **or** atm), GPU device, and checkpointing:

driftmd_workbench/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.venv/
2+
__pycache__/
3+
*.pyc
4+
.pytest_cache/
5+
runs/
6+
private_reports/
7+
*.egg-info/

0 commit comments

Comments
 (0)