Abstract
Compensating in flow cytometry is an unavoidable challenge in the data analysis of fluorescencebased flow cytometry. Even the advent of spectral cytometry cannot circumvent the spillover problem, with spectral unmixing an intrinsic part of such systems. The calculation of spillover coefficients from singlecolor controls has remained essentially unchanged since its inception, and is increasingly limited in its ability to deal with highparameter flow cytometry. Here, we present AutoSpill, an alternative method for calculating spillover coefficients. The approach combines automated gating of cells, calculation of an initial spillover matrix based on robust linear regression, and iterative refinement to reduce error. Moreover, autofluorescence can be compensated out, by processing it as an endogenous dye in an unstained control. AutoSpill uses singlecolor controls and is compatible with common flow cytometry software. AutoSpill allows simpler and more robust workflows, while reducing the magnitude of compensation errors in highparameter flow cytometry.
Introduction
Fluorescently labeled antibodies and flow cytometry have been the workhorse for singlecell data generation in many fields of biosciences since its development in the late 1960s^{1}. The ability to rapidly collect quantitative data from millions of single cells has driven the understanding of heterogeneity in complex cellular mixtures, and led to the development of many fluorescencebased functional assays^{2,3,4,5}. The diverse utility of flow cytometry has driven constant demand for an expansion in the number of parameters to be simultaneously measured. Development of novel fluorophores and advances in laser technology have provided a steady increase in the number of parameters that can be measured on stateoftheart machines, roughly doubling each decade since the 1970s (Roederer’s Law for Flow Cytometry)^{6}.
The development from singlecolor flow cytometry to ultra highparameter flow cytometry has allowed an enormous growth in the data collected per cell. In our own field of immunology, highparameter flow cytometry panels have become necessary, with multiple markers required to identify cellular lineages, major subsets, and activation markers. A key limitation with highparameter flow cytometry, however, is the spectral overlap of fluorescent dyes^{7}. This results in the spillover of fluorescence to detectors different from the detector assigned to each dye (in classical flow cytometry). Removing this unwanted spillover, i.e. compensating, is a necessary preliminary step in the data analysis of multicolor flow cytometry.
Stateoftheart flow cytometers, with ~30 channels, make compensation increasingly difficult as the number of channels grows, due to the unavoidable overlap between emission spectra of fluorescent dyes. The difficulty of experimental design has followed the growth in fluorophore options, to the point where the development, refinement, and validation of ultrahigh parameter panels can take months to years of expert input^{4,8,9,10}. Indeed, the development of mass cytometry as an alternative technology is largely driven by its lack of spillover^{11}, as otherwise the technology compares unfavorably to flow cytometry in several aspects^{6}.
Unlike the extensive development efforts in fluorophore generation, fluidics refinement, and laser addition, the basis for dealing with spillover in flow cytometry has largely remained unchanged. Current compensation algorithms are based upon the algorithm for spillover calculation proposed by Bagwell and Adams, when flow cytometers worked with only a few fluorophores^{12}. While aspects of data processing have been refined since then, such as autofluorescence correction, the basic compensation strategy of calculating the spillover signal between defined positive and negative populations remains the traditional approach used across the majority of software packages. These approaches provide an estimation of the spillover matrix, in which the degree of spectral spillover between channels is estimated from singlecolor controls. A compensation matrix is obtained by inverting the spillover matrix, by which spillover is compensated out from experimental datasets. While effective in lowparameter datasets, where spillover is moderate to start with, in the case of highparameter data this method often requires manual adjustment before proceeding with downstream analyses. This manual tuning entails manipulating a matrix with several hundred coefficients, which can be challenging and timeconsuming, thus severely constraining panel design in practice. This approach requires singlecolor controls with welldefined positive and negative populations, which often forces the singlecolor controls to differ from those of the actual panel, increasing the complexity of the experiment.
Spectral flow cytometry is a refinement of classical flow cytometers, expanding the number of parameters simultaneously measured. In these systems, spectral unmixing is used to discriminate between the spectra of similar fluorophores. The unmixing is carried out in a different way, but obtaining the spectral signature of each fluorophore is also based on singlecolor controls. As with compensation, unmixing requires the calculation of spillover to every detector, with more detectors used than fluorophores. Both classical flow cytometers, and the spectral systems potentially replacing them over the upcoming decades, are therefore limited by the accuracy of spillover calculation.
We have developed an algorithm, AutoSpill, to compensate flow cytometry data. This approach uses singlecolor controls, making it compatible with existing datasets and protocols. Unlike other compensation approaches, however, it calculates spillover coefficients by means of robust linear models. This method produces better estimation of spillover coefficients, without requiring welldefined positive and negative populations. Moreover, AutoSpill uses this improved estimation of the spillover matrix only as the initial value for an iterative algorithm that automatically refines the spillover matrix until achieving, for practical purposes, virtually perfect compensation for the given set of controls. In addition to providing optimal spillover matrices for compensating (or unmixing in spectral systems), and given that AutoSpill does not rely on welldefined positive and negative populations, it can calculate the autofluorescence spectrum of cells by treating it as an extra endogenous dye. Thus, it allows effective detection and removal of autofluorescence from experimental data.
A linear modeling approach can equally be used to estimate the increase in fluorescence noise or spread caused by compensating spillover. Thus, we also propose a second algorithm, AutoSpread, which calculates spillover spreading coefficients with linear models, thereby providing a spillover spreading matrix (SSM) without the need for welldefined positive and negative populations in the singlecolor controls.
Together, AutoSpill and AutoSpread remove limiting constraints of traditional compensation methods, easing the preparation of compensation controls in highparameter flow cytometry, making errors less likely, and facilitating the practical implementation of ultra highparameter flow cytometry. AutoSpill is available through opensource code and a freely available web service (https://autospill.vib.be). AutoSpill and AutoSpread are available in FlowJo v.10.7.
Results
Tessellation allows robust gating
A critical first step in the processing of flow cytometry data is the elimination of cellular debris and other noncellular contamination. This stage is typically performed by manual or automated gating of particles with the expected size and granularity, based on forward scatter and side scatter. In order to develop a fully automated pipeline, we sought to encode this initial cellular gating in the AutoSpill algorithm (Supplementary Software 1). After numerous tests on data provided by collaborating immunologists, we settled on a multistep process with two tessellations, which demonstrated the required features of robust cell or bead identification. Figure 1 shows the initial gating for one singlecolor control of each set of controls. The multistep process robustly identified the cellular fractions as desired, regardless of the presence of high amounts of cellular debris in the HS1 and HS2 datasets (Fig. 1, second and third columns). It also worked correctly with beads (Be1 dataset), which exhibited substantially different forwardscatter/sidescatter profiles (Fig. 1, fourth column). For all channels and all datasets, the gate selected the cell/bead population in the desired density maximum, without needing manual adjustment.
Robust linear regression effectively estimates spillover coefficients
The estimation of spillover coefficients is based on the comparison between the level of fluorescence detected in the primary channel (i.e. the detector dedicated to the dye or fluorophore, in classical systems, or the detector with highest signal, in spectral systems) and the secondary channels (i.e. every other detector). The linear relationship between the fluorescence levels of primary and secondary channels is not visible in the usual biexponential scale (Fig. 2, first and third columns), but it becomes apparent in linear scale (Fig. 2, second and fourth columns). The linear relationship between the primary and secondary channels shows that the ratio of fluorescence between the two channels is constant across a broad range of fluorescence levels. Thus, a linear regression can be used to properly identify the slope between the two channels, that is, the spillover coefficient. As fluorescence data is heteroskedastic, owing to the effects of photoncounting statistics, robust linear regression, which efficiently estimates the relationship while downweighting outlier points, is more suitable for this purpose than an ordinary linear regression, which has increased sensitivity to outliers that violate the normality of the data. We sought to compare robust linear regression to the traditional approach. As our robust gating (described above) provided notable benefits on downstream spillover calculation, independent of calculation method, we applied the same initial robust gating strategies to both the traditional and robust linear regression approaches. Other than the use of improved robust gating (applied so as to not overestimate the advantages of our approach), the traditional calculation used the standard approach of identifying positive and negative peaks and selecting the median. The robust linear model approach produces a similar result to that achieved by the “traditional” calculation of a slope between the median values of the positive and negative populations^{12}, which is the method usually employed (Fig. 2, first and second columns). Notably, however, the use of linear regression also allows the robust calculation of the slope in cases that the traditional approach was not designed to deal with: low numbers of positive events (Fig. 2b), without a welldefined positive population (Fig. 2c), or without welldefined positive and negative populations (Fig. 2d). The quality of compensation can be evaluated by the difference between the obtained compensation and the ideal one, with perfectly compensated data showing an exactly vertical distribution of data along the primary fluorophore (i.e. zero slope). While traditional estimation of spillover was successful to some extent in producing lowerror compensation, in particular when distinct positive and negative populations were present (Fig. 2a, first and second columns), errors were identified in particular channels, especially when populations did not conform to good separation (Fig. 2c, first and second columns). Traditional algorithms struggle in the case of poor separation between positive and negative populations due to the requirement to identify two distinct populations to calculate a slope between (Fig. 2c). In extreme cases this can result in the identification of two populations within the negative cell cluster, and grossly wrong slope calculations. AutoSpill, by contrast, treats data at the singlecell level, utilizing expression data even when the positive and negative populations are low in frequency or form a tail from the negative population, driving a large correction in error (Fig. 2c). In all cases, linear regression resulted in less compensation error (Fig. 2, third and fourth columns).
Iterative reduction of compensation error yields optimal spillover coefficients
The spillover coefficients obtained in the first iteration step by robust linear regression produced lowerror estimates of the spillover matrix for all channels (Fig. 3, with representative example in Fig. S1). While this error level outperformed that of the traditional approach (Figs. 3 and S1C), some channels exhibited a residual degree of over compensation or under compensation (Fig. S1E). While such errors are small, they nonetheless produce overcompensation or undercompensation noticeable in biexponential scale, which visually amplifies fluorescence levels close to zero. In a highparameter flow cytometry panel, with multiple fluorophores present on small subpopulations, such errors can accumulate to the point of making individual channels effectively unusable. We therefore developed an iterative approach, by which the spillover results obtained through the robust linear regression approach (Fig. S1E) were used as the starting point for an additional round of robust linear regression. This process repeats, successively obtaining better spillover matrices allowing for further reduction of error in the compensated data, until predefined criteria are met. This iterative refinement of the spillover matrix reduced the compensation errors to negligible values (Figs. 3 and S1F).
While effective in most cases, this strategy for reducing compensation error can become compromised when using controls with low fluorescence levels in the primary channel or other fluorescence artifacts. Under these circumstances, iterations gave rise to oscillations in the observed compensation errors before reaching convergence (Fig. 3a, c). In order to deal with these extreme cases, we applied a fraction of the update to the spillover matrix, slowing down convergence and further decreasing compensation error (Fig. 3a, c).
Overall, the iterative refinement of spillover coefficients was effective at reducing errors in compensation. In the four representative datasets reported here, the refinement reduced error from the initial compensation step in 4–6 orders of magnitude (Fig. 3). This improvement was observed even with subsampling single color controls to very low numbers of cells (Fig. S2A), although an increased number of iterations was required to achieve convergence (Fig. S2B). This low error amounts to optimal spillover coefficients and compensation matrices, relative to the quality of the singlecolor controls used as input, and therefore it removes a key challenge to successful compensation in highdimensional flow cytometry.
Removal of autofluorescence through compensation with an additional autofluorescence channel
Cells produce autofluorescence, due to the interaction of the constituent organic molecules with the incoming photons. The amount of autofluorescence varies between cell types, and it is, for example, higher on cells from the myeloid lineage^{13,14}. This can create problems in the analysis of certain flow cytometry datasets. Although the amount of autofluorescence varies between cell types, the spillover from autofluorescence observed in an unstained control (Fig. 4a) behaved similarly to the spillover detected from (exogenous) fluorescent dyes (Fig. 2, first and third columns), with the key feature of not having welldefined positive and negative populations. The capacity of AutoSpill to estimate spillover coefficients without needing these populations allowed the treatment of autofluorescence as coming from an endogenous dye, whose singlecolor control was an unstained control, and whose fluorescence level was recorded in an extra empty channel assigned to a dummy dye. We therefore tested the ability of AutoSpill to compensate out autofluorescence, which was in issue in the HS1 and HS2 datasets. In effect, we were able to use the extra channel to measure the intensity of autofluorescence and greatly reduce its impact onto the other channels (Fig. 4b, c). Importantly, the empty channel assigned to autofluorescence worked best when it was the channel with higher level of signal in the unstained control. This way, the most autofluorescent channel was sacrificed during panel design to enhance resolution across all the other channels. As this process of autofluorescence removal is based on the calculation of spillover in the unstained control, autofluorescence removal requires all of the singlecolor control samples to be run from the same base cell type as the experimental samples. Autofluorescence removal is therefore not possible in AutoSpill, or any other computational approaches of which we are aware, when single color controls come from disparate sources (such as using beads or cellular mixes with different baseline autofluorescence). While autofluorescence removal is effective in a mixed cellular population in which different cell types have quantitatively different levels of autofluorescence, the process may fail if the sample includes a mixture cells which qualitatively differ in their autofluorescence spectrum. Autofluorescence subtraction in samples with minimal autofluorescence could, in principle, add low degree of noise to the data. We therefore suggest that users manually inspect unstained samples for variance in fluorescence and only use the autofluorescence subtraction option if autofluorescence is detected in the sample.
Linear models for estimation of the SSM
Spillover spreading is defined as the incremental increase in standard deviation of fluorescent intensity in one parameter caused by the increase in fluorescent intensity of another parameter. Calculation of SSM coefficients, while not a standard step in the analysis pipeline, is a useful tool for machine quality control of consistency in sensitivity and performance, and can aid in minimizing interference during the design of high parameter flow cytometry panels^{15}. The SSM coefficients can be calculated by comparing the fluorescent intensity in the primary detector to the standard deviation of fluorescence in the secondary detector, for a pair of positive and negative populations in a singlecolor control corresponding to the primary detector^{15}. It can also be demonstrated that the linearity of this relationship for different sizes \(\sqrt{{{\Delta }}F}\), and that the estimation of each spillover spreading coefficient is machinedependent and compensationmatrixdependent, but is, however, dataset independent^{15}. Here, we used quantile partitioning and linear regression to estimate the linear relationship observed by Nguyen et al. thereby allowing the inclusion of events above, below, or inbetween the positive and negative populations of the original approach.
The events of each singlecolor control were partitioned quantilewise in the primary detector, and the standard deviation of the level of fluorescence was estimated, for each quantile bin, in every secondary detector. Next, two linear regressions were used to estimate, first, the standard deviation at zero fluorescence, and second, the spillover spreading coefficient. Coefficients deemed nonsignificant using an Ftest were replaced with zeros, as well as any negative coefficients. The majority of quantiles were, in fact, subsamples of the traditional positive and negative populations, but the inclusion of additional quantiles improved the precision of AutoSpread in estimating spillover spreading effects, because all these events conform to the same linear relationship, assuming that they are onscale and in the linear range of the flow cytometer (Fig. 5a). As a result, AutoSpread accurately estimated spillover spreading for datasets whose compensation matrices successfully orthogonalized the fluorescent signals present in the singlecolor controls (Fig. 5b).
The adjustment step of AutoSpread (the first regression) was critical. The adjustment removed the minor quadratic effect caused by σ_{0} in the initial estimates, thereby allowing a more accurate estimation of the coefficients \({\mathrm{{S{S}}}}_{C}^{P}\). If this adjustment step were skipped, that is, if the β’s were taken as the spillover spreading coefficients, then spreading effects would be consistently underestimated. In that case, comparison against the traditional SSM algorithm would show a clear negative bias (Fig. 5c). Including the adjustment, step eliminated that bias. For datasets whose singlecolor controls were contaminated by uncompensated signals (e.g. autofluorescence), both AutoSpread and the traditional SSM calculation may fail to accurately estimate spillover spreading. Initial gating that actively eliminates such effects, as well as the use of an extra autofluorescence channel, can alleviate the problem for both algorithms.
Biological utility of AutoSpill
To demonstrate the biological utility of improving the spillover matrix, we compared downstream analyses resulting from data compensated with AutoSpill versus the current traditional compensation algorithm. Here we used flow cytometry panels built to address biological questions that required antibody sets close to machine limits, or the analysis of highly autofluorescent cells, i.e., contexts where the greatest advantages of AutoSpill can be observed. First we compared the results of gating based on automated compensation calculation built into FlowJo v10.6 (traditional) with the results achieved by uploading an AutoSpillgenerated spillover matrix into the same gating experiment in FlowJo. Analyzing 18 and 28parameter flow cytometry datasets (MM3 and MM2, respectively), we identified multiple examples of poor discrimination of welldescribed immunological populations due to over and undercompensation (Fig. 6a). A substantial fraction of the error introduced by traditional compensation calculation was due to inefficiencies in the gating component driving major errors in spillover calculation (which can be corrected by the user through manual regating), with the remaining quotient due to residual errors in spillover calculation even with corrected gates (as seen in Fig. S1). AutoSpill corrected both aspects of the pipeline and produced quality results (Fig. 6a). Next, as AutoSpill was incorporated into FlowJo v10.7 during the course of manuscript review, we were able to run a typical user experience test, with all sample compensation and analysis performed within FlowJo v10.7 either using the traditional algorithm or with the AutoSpill option enabled. As with the website pipeline, the FlowJo v10.7 AutoSpill option corrected several obvious compensation flaws (Fig. 6b). While these errors can readily be identified as compensation errors, AutoSpill also corrected less obvious downstream analyses. For example, in the 18parameter MM3 dataset, where we gated for CD4+CD8−CD25+ lymphocytes, the population was 10fold lower using traditional compensation algorithms than with AutoSpill, despite similar compensation identified between the CD4, CD8, and CD25 channels (Fig. 6b). Backgating the missing CD25+ population identified the problem as undercompensation between the CD25 and CD19 channels, leading to elimination of more than 90% of the CD25+ population during early gating stages (Fig. 6c). Finally, we display two clear examples of the benefit of autofluorescence reduction, both based on highly autofluorescent myeloid populations (MM4 and MM5 datasets). First, microglia, a brainresident macrophagelike population, are often described as having low expression of MHCII during homeostasis^{16}. This is a key difference from brainresident macrophages, with high baseline MHCII expression, and determines the ability of the cell to present antigen to CD4 T cells. Using traditional compensation algorithms, low expression of MHCII was detected on 40% of microglia. This figure, however, dropped to near 0% when autofluorescence reduction was added (Fig. 6d), consistent with the complete absence of MHCII expression at the mRNA level in singlecell transcriptome analysis^{17}. We validated the result by including microglia from MHCII knockout mice, where a similar level of background MHCII expression was observed (Fig. 6d), demonstrating that autofluorescence reduction gave the biologically correct outcome. As an independent example, we investigated Foxp3 expression, the key lineagedetermining factor of regulatory T cells. Foxp3 expression has also been reported on various autofluorescent lineages, including thymic epithelium^{18}, lung epithelium^{9}, tumor cells^{19}, and macrophages^{20}. While expression outside the regulatory T cell lineage was later demonstrated to be due to autofluorescence artifacts^{21,22,23,24}, the incorrect reports resulted in research misdirection for several years. Using high dimensional analysis on a Foxp3^{GFP} reporter line and traditional compensation, low expression of the reporter was detected in 10% of the CD11b+ macrophage population (Fig. 6e). This expression was almost entirely eliminated through the use of the autofluorescence correction of AutoSpill, and was validated against wildtype mice, which do not have a GFP reporter present (Fig. 6e). Together, these practical examples demonstrate the added value of AutoSpill to flow cytometry analysis.
Discussion
Flow cytometry has been a revolutionary force in singlecell analysis. The ability to rapidly analyze protein expression of millions of cells at singlecell level, coupled with the purification capacity of fluorescenceactivated cell sorting, has provided a remarkable tool for understanding cellular heterogeneity and function. Initial limitations were overcome through ingenious technical developments: the number of fluorescent parameters were expanded through the development of new dyes and lasers, intracellular staining protocols were optimized for the detection of intracellular (and even posttranslationally modified) proteins, RNAflow techniques allowed measurement at the RNA level^{25}, and numerous nonantibodybased dyes were able to detect processes from redox potential^{26} to organelle content and status^{27}. The very utility of the technique has pushed flow cytometry to its technical barrier—the desire to measure everything on every cell has driven up the number of parameters that can be distinctly measured. The constraints imposed by overlapping fluorescent spectra are arguably the largest limit to the potential of flow cytometry, yet progress in the mathematical underpinnings of the analysis have substantially lagged behind the advances in the chemical and physical bases of the technology.
Newer singlecell technologies, most notably mass cytometry and singlecell RNASeq, do not have the spillover issues of flow cytometry. Mass cytometry is a direct competitor to flow cytometry, also primarily utilizing antibodybased detection of singlecell expression^{28}. As the heavy metal labels do not overlap, mass cytometry panels can be built up in an modular manner, without the same design constraints required for flow cytometry^{29}. While spectral flow cytometry and mass cytometry can readily run more than 40 parameters, classical flow cytometry experiments struggle to use more than 30 parameters, due to the challenge of distinguishing signals from each dye or fluorophore. Nonetheless, flow cytometry has major advantages over mass cytometry, most notably the speed of data acquisition (around 50fold more rapid data collection) and the ability to sort live cells. The other main competitor to flow cytometry is singlecell RNASeq^{28}. While initially limited to measurement of RNA content in a semiquantitative manner, the advent of barcoded antibodies in protocols such as CITESeq^{30} and Abseq^{31} provided data directly comparable to that of flow cytometry. As barcoding approaches have no practical limit concerning compensation issues, they can compete with flow cytometry. Even in this case, however, flow cytometry has distinct technological advantages. In addition to the previously mentioned advantage of livecell sorting, flow cytometry produces data at an unparalleled speed, with more than 10^{6} cells measured per minute, and with a data format enabling immediate analysis. In terms of price, current flow cytometry assays are several orders of magnitude cheaper than RNASeq, with costs on the order of 10 USD per 10^{6} cells^{28}. Flow cytometry is therefore very much a living technology, with important advantages over competitor technologies and limited only by the parameter barrier.
The latest iteration of flow cytometry is spectral flow cytometry, a refinement where more channels (detectors) are used than dyes. Spectral flow cytometry allows for enhanced discrimination of fluorophores, including those that share a main channel, by calculating the dye origin through fluorescence at minor channels where the emission spectrum differs^{32}. Spectral unmixing (assignment of detector signal to dyes) requires the generation of an accurate spillover matrix, which can be performed in a mathematically identical manner to the spillover matrix of traditional flow cytometry, regressing each dye against each other, but producing a rectangular rather than square spillover matrix (as channels > dyes). While different algorithms have been proposed on the methodology of applying this spillover matrix to unmix the spectral data^{33,34}, each benefits from the use of a more correct spillover matrix. As AutoSpill focuses on improving the estimation of the spillover coefficients, rather than on how these coefficients are used, the implementation of the AutoSpill algorithm to spectral cytometry data can therefore yield similar benefits to that observed with traditional flow cytometry data. Indeed, spectral systems may well be the more compelling use case, as the system encourages dye crowding and the use of dyes with overlapping spectra. Moreover, spectral systems almost always have sufficient spectral resolution to orthogonalize autofluorescence from the other fluorescent spectra present in a sample. It is in these more complex cases where AutoSpill provides the greatest benefit.
We have presented here a compensation method which greatly reduces compensation error and expands the possible number of parameters in flow cytometry experiments. The use of robust linear regression and iterative refinement allows the calculation of spillover matrices without the need for using controls with welldefined positive and negative populations, thus permitting the use of the actual panel antibodies for the controls in many experiments. This method can be applied to any flow panel from 4 to 6 fluorophores up to multicolor staining sets with more than 30 fluorescent dyes. Given that the typical number of gated events in singlecolor controls is at least in the order of thousands, the amount of data points available enables this approach to reduce compensation errors to such small values that the resulting compensation is, in practical terms, functionally perfect for the given set of singlecolor controls. On the other hand, the method needs some level of fluorescence in the primary channel for each control (or at least in one of the detectors for spectral systems), to be able to regress the spillover coefficients.
An added feature of AutoSpill is the ability to compensate out autofluorescence. Although some methods have been proposed^{35,36,37}, typically it is not possible to remove autofluorescence, with the exception of some spectral systems^{38,39}. By default, AutoSpill does not use an unstained control, but it can be included and assigned to an extra unused channel in the flow cytometer. Data collected in this extra channel can be treated as coming from an endogenous fluorescent dye, which results in the inclusion of autofluorescence levels in the calculation of spillover coefficients and ensuing compensation. This optional approach is recommended when there are nonnegligible levels of autofluorescence in one or several channels (as observed from an unstained control), and one of those highautofluorescence channels is not used in the design of the panel. As autofluorescence can be increased by physiological and cellular processes^{13,40}, the ability to compensate out autofluorescence can remove distortions appearing as false positives, where cellular changes are mistakenly identified as altered expression of a marker, while the signal is in fact caused by autofluorescence. This approach will be of particular utility in the study of cell populations with high intrinsic autofluorescence, such as myeloidlineage cells^{13,14} or tumor cells^{41,42}.
In comparison with previous compensation methods, which do not guarantee an upper bound on the compensation error, AutoSpill provides a spillover matrix with such a guarantee, given a set of controls. Therefore, it is possible now to address a new question: To which extent a set of singlecolor controls is sufficient to ensure proper compensation of data obtained with a complete panel, that is, not just for the set of controls. In our experience, some panels still require minor modifications of the spillover matrix, which implies that the singlecolor controls do not fully describe the fluorescence properties of the complete panel, probably because of secondorder phenomena such as secondary fluorescence or other interactions between dyes. Thus, this remains an open question.
While we demonstrate the utility of this method using eight representative datasets, the tool has been betatested more than 1000 times over a period of 22 months by more than 100 collaborating immunologists. This has allowed the development of a robust algorithm, designed to accommodate diverse datasets and to deal with lessthanperfect data arising in realworld experiments. The code is open source and is released with a permissive license, allowing integration into existing flow cytometry analysis pipelines in academia and industry. To increase access by research communities in immunology and other fields, we also provide a website (https://autospill.vib.be) that allows the upload of sets of singlecolor controls for calculating the spillover matrix with AutoSpill, produced in formats compatible with common software for flow cytometry analysis. As we have demonstrated by including AutoSpill in FlowJo v.10.7, this algorithm is suitable for integration into commercial software, allowing for rapid and widespread uptake of superior flow cytometry compensation.
Methods
Datasets
Collaborating immunologists betatested AutoSpill over a period of 22 months, which allowed extensive testing and improvement of the algorithm for niche cases. Among these datasets, four are used as examples here, covering mouse cells, human cells, and beads. Compensation using AutoSpill, with default parameters, was carried out for each of these four sets of singlecolor controls: mouse splenocytes (MM1 dataset), human PBMCs (HS1 and HS2 datasets), and beads (Be1 dataset). We also analyzed four fully stained datasets, as examples of biological utility: mouse splenocytes (MM2 and MM3 datasets), and mouse microglia (MM4 and MM5 datasets). Data collection complied with all relevant ethical regulations for animal research and work with human participants. All animal experiments were performed in accordance with the University of Leuven Animal Ethics Committee guidelines or the Babraham Institute Animal Welfare and Ethics Review Body. Animal husbandry and experimentation complied with existing European Union and national legislation and local standards. Sample sizes for mouse experiments were chosen in conjunction with the ethics committees to allow for robust sensitivity without excessive use. For human experiments, written informed consent was obtained from all participants and the ethics committee of University Hospitals Leuven approved the study.
Be1 dataset, beads
UltraComp eBeads^{TM} Compensation Beads (Thermofisher) were used to optimize fluorescence compensation settings for multicolor flow cytometric analysis at a Symphony flow cytometer. UltraComp eBeads^{TM} were stained with the following fluorochromelabeled antihuman antibodies: antiCD8–BUV805 (1:200, clone SK1), antiCD4–BUV496 (1:50, clone SK3), antiCD86–BUV737 (1:50, clone 2331 FUN1), antiCD141–BUV615P (1:50, clone 1A4), antiCD56–BUV563 (1:50, clone NCAM 16.2), antiCD16–BUV395 (1:50, clone 3G8), antiCD123–BB660P (1:50, clone 7G3), antiCD80–BB630 (1:50,clone L307.4), antiCD21–BV785 (1:50, clone Bly4), antiCD27–BV750P (1:40,clone L128), antiBAFFR–BV650 (1:50, clone 11C1), antiCD94–BV605 (1:50, clone HP3D9), antiCD40–APCR700 (1:50, clone 5C3) (all BD bioscience); antiCD3–PerCPVio700 (1:50, clone REA613) (Miltenyi Biotec); antiCD57–FITC (1:100, clone TB01), antiCD14–PECy5.5 (1:200, clone TuK4), fixable viability dye eFluor780 (1:1000) (all eBioscience); antiCD24–BV711 (1:50, clone ML5), antiCD19–BV510 (1:25, clone HIB19), antiHLADR–BV570 (1:40, clone L243), antiIgM–BV421 (1:100, clone MHM88), antiCD11c–APC (1:40, clone 3.9), antiCD38–PE/Dazzle 594 (1:100, clone HB7), antiCD10–PECy5 (1:50, clone HI10a), and antiIgD–PECy7 (1:100, clone IA62) (all BioLegend).
HS1 dataset, human peripheral blood mononuclear cells (PBMCs)
PBMCs were isolated from heparinized blood samples of human healthy donors using FicollPaque density centrifugation (MP biomedicals), frozen and then stored in liquid nitrogen. Frozen PBMCs were thawed and counted, and cell concentration was adjusted to 1 × 10^{6} for each singlecolor control. Cells were plated in a Vbottom 96well plate, washed once with PBS (Fisher Scientific) and stained with live/dead marker and fluorochromeconjugated antibodies against surface markers: antiCD8–BUV805 (1:200, clone SK1), antiCD4–BUV496 (1:50, clone SK3), antiCD95–BUV737 (1:100, clone DX2), antiCD4–BUV615P (1:50, SK3), antiCD28–BB660P (1:100, clone CD28.2), antiCD4–BB630 (1:50, clone SK3), antiCD4–BV750P (1:50, clone SK3), antiCD31–BV480 (1:100, clone WM59), antiCXCR5–BV650 (1:25, clone RF8B2), antiCD4–PE (1:100, clone SK3), antiCD4–PECy5 (1:50, clone SK3) (all BD Biosciences); antiCD3–PerCPVio700 (1:50, clone Rea613) (Miltenyi Biotec); antiCD3–FITC (1:50, clone UCHT1), antiCD4–PECy5.5 (1:50, clone SK3), antiCCR7–PECy7(1:50, clone 3D12), antiCD4–APCeFluor780 (1:50, clone SK3) (all eBioscience); antiCD4–BV786 (1:50, clone SK3), antiCD4–BV711 (1:50, clone SK3), antiCD4–BV605 (1:50, clone SK3), antiHLADR–BV570 (1:40, clone L243), antiCD127–BV421 (1:25, clone A019D5), antiCD4–PE/Dazzle 594 (1:100, clone SK3), antiCD4–AF647 (1:50, clone SK3) (all BioLegend).
Samples were stained for 60 min at 4 °C, washed twice in PBS/1% FBS (Tico Europe), and then fixed and permeabilized with Foxp3 Transcription Factor Staining Buffer Set (eBioscience), according to manufacturer’s instructions. Cells were stored overnight at 4 °C and were then acquired on a Symphony flow cytometer with Diva software (BD Biosciences). A minimum of 5 × 10^{4} events were acquired for each sample.
HS2 dataset, human PBMCs
Frozen PBMCs from human healthy donors were processed as for the HS1 datasset and stained with live/dead marker and fluorochromeconjugated antibodies against the following surface markers: antiCD8–BUV805 (1:200, clone SK1), antiCD4–BUV496 (1:50, clone SK3), antiCD95–BUV737 (1:100, clone DX2), antiCD28–BB660P (1:100, clone CD28.2), antiICOS–BB630 (1:50, clone DX29), antiCXCR3–BV785 (1:25, clone 1C6), antiPD1–BV750P (1:25, clone EH12.1), antiCXCR5–BV650 (1:25, clone RF8B2), antiCCR2–BV605 (1:25, clone 1D9), antiCD31–BV480 (1:100, clone WM59) (all BD Biosciences); antiCD3–PerCPVio700 (1:50, clone REA613) (Miltenyi Biotec); antiCD45RA–FITC (1:50, clone HI100), antiCD14PE–Cy5.5 (1:200, clone TuK4), antiCCR7PE–Cy7 (1:50, clone 3D12), fixable viability dye eFluor780 (all eBioscience); antiCD25–BV711 (1:25, clone BC96), antiHLADR–BV570 (1:40, clone L243), antiCD127–BV421 (1:25, clone A019D5), and antiCCR4–PE/Dazzle 594 (1:100, clone L291H4) (all BioLegend).
Samples were stained for 60 min at 4 °C, washed twice in PBS/1% FBS (Tico Europe), and then fixed and permeabilized with Foxp3 Transcription Factor Staining Buffer Set (eBioscience), according to manufacturer’s instructions. Cells were stained overnight at 4 °C with antiKi67–BUV615P, antiCTLA4–PECy5, antiRORγt–PE (BD Biosciences), and antiFOXP3–AF647 (BioLegend) antihuman intracellular antibody. Samples were acquired on a Symphony flow cytometer (BD Biosciences).
MM1 dataset, mouse splenocytes
Splenocytes from C57Bl/6 mice were disrupted with glass slides, filtered through 100 μm mesh, and red blood cells lysed. Cells were fixed and permeabilized with Foxp3 transcription factor staining buffer set (eBioscience) according to the manufacturer’s instructions, and stained overnight at 4 °C with Fixable Viability Dye eFluor780 (eBioscience) or the following antibodies: antiCD4–BV421 (1:200, clone GK1.5), antiCD24–BV510 (1:400, clone M1/69), antiCD3–BV570 (1:250, clone 1452C11), antiCD4–BV605 (1:200, clone RM45), antiCD3–BV650 (1:400, clone 1452C11), antiCD4–BV711 (1:200, clone GK1.5), antiCD4–BV785 (1:200, clone GK1.5), antiCD3–AF488 (1:1000, clone 1452C11)/antiCD4–AF488 (1:200, clone RM45)/antiTCRβ–AF488 (1:2000, clone H57597), antiCD4–PerCPCy5.5 (1:200, clone RM45), antiCD4–PE594 (1:200, clone RM45), antiCD8–PECy7 (1:2000, clone 536.7), antiMHCII–AF700 (1:1000, clone M5/114.15.2) (all Biolegend), antiCD19–BV750 (1:500, clone 1D3), antiCD3–BB630P (1:1000, clone 1452C11)/antiThy1.2–BB630P (1:4000, clone 532.1), antiCD45.2–BB660P2 (1:1000, clone 104)/antiCD3–BB660P2 (1:1000, clone 1452C11), antiTCRβ–BB790P (1:2000, clone H57597), antiCD4–BUV395 (1:200, clone GK1.5), antiIgD–BUV496 (1:2000, clone 1126c.2a), antiCD3–BUV563 (1:400, clone 1452C11), antiCD3–BUV615P (1:400, clone 1452C11), antiCD19–BUV661 (1:250, clone 1D3), antiCD21–BUV737 (1:500, clone 7G6), antiCD8–BUV805 (1:250, clone 536.7) (all BD Biosciences), antiCD4–PE (1:500, clone RM45)/antiCD3–PE (1:2000, clone 1452C11)/antiCD8–PE (1:500, clone 536.7), antiIgM–PECy5 (1:2000, clone Il/41), antiCD3–PECy5.5 (1:8000, clone 1452C11) or antiCD4–APC (1:1000, clone RM45) (all eBioscience). For some fluorophores, multiple antibodies were used in the same compensation control, which is indicated by slashes. Samples were acquired on a Symphony flow cytometer (BD Biosciences).
MM2 dataset, mouse splenocytes
Splenocytes from C57Bl/6 mice were disrupted with glass slides, filtered through 100 μm mesh, and red blood cells lysed. Cells were stained with Fixable Viability Dye eFluor780 (eBioscience), fixed and permeabilized with Foxp3 transcription factor staining buffer set (eBioscience) according to the manufacturer’s instructions, and stained overnight at 4 °C with the following antibodies: antiCD4–BV421 (1:2000, clone N418), antiCD24–BV510 (1:2000, clone M1/69), antiLy6G–BV570 (1:2000, clone 1A8), antiXCR1–BV650 (1:2500, clone ZET), antiCD19–BV785 (1:400, clone 1D3), antiCD3–AF488 (1:1000, clone 1452C11), antiPDCA1–PerCPCy5.5 (1:1000, clone 927), antiCD23–PE (1:5000, clone B3B4), antiCD64–PE594 (1:500, clone X545/7.1), antiCD172a–PECy7 (1:5000, clone P84), antiCD45–APC (1:10,000, clone 30F11), antiMHCII–AF700 (1:2000, clone M5/114.15.2) (all Biolegend), antiIgE–BV605 (1:5000, clone R3572), antiCD93–BV711 (1:2000, clone AA4.1), antiCD11b–BV750 (1:2000, clone M1/70), antiCD80–BB630P (1:2000, clone 1610A1), antiCD95–BB660P2 (1:10,000, clone Jo2), antiTCRβ–BB790P (1:2000, clone H57597), antiCD103–BUV395 (1:1000, clone M290), antiIgD–BUV496 (1:2000, clone 1126c.2a), antiLy6C–BUV563 (1:500, clone AL21), antiSiglec F–BUV615P (1:1000, clone E502440), anticKit–BUV661 (1:5000, clone 2B8), antiCD21/35–BUV737 (1:5000, clone 7G6), antiCD8a–BUV805 (1:500, clone 536.7) (all BD Biosciences), antiIgM–PECy5 (1:1000, clone Il/41) and antiNK1.1–PECy5.5 (1:2000, clone PK136) (eBioscience). Compensation controls were stained as described in the MM1 dataset. Samples were acquired on a Symphony flow cytometer (BD Biosciences).
MM3 dataset, mouse splenocytes
Splenocytes from C57Bl/6 mice were disrupted with glass slides, filtered through 100 μm mesh, and red blood cells lysed. Cells were stained with Fixable Viability Dye eFluor780 (eBioscience), antiCD90.2–BV510 (1:250, clone 532.1), antiCD25–BV650 (1:200, clone PC61), antiCD45–BUV395 (1:500, clone 30F11) (all Biolegend), antiCD127–PE (1:100, clone A7R34) and antiB220–PECy5 (1:200, clone RA36B2) (all eBioscience). Cells were fixed and permeabilized with Foxp3 transcription factor staining buffer set (eBioscience) according to the manufacturer’s instructions, and stained overnight at 4 °C with the following antibodies: antiTbet–BV421 (1:200, clone 4B10), antiCD8–BV785 (1:2000, clone 536.7), antiNKp46–FITC (1:500, clone 29A1.4), antiNK1.1–PECy5.5 (1:2500, clone PK136), antiMHCII–AF700 (1:2000, clone M5/114.15.2) (all Biolegend), antiCD11b–eFluor450 (1:1000, clone M1/70), antiGATA3–PECy7 (1:100, clone L50823), antiCD3–biotin (1:1000, clone 1452C11), antiRORt–APC (1:500, clone AFKJS9) (all eBioscience), antiTCRβ–BB790P (1:4000, clone H57597), antiCD4–BUV496 (1:500, clone GK1.5), and antiCD19–BUV661 (1:2000, clone 1D3) (all BD Biosciences). Antibodies used for compensation controls were antiCD25–BV421 (1:200, clone PC61), antiCD44–BV510 (1:200, clone IM7), antiCD3–BV650 (1:200, clone 17A2), antiCD8–BV785 (1:2000, clone 536.7), antiNK1.1–PECy5.5 (1:2500, clone PK136), antiMHCII–AF700 (1:2000, clone M5/114.15.2) (all Biolegend), antiCD11b–eFluor450 (1:1000, clone M1/70), antiTCRβ–FITC (1:500, clone H57597), antiB220–PECy5 (1:200, clone RA36B2), antiCD23–PECy7 (1:500, clone B3B4), antiCD8–biotin (1:200, clone 536.7), antiFoxp3–APC (1:200, clone FJK16s), antiCD69–PE (1:200, clone H1.2F3) (all eBioscience), antiTCRβ–BB790P (1:4000, clone H57597), antiCD103–BUV395 (1:500, clone M290), antiCD4–BUV496 (1:200, clone GK1.5), and antiCD19–BUV661 (1:2000, clone 1D3) (all BD Biosciences). Streptavidin AF350 (1:200, Invitrogen) was used to identify biotinylated antibody. Samples were acquired on a Yeti/ZE5 flow cytometer (Propel Labs/BioRad).
MM4 dataset, mouse microglia
MHCII knockout mice^{43} were used on the B6 background. Leukocytes and microglia were extracted from mouse brains by chopping with a razor blade, digested in 0.4 mg/ml collagenase D (SigmaAldrich), and separated over 40% Percoll (GE Healthcare). Microglia were stained with antiMHCII–FITC (1:200, clone M5/114.15.2, eBioscience), antiCD11b–PECy7 (1:500, clone M1/70, eBioscience), antiCD45–APC (1:1000, clone 30F11, eBioscience), antiCD4–PEDazzle594 (1:500, clone GK1.5, BioLegend), and fixable viability dye eFluor780 (eBioscience). Samples were acquired on an Aurora spectral cytometer (Cytek).
MM5 dataset, mouse splenocytes
Foxp3^{DTRGFP} mice^{44} were used on the B6 background. Splenocytes were disrupted with glass slides, filtered through 100 μm mesh, and red blood cells lysed. Splenocytes antiCD11b–PECy7 (1:2000, clone M1/70, eBioscience), antiCD45–APC (1:1000, clone 30F11, eBioscience), antiCD4–PEDazzle594 (1:500, clone GK1.5, BioLegend), and fixable viability dye eFluor780 (1:4000, eBioscience). Samples were acquired on an Aurora spectral cytometer (Cytek).
General implementation details of AutoSpill
AutoSpill was implemented in R v.3.6.3, using the packages flow core v.1.52.1, flowWorkspace v.3.34.1, ggplot2 v.3.3.2, moments v.0.14, and RColorBrewer v.1.12. Further details on packages specific to particular steps of the algorithm are listed below.
Initial gating
The initial gate was calculated independently for each control, over the 2ddensity of events on forward and side scatter (FSCA and SSCA parameters). To robustly detect the population of interest, two tessellations were successively carried out to isolate the desired density peak. First, data were trimmed on extreme values (1% and 99%). Then, maxima were located numerically by a moving average (window size 3) on a soft estimation of the 2ddensity (bandwidth factor 3). Maxima were used to generating nonoverlapping tiles covering the entire 2d dataset (tessellation). The first tessellation was carried out on these density maxima, and the tile corresponding to the highest maximum was selected, ignoring peaks with lower values of both FSCA and SSCA (<5% of range). A rectangular region in the FSCA/SSCAplane was chosen by using the median and 3 × the mean absolute deviation of the events contained in the selected tile. A second, finer 2ddensity estimation (bandwidth factor 2) was obtained on this region, followed again by numerical detection of maxima (window size 2) and tessellation by the maxima. A final 2ddensity estimation (bandwidth factor 1) was obtained on the tile containing the highest maximum, with the gate being defined as the convex hull enclosing the points that belonged to this tile and had a density larger than a threshold (33% of range).
Tessellations were carried out with package deliver v.0.128, density estimations with packages MASS v.7.351.6, surface interpolations with package fields v.10.3, and spatial operations with packages sp v.1.42 and tripack v.1.39.
Robust linear models for estimation of spillover coefficients
The linearity of the quantum mechanical nature of photons implies that the ratio between the average fluorescence level (that is, the average number of photons) detected in any two detectors and from any dye is equal to the ratio between the corresponding values of the emission spectrum of the dye, regardless of the level of fluorescence. As the value of the spillover coefficient for the primary channel (the channel assigned to the dye in the singlecolor control, in classical systems) is usually normalized to one, the spillover coefficient of every secondary channel is equal to the fluorescence ratio above. This implies that each spillover coefficient can be directly read from the slope of a linear regression considering the fluorescence in the primary channel as the independent variable and the fluorescence in the secondary channel as the dependent variable (that is, with x and y swapped for the usual representation of singlecolor controls when compensating). Thus, the absence of spillover corresponds to a zero slope in this regression, that is, to the vertical direction in the usual plot where the primary channel is displayed in the yaxis. To protect the algorithm against distortions in the data, especially those coming from autofluorescence issues, robust linear regression was used, giving lower weights to events farther away from the estimated regression line. Robust linear models (motivated by the heteroscedastic data with outliers) were implemented with the package MASS v.7.351.6, with default parameters, i.e. Mestimation with Huber weighting and the parameter k = 1.345.
Refinement of spillover matrix
After the first iteration of the algorithm, applying on compensated data the same kind of calculation used for the spillover coefficients, on channels in classical systems or on dyes in spectral systems, would produce zero values with perfect compensation, corresponding to perfectly vertical compensation plots. Otherwise, errors in compensation would yield nonzero values reflecting residual spillover. Overcompensated data would amount to excessively negative values in the secondary channel/dye, corresponding to a negative slope. Similarly, undercompensation would produce excessively positive values in the secondary channel/dye, corresponding to a positive slope.
Observed errors in compensation arise from errors in the estimation of the spillover coefficients. Crucially, it can be proved that, for the average event at any level of fluorescence, the error matrix T in the calculation of the spillover matrix S can be calculated from the observed compensation errors E as
U = S + T is the (erroneous) spillover matrix used to compensate the data (see below).
By successively applying Eq. (1), that is, by iteratively refining the spillover matrix and recalculating the compensation, errors in the spillover matrix and errors in compensation can be reduced to a negligible magnitude. The algorithm starts working in linear scale, and switches to biexponential scale when the maximum compensation error across all singlecolor controls is less than a threshold fixed a priori (10^{−2}). To be used in Eq. (1), compensation errors obtained in the biexponential scale are transformed back to a linear scale, by using the two points in the regression line with extreme values in the primary channel. Iterations stop near the convergence of the algorithm when the maximum compensation error across all singlecolor controls is less than a threshold of 10^{−4}.
While effective in most cases, this strategy for reducing compensation error can become compromised when using controls with low fluorescence levels in the primary channel or other fluorescence artifacts. In these situations, iterations can give rise to oscillations in the observed compensation errors before reaching convergence. To deal with these extreme cases, oscillations are detected by a moving average (size 10, initial value 1) of the decrease in the standard deviation of spillover errors. When this moving average gets below a threshold of 10^{−6}, a fraction (10%) of the update to the spillover matrix is applied in Eq. (1), slowing down convergence and further decreasing compensation error.
Spillover error
In a flow cytometry system with c channels, let us consider the spillover matrix for a set of d singlecolor controls, that is for d dyes, with d ≤ c. We concentrate on the dye i = 1…d during the following argument.
For any event in the flow cytometer, we have the following tworow vectors: the true event data x, with length d, and the observed event data y, with length c. On average for any level of fluorescence, true and observed events are related linearly through the d × c spillover matrix S, according to
Classical flow cytometry systems have c = d, and compensation is usually achieved by inverting the spillover matrix S and multiplying by the observed data y. Spectral systems feature c > d, and compensation is usually called unmixing and is not unequivocally defined, because Eq. (2) produces an overspecified system of equations. In the following, and for simplicity, we refer to unmixing in spectral systems also as compensation.
Independently of the compensation method used, when the spillover matrix S is estimated as U = S + T, thus with some error T, it unavoidably gives rise to incorrectly compensated data x + p, which verifies, on average,
Therefore,
The vectors x and p, and the matrices S, T, and U, have the following properties:

Because x represents the true value of events in the singlecolor control for dye i, then x_{i} > 0 and x_{j} = 0, for all j ≠ i.

The ith row of the spillover matrix S is normalized with 1 = S_{ir} ≥ S_{is} ≥ 0, for some r = 1…c and every s ≠ r.

The row normalization of S implies that the true value of the dye in the control, x_{i}, can always be obtained from the observed value y_{r}, as Eq. (2) implies y_{r} = x_{i}S_{ir} = x_{i}. Therefore, p_{i} = 0, irrespective of errors in the estimation of the spillover matrix.

Also because of the row normalization of the spillover matrix, the estimation of the spillover coefficient S_{ir} = 1 will always be exact, i.e. U_{ir} = 1 and T_{ir} = 0, irrespective of errors in the estimation of the spillover matrix.
Let us consider now the LHS of Eq. (4), i.e. the row vector xT. Its sth coefficient, for any s = 1…c, equals
Note that (xT)_{r} = 0.
Let us consider the RHS of Eq. (4), i.e. the row vector−pU. Its sth coefficient, for any s = 1…c, equals
Note that the summation term p_{i}U_{is} = 0.
Equations (4–6) imply that, for any s = 1…c,
The ratio p_{j}/x_{i} can be considered as the compensation error for the average event, corresponding to a spurious signal assigned to dye j, caused by incorrectly compensated spillover from dye i. Equation (3) implies that the ratio p_{j}/x_{i} is invariant w.r.t. the level of fluorescence, and thus it can be estimated by regressing p_{j} vs. x_{i}.
Let us define the compensation error matrix E as the d × d matrix with coefficients
Note that E_{ii} = 0. We can then rewrite Eq. (7) as
for any s = 1…c.
In summary, Eq. (9) allows to calculate the ith row of the spillover error matrix T. By repeating the same argument for every dye, we can obtain all the rows i = 1…d, and thus the complete matrix as
Box 1
Linear models for estimation of SSM
Successful compensation equilibrates around zero the fluorescence levels in all secondary channels, but with the cost of accentuating undesirable variance or spread in those channels. Again for quantum mechanical reasons, the variance in fluorescence for any (compensated or uncompensated) channel/dye grows linearly with the fluorescence level, and therefore the coefficients of the SSM can be estimated with linear regression.
We start with the formula for an SSM coefficient \({\mathrm{{S{S}}}}_{C}^{P}\), which characterizes the incremental standard deviation induced in parameter C by the spillover from parameter P^{15},
where σ_{positive} and σ_{negative} are the standard deviations in Cfluorescence in positive and negative populations, respectively, and F_{positive} − F_{negative} is the difference in Pfluorescence intensity between them. While the traditional algorithm estimates the above quantities using medians and robust standard deviations of fluorescence in the positive and negative populations, we will, for the sake of linear regression, let our negative be the theoretical quantity when Pfluorescence (F) is equal to zero, while the standard deviation is an unknown quantity, which we call σ_{0}. This assumption, introduced for practical computation, excludes the quadratic effect that σ_{0} imparts. The effect of this exclusion is negligible, as: (i) σ_{0} (characterization of the cytometer’s machine noise) is guaranteed to be small when compared to the standard deviation introduced by the Poisson process of counting photons (otherwise the cytometer cannot generate meaningful data), (ii) compensation controls used during SSM calculation include negative populations that reside close to zero, and (iii) the result of a small σ_{0} and presence of a population nearzero dramatically reduces the impact of the σ_{0} quadratic effect on the model because they guarantee that the data reside on a nearlinear region of a parabola. This gives us the following equation relating F to σ, which is suitable for estimating σ_{0} by linear regression:
Notice that the slope β is not equal to the spillover spreading coefficient \({\mathrm{{S{S}}}}_{C}^{P}\), except in the unique case where σ_{0} equals zero. We thus proceed with the estimation of σ_{0} as the first step of AutoSpread.
To supply data for the regression, we partition the events of the singlecolor control for parameter P by quantile. For controls with a large number of events, we use 256 quantiles, but we allow as few as 8 to ensure enough events in each quantile to estimate standard deviation reliably. For each other parameter C, we calculate in each quantile the robust standard deviation of fluorescence (the 84th percentile minus the median) as the estimate of σ and the median fluorescence as the estimate of F. The F values may be negative and/or close to zero, so they are passed through a squarerootlike transform defined by \({f}_{\sqrt{}}(x)={\rm{sign}}(x)\ (\sqrt{ x +1}1)\) prior to regression, instead of the simple square root function. The resulting regression provides an estimate of σ_{0}.
Using the estimate of σ_{0}, AutoSpread calculates for each quantile the estimate of \(\sigma ^{\prime} \), defined by \(\sigma ^{\prime} ={f}_{\sqrt{}}({\sigma }^{2}{\sigma }_{0}^{2})\), and these adjusted standard deviation estimates provide the data for the second regression, \(\sigma ^{\prime} =\sqrt{F}\ {\mathrm{{S{S}}}}_{C}^{P}\). This regression is calculated without an intercept term because the adjustment of σ_{0} forces it to zero.
Reporting summary
Further information on research design is available in the Nature Research Reporting Summary linked to this article.
Data availability
The raw data for the eight analyzed datasets is available at FlowRepository (https://flowrepository.org), with IDs FRFCMZ2SV (Be1) [https://flowrepository.org/id/FRFCMZ2SV], FRFCMZ2ST (HS1 & HS2) [https://flowrepository.org/id/FRFCMZ2ST], FRFCMZ2SS (MM1) [https://flowrepository.org/id/FRFCMZ2SS], FRFCMZ2SW (MM2) [https://flowrepository.org/id/FRFCMZ2SW], FRFCMZ2SJ (MM3) [https://flowrepository.org/id/FRFCMZ2SJ], FRFCMZ2SK (MM4) [https://flowrepository.org/id/FRFCMZ2SK], and FRFCMZ2SL (MM5) [https://flowrepository.org/id/FRFCMZ2SL]. Note that the compensation controls for the MM2 dataset are the MM1 dataset. Source data are provided with this paper.
Code availability
Source code for AutoSpill is available through the R package autospill, available at the github repository https://github.com/carlosproca/autospill^{45}, which includes batch code that reproduces the reported results for the datasets MM1, HS1, HS2, and Be1. The R package is also available in the Supplementary Information as Supplementary Data. In addition, AutoSpill is accessible as a freely available web service at https://autospill.vib.be. The R package also includes batch code to reproduce results as generated by the website.
To allow a large user base to take immediate advantage of the approaches reported here, an implementation of AutoSpill is included in the release of FlowJo v.10.7. AutoSpread is available in binary form in FlowJo v.10.7 (patent pending).
References
Herzenberg, L. A. et al. The history and future of the fluorescence activated cell sorter and flow cytometry: a view from Stanford. Clin. Chem. 48, 1819–1827 (2002).
O’Gorman, M. R. Clinically relevant functional flow cytometry assays. Clin. Lab. Med. 21, 779–94 (2001).
Krutzik, P. O. & Nolan, G. P. Fluorescent cell barcoding in flow cytometry allows highthroughput drug screening and signaling profiling. Nat. Methods 3, 361–368 (2006).
Maciorowski, Z., Chattopadhyay, P. K. & Jain, P. Basic multicolor flow cytometry. Curr. Protoc. Immunol. 117, 5.4.1–5.4.38 (2017).
Cossarizza, A. et al. Guidelines for the use of flow cytometry and cell sorting in immunological studies (second edition). Eur. J. Immunol. 49, 1457–1973 (2019).
Bendall, S. C., Nolan, G. P., Roederer, M. & Chattopadhyay, P. K. A deep profiler’s guide to cytometry. Trends Immunol. 33, 323–332 (2012).
Roederer, M. Spectral compensation for flow cytometry: visualization artifacts, limitations, and caveats. Cytometry 45, 194–205 (2001).
Carr, E. J. et al. The cellular composition of the human immune system is shaped by age and cohabitation. Nat. Immunol. 17, 461–468 (2016).
Mair, F. & Prlic, M. OMIP 044: 28 color immunophenotyping of the human dendritic cell compartment. Cytometry Part A 93, 402–405 (2018).
Brummelman, J. et al. Development, application and computational analysis of highdimensional fluorescent antibody panels for singlecell flow cytometry. Nat. Protoc. 14, 1946–1969 (2019).
Bandura, D. R. et al. Mass cytometry: technique for real time single cell multitarget immunoassay based on inductively coupled plasma timeofflight mass spectrometry. Anal. Chem. 81, 6813–6822 (2009).
Bagwell, C. B. & Adams, E. G. Fluorescence spectral overlap compensation for any number of flow cytometry parameters. Ann. N. Y. Acad. Sci. 677, 167–84 (1993).
Mitchell, A. J. et al. Technical advance: autofluorescence as a tool for myeloid cell analysis. J. Leukoc. Biol. 88, 597–603 (2010).
Vermaelen, K. & Pauwels, R. Accurate and simple discrimination of mouse pulmonary dendritic cell and macrophage populations by flow cytometry: methodology and new insights. Cytometry Part A 61, 170–177 (2004).
Nguyen, R., Perfetto, S., Mahnke, Y. D., Chattopadhyay, P. & Roederer, M. Quantifying spillover spreading for comparing instrument performance and aiding in multicolor panel design. Cytometry Part A 83A, 306–315 (2013).
Li, Q. & Barres, B. A. Microglia and macrophages in brain homeostasis and disease. Nat. Rev. Immunol. 18, 225–242 (2018).
Pasciuto, E. et al. Microglia require cd4 t cells to complete the fetaltoadult transition. Cell 182, 625–640 (2020).
Chang, X. et al. The Scurfy mutation of FoxP3 in the thymus stroma leads to defective thymopoiesis. J. Exp. Med. 202, 1141–1151 (2005).
Zuo, T. et al. FOXP3 is an Xlinked breast cancer suppressor gene and an important repressor of the HER2/ErbB2 oncogene. Cell 129, 1275–1286 (2007).
Manrique, S. Z. et al. Foxp3positive macrophages display immunosuppressive properties and promote tumor growth. J. Exp. Med. 208, 1485–1499 (2011).
Liston, A. et al. Lack of Foxp3 function and expression in the thymic epithelium. J. Exp. Med. 204, 475–480 (2007).
Li, F. et al. Autofluorescence contributes to falsepositive intracellular Foxp3 staining in macrophages: a lesson learned from flow cytometry. J. Immunol. Methods 386, 101–107 (2012).
Kim, J. et al. Cutting Edge: depletion of Foxp3+ cells leads to induction of autoimmunity by specific ablation of regulatory T cells in genetically targeted mice. J. Immunol. 183, 7631–7634 (2009).
Put, S. et al. Macrophages have no lineage history of Foxp3 expression. Blood 119, 1316–1318 (2012).
Hanley, M. B., Lomas, W., Mittar, D., Maino, V. & Park, E. Detection of low abundance RNA molecules in individual cells by flow cytometry. PLoS ONE 8, e57002 (2013).
Li, R., Jen, N., Yu, F. & Hsiai, T. K. Assessing mitochondrial redox status by flow cytometric methods: vascular response to fluid shear stress. Curr. Protoc. Cytom. 58, 9.37.1–9.37.14 (2011).
Poot, M., Gibson, L. L. & Singer, V. L. Detection of apoptosis in live cells by MitoTracken(TM) red CMXRos and SYTO dye flow cytometry. Cytometry 27, 358–364 (1997).
Chattopadhyay, P. K., Winters, A. F., Lomas, W. E., Laino, A. S. & Woods, D. M. Highparameter singlecell analysis. Annu. Rev. Anal. Chem. 12, 411–430 (2019).
Spitzer, M. H. & Nolan, G. P. Mass cytometry: single cells, many features. Cell 165, 780–791 (2016).
Stoeckius, M. et al. Simultaneous epitope and transcriptome measurement in single cells. Nat. Methods 14, 865–868 (2017).
Shahi, P., Kim, S. C., Haliburton, J. R., Gartner, Z. J. & Abate, A. R. Abseq: ultrahighthroughput single cell protein profiling with droplet microfluidic barcoding. Sci. Rep. 7, 44447 (2017).
Nolan, J. P. & Condello, D. Spectral flow cytometry. Curr. Protoc. Cytom. 63, 1.27.1–1.27.13 (2013).
Novo, D., Grégori, G. & Rajwa, B. Generalized unmixing model for multispectral flow cytometry utilizing nonsquare compensation matrices. Cytometry Part A 83 A, 508–520 (2013).
Futamura, K. et al. Novel fullspectral flow cytometry with multiple spectrallyadjacent fluorescent proteins and fluorochromes and visualization of in vivo cellular movement. Cytometry Part A 87, 830–842 (2015).
Roederer, M. & Murphy, R. F. Cell by cell autofluorescence correction for low signal to noise systems: application to epidermal growth factor endocytosis by 3T3 fibroblasts. Cytometry 7, 558–565 (1986).
Alberti, S., Parks, D. R. & Herzenberg, L. A. A single laser method for subtraction of cell autofluorescence in flow cytometry. Cytometry 8, 114–119 (1987).
Roederer, M. Distributions of autofluorescence after compensation: Be panglossian, fret not. Cytometry Part A 89, 398–402 (2016).
Nitta, N., Veltri, G. & Dessing, M. Method and Theory of The Autofluorescence Unmixing in sp6800 Spectral Cell Analyzer. Technical Report (Sony Corporation, 2015).
Schmutz, S., Valente, M., Cumano, A. & Novault, S. Spectral cytometry has unique properties allowing multicolor analysis of cell suspensions isolated from solid tissues. PLoS ONE 11, e0159961 (2016).
Surre, J. et al. Strong increase in the autofluorescence of cells signals struggle for survival. Sci. Rep. 8, 12088 (2018).
Smith, C. A., Pollice, A., Emlet, D. & Shackney, S. E. A simple correction for cell autofluorescence for multiparameter cellbased analysis of human solid tumors. Cytometry Part B 70, 91–103 (2006).
Pantanelli, S. M. et al. Differentiation of malignant Blymphoma cells from normal and activated Tcell populations by their intrinsic autofluorescence. Cancer Res. 69, 4911–4917 (2009).
Madsen, L. et al. Mice lacking all conventional MHC class II genes. Proc. Natl Acad. Sci. USA 96, 10338–10343 (1999).
Kim, J. M., Rasmussen, J. P. & Rudensky, A. Y. Regulatory T cells prevent catastrophic autoimmunity throughout the lifespan of mice. Nat. Immunol. 8, 191–197 (2007).
Roca, C. P. et al. Autospill is a principled framework that simplifies the analysis of multichromatic flow cytometry data. GitHub repository https://doi.org/10.5281/zenodo.4656919 (2021).
Acknowledgements
This project has received funding from the European Union’s Horizon 2020 research and innovation program under grant agreement Nos. 779295 and 874707 (EXIMIOUS). This work was also supported by the VIB, the ERC Consolidator Grant TissueTreg (to A.L.), the Biotechnology and Biological Sciences Research Council through BB/S019189/1, Institute Strategic Program Grant funding BBS/E/B/000C0427, and BBS/E/B/000C0428, and the Biotechnology and Biological Sciences Research Council Core Capability Grant to the Babraham Institute. Part of this research is conducted within the project entitled PRISMA funded by VLAIO (Flanders Innovation & Entrepreneurship) and supported by grant from Stichting Alzheimer Onderzoek Fondation Recherche Maladie Alzheimer (SAOFMA) (to S.H.B.). The authors thank all the collaborators who extensively tested and gave feedback on the beta version of AutoSpill, Michelle Linterman, Danika Hill (Babraham Institute) and Alice Denton (Imperial College London) for supplying additional example data for the AutoSpill website, and Ruben Van Gestel (KUL) for running test datasets for the AutoSpill website.
Author information
Authors and Affiliations
Contributions
The study was conceived by C.P.R. and A.L. C.P.R. developed and tested the AutoSpill algorithm. O.T.B., T.P., C.E.W., and S.H.B. provided the datasets, input on flow cytometry practicalities, and evaluated compensation results. R.H. and J.S. developed and tested the AutoSpread algorithm, and implemented AutoSpill into FlowJo. L.K., J.C., and A.B. developed and tested the AutoSpill website. V.G. worked on revisions. The manuscript was written by C.P.R. and A.L., and revised and approved by all authors.
Corresponding authors
Ethics declarations
Competing interests
The VIB and the Babraham Institute received funding from BD Bioscience in return for prepublication access to and consultancy on the AutoSpill algorithm, in order to be incorporated into FlowJo v.10.7. R.H. and J.S. are affiliated with FlowJo, a wholly owned subsidiary of Becton, Dickinson and Company. The other authors declare no competing interests.
Additional information
Peer review information Nature Communications thanks Pratip Chattopadhyay, Wayne Moore, David Parks and the other, anonymous, reviewer(s) for their contribution to the peer review of this work.
Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Source data
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/.
About this article
Cite this article
Roca, C.P., Burton, O.T., Gergelits, V. et al. AutoSpill is a principled framework that simplifies the analysis of multichromatic flow cytometry data. Nat Commun 12, 2890 (2021). https://doi.org/10.1038/s41467021231268
Received:
Accepted:
Published:
DOI: https://doi.org/10.1038/s41467021231268
This article is cited by

Highly efficacious and safe neutralizing DNA aptamer of SARSCoV2 as an emerging therapy for COVID19 disease
Virology Journal (2022)

Intratumoral DNAbased delivery of checkpointinhibiting antibodies and interleukin 12 triggers T cell infiltration and antitumor response
Cancer Gene Therapy (2022)

Astrocytetargeted gene delivery of interleukin 2 specifically increases brainresident regulatory T cell numbers and protects against pathological neuroinflammation
Nature Immunology (2022)

Monocytedriven atypical cytokine storm and aberrant neutrophil activation as key mediators of COVID19 disease severity
Nature Communications (2021)
Comments
By submitting a comment you agree to abide by our Terms and Community Guidelines. If you find something abusive or that does not comply with our terms or guidelines please flag it as inappropriate.