Skip to main content

alchemy-viz

Browser-based visualizations for OpenFE and gufe objects: ligands, proteins, atom mappings, ligand networks and alchemical campaigns.

Curated gallery
Click the image to see interactive examples

Install

conda activate my-openfe-env
pip install "alchemy-viz[notebook]"   # the notebook extra is optional

gufe must be installed from conda-forge, not pip.

Use

From the shell, alchemy-viz accepts as inputs anything from openfe plan-rbfe-network:

alchemy-viz network_setup/network_setup.json -o campaign.html
alchemy-viz network_setup/ligand_network.graphml     # writes <input>.html beside it
alchemy-viz ligand.json -o -                         # or stdout

One self-contained HTML file is created.

From Python, on the object itself:

from alchemy_viz import view, to_html

view(network)        # a LigandNetwork, drawn in a notebook cell
view(ligand)         # a SmallMoleculeComponent, ProteinComponent, ChemicalSystem...
html = to_html(obj)  # the same page as a string; writes nothing

view() takes a live gufe object or an alchemy-viz payload dict.

Embedding into a webpage

Embed the visualization module directly into your own websites:

npm install alchemy-viz
import "alchemy-viz";
// Or from a CDN with no build step:
// import "https://cdn.jsdelivr.net/gh/omsf-eco-infra/alchemy-viz@main/python/alchemy_viz/_assets/alchemy-viz.js";
import type { AlchemyVizPayload } from "alchemy-viz";

const payload: AlchemyVizPayload = await (await fetch("payload.json")).json();

const view = document.createElement("alchemy-view");
document.body.append(view);
view.payload = payload;

Documentation

Doc Description
cli.md alchemy-viz object.json - input formats, options, errors
openfe.md view() on your own objects, a network_setup/ directory, planning in Python
notebooks.md how the notebook integration works
views.md
embedding.md mounting the bundle in a page of your own
troubleshooting.md blank cells, missing depictions, payloads that will not draw

Two notebooks: demo is basic usage while gallery shows the examples as images so you can see the outputs in github

Development

Requires pixi.

git clone https://github.com/omsf-eco-infra/alchemy-viz.git
cd alchemy-viz
pixi install
pixi run dev     # vite: /gallery.html, /gallery-all.html, /parity.html, / (dropzone)
pixi run test    # both suites
pixi run ci      # what CI runs: lint, tests, generated-artifact freshness

Adding a view

  1. Add a $def to schema/alchemy-viz.schema.json, named exactly for the type const it declares - both validators find a branch by that name.
  2. Build the payload in python/alchemy_viz/ (components.py, networks.py or alchemical.py) and add it to the isinstance dispatch. Ask the gufe object to serialize itself; never reach into its JSON.
  3. pixi run types.
  4. Write ts/src/views/<type>.ts: a class extending AlchemyElement<Payload> with one renderView(host, payload), returning { onResize, cleanup } if it owns anything that must be released.
  5. Add the tag to VIEW_TAGS in ts/src/alchemy-view.ts and an import in ts/src/index.ts.
  6. pixi run examples, add mutation rows, then pixi run build && pixi run test.
  7. Add a row to the table in docs/views.md and a NOTES entry in scripts/make_gallery.py, then pixi run gallery. Neither is checked by CI, so a new view is invisible in the docs until this step.

A declared type with no view renders as "no visualization for X yet", which is correct behaviour; a view whose type the schema does not declare fails the tests.

Releasing

setuptools-scm derives the version from the git tag, so tagging is the release:

git tag -a v0.1.0 -m "v0.1.0" && git push origin v0.1.0

Support

This work was supported by the National Science Foundation under Grant No. 2303740, via the Open Molecular Science Foundation.

Licence

MIT.

Metadata

Release files for alchemy-viz 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for alchemy-viz 0.1.0
File Size Uploaded Provenance
alchemy_viz-0.1.0.tar.gz 167.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for alchemy-viz 0.1.0
File Interpreter ABI Platform
alchemy_viz-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 313.6 kB

Release files / alchemy_viz-0.1.0.tar.gz

Download URL alchemy_viz-0.1.0.tar.gz
Size 167.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4e38350f101b774f137f89b640e52c9a5b1bf5ee67ea9abc099413fbc7d2a51c
BLAKE2b-256 checksum
How to use checksums
6e39aaa1b2118b06264fc1a3e39ce3ff9913b9a47d8669d1aa0906febb518777
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / alchemy_viz-0.1.0-py3-none-any.whl

Download URL alchemy_viz-0.1.0-py3-none-any.whl
Size 146.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
631fb9411c450547061d16e3b0c5473e81faab8542490e6bfffe77ec08a49509
BLAKE2b-256 checksum
How to use checksums
29737868e77f5569562947fd7d67004341a340a7f9a389283c1e03706155adc6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Security for alchemy-viz 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page