structural-biology/ai produced the result/Nature Communications 2022 · v2
Bayesian program merges X-ray diffraction data from three experiment types in one step
Researchers built an open-source program, Careless, that turns raw X-ray reflection measurements into the quantities crystallographers need. A small neural network inside it works out how much each measurement must be rescaled, learning this from the recorded geometry of the experiment.
spectrum · one line per step, placed by what the step does · bright lines used AI
A unifying Bayesian framework for merging X-ray diffraction data
Nature Communications, 2022
doi:10.1038/s41467-022-35280-8 · record aix-00054 v2 · checked 2026-10-08
- AI was for
- Denoising
- Model family
- Multilayer perceptron, Probabilistic graphical model
- Checked by
- Held-out
- Code
- available
The finding the paper is about came from the AI.
What this research was about
To see the shape of a protein, crystallographers shine X-rays through a crystal of it. The beam scatters into a pattern of spots, and the brightness of each spot carries information about where the atoms sit. The problem is that a spot's measured brightness depends on much more than the molecule: how long that part of the crystal sat in the beam, how it had decayed, where the spot landed on the detector, the wavelength involved. The same reflection measured twice can come out at different strengths. Before anything can be interpreted, the thousands of measurements must be put on a common footing and combined, a stage called scaling and merging.
Traditionally this is done by a chain of separate corrections, with different procedures for different kinds of experiment: a crystal rotated in a steady beam, a crystal hit with a spread of wavelengths at once, or a stream of crystals each exposed a single time at an X-ray laser. The authors set out to describe all of these with one statistical model, and to estimate the underlying quantities, called structure factor amplitudes, directly from the unscaled measurements rather than correcting them step by step.
Where AI came in
The part the AI does is the scaling. Instead of a fixed formula, a multilayer perceptron, a plain neural network of stacked layers, reads the recorded details of each individual measurement, such as its resolution, its position on the detector, its Miller indices, its wavelength and its Ewald offset, and returns a distribution over that measurement's scale factor. Nothing tells the network the right answers in advance. It is fitted at the same time as the amplitudes themselves, by variational inference, which adjusts both until the model best explains the observed intensities.
So the network stands in for the conventional scaling algorithms that crystallographic software applies, and it is inside the instrument-like stage that produces the numbers everything later rests on. The merged amplitudes coming out were then phased and refined with standard crystallography programs, and compared against the same data merged by Aimless, XDS and cctbx.xfel. The code is available, and the authors report that each example here runs in under an hour on a consumer-grade NVIDIA 3000 series graphics card.
Written by AIxSci from the checked record below, to give context for readers outside the field. It is not part of the record.
The work
Technical · from the record
The authors built a Bayesian forward model, implemented as the open-source program Careless, that treats observed X-ray reflection intensities as the product of a structure factor amplitude and a per-observation scale, where the scale is computed by a multilayer perceptron from experimental metadata and both quantities are estimated jointly by variational inference with a Wilson prior on amplitudes. The method was applied to a 1,440-image monochromatic sulfur SAD series of lysozyme, 40 Laue images of photoactive yellow protein in the dark state and 2 ms after a laser pulse, and one serial XFEL run of 3,160 thermolysin images. Merged amplitudes were assessed by half-dataset correlation coefficients, held-out intensity prediction, phasing and refinement, and compared with Aimless, XDS and cctbx.xfel. With a Student's t likelihood at 16 degrees of freedom the lysozyme maps were interpretable, while Aimless gave higher anomalous peak heights than Careless at 16 d.f. in the real-space test.
How AI was used
Reflections were indexed and integrated with conventional software (DIALS, Precognition, cctbx.xfel or XDS), and the resulting unmerged, unscaled intensities were passed to Careless together with per-reflection metadata such as resolution, detector position, Miller indices, Laue wavelength and Ewald offset. Inside Careless a multilayer perceptron with leaky ReLU activations, twenty layers by default and a two-unit linear output head maps each metadata vector to the mean and standard deviation of a normal distribution over that observation's scale; structure factor amplitudes are given independent truncated-normal surrogate posteriors with Wilson distributions as priors. Both the network parameters and the amplitude posteriors are fitted simultaneously by maximising an evidence lower bound with the reparameterisation trick and the Adam optimizer, using a normal or Student's t likelihood on the observed intensities; for Laue data the likelihood sums the contributions of all Miller indices on a central ray to perform harmonic deconvolution, and for serial XFEL data image-specific kernel and bias layers are appended so a separate scale function is effectively learned per image. Hyperparameters including the t-distribution degrees of freedom and the number of image layers were chosen by the package's own cross-validation modes, and a transfer-learning variant initialised the scale function from a non-anomalous pre-processing run. The merged amplitudes were then phased and refined with conventional crystallographic software.
The shape of the work
Structural · the record, drawn
no AI
Collect diffraction images
Obtaining raw data, whether by measurement, download or retrieval.
It consists of a single 1,440 image rotation series collected in 0.5 degree increments at a low X-ray energy, 6.55 keVwhere the paper describes this · verbatim
no AI
Index and integrate reflections
Cleaning, filtering, normalising or labelling data already obtained.
DIALS version 3.1.4 was used to index and integrate observed reflections for hen egg white lysozymewhere the paper describes this · verbatim
no AI
Assemble reflection metadata for the scale function
Encoding data into features, descriptors, embeddings or graphs.
we assert that the scale of a reflection should be computable from the geometric metadata recorded about each reflection during integrationwhere the paper describes this · verbatim
AI
Fit scale network and structure factor posteriors by variational inference
Fitting model parameters, including fine-tuning an existing model. The AI stood in for conventional algorithm.
inference is made possible by variational inference, in which the parameters of proposed posterior distributions are directly optimizedwhere the paper describes this · verbatim
AI
Infer merged structure factor amplitudes
Running a trained model over new data to predict, classify or score. The AI stood in for conventional algorithm.
performs scaling, merging, and French-Wilson corrections in a single step by directly inferring structure factor amplitudes from unscaled, unmerged intensitieswhere the paper describes this · verbatim
no AI
Tune likelihood degrees of freedom and layer count by cross-validation
Iterative search over a space. Its result feeds back into an earlier step.
Titrating the number of degrees of freedom, we found that 16 d.f. resulted in the best Spearman correlation coefficient between observations and model predictionswhere the paper describes this · verbatim
no AI
Phase, refine and compare against conventional merging
Testing outputs against ground truth.
We used Autosol to phase our merging results, comparing the Careless output with a Student's t-distributed likelihoodwhere the paper describes this · verbatim
What the record says
Technical · every part carries its own basis
+ in the paper~ our reading− not reported
How to read the quotations. A quotation shows where the paper describes something. It does not quote every value beside it: one passage locates a part of the work, and values without their own quotation are our reading of that passage.
The structure factor amplitudes that all downstream maps and comparisons rest on are produced by the variational model itself; the paper's result is the merging method and its outputs
this scale function, Σ, is implemented as a deep neural network, which takes the metadata as argumentswhere the paper describes this · verbatim
Ten-fold cross-validation of merging as a function of the likelihood degrees of freedomwhere the paper describes this · verbatim
Careless is modular and open-source.where the paper describes this · verbatim
What this paper did not report
Technical · absence is published deliberately
- Trained model weightsWhether the trained model is available is not stated.
- DataWhether the data are available is not stated.
- How many were testedThe paper gives no count of what was tested.
About this article
Record aix-00054, version 2, checked by a person on 2026-10-08. The record describes the paper; it does not assess whether the paper's findings are right. The paper is published under CC-BY; quotations are at most 25 words. How we work · Report an error