cryoJAX: A Cryo-electron Microscopy Image Simulation Library In JAX

Michael J. O’Brien, David Silva-Sánchez, Geoffrey Woollard, Kwanghwi Je, Sonya M. Hanson, Daniel J. Needleman, Pilar Cossio, Erik Henning Thiede, Miro A. Astore2025

TL;DR

Researchers have developed cryoJAX, a flexible Python library for simulating cryo-electron microscopy (cryo-EM) images. Built on the powerful JAX framework, cryoJAX aims to accelerate the development of sophisticated cryo-EM data analysis tools by providing a robust and extensible platform for image formation modeling.

What Problem Does This Paper Address?

Cryo-electron microscopy (cryo-EM) has become a revolutionary tool for determining the atomic structures of biomolecules. However, extending cryo-EM to study more complex biological phenomena like intracellular organization and dynamic molecular states presents significant computational challenges. Analyzing the vast, high-resolution, but low-signal-to-noise cryo-EM data requires advanced computational methods. While many tools exist for single-particle reconstruction, there's a growing need for flexible simulation frameworks that can support the development of novel data analysis techniques, especially those leveraging modern scientific computing libraries.

Methods

cryoJAX is built on JAX, a Python library known for its automatic differentiation, JIT compilation, and automatic vectorization capabilities. This allows cryoJAX to achieve high performance and enables complex gradient-based analyses. The library provides an extensible framework for modeling cryo-EM image formation, which is fundamentally a linear process involving the projection of a molecule's electrostatic potential and convolution with the microscope's contrast transfer function (CTF).

Key components of cryoJAX include:

  • Volume Representation: Abstract base classes for representing molecular structures (e.g., atomic models, voxel maps).
  • Contrast Transfer Function (CTF): Abstract base classes for modeling the effects of the microscope optics, including astigmatism and beam tilt.
  • Pose: Abstract base classes for representing particle orientation and translation.

Users can leverage existing implementations or create custom components to tailor simulations to specific needs. The library also integrates with Equinox, a JAX library for defining PyTorch-like neural network modules, facilitating the use of JAX transformations like jit and vmap for efficient simulation.

Datasets

The paper uses an experimental dataset of thyroglobulin from EMPIAR-10833 for comparison with simulated images. They also generate synthetic datasets for demonstrating the capabilities of their library, particularly for structure refinement.

Key Insights and Ideas

  • JAX as a Foundation for Cryo-EM: The paper highlights JAX's suitability for cryo-EM data analysis due to its automatic differentiation and high-performance computing features, which are crucial for computationally intensive tasks.
  • Modularity is Key: By providing abstract base classes for core image formation components, cryoJAX allows for great flexibility, enabling researchers to easily swap out or implement new models for volumes, CTFs, and poses.
  • Simulation as a Tool for Analysis Development: cryoJAX isn't just for generating realistic images; it's positioned as a foundational tool for building and testing new data analysis algorithms, especially those that rely on gradient-based optimization.
  • Performance Gains with JIT: The benchmarks clearly show the dramatic speedups achievable by using JAX's just-in-time (JIT) compilation for image simulation, making complex analyses more feasible.

Key Results

  • Significant Speedups: JIT compilation in cryoJAX resulted in speedups of up to 800x for simulating single images on a GPU compared to non-JIT compiled versions.
  • Realistic Simulations: The library can generate synthetic images that show quantitative agreement with experimental data, as demonstrated by comparing simulated and experimental power spectra.
  • Demonstrated Structure Refinement: The paper showcases an application of cryoJAX and JAX's automatic differentiation to refine protein structure, successfully recovering a ground truth conformation from noisy synthetic data. This process, involving optimization of thousands of atom positions, was completed in under 5 minutes on a laptop CPU.

Limitations and Future Work

  • Focus on Image Formation: cryoJAX itself is primarily an image simulation library and does not implement specific data analysis algorithms like single-particle reconstruction. These need to be built on top of cryoJAX and JAX.
  • Noise Modeling: While cryoJAX supports noise modeling, the paper notes that generically modeling noise in cryo-EM images remains an open challenge.
  • Future Work: The authors suggest that cryoJAX can be extended to handle more complex structural models, such as those with conformational heterogeneity, and to incorporate more advanced image formation physics like dose-dependent contrast. The library's flexibility is intended to support a wide range of emerging cryo-EM applications.

Summary updated

BibTeX
@misc{obrien2025cryojax,
  author = {Michael J. O’Brien and David Silva-Sánchez and Geoffrey Woollard and Kwanghwi Je and Sonya M. Hanson and Daniel J. Needleman and Pilar Cossio and Erik Henning Thiede and Miro A. Astore},
  title = {{cryoJAX: A Cryo-electron Microscopy Image Simulation Library In JAX}},
  year = {2025},
  url = {https://openreview.net/forum?id=RHLSW9w71o},
}
Figure