Analysis › DNA-PAINT · version 1 · can run once per region
The share of the molecules in each kind of complex (monomers, dimers,
Many membrane proteins work as complexes: a receptor pairs up when its ligand binds, two proteins meet in a signalling complex. DNA-PAINT with RESI or Molecular mapping resolves the single proteins, one position each, a few nanometres apart. It does not count them into complexes directly: most complexes miss a label (the labelling efficiency is often 30-60 %), each label sits a few nanometres off its protein, and two complexes can lie as close to each other as the molecules of one.
SPINNA (single-protein investigation via nearest-neighbour analysis, Masullo, Kowalewski et al. 2025, ported from Picasso) answers by simulation. You say which structures the molecules may be in – monomers, dimers 20 nm long, trimers, a complex of two proteins – and SPINNA asks which mixture of them, placed at random, labelled and blurred as the experiment labels and blurs, gives nearest-neighbour distances like the data's. The answer is each structure's share of the molecules, with an error from a bootstrap.
Use it on a table of molecules, one row each: the centres of Molecular mapping or any table of single-protein positions (x_nm, y_nm, and z_nm for 3D). Each visible layer is one target (one kind of protein): A the first visible layer, B the second – so two proteins imaged in two rounds or channels are two layers, each showing its file or channel. It is not for raw localizations: a molecule seen in many frames would look like a cluster of itself. It needs the labelling efficiency and the label uncertainty, measured beforehand (the second fit, labelling efficiency, measures the first: below), and the molecules spread evenly over the window – in a cell whose density changes, draw ROIs where it is even and fit each (per region).
1. The structures. An oligomer or any other complex is a structure. Each structure is a short list of molecules about its centre, in nm: a dimer 20 nm long is A -10 0; A 10 0, a heterodimer of the two targets A -5 0; B 5 0. A model (a preset) fills the list; any structure can be edited, added or ticked off.
2. The candidates. The labelling efficiency says how many molecules there are in all: the observed ones over the efficiency. Every candidate mixture uses up exactly that many, so with monomers and dimers, choosing the number of dimers fixes the number of monomers. The free numbers are put on a grid of grid steps values, from none to as many as the molecules allow.
3. A simulation per candidate. The structures are placed uniformly at random in the window, each turned at random, each molecule moved by a Gaussian of the label uncertainty (the label is not on the protein's centre, and its position has an error), and only the labelling efficiency of the molecules kept. This is repeated simulations times.

The same density of molecules as monomers alone (left) and as dimers 20 nm long (middle), labelled at 50 % and blurred by 5 nm – a square of 1 µm. Right: the distance from each molecule to its nearest neighbour. Dimers add a peak at their length, from the dimers with both molecules labelled; that peak is what SPINNA weighs.
4. The score. For each pair of targets the distance from every molecule to its 1st, 2nd, ... nearest neighbour is measured, in the data and in the simulation, up to as many neighbours as a structure gives a molecule (a dimer one, a trimer two). Each distribution of the simulation is compared with the data's by the Kolmogorov-Smirnov statistic, the largest gap between their cumulative distributions, and the statistics are averaged: 0 for the same distributions, 1 for the most different.
5. The search. Trying every candidate (every candidate) is safe and slow. Coarse to fine first tries candidates spread evenly over the grid, then every candidate near the best of them.
6. The errors. The best mixture is simulated again, rounds times, each simulation taken as the data and fitted, among the candidates near the best. The spread of the answers is the error.

Left: the data's nearest-neighbour distances (bars) and those of the best-fitting simulation (line), for simulated data with 30 % of the molecules in dimers. Right: the score of every candidate tried, coarse (crosses) then fine (dots); the best is ringed, with its bootstrap error.
Which table. Each target's layer as it shows: its rows, its filter, the drawn ROI. A layer that merges blinks gives a row per blink, which is seldom what is wanted: SPINNA is meant for molecules, one row each.
Proportions are of molecules. A structure's share is the number of molecules in it over all molecules, all targets together: 300 dimers and 1400 monomers are in dimers, not 18 % of the structures. This is the paper's and Picasso's convention.
The candidates. With the molecules of target
in structure
and
the observed molecules of
over its efficiency (rounded down), the numbers of structures
solve
The first structures that make the system solvable are dependent, the rest free. Each free takes grid steps values evenly from 0 to the most the molecules allow, rounded; the dependent ones are solved, and a candidate that needs a negative number is dropped. One target and two structures is one free number, grid steps candidates; three structures two free numbers, about half of grid steps squared. So a structure added multiplies the run time.
The simulation. Each structure's centres are uniform in the window; the turn is uniform in the plane (rotation: or uniform in 3D, or none); for 3D the centres are uniform in z over the molecules' z range. The label uncertainty is a Gaussian of that standard deviation in each coordinate. Of each structure's molecules of a target exactly are kept,
the efficiency, drawn without replacement – Picasso's choice, which takes the binomial noise of labelling out of the simulation. Molecules of a structure near the window's edge may fall just outside it; they are kept, as in Picasso.
The neighbours compared. For targets : the 1st to
-th nearest neighbours,
the largest number of partners a structure gives –
for a structure of
molecules of one target, the smaller count for two targets – and none where no structure has two molecules that could be neighbours. Two targets are measured one way, from A to B. A molecule is never its own neighbour.
The score. With and
the cumulative distributions of a distance in the simulation and the data,
and the score is the mean of over every pair of targets and every order. A candidate's simulations are pooled before
is taken. The score is noisy – two simulations of one candidate do not give the same
– which is what simulations reduces.
Coarse to fine. The coarse pass takes the candidate nearest the middle of the grid, then again and again the one farthest from those taken (farthest-point sampling), at least 10 % of the candidates and until every candidate is within 15 percentage points of one taken. The distance between two candidates is the sum over structures of the differences of their proportions (an L1 distance). The fine pass tries every candidate within 30 points of the coarse winner and keeps the best.
The bootstrap. The best mixture is simulated once per round, the distances of that simulation taken as the data, and the candidates within 30 points of the best scored against it; the standard deviation of the proportions found over the rounds is the error, and that of their scores the score's. It is a parametric bootstrap: it says how far the answer moves with the randomness of placing and labelling, not whether the model is right. An error below half a grid step means the rounds seldom left the best candidate; more grid steps resolve it.
Labelling efficiency (fit: labelling efficiency; Hellmeier et al. 2024). A protein carries two tags, A (the first visible layer) and B (the second), each labelled and imaged on its own. The model is A alone, B alone and an A-B pair at the tag distance, simulated with every label detected; the proportions found are then read as efficiencies:
the fraction of the B molecules that have an A partner, and the other way round. Several tag distances are each fitted and the best-scoring kept. The bootstrap's proportions give the efficiencies' errors.
Several files are several windows. Each file gets the candidate's structures in proportion to its share of the molecules, and the distances of all files are pooled before they are compared.
What limits it. Structures smaller than the nearest-neighbour distance at the density measured show; a dimer longer than the typical distance between complexes hides among them. Low labelling efficiency leaves few complexes with two labels: at 30 % one dimer in eleven shows both. And the model has to hold the right structures: a mixture fitted with only monomers and dimers will call trimers dimers. Compare models by running each and reading their scores.
| setting | default | what it does |
|---|---|---|
fitfit | proportions of structures | The share of each structure, or the labelling efficiency of two tags on one protein (two visible layers). proportions of structures needs the efficiency known; labelling efficiency measures it on a sample made for it, two tags on one protein. Choices: proportions of structures; labelling efficiency |
modelpreset | – | A set of structures to start from: it fills the list below. |
| structures (a list; each item has the settings below) – The complexes the molecules may be in; select one to set it. Each structure's molecules are written as | ||
namestructures.name | dimer | What the results call it. |
onstructures.enabled | on | Untick to leave it out of the model. |
moleculesstructures.molecules | A -10 0; A 10 0 | X y (z) of each molecule about the centre, ';' between them; a letter first names its target: A the first visible layer, B the second. |
tag distancedistance_nm | 10 | Between the two tags of one protein; several, comma-separated, are each tried. Around the size of the two binders together; several values separated by commas are each fitted and the best kept. |
labelling efficiencyefficiency | 0.5 | The fraction of molecules detected: one value, or one per target, '0.5, 0.4'. Measure it (the labelling efficiency fit, or a reference such as DNA origami) rather than guess it: the proportions move with it. Too low a value overestimates the complexes: fewer of their molecules are taken to be seen, so more complexes are needed for the close pairs the data show. |
label uncertaintylabel_unc_nm | 5 | The spread of a detected molecule about the protein: one value, or one per target. The size of the label (antibody or nanobody, linker) and the precision of the molecule's position together: 3-8 nm for nanobodies and RESI, more for antibodies. |
dimensionsdimensions | 2D | 3D: the distances in x, y and z, structures placed through the molecules' z range. Choices: 2D; 3D |
rotation (more)rotation | in the plane | How each structure is turned at random; in 3D for a 2D fit is the turned structure seen from above. Choices: in the plane; in 3D; none |
without an ROIwindow | the occupied area | The window when neither a region nor a drawn ROI gives one. Choices: the occupied area; the bounding box |
occupied bin (more)occupied_bin_nm | 500 nm | The pixel of the occupied area's mask. at least 1 nm |
searchsearch | coarse to fine | How the candidate mixtures are tried. Choices: coarse to fine; every candidate |
grid stepsgranularity | 21 | Values of each free structure's number, from none to all. 21 is a step of 5 points for monomers and dimers. A finer grid costs a candidate per step for one free structure, but squares for two. at least 2 |
simulationssimulations | 10 | Per candidate, their distances pooled. Ten gives a smooth enough score for a few thousand molecules; fewer molecules want more. at least 1 |
bootstrap errorsbootstrap | on | Fit simulations of the answer again, for the errors. |
roundsbootstraps | 20 | Simulated data sets fitted. at least 2 |
seed (more)seed | 0 | The same seed and settings give the same answer. |
Text: the molecules of each target, their density and the window; which neighbours were compared, how many candidates were tried and how long it took; each structure's share of the molecules with its bootstrap error and the number of structures; the score. In the labelling efficiency fit, the efficiency of A and of B and the tag distance.
Figures: nearest neighbours, the data's distances (bars) against the best simulation's (lines) for each pair of targets and each order – they should lie on top of each other; a gap that no mixture closes says the model lacks a structure or the efficiency or label uncertainty is off. Scores, the score of every candidate tried against its proportion: a clear minimum is a good fit; a flat floor means the data cannot tell those mixtures apart. Window, the window and the molecules in it.
Values (per region, a column each of the region table):
<structure>_pct and <structure>_err_pct – each structure's share of the molecules and its error, the name in lower case with spaces as _ (dimer_pct);efficiency_A, efficiency_err_A, ... and distance_nm – from the labelling-efficiency fit;ks and ks_err – the score;n_A, density_A_um2, ... – the molecules of each target and their density per µm².Stop ends the search; nothing is kept.
SPINNA is Picasso's (spinna.py); the constants are its own – 20 bootstrap rounds, neighbourhoods of 30 points (L1), its default grid of 21, 10 simulations, 5 nm and 50 % – and so is the convention of proportions of molecules. The changes that can move an answer: