Automated navigation of condensate phase behavior with active machine learning

Machine Learning


Preparation and dye labeling of polypeptides

All polypeptides used in this study were purchased from Alamanda Polymers. They were dissolved in fresh Milli-Q water (MQ) at 25 mg/mL, then sterile-filtered through a 0.2μm filter, and stored in aliquots at –20 °C. Further dilutions were prepared in MQ, with stock solutions maintained at 4 °C.

A portion of the poly-L-(lysine) polypeptides was labeled with NHS-Sulfo-Cy5 dye (Lumiprobe) for confocal imaging. The dye was dissolved in DMSO at a concentration of 10 mg/mL and stored at –20 °C. Poly-L-(lysine) was labeled in a reaction buffer consisting of 100 mM HEPES (pH 8.0) and 150 mM NaCl in MQ. The polymer-to-dye ratios were 1:3 for poly-L-(lysine) with a chain length of 100 and 1:6 for chain lengths of 20 and 250. The reaction was carried out for two hours at room temperature while shaking at 550 rpm using an Eppendorf MixMate.

Unbound dye was removed using a PD Minitrap G-25 size exclusion column (Cytiva), which was pre-equilibrated with a storage buffer of 25 mM HEPES (pH 7.4) and 100 mM NaCl. Labeling was, if possible, further confirmed by analyzing the flow-through of the dye-labeled polymer after centrifugation with a 3 kDa spin filter (Amicon). All polypeptides were freeze-dried, weighed, and dissolved in MQ. The dye concentration was determined using a nanodrop spectrophotometer (Thermo Scientific NanoDrop 1000). This measurement, combined with the dry weight of the polypeptide, allowed for the calculation of the Degree of Labeling (DoL). The final dye-labeled polypeptides were sterile-filtered (0.2 μm) and stored at –20 °C, with additional dilutions prepared in MQ and maintained at 4 °C.

Preparation microscopy plates

For confocal imaging, black 96-well glass-bottom microscopy plates (Cellvis, 1.5, P96-1.5H-N) were used and the glass surface was passivated to prevent wetting of the condensates. To prepare the surface coating, bovine serum albumin (BSA) was dissolved in MQ at 30 mg/mL and then sterile-filtered through a 0.2 µm filter. A volume of 100 µL of this BSA solution was added to each well. The plates were placed on a MixMate shaker (Eppendorf) and incubated at 500 rpm for 60 min at room temperature. After incubation, the BSA solution was discarded, and each well was rinsed three times with 100 µL of MQ water. The plates were then dried overnight, covered with a Kimwipe, and stored at room temperature under a protective cover until use.

Data architecture and general automation workflow

All devices were integrated within a local network and regulated through a central orchestrator workstation, which served as the control hub for the entire platform. The orchestrator contains all necessary protocols and information, and coordinates all device actions and data exchange. Communication with platform components was achieved through USB connections and a local Ethernet network, using TCP-based network communication protocols such as SSH and HTTP.

A centralized data architecture was implemented to manage knowledge transfer between instruments. This architecture included a structured folder system on the orchestrator workstation for organizing Python protocols, instrument logs, raw data storage, and dedicated information transfer files. These information transfer files, detailed below, contained specific instructions for each device—often generated through machine-learning algorithms—and were sent from the orchestrator workstation to individual components. Each device passively listened to the orchestrator workstation, which assigned tasks and actions directly. Devices executed only the actions directed by the orchestrator, forming a streamlined, centralized data workflow across the platform.

Master file

Central, continuously updated database for all sample details, conditions, and results. It logs sample locations and barcoded plates, directing sample creation, handling, and analysis. A versioned copy was made before each update to maintain data integrity.

Barcode file

Output from machine learning, which is cross-referenced with the Master File to identify samples to be processed.

  • Batch File: Contains a detailed description of polypeptide stocks, including date, version, and degree of labeling for dye-labeled polypeptides. It is essential for calculating component volumes in sample preparation.

  • Source File: Tracks materials that are stored in a 96-well plate, including their concentrations and volumes. This file was updated after each pipetting step and versioned once per automation cycle to support accurate records.

This system operated in a closed-loop workflow, where each action depended on information from previous steps, all coordinated by the central orchestrator workstation. The workflow began with the machine learning model, which assessed the chemical space and determined the next set of samples to be measured. It appended these new sample conditions to the Master File and created a matching Barcode File. Next, the pipetting platform used information from the Master, Source, and Batch Files to calculate the required volumes and assign target locations for each sample. During sample preparation, the Source File was updated after each pipetting step to keep track of remaining volumes. Once the samples were prepared, their locations were added to the Master File. The microscope then cross-referenced the Barcode File with the updated Master File to find sample locations and imaging coordinates. It automatically acquired and processed confocal micrographs and added the classification results to the Master File. Finally, the machine learning model retrieved these updated classifications, incorporated them into the chemical space, and initiated the next cycle of experiments.

Automated sample preparation

Instrument setup and configuration

Samples were prepared automatically using an Opentrons Flex pipetting robot equipped with both single- and 8-channel pipettes (5–1000 µL) and 200 µL tips. The deck was configured as follows: 200 µL tip rack in slot B1; 195 mL NEST reservoir filled with MQ in slot C2; Heater-shaker module (Gen 1) with a PCR adapter plate and either a NEST 96-well PCR plate for 2D phase diagrams or an Opentrons Tough 96-well PCR plate for 3D phase diagrams in slot D1; 2 mL 96-well deep-well plate (NEST) containing stock solutions in slot D2; waste chute in slot D3; and a 96-well microscopy plate (Cellvis) in slot C3.

Pipette offset calibration

The Flex platform was calibrated for height and x/y offsets, following the manufacturer’s guidelines.

Source plate setup

Stock solutions of HEPES, NaCl, and polypeptides (labeled and unlabeled) were preloaded in the source plate (D2). The robot tracked and updated each well’s volume (see Data Architecture and Workflow), prompting refills to bring wells up to 1800 µL when volumes dropped below 200 µL.

Liquid handling

Reagents were dispensed sequentially to achieve a final volume of 150 µL per PCR well: MQ water, HEPES buffer (50 mM, pH 7.4), NaCl (150 mM for 2D or 25–2050 mM for 3D diagrams), dye-labeled poly-L-(lysine) (96–250 nM), unlabeled poly-L-(lysine), and poly-L-(aspartic acid) (0.1–8.1 mM monomer concentration). Final calculations accounted for any additional monomers introduced by the dye-labeled poly-L-(lysine) to ensure accurate concentrations. The same tip was used for multi-dispensing reagents, with new tips used for each aspiration step (except MQ).

Mixing

From NaCl addition onward, samples were mixed (1500 rpm) for 10 seconds. After the final component (poly-L-aspartic acid), samples were mixed (1500 rpm) for 5 minutes to promote phase separation.

Custom dispensing technique

To improve accuracy, transfers used a minimum of 10 µL, leaving 5 µL of residual volume in the tip. Prior to dispensing, dynamic volume tracking adjusted the pipette height based on the anticipated liquid volume in the well. Dispensing occurred just above the liquid surface to ensure that any residual droplets hanging from the tip were reliably released into the bulk solution (Fig. 1C, side view). After dispensing, a custom touch-tip function guided the pipette to contact specific points along the well wall at the same height to remove remaining droplets. Unlike the default four-point Opentrons routine, our implementation dynamically adjusted both the number and location of contact points based on the number of distinct liquids added to each well (Fig. 1C, top view). As additional liquids were dispensed, new touch points were assigned at progressively higher vertical positions, forming a gentle upward spiral (Fig. 1C, touch point trajectory). This approach enabled accurate multi-liquid dispensing with a single tip, minimized cross-contamination risk, and maintained spatial separation between touch locations regardless of the number of liquids used.

Final transfer for imaging

After preparation, 100 µL of each sample was transferred to the imaging plate (C3), which was then sealed with an adhesive aluminum foil seal (ThermoFisher) for confocal imaging. A new tip was used for each well, with samples mixed three times by aspiration/dispensing before transfer. Samples were incubated for 15 minutes before analysis, unless indicated otherwise.

Automated confocal microscopy

Confocal microscopy setup and hardware configuration

Imaging was conducted on a custom confocal setup integrated by Confocal NL. The microscope consisted of an open-frame inverted microscope (Zaber), with a confocal NL line re-scan system (NL5 + ) mounted on the left-side camera port. Additionally, the microscope was equipped with a motorized filter wheel (Confocal NL), and a laser autofocus module (Zaber). The NL5+ unit was equipped with an sCMOS camera (Teledyne Photometrix BSI express), providing a large Field of View of 18.8 mm (diagonal). Laser excitation from an Oxxius L4Cc laser diode combiner (containing a 638 nm laser) was coupled to the NL5+ module via an optical fiber. All experiments were conducted using laser power 7%, and a 60x air objective (Nikon, NA 0.95).

Software and connections

All components were controlled via Python. Specifically, pycromanager interacted with Micro-Manager (version 2.0.3) to control laser powers, Z-stacks, and XY positioning. Additionally, the zaber_motion library was connected to the Zaber Launcher (version 2024.11.14) to control the autofocus device.

Automated autofocus adjustments

The autofocus loop involved several steps. To start, the objective was initially directed to a preset Z-position, aligning the autofocus laser within range for the first autofocus attempt. The autofocus was then triggered, aligning the objective with the bottom of the imaging plate. This in-focus focal height was recorded and serves as a reference for the next autofocus loop. After acquisition (see below), the autofocus routine subsequently started each new loop 10 µm below the previously recorded focal plane, searching upward to locate the plate bottom.

XY Positioning and Image Acquisition

The 96-well microscopy plate was mapped into 2 × 2 grids (550 µm spacing), creating technical replicates within each well. A well-specific event list was created, associating each well with the correct sample barcodes, coordinates, grid locations, and channel information. The scanning algorithm employed a snake pattern, optimizing acquisition time by minimizing travel distance and positional drift across the microscopy plate. Following autofocus, Z-stacks were captured as height additions on top of the recorded autofocus height, using dynamic spacing: a fine 0.5 µm step for the first 5 µm, increasing to 1.0 µm for the next 5 µm, then 2.5 µm for the following 5 µm, and finally 5.0 µm for deeper layers, spanning a total of 50 µm of Z-depth per position. Acquisitions were performed at 5 frames per second.

Verification of imaging completion

To monitor imaging progress, a continuous background process compared the number of saved image slices to the expected slice count based on the number of imaging events (i.e., focal planes across wells). Once the saved slice count matched the target, the acquisition was deemed complete, and MM and associated processes were automatically closed.

Automated image analysis and classification

Each acquired micrograph underwent automated analysis to extract sample classifications and particle features. Particles were detected using the scikit-image Python module. Yen thresholding was applied to create a binary mask, which was used to detect particles above 500 pixels (5.87 µm2). The extracted particle properties (e.g., X/Y position, area, mean intensity) were saved for each micrograph. Results were then grouped by grid position and sorted by Z-index. For each particle, the slice with the largest detected area was selected as the representative view, which was used for the property mappings performed in this study. Wells were classified based on particle count and distribution, with 12 or more particles across at least three grid positions indicating “Phase Separation” and fewer particles marking “No Phase Separation”.

Machine learning and computation

Design of the parameters space

The initial dataset (i.e., cycle 0) for any given system formulation was created by computing a regular D-dimensional grid of points (with D being the number of variables to be considered), where each independent component of the formulation accounts for a dimension. Two of the dimensions were always assigned to the concentration of the two oppositely charged polymers, poly-L-(lysine) and poly-L-(aspartic acid) respectively. Additional dimensions could be added to account for other behaviors. The response variable was represented by an integer that mapped the recorded phase to either coacervate or not. In all our experiments we restrained our formulations to study the coacervation phenomena of two oppositely charged polymers as a function of the two polymer concentrations and the salt concentration. Additionally in the current work, we only focused on 2-D and 3-Dimensional datasets. This means that in the former case (2-D) the salt concentration is fixed and kept constant, while in the latter case (3-D) it is allowed to change. The range for the polymer concentrations was constrained to be the same for all the experiments, regardless the polymer identity, and it was chosen to be a regularly spaced interval starting from concentration of 0.1 mM to 8.1 mM, with steps of 0.1 mM, giving a total of 81 concentrations values (end points included). Similarly, the range for the variation of the salt concentration was chosen to vary from 50 mM to 2075 mM with steps of 25 mM, giving a total of 81 values. All the ranges were chosen accordingly to the accuracy of the machines used to formulate the solutions. Finally, the dataset was created by filling a 2-D or 3-D regular grid with the values of the variable under investigation, creating a total of 6561 (81 × 81) points for the 2-D case, and 531441 (81x81x81) for the 3-D case. In all the experiments the response variable was set to -1, the undefined default value, for all the points of the grid.

Selection of new points

Starting from cycle 0, and for each cycle, a subset of points \(n\) (i.e., new formulations) was sampled from the available pool of points \(N\). The chosen sampling techniques followed the rules of Farthest Point Sampling (FPS)47. FPS is a sampling technique used to select a subset of points that are maximally spread out from each other within a given dataset. The goal is to retain points that represent the diversity of the data distribution by maximizing the minimum distance between selected points. Given a starting dataset \(X=\{{x}_{1},{x}_{2},\ldots,{x}_{N}\}\) of \(N\) points, a first random point \({r}_{1}\in X\) was selected and added to the set of sampled points \(S=\{{r}_{1}\}\). For each remaining point \(x\in {X\backslash S}\) the minimum distance to any point in \(S\) was computed:

$$d\left(x\right)={\min }_{r\in S}{||x}-{r||}$$

(1)

Then, the point \({x}_{i}\) with the largest \(d\left({x}_{i}\right)\) was selected and added to the set of sampled points (i.e., the point farthest from the currently sampled points). This selection was repeated until the desired number \(n\) of points was reached. The result is a subset \(S\subset X\) of \(n\) points that were distributed in such a way that they maintain maximal separation, thereby capturing the structure of the original dataset more effectively than random sampling in cases where spread was important.

Phase diagram (PD) prediction

At each cycle \(N\), a phase diagram was predicted using the data that has been experimentally tested in cycle \(N-1\). In the case of \(N=0\), no previous tested data was available, the prediction was skipped, and the FPS selected points were fed to the experimental validation pipeline, where their phase is recorded. For all \(N\ge 1\), all the points assigned to the sampled set \(S\), after experimental validation, would be used as the ground truth for a Gaussian Process Classifier (GPC)46 model, that is going to predict the phase distributions over the entire input space. The GPC models the probability distribution over classes (e.g., the phases) by defining a latent function \(f:{{\mathbb{R}}}^{d}\to {{\mathbb{R}}}^{K}\) that associates each input \(x\in {{\mathbb{R}}}^{d}\), contained in the input space, with a set of probabilities \(p\left(y={c|x},S\right)\), where \(c\in \left\{1,\ldots,K\right\}\) represents the class labels. The training step involved using the subset \(S\) to learn the posterior distribution of \(f\), which, in turn, yielded a probabilistic model capable of assigning any points \({x}_{i}\in X\) to the probability of belonging to a specific class.

In our case, for each point in the input space the GPC would output a probability vector defined as follows:

$${{{{\boldsymbol{p}}}}}_{i}=\left[p\left(y=1|{x}_{i},S\right),p\left(y=2|{x}_{i},S\right)\right]$$

(2)

where each component represents the probability of \({x}_{i}\) belonging to either the “non-aggregate” (\(y=1\)) or “coacervate” (\(y=2\)) class. Obviously, given that \({{{{\boldsymbol{p}}}}}_{i}\) is a probability vector, it holds that the value for the sum of the individual contribution in Eq. 2 needed to sum up to 1. Thus, the GPC trained on the set of all the sampled and tested points could be used to provide a probabilistic prediction over the entire dataset, simply defined concatenating the individual vectors (Eq. 2) for all the points contained in \(X\),

$${{{\boldsymbol{P}}}}=\left[{{{{\boldsymbol{p}}}}}_{1},\ldots,{{{{\boldsymbol{p}}}}}_{i},\ldots,{{{{\boldsymbol{p}}}}}_{N}\right]$$

(3)

Equation( 3) enabled inference about phase membership across all points, essentially representing the phase diagram.

The GPC algorithm used in our work was defined using a Radial Basis Function (RBF) kernel with length scale \(1.0\), multiplied by a constant kernel with default value of \(1.0\). In each application of the prediction algorithm, we allowed for an automatic internal optimization step by setting the parameters n_restarts_optimizer to \(5\), and the max_iter_predict to \(150\) (more information can be found on the original GPC Scikit-Learn documentation page80).

Uncertainty estimation

At each cycle, to estimate the uncertainty in the phase diagram predictions, we computed the information entropy for each point’s probability vector \({{{{\boldsymbol{p}}}}}_{i}\) (Eq. 2). The uncertainty was computed as the (information) Entropy \(H\left({x}_{i}\right)\), and for \({x}_{i}\) could be computed as follow:

$$H\left({x}_{i}\right)=-\sum_{c=1}^{K}p\left(y={c|}{x}_{i},S\right)\log p\left(y={c|}{x}_{i},S\right)$$

(4)

Higher entropy values indicate greater uncertainty, providing an uncertainty measure for each point in the phase diagram that is representative of the prediction’s confidence level. The entropy range of values is bounded, and it depends on the number of independent classes \(K\). In all our cases, \(K=2\), leading to a range of values that goes from \(H=0\), if either of the two classes was known for certain, i.e. \({{{{\boldsymbol{p}}}}}_{i}=\left[{{\mathrm{1.0,0.0}}}\right]\), to \(H=0.69\), if both of the two classes were most uncertain, i.e. \({{{{\boldsymbol{p}}}}}_{i}=\left[{{\mathrm{0.5,0.5}}}\right]\).

Highest uncertainty landscape and exploration

The values of \(H\left({x}_{i}\right)\) gave direct access to the so-called uncertainty (phase) landscape which represented, per cycle, which areas of the design space were most (un)certain. This information was then exploited to select a subset of points \({X}^{{\prime} }\subset X\) that exhibited maximal entropy, within a set range of entropy values:

$${X}^{{\prime} }=\left\{{x}_{i}\in {X|h}\le H\left({x}_{i}\right)\le {H}_{\max }\right\}$$

(5)

In Eq.( 4) the upper-bound limit, \({H}_{\max }\), represented the maximum value of entropy, defined as:

$${H}_{\max }=-\sum\limits_{c=1}^{K}\frac{1}{K}\log \frac{1}{K}=\log K$$

(6)

which for \(K=2\) it takes the value of \({H}_{\max }=\log 2\approx 0.69\). The lower-bound limit can be freely chosen, and in our cases was set it to \(h=0.60\), effectively selecting only the highest uncertainty regions.

The points contained in \({X}^{{\prime} }\) would then be used as the new search space for the FPS algorithm, sampling new suitable points for refining the prediction of the phase diagram. In the context of active learning, this was often referred to as the exploration phase of the cycle, where new points were selected trying to maximize the exploration, lowering the overall uncertainty of the predictive algorithm.

Accuracy measurement

To assess the accuracy of our classification model in a way that accounts for class imbalance, we used a balanced accuracy metric59. At each cycle a set of labels \({Y}^{
(7)

In Eq. 7, \({T}_{P}\) and \({T}_{N}\) refer to the true-positive and true-negative predicted labels, while \({F}_{P}\) and \({F}_{N}\) refer to the false-positive and false-negative predicted labels.

Convergence measurements

To monitor the convergence of the model across cycles and/or experiment replicas, we tracked changes in the phase diagram, represented by the concatenated probability vector \({{{{\boldsymbol{P}}}}}^{
(8)

where \({{{{\boldsymbol{M}}}}}^{(t,t+1)}=\frac{1}{2}\left({{{{\boldsymbol{P}}}}}^{
(9a)