Skip to main content
BioData Mining logoLink to BioData Mining
. 2026 Feb 19;19:18. doi: 10.1186/s13040-026-00527-3

KeySDL: sparse dictionary learning for keystone microbe identification from steady-state observations using a dynamical-systems model

Max Gordon 1, Turgut Yigit Akyol 2, B Amos 1, Stig U Andersen 2, Cranos Williams 1,✉
PMCID: PMC12922210  PMID: 41715111

Abstract

Background

Identification of microbes with large impacts on their microbial communities, known as keystone microbes, is a topic of long-standing interest in microbiome research. However, many approaches to identify keystone microbes are limited by the inherent nonlinearity and state-dependence of microbial dynamics. Machine learning approaches have been applied to address these shortcomings but often require more data than is available for a given microbial system.

Results

We propose a keystone identification approach called KeySDL which reduces the amount of data required by incorporating assumptions about the type of microbial dynamics present in the experimental system. The data are modeled as originating from a Generalized Lotka-Volterra (GLV) model, an architecture commonly used to simulate microbial systems. The parameters of this model are then estimated using Sparse Dictionary Learning (SDL).We also propose a self-consistency score to help evaluate whether the assumption of GLV dynamics is reasonable for a given dataset, either through the application of KeySDL or other analysis tools validated using GLV simulation.

Conclusion

Compared to existing methods, this approach allows accurate prediction of keystone microbes from small numbers of samples and provides an output interpretable as reconstructed system dynamics.

Supplementary Information

The online version contains supplementary material available at 10.1186/s13040-026-00527-3.

Keywords: Microbiome modeling, Keystone microbes, Systems identification, Sparse dictionary learning

Introduction

In ecology, keystone species are generally considered to be those with a disproportionate impact on the interaction structure and stability of the ecosystem when removed [1–3]. Identification of keystone species in microbial systems is often sought to help explain microbial behavior or identify means to modulate microbial interactions [4, 5]. In this work we will consider the keystone microbes of a system to be those whose absence has the largest impact on the observed steady-state composition of the microbial ecosystem. Identifying this type of keystone species by iterative removal from a microbial community is not generally possible in natural microbiomes with current experimental methods [6]. In synthetic communities it is possible to omit strains from the inoculant used [7, 8] but this very quickly becomes experimentally infeasible to explore as the size of the community increases and with it the required number of dropout screens.

One approach that has seen recent use in attempts to identify keystone microbes without individually removing strains is the construction of correlation or co-occurrence networks [4, 9–13]. These networks can be very interpretable. However, they cannot capture the nonlinearity of microbial dynamics. Since this nonlinearity arises in part from the combination of growth and interactions, this prevents these networks from providing a comprehensive view of the underlying microbial system. They are also unable to represent the state-dependency of many microbial interactions, where the behavior of and interactions between microbes in the system depends on the composition of the community as a whole. Co-occurrence networks may provide an overview of a particular state of the microbiome but will not reliably result in insights into perturbations from that state. Additionally, the edges in these networks do not necessarily correspond to direct interactions between microbes as they capture associations, which may also be present between microbes with shared influencing factors. Although correlation network approaches are widely used, their sensitivity is limited [14]. Prior tests attempting network reconstruction from simulated data have shown that co-occurrence networks cannot reliably recover keystone species due to these limitations [11, 14].

Machine learning (ML) approaches have been applied with some success to the problem of keystone microbe identification [6, 15, 16]. The Data-driven Keystone species Identification (DKI) framework based on cNODE2 uses a compositional neural Ordinary Differential Equation (ODE) to implicitly infer microbiome assembly rules from presence/absence vectors representing species present in a given sample [6]. This approach functioned reliably in simulation and with a small in vitro synthetic community. However, this test was performed with relatively large numbers of samples and small numbers of microbes compared to more typical experiments. The models produced by this framework are multi-layered neural networks that may be difficult to interpret for further insights beyond keystoneness predictions. The number of observations required to constrain an ML model will grow with its complexity and number of parameters [17]. This can pose a major challenge for microbial studies, where large numbers of observations are often not experimentally feasible, so it is often desirable to use a simple model with fewer parameters when limited data is available.

Another approach is the inference of models of microbiome dynamics, often using Generalized Lotka-Volterra (GLV) models, which have been successfully applied to model experimental microbial systems despite their inability to capture stochastic behavior [18–20]. These approaches typically require time-series datasets and absolute microbial abundances, rather than the compositional measurements typically available. When appropriate data is available and the scale of the system permits, interpretation of these structures can be very insightful and connected to relevant biological concepts such as growth rates.

High throughput amplicon sequencing data presents an opportunity to quantify the relative abundance of individual microbes at scale and use the community structure of these broad datasets as a basis for hypothesis generation [5]. However, despite the potential of these data, the analytical tools to transform them into a comprehensive understanding of the structure of a microbial community are still lacking.

Amplicon sequencing measurements of microbial systems are compositional [21]. This makes modeling approaches which use absolute abundance measurements difficult to apply to these data, requiring separate quantification of microbial abundance. As a result, an analog of the GLV system that can operate on compositions is desirable for any analysis of an assumed-GLV system through compositional observations. Replicator dynamics constitute such a compositional analog to the GLV model capable of capturing the behavior of the composition of a GLV system without modeling its total abundance [22].

We propose an approach called Keystone Sparse Dictionary Learning (KeySDL) to predict microbial keystoneness based on the assumption that the system we are observing is a Generalized Lotka-Volterra system under steady state. To do this, we first explore an operational definition of keystoneness based on Bray-Curtis dissimilarity of relative abundance profiles in the context of a GLV system. Because of the structure of the GLV model, the assumption that the system is under steady state removes the need for numerical integration of the system dynamics by allowing transformation of the differential equation to a system of linear equations. This change greatly simplifies model optimization as compared to a direct fitting of a GLV or other dynamic model. We then solve for the parameters of this GLV system or the corresponding compositional replicator system using Sparse Dictionary Learning (SDL) [23] with additional constraints based on system traits typically observed in experimental microbial communities such as finite carrying capacity. These additional constraints allow our model to converge to a solution from a very small number of observed system steady states, making KeySDL a viable option for datasets where GLV dynamics are a reasonable assumption and there is not enough data available to constrain more flexible ML models. In addition to estimates of impact on removal, KeySDL estimates the parameters of the GLV or replicator system that best describes the observations, providing an interpretable view of model parameters. We also develop a self consistency measure to evaluate the potential validity of assuming GLV dynamics govern a dataset. Beyond keystone identification, the self consistency measure may be useful in identifying scenarios where GLV simulations are not an appropriate in silico test for analytical methods.

Methods

Steady states and keystoneness in GLV systems

In this work, we consider a microbial system governed by Generalized Lotka-Volterra dynamics. This approach does have limitations in the complexity of microbial interactions it is capable of representing but has nonetheless found widespread use in simulation [6, 15, 16, 24, 25] and analysis [18–20] of microbial systems. The fixed growth rates and interactions mean this model is unable to capture changing external influences on the system but this is a shortcoming shared with many other approaches, including nonlinear machine learning methods.

We will consider an Inline graphic-microbe GLV system with set of species Inline graphic given by:

graphic file with name d33e342.gif 1

with Inline graphic representing microbial abundances over time, Inline graphic microbial growth rates, and Inline graphic microbe-microbe interactions. This system has several steady states denoted Inline graphic, where Inline graphic is an index associated with each steady state of the system. The trivial steady state is achieved when:

graphic file with name d33e369.gif 2

and corresponds to the extinction of all species. At the steady state:

graphic file with name d33e375.gif 3

all microbes are present in some quantity given by Inline graphic. Finally, for all remaining Inline graphic steady states, we consider combinations of extinct microbes Inline graphic and non-extinct microbes Inline graphic, such that Inline graphic and Inline graphic. This additionally means that we can associate each steady state index Inline graphic with a species presence profile Inline graphic and extinction profile Inline graphic. For every possible Inline graphic and Inline graphic there exists a steady state where:

graphic file with name d33e427.gif 4

In this context, the keystoneness of a given microbe is the distance, by any keystoneness metric, between the steady state with no extinctions and a perturbed steady state where the microbe is extinct.

It is possible for any steady state in a GLV system to require negative abundances. However, this is not achievable in a real microbial system nor an ideal GLV system as the GLV equation does not allow zero crossing. Therefore, in the case that a perturbation places the microbial community in a steady state where some microbes are required to be negative, these microbes will be driven to extinction since their abundances cannot be negative. If the steady state corresponding to this expanded set of extinct microbes also has microbes with negative abundances, the process will repeat until the system reaches a steady state with all non-negative abundances. This corresponds neatly with the definition of keystoneness by the decrease in the number of distinct species observed in a system after removal of the target microbe. Despite this symmetry, we use Bray-Curtis dissimilarity to measure keystoneness to capture changes that fall short of complete species extinction. In order to avoid simply measuring the abundance of a microbe, we also exclude the microbe’s own abundance prior to the calculation. This can be expressed by defining Inline graphic, setting the microbe Inline graphic to Inline graphic abundance. The Bray-Curtis Keystoneness of microbe Inline graphic is then as follows:

graphic file with name d33e451.gif 5

where Inline graphic is Bray-Curtis dissimilarity [26] and Inline graphic is the set of all microbes in the modeled system. It is also possible to apply presence/absence measures such as Jaccard distance [27] or more abundance-focused measures such as Aitchison distance [28] within the KeySDL framework. However, presence-absence measures could lead to reduced sensitivity to changes in the microbial community as in experimental datasets it is not always common to see species extinction as a consequence of removal of dropped-out microbes [7, 8]. Conversely, abundance-focused measures may be overly sensitive to small changes in microbial abundance that do not reflect a truly different community state. In this work we have limited our analysis to Bray-Curtis dissimilarity to maintain comparability with prior publications on microbial keystoneness [6, 16, 29].

Because the steady states of a GLV system are defined by the combinations of extinct and nonextinct strains, there is only one steady state for each combination of microbes, resulting in a total of Inline graphic steady states. This means that for a system following GLV dynamics we should not expect perturbations falling short of complete removal of a species to cause any change in the steady state the system will return to. As a result, we focus in this work on keystoneness defined by microbial dropouts. This also implies that a microbial system where changes in species abundance without extinction or addition of new species lead to changes in steady state must be governed by non-GLV dynamics such as stochastic extinction.

KeySDL recovery of GLV model parameters

To evaluate keystoneness, our goal is to recover a model with the same steady states as the original system. By focusing only on steady states, we can ignore the nonlinearity of GLV dynamics and solve Eq. 1 at Inline graphic to find Inline graphic and Inline graphic such that:

graphic file with name d33e515.gif 6

for each observation Inline graphic with non-extinct microbes Inline graphic. We assume that each observation is a measurement of an underlying system steady state, Inline graphic. For any reasonable number of observed steady states, this creates an underdetermined system of linear equations, which may be solved as a Sparse Dictionary Learning (SDL) problem [23]. In SDL, underdetermined systems of linear equations may be solved if we have prior knowledge that the solution will be sparse, which further constrains the set of possible solutions. By imposing sparsity through penalty or learning structure, we can approximately solve a system that would otherwise not have a single solution [23].

There are many possible ways to enforce sparsity, but in many practical cases L1 regularization is optimal or nearly so [30]. In the case of learning GLV model parameters, there are several additional constraints that can be incorporated based on knowledge of the underlying system. These are 1) Inline graphic must be invertible for a steady state to exist and 2) All diagonal entries of Inline graphic must be negative. This is because the diagonal entries of Inline graphic represent the interaction between a microbe and itself. If any of these values are positive, unbounded growth would be possible as more of a microbe being present would further increase its growth rate. This would correspond to a microbial system which would not exist in reality.

To allow flexible inclusion of these constraints as well as extension to other constraints in the future, we solved this optimization problem with gradient descent in Torch [31]. Sparsity was enforced by an L1 regularization of strength Inline graphic on the entirety of Inline graphic, while invertibility was enforced with a penalty for a small determinant of Inline graphic consisting of the reciprocal of the determinant multiplied by weight Inline graphic, and the negative diagonal was enforced with a large negative L1 penalty of strength Inline graphic on diagonal entries of Inline graphic larger than Inline graphic. The L1 regularization requires selection of a regularization weight, which may be accomplished by cross-validation for each individual dataset. However, in this work we selected a value of Inline graphic based on the simulation testing and carried this parameter through to the experimental datasets. This is a relatively small value for an L1 regularization because the scale of the error is small relative to the number of parameters subject to the L1 penalty. Higher L1 values will often result in the regularization contributing more to the objective function than the error, leading to a prediction of Inline graphic. The weight of the penalty terms for invertibility and diagonal negativity are in theory tunable parameters but in practice they only need to be sufficiently large that they outweigh any improvement in reconstruction error that might come from violating them. Analysis of the impact of these parameter values on reconstruction of a noisy GLV system is shown in Fig. S1. A graphical overview of the KeySDL approach applied to a GLV system is shown in Fig. 1.

Fig. 1.

Fig. 1

Key concepts in the KeySDL pipeline applied to a GLV system. (a) the presence and absence of each microbe Inline graphic defines steady states Inline graphic. (b) each measured steady state has microbial composition Inline graphic. These observations are used in combination with Eq. 6 to solve for interactions Inline graphic and growth rates Inline graphic. (c) with estimates of these model parameters, we can predict compositions for both simulated no-extinction and simulated single-extinction systems for each microbe Inline graphic to derive an estimate of impact on removal Inline graphic

Relating GLV and Compositional replicator dynamics

While GLV models operate on absolute abundances, high throughput sequencing measurements are inherently compositional [21]. Without measurement of the total quantities present, these sequencing data only convey the ratios of microbes in the system to each other. Attempting to completely model a GLV system based on compositional measurements is not possible due to the loss of information compared to the full abundance profiles.

Replicator systems are a way of modeling compositional measurements of dynamics, following the form:

graphic file with name d33e659.gif 7

Where Inline graphic is a function describing the fitness of element ×over time and Inline graphic. In the case of the fitness function Inline graphic it is possible to map trajectories from an Inline graphic dimensional GLV system to an Inline graphic dimensional replicator system [22, 32]. An additional dimension is needed to encode the system’s total abundance. Without this, there is not full equivalence to the GLV system but trajectories in the GLV and replicator systems do have equivalent compositions [32]. As a result, the relative abundance profiles of the steady states of the replicator system will be the same as the relative abundance profiles of the steady states of the GLV system. This allows us to use replicator dynamics to model steady states and keystoneness from a compositional view of an assumed GLV system.

This replicator system does not directly model the growth rates Inline graphic of the original GLV dynamics but the impact of the growth rates on the composition is in the interactions matrix Inline graphic by the relationship Inline graphic [32]. The impact of the growth rates on the true abundances is outside the scope of modeling for a replicator system.

Finally, steady states of the replicator system are difficult to find compared to those of a GLV model. We can use the equivalence of GLV and replicator systems to find these steady states without numerical methods. A GLV model with interactions matrix Inline graphic and uniform growth rates Inline graphic will have the same steady-state compositions as a replicator model with interactions matrix Inline graphic [32]. This allows for rapid computation of the steady-state relative abundance a set of microbes will converge on under replicator dynamics without full simulation.

The framework used to fit GLV dynamics in Sect. 2.2 is easily extended to compositional data using the equivalence of GLV and Replicator dynamics [22, 32]. Non-zero steady states of a Replicator system occur when:

graphic file with name d33e740.gif 8

We can substitute this into the KeySDL optimization procedure and recover the Inline graphic matrix of the Replicator system associated with the composition of the underlying GLV dynamics, which is related to the steady states and therefore keystones as described earlier.

Evaluation of steady state consistency

One concern with the application of a model that assumes GLV dynamics is whether GLV dynamics are a reasonable approximation of the underlying system. We propose a self-consistency metric Inline graphic which evaluates how well GLV dynamics are able to capture the system’s behavior to provide insight into the suitability of GLV dynamics for modeling an individual dataset. This score is a measure of how well the steady states of the reconstructed system correspond to measured experimental samples. Inline graphic is constructed by evaluating the Bray-Curtis dissimilarity between the predicted steady states and true samples for each sample in the training dataset. The mean of these dissimilarity measurements is subtracted from 1 to create a self-consistency metric that is 1 if the data is perfectly explained by a GLV model. Given Inline graphic observed steady states Inline graphic and reconstructed steady states Inline graphic, we can compute the Bray-Curtis dissimilarity between each pair as Inline graphic and then assemble the self-consistency metric as:

graphic file with name d33e779.gif 9

Cross-validated prediction for single-dropout datasets

To validate KeySDL, we need datasets with ground-truth Inline graphic values. The most available type of experiment where this can be computed are those consisting of dropouts of individual microbial strains. One challenge arising from this experimental structure is that we cannot use KeySDL on all the data at once without the model seeing the dropout sample it is trying to recreate during training. We use 3-fold cross-validation for prediction from single dropout datasets to address this. In this scheme, the data are divided into 3 folds. These are split into 3 training sets each consisting of 2 folds, and KeySDL is used on each training set. Predictions are made for the microbes whose dropout samples are not part of the training set. By combining these predictions from the 3 folds, each microbe’s predicted keystoneness is based on a model trained without seeing the dropout it is predicting.

This approach is conceptually very similar to leave-one-out cross-validation. We selected 3-fold instead as with an Inline graphic sample dataset it trains the models on Inline graphic samples rather than Inline graphic samples. This provides a more rigorous test of KeySDL analogous to other datasets where dropouts for each individual strain are not available.

Results

GLV reconstruction with KeySDL from in-silico absolute abundance data

To validate KeySDL’s ability to reconstruct GLV dynamics from absolute abundance data, we generated ground-truth GLV models and simulated different dropout combinations to produce a synthetic dataset from each set of parameters. We generated the Inline graphic matrices using the Klemm algorithm [33], which produces small-world scale-free networks, properties consistent with interactions in observed ecosystems, while Inline graphic was drawn from a uniform distribution between 0.1 and 1.

First, we generated a 50-microbe GLV system and evaluated the KeySDL reconstruction accuracy based on 500 randomly generated multiple dropouts. The total number of steady states for this system is Inline graphic, so 500 is a small sample of the total number of steady states. The ground-truth and reconstructed dynamics are very similar, with a mean squared error of Inline graphic for Inline graphic and Inline graphic for Inline graphic. Qualitatively, the true and reconstructed Inline graphic matrices are shown in Fig. 2a and show the same overall structure. True and reconstructed Inline graphic values are shown in Fig. 2b. The reconstruction perfectly captures the rank order of keystones Inline graphic and closely reproduces the GLV interactions matrix. As a basis for comparison with existing co-occurrence network generation approaches [14], we generated a co-occurrence network using Pearson correlation from the simulated absolute abundance data and computed network degree and betweenness centrality, shown in Fig. S2a and S2b. Both degree (p = 0.12) and betweenness (p = 0.76) are uncorrelated with the removal impact Inline graphic, demonstrating that these network topological metrics do not provide a useful way to assess potential impact on removal in this case.

Fig. 2.

Fig. 2

a) true and reconstructed interactions matrices from 500 samples taken from a GLV model. b) true and reconstructed Inline graphic from 500 samples taken from a GLV model (Spearman Inline graphic). c) Spearman correlation between true and reconstructed Inline graphic with varying numbers of samples from a GLV model. d) true and compositionally reconstructed Inline graphic from 500 samples taken from a GLV model (Spearman Inline graphic). e) Spearman correlation between true and compositionally reconstructed Inline graphic with varying numbers of samples from a GLV model

Next, we also evaluated how the number of distinct steady states used to create the reconstruction impacted reconstruction accuracy. This was done by selecting a subset of multiple dropouts for each number of dropouts being tested and computing the average spearman correlation between true and reconstructed Inline graphic based on individual strain dropouts. This was repeated for 10 random subsets to prevent any individual sampling from distorting the results. We tested a with numbers of observed steady states ranging from 5 to 500. The average Inline graphic is shown in Fig. 2c. This correlation is above 0.9 whenever more than 20 steady states are used in the reconstruction and remains above 0.85 even at 5 steady states, indicating that only a small number of observations are needed to usefully constrain the reconstruction.

Replicator reconstruction with KeySDL from in-silico relative abundance data

With KeySDL tested on absolute simulated data, we next validated its performance on compositional data like those produced by real microbiome amplicon sequencing experiments by repeating the same testing steps with compositionally transformed data. Notably, the interactions matrix recovered by compositional KeySDL is not the same as the original GLV interactions matrix but is instead a reconstruction of the Replicator interactions matrix associated with its composition. This relationship is given by Inline graphic. We demonstrate the correlation (Inline graphic) between true and reconstructed Inline graphic for a compositional reconstruction from 500 samples in Fig. 2d. Degree and betweenness for a co-occurrence network produced from the simulated compositional data using SparCC [12] are shown in Figs. S3a and S3b. These network metrics are not correlated with the true impact on removal and would therefore not be useful in identifying keystone microbes. Finally, the impact on reconstruction of keystoneness from numbers of steady-state observations ranging from 5 to 500 is shown in Fig. 2e. As with the GLV reconstruction from absolute abundances, the replicator reconstruction from relative abundances is able to accurately estimate Inline graphic for all microbes in a system from a small number of samples.

Evaluation of KeySDL robustness to noise

So far, we have evaluated the model with noiseless samples of different steady states. However, real data will contain read noise and will be quantified into read counts prior to normalization, which introduces additional noise. To evaluate the robustness of KeySDL reconstruction to noise, we added Gaussian noise with standard deviation varying from 0% to 200% of the mean microbial abundance into 200 samples used to estimate a replicator system with KeySDL and evaluated its ability to recover Inline graphic as noise increased. The selection of this range of noise values was informed by comparison of the effect of additive noise to the effect of experimental perturbations to ensure the noise was a sufficient distortion, with details in Fig. S4. This was performed 5 independent times for each noise level and the results averaged. These results are shown in Fig. 3a and demonstrate that the reconstruction is able to recover keystones even in the presence of large amounts of noise, although with reduced accuracy, maintaining a Spearman correlation between true and predicted keystones above 0.7 until more than 100% of the mean microbial abundance is added as noise.

Fig. 3.

Fig. 3

a) Spearman correlation between true and compositionally reconstructed KBC with varying Gaussian noise added to 100 samples from a GLV model. b) Spearman correlation between and between true and compositionally reconstructed KBC from 100 samples from a GLV model with different library size

The total number of reads collected, library size, is an important property of amplicon sequencing datasets. Since all abundances must be expressed as a fraction of the reads collected and fractional reads are not possible, a small library size corresponds to quantization noise in the abundance measurements. We quantized the data targeting a total library size across the entire sample to evaluate KeySDL’s robustness to this experimental variable. If the library size is decreased, each quantization step will be larger, resulting in higher quantization noise. This was performed 5 independent times for each library size and the results averaged. The results of this test are shown in Fig. 3b and demonstrate the reconstruction’s robustness to sampling and quantization, even with small library sizes, with a Spearman correlation between true and predicted keystones above 0.91 even for the smallest library size tested of 2500 reads.

Characterization of self-consistency scoring

Next, we evaluate how the self-consistency metric Inline graphic allows us to distinguish between datasets that are consistent with GLV dynamics and those that are likely derived from other system structures. To measure this, we compared Inline graphic for synthetic datasets generated with GLV dynamics, Self-Organized Instability (SOI) dynamics [34], and pure noise. We chose SOI as the non-GLV dynamic model to test because of its stochasticity. This allows extinct species to re-emerge which is not achievable through GLV dynamics. We used miaSim [25] to produce the SOI simulations. We added Gaussian noise with standard deviation varying from 0 to 200% of the mean microbial abundance to simulate the effect of experimental variation and sequencing noise. Due to the computational resources required for the SOI simulation, this test was performed for 200 synthetic datasets of each of model type, consisting of 10 datasets for each noise level, with the aggregate results shown in Fig. 4a and b. There is a distinction between synthetic data from GLV and SOI systems, with samples comprised entirely of noise in between. These distributions are distinct, with a Kruskal-Wallis p value of Inline graphic. Since the true distribution of behaviors displayed by experimental microbial systems are unknown, our selection of SOI, GLV, and Gaussian noise as well as the even partitioning of these simulations into each type do not necessarily reflect experimental microbial systems. This means that any measures which would be influenced by the true underlying distribution of microbiome dynamics observed during the use of KeySDL, such as false positive rate, false negative rate, ROC, or AUC, could be misleading if computed on this population of simulations. Instead, we are limited to examining the range of possible values of Inline graphic each type of system might produce. The hightest and lowest observed scores for a noisy GLV system in this simulation were Inline graphic and Inline graphic respectively, so we can expect that a noisy system reasonably approximated by GLV dynamics will have a self-consistency score between these values. Notably, there is overlap between the score distributions for noise-perturbed GLV systems and measurements entirely comprised of noise, making Inline graphic more useful to evaluate the in-sample fit of a GLV model to the data rather than a general applicability indicator. Despite this, a system operating under certain non-GLV dynamics is still identifiable through Inline graphic. While this means that Inline graphic in a range consistent with a GLV model is not a conclusive sign that the KeySDL pipeline will produce accurate predictions, it does provide a way to avoid application of the approach in cases where a GLV model is highly misspecified. A more robust test for the applicability of KeySDL would be to measure the reconstruction accuracy of steady states not used in training the model. However, this would require a large dataset to have enough additional samples and would potentially be highly sensitive to which individual samples were held out from training if performed with a small number. In addition to this characterization of Inline graphic, we evaluated the performance of KeySDL in identifying keystones in these different simulations. The results of this are shown in Fig. 4c, a mean Spearman Inline graphic across all noise levels of Inline graphic for the noisy GLV system, Inline graphic for the noisy SOI system, and Inline graphic for the noise samples. In the case of the noise samples, as there are no underlying dynamics, keystoneness was randomly assigned. Although the performance of KeySDL is slightly lower for the noisy SOI system than for the noise samples, this difference is not significant Inline graphic, indicating that KeySDL is extracting no useful information on keystone microbes from the noisy SOI simulations. It is possible that model misspecification would be less detrimental to predictive power for other types of true underlying model, in particular if the true system dynamics do not allow stochastic extinction and re-emergence as SOI does.

Fig. 4.

Fig. 4

a) histogram and b) boxplot of consistency score Inline graphic for SOI-simulated data, GLV-simulated data, and random noise. The different model specifications have different median values Inline graphic. c) boxplot of Spearman correlation between true and compositionally reconstructed Inline graphic for for SOI-simulated data, GLV-simulated data, and random noise. The mean Spearman correlation for SOI-simulated data and random noise are not significantly different Inline graphic, suggesting that KeySDL was unable to extract information about impact on removal from the SOI system

Validation of KeySDL in vitro

To validate the performance of KeySDL in recovering the behavior of experimental biological systems, we identified an in vitro gut microbial SynCom experiment with individual species dropouts [7]. The SynCom in this experiment consists of 14 gut microbes grown in a batch bioreactor. The dropouts in this dataset allow us to compute ground-truth Inline graphic in addition to fitting a KeySDL reconstruction, enabling direct comparisons between the model’s reconstructions and measured keystones.

In order to predict Inline graphic for each microbe from a model not trained on that microbe’s dropout, we used the cross-validation scheme described in 2.5. The results of this cross-validation are shown in Fig. 5a, along with degree and betweenness centrality for a co-occurrence network generated using SparCC [12] on all data at once in Fig. S5a and S5b. The KeySDL reconstructed keystones reasonably correspond to the measured keystones of the microbial system (Inline graphic). The co-occurrence network metrics do not have a statistically significant association with measured Bray-Curtis keystoneness, despite being fitted to all data at once. The validity of Inline graphic as a biologically relevant metric is also supported by the recovery of E. coli and B. dorei as the primary keystones of the system, with predicted Inline graphic values of Inline graphic and Inline graphic respectively. These microbes were identified as dominant microbes in the system by the authors of the original paper, and while they are also highly central based on the two network centrality metrics, there are many other microbes with comparably high centrality by those measures. Inline graphic for this dataset is Inline graphic, which is within the range expected for a noisy GLV system and suggests that it is reasonable to reconstruct this system based on GLV dynamics. For a qualitative view of this, the measured and reconstructed compositions are shown in Fig. 5c, along with compositions from a null model consisting of removal of the dropped-out microbe followed by re-scaling. Notably, KeySDL is able to capture the increase in B. adolescentis when E. coli is removed, as well as the presence of L. symbosium in notable quantities in nearly all dropouts.

Fig. 5.

Fig. 5

Spearman correlation between predicted and measured Inline graphic with data from a) [7] (Inline graphic) and b) [8] (Inline graphic). Measured (T), KeySDL (P), and null model (N) composition for data from c) [7] where KeySDL captures the increase in Ba when Ec is removed, and d) [8] where KeySDL predicts the increased abundance of L68 when L288, L344, L88, and L90 are dropped out while the null model does not. The null model consists of removing the dropped-out microbe and total sum scaling of the remaining abundances

Validation of KeySDL in planta

In addition to in vitro test data, it is desirable to validate the KeySDL methodology in a more complex system. For this, we identified a plant microbial dataset with a suitable experimental setup. The data used for this validation consists of sequencing of the phyllosphere microbiome of Arabidopsis thaliana grown in a SynCom, with 25 microbes selected for single dropouts, as well as a complete SynCom with no dropouts as a control. There are two biological replicates, with each consisting of 8 technical replicates [8].

We predicted Inline graphic according to the cross-validation scheme described in Sect. 2.5. Plotting these predictions against the Inline graphic derived from the dropout and control samples results in the plot shown in Fig. 5b. KeySDL identified L68, L405, and L203 as top keystones. L68 was identified as the dominant strain in the system in the original paper, while L203 and L405 had significant impacts on community composition when removed. The reconstructed and measured keystones of the system are correlated Inline graphic. In addition to the KeySDL reconstruction, we produced co-occurrence networks from the same data using SparCC [12], shown in Figs. S6a and S6b. These cannot be cross-validated, so the co-occurrence network generation uses all the dropouts we are trying to predict the impact of. Despite this, neither co-occurrence network metric is correlated with Inline graphic for either replicate. Computing Inline graphic to evaluate the reconstruction of individual steady states, we obtained a score of Inline graphic. This score is in the range expected for GLV dynamics from in silico testing, so application of KeySDL here is reasonable. The measured and reconstructed compositions that Inline graphic is derived from are shown in Fig. 5d, along with a null model where the composition is rescaled with the dropped-out microbe removed. In several dropouts, such as L288, L344, L88, and L90, the KeySDL reconstruction more accurately predicts the abundance L86 than the null model does, showing the observed disproportionate increase in its abundance.

KeySDL recovers disproportionate keystones in silico

Proportionality is a major component of the ecological definition of a keystone species [1]. This is the idea that a keystone species must have an impact larger than would be expected based on its abundance. Prior work in microbial keystone identification, however, has largely considered impact on removal independently of starting abundance [11, 29]. Although in these prior works the measure of impact on removal does exclude the removed microbe’s own abundance, to evaluate proportionality we need to compare against a measure of mean abundance. We can randomly sample steady states of the reconstructed GLV or Replicator system and compute mean abundance across these steady states. In Fig. 6a we plot this abundance against reconstructed impact on removal for a simulated microbial system created from a network built using the Klemm algorithm [33]. This network construction approach is prone to generating keystones. In the plot we can observe that KeySDL has reconstructed a system where Inline graphic and abundance are broadly correlated. However, there are several disproportionate keystones with impacts on removal greater than expected given their abundance. These disproportionate keystones may fit the ecological definition of keystoneness more closely than the microbes with the larger impact on removal but also higher abundance.

Fig. 6.

Fig. 6

a) Spearman correlation between reconstructed Inline graphic and simulated mean relative abundance from 500 simulated steady states reconstructed from a simulated GLV system (Inline graphic). b) Spearman correlation between reconstructed Inline graphic and simulated mean relative abundance from 500 simulated steady states for the dataset from [7] (Inline graphic). c) Spearman correlation between reconstructed Inline graphic and simulated mean relative abundance from 500 simulated steady states for the dataset from [8] (Inline graphic)

KeySDL finds proportionate keystoneness in experimental data

Following recovery of simulated disproportionate keystones, we also investigated whether keystoneness is proportional to relative abundance in the two validation datasets we identified. We used KeySDL to reconstruct a set of replicator dynamics from each dataset and then extracted impact on removal and mean relative abundance for each microbe from these reconstructions. Plots of these results are given in Fig. 6b and c and show that in both cases Inline graphic and mean relative abundance are correlated without outliers. This suggests that in both of these experimental systems, there may not be strongly disproportional keystones.

Discussion

We have presented an approach for the reconstruction of microbial dynamics and identification of keystone microbes based on observations of steady states of the microbial system. We demonstrated the robustness of this approach in recovering keystone microbes in silico with both absolute and relative abundance, as well as with the presence of additive Gaussian noise and quantization error from limited read depth. We developed and characterized a self-consistency metric to help identify when an assumption of GLV dynamics is model misspecification. Finally, we validated this method’s performance in keystone identification with in vitro and plant microbial datasets with dropouts. In these experimental datasets, KeySDL recovered top keystone species broadly consistent with the findings of the original publications which produced the data. This identification of keystone species could enable more targeted design of dropout experiments by predicting impactful microbes to remove based on cross-sectional data.

This approach is able to function with many methods of defining keystoneness since it directly reconstructs the steady-state abundance or composition of the underlying system. Since these reconstructions follow the form of the assumed dynamics rather than a black box estimator, as in some other recent approaches, it may be feasible to perform time-series simulations based on the reconstructed model parameters. This may be of particular interest if quantification of absolute abundances through spike-in or other methods enables reconstruction of a full GLV model rather than the compositional Replicator model. In addition to time series simulation, these GLV models could enable better separation of the components a microbial system explained by growth rate and interactions. Currently, identifying these microbial interactions is limited by the coupling of the interactions with growth rate to produce observed variables [6].

In addition to simulation of single-dropout experiments, the reconstruction approach within KeySDL allows evaluation of combinatorial effects within the reconstructed system. This could be used to test the keystoneness of combinations of microbes or to compute metrics such as the D1 measure [29], which evaluates keystoneness across a broad sampling of steady states instead of from the no-extinction condition, for datasets where the presence/absence structure of the samples does not allow for direct computation from the experimental data. Rapid computational screening for these types of combinatorial interactions could greatly improve the feasibility of identifying microbes which have a particular effect only in combination, as the problem of experimental scale becomes intractable with even a small number of microbes.

A key limitation of the approach we have developed is the strong assumption of GLV dynamics it requires. Although these dynamics are an approximation, we show that for some experimental data, they are informative of the underlying keystones and can robustly represent the observed relative abundances of some experimental systems (Fig. 5c and d). In small or noisy datasets, the low number of samples required and robustness to noise of this approach may make it a suitable option despite the limitations of the GLV model. The risk of using KeySDL in cases where it is not reasonable to assume GLV dynamics is mitigated by the self-consistency score.

One particularly important assumption used here is that microbial growth rates and interactions must be constant across the dataset being used. In this initial work, we have attempted to select datasets for which this is the case in order to demonstrate the viability of KeySDL. However, there are many existing datasets, such as Genome Wide Association Studies (GWAS) or cross-sectional measurements, where this assumption is likely not met due to the influence of host genotype or environment. The reconstruction may still find meaningful keystones in such data if this variation is small compared to the strength of the microbial interactions. In order to make full use of commonly available experiments it may be necessary to extend KeySDL to incorporate non-microbial factors with impacts on the microbiome. Without this, we do not have a way to estimate variation in growth rates and interactions across a dataset, although in situations where this variation is sufficient to degrade predictive performance, Inline graphic or a more robust version of it based on held-out samples may be able to identify the decrease in prediction accuracy. If KeySDL can be extended to incorporate non-microbial factors it may also be possible to compare Inline graphic between a GLV reconstruction and one which does not assume constant growth rates and interactions. Careful interpretation of the biological relevance of identified keystones would therefore be required when non-microbial influences vary across samples. It should be noted that this restriction is not unique to GLV reconstruction approaches and would affect any prediction of microbial keystones or dynamics that does not incorporate the influence of non-microbial variables.

Time-series datasets are somewhat uncommon in microbiome research but there is potential to extend this approach to such experiments using the framework of neural ODEs to allow optimization of the model parameters through a numerical integrator. This concept would be distinguished from prior work using neural ODEs in microbiome research by the use of an assumed dynamic model (GLV/Replicator) and by the addition of constraints such as those used in this work’s reconstruction from steady states. The stiffness of GLV models may lead to numerical stability issues in making such an extension. The neural ODE approach could also be valuable in non-time-series datasets where initial inoculum sequencing is available. These are commonly collected and making use of them to further constrain the reconstruction would provide an avenue to improve the performance of KeySDL.

Electronic supplementary material

Below is the link to the electronic supplementary material.

Supplementary Material 1 (24.9KB, zip)
Supplementary Material 2 (179.5KB, zip)
Supplementary Material 3 (343.4KB, pdf)

Acknowledgements

Not applicable.

Author contributions

M.G. conceived, designed, and implemented the analysis approach and simulations, wrote the manuscript, produced the figures, and performed the statistical tests. T.A. identified related approaches in the literature, experimental datasets, simulation approaches and provided comments in revision. B.A., S.A., and C.W. contributed to the revision of the manuscript and provided input for development of the figures. All authors reviewed the manuscript.

Funding

This work was funded by the Novo Nordisk foundation as part of the Collaborative Crop Resiliency Program through the InRoot project (NNF19SA0059362). MG was also funded by the National Science Foundation Graduate Research Fellowship (DGE-1746939) and the NIH/NCSU Molecular Biotechnology Training Program (NIH T32 GM008776).

Data availability

KeySDL is available at https://github.com/mjgord/KeySDL. The scripts used to produce the results and figures as well as any supplementary information are available at https://github.com/mjgord/KeySDL-Manuscript-Code. Both of these codebases are also provided as supplementary files. All simulations used are available through these code repositories. The experimental datasets are available through the respective publications cited with associated results in the text.

Declarations

Ethics approval and consent to participate

Not applicable.

Consent for publication

Not applicable.

Competing interests

The authors declare no competing interests.

Footnotes

Publisher’s Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

References

  • 1.Mills LS, Doak DF. The keystone-species concept in ecology and conservation. BioScience. 2025, 02, 03;43(4):219–24. Accessed: 10.2307/1312122. [Google Scholar]
  • 2.Schulze E-D, Mooney, H.A, New York: Biodiversity and Ecosystem Function. Springer; 2012.
  • 3.Jordán F. Keystone species and food webs. Philosophical transactions of the royal society B: biological sciences. 364(1524):1733–41. 10.1098/rstb.2008.0335. Accessed 2025-01-31. [DOI] [PMC free article] [PubMed]
  • 4.Herren CM, McMahon KD. Keystone taxa predict compositional change in microbial communities. Environ Microbiol. 20(6):2207–17 10.1111/1462-2920.14257. Accessed 2025-01-31. [DOI] [PubMed]
  • 5.Di Bella JM, Bao Y, Gloor GB, Burton JP, Reid G. High throughput sequencing methods and analysis for microbiome research. J Microbiol Methods. 95(3):401–14. 10.1016/j.mimet.2013.08.011. Accessed 2020-12-9. [DOI] [PubMed]
  • 6.Wang X-W, Sun Z, Jia H, Michel-Mata S, Angulo MT, Dai L, et al. Identifying keystone species in microbial communities using deep learning. Nat Ecol Evol. 8(1):22–31. 10.1038/s41559-023-02250-2. Accessed 2024-05-3 [DOI] [PMC free article] [PubMed]
  • 7.Gutiérrez N, Garrido D. Species deletions from microbiome consortia reveal key metabolic interactions between gut microbes. mSystems. 2025, 03, 04;4(4):00185–19. Accessed: 10.1128/mSystems00185-19. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 8.Carlström CI, Field CM, Bortfeld-Miller M, Müller B, Sunagawa S, Vorholt JA. Synthetic microbiota reveal priority effects and keystone strains in the arabidopsis phyllosphere. Nat Ecol Evol. 2024, 05, 03;3(10):1445–54. Accessed: 10.1038/s41559-019-0994-z. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 9.Raman AS, Gehrig JL, Venkatesh S, Chang H-W, Hibberd MC, Subramanian S, et al. J.I.: a sparse covarying unit that describes healthy and impaired human gut microbiota development. Science. 365(6449):4735. 10.1126/science.aau4735. Accessed 2020-12-11. [DOI] [PMC free article] [PubMed]
  • 10.Berry D, Widder S. Deciphering microbial interactions and detecting keystone species with co-occurrence networks. Front Microbiol. 2021, 08, 16;5. Accessed: 10.3389/fmicb.2014.00219. [DOI] [PMC free article] [PubMed]
  • 11.He X, Wang D, Jiang Y, Li M, Delgado-Baquerizo M, McLaughlin C, et al. Heritable microbiome variation is correlated with source environment in locally adapted maize varieties. Nat Plants. 10(4):598–617. 10.1038/s41477-024-01654-7. Accessed 2025-01-31. [DOI] [PubMed]
  • 12.Friedman J, Alm EJ. Inferring correlation networks from genomic survey data. PLoS Comput Biol. 2012;8(9):1002687. 10.1371/journal.pcbi.1002687. Accessed 2025-01-31. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 13.Banerjee S, Schlaeppi K, Van Der Heijden MGA. Keystone taxa as drivers of microbiome structure and functioning. Nat Rev Microbiol. 2025, 01, 31;16(9):567–76. Accessed: 10.1038/s41579-018-0024-1. [DOI] [PubMed] [Google Scholar]
  • 14.Hirano H, Takemoto K. Difficulty in inferring microbial community structure based on co-occurrence network approaches. BMC Bioinf. 2025, 02, 17;20(1):329. Accessed: 10.1186/s12859-019-2915-1. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 15.Ghannam RB, Techtmann SM. Machine learning applications in microbial ecology, human microbiome studies, and environmental monitoring. Comput Struct Biotechnol J. 19:1092–107. 10.1016/j.csbj.2021.01.028. Accessed 2025-01-31. [DOI] [PMC free article] [PubMed]
  • 16.Michel-Mata S, Wang X, Liu Y, Angulo MT. Predicting microbiome compositions from species assemblages through deep learning. iMeta. 1(1):3. 10.1002/imt2.3. Accessed 2025-01-6. [DOI] [PMC free article] [PubMed]
  • 17.Raudys SJ, Jain AK. Small sample size effects in statistical pattern recognition: recommendations for practitioners. IEEE Trans Pattern Anal Mach Intel. 13(3):252–64. 10.1109/34.75512. Accessed 2025-05-21.
  • 18.Stein RR, Bucci V, Toussaint NC, Buffie CG, Rätsch G, Pamer EG, et al. Ecological modeling from time-series inference: insight into dynamics and stability of intestinal microbiota. PLoS Comput Biol. 9(12):1003388. 10.1371/journal.pcbi.1003388. Accessed 2025-01-31. [DOI] [PMC free article] [PubMed]
  • 19.Fisher CK, Mehta P. Identifying keystone species in the human gut microbiome from metagenomic timeseries using sparse linear regression. PLoS One. 2025, 01, 31;9(7):102451. Accessed: 10.1371/journal.pone.0102451. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 20.Bucci V, Tzen B, Li N, Simmons M, Tanoue T, Bogart E, et al. MDSINE: microbial dynamical systems INference engine for microbiome time-series analyses. Genome Biol. 2025, 01, 31;17(1):121. Accessed: 10.1186/s13059-016-0980-6. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 21.Gloor GB, Macklaim JM, Pawlowsky-Glahn V, Egozcue JJ. Microbiome datasets are compositional: and this is not optional. Front Microbiol. 2021, 10, 06;8:2224. Accessed: 10.3389/fmicb.2017.02224. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 22.Bomze IM. Lotka-volterra equation and replicator dynamics: A two-dimensional classification. Biol Cybern. 2025, 01, 06;48(3):201–11. Accessed: 10.1007/BF00318088. [Google Scholar]
  • 23.Gangeh MJ, Farahat AK, Ghodsi A, Kamel MS. Supervised dictionary learning and sparse representation-A review. arXiv. 2025, 05, 14. Accessed: https://doi.org/10.48550/arXiv.1502.05928. http://arxiv.org/abs/1502.05928.
  • 24.Faust K, Bauchinger F, Laroche B, De Buyl S, Lahti L, Washburne AD, et al. Signatures of ecological processes in microbial community time series. Microbiome. 2025, 05, 21;6(1):120. Accessed: 10.1186/s40168-018-0496-2. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 25.Gao Y, Şimşek Y, Gheysen E, Borman T, Li Y, Lahti L, et al. D.R.: miaSim: an r/bioconductor package to easily simulate microbial community dynamics. Methods Ecol Evol. 2025, 05, 21;14(8):1967–80. Accessed:10.1111/2041-210X.14129. [Google Scholar]
  • 26.Bray JR, Curtis JT. An ordination of the upland forest communities of southern wisconsin. 2025, 07, 31;27(4):325–49. Accessed: 10.2307/1942268.
  • 27.Chung NC, Miasojedow B, Startek M, Gambin A. Jaccard/Tanimoto similarity test and estimation methods for biological presence-absence data. BMC Bioinf. 2026, 01, 08;20(S15) (2019):644. Accessed: 10.1186/s12859-019-3118-5. [DOI] [PMC free article] [PubMed]
  • 28.Aitchison J, Barcelo-Vidal C, Martın-Fernandez JA, Pawlowsky-Glahn V. Logratio analysis and compositional distance. Math. 2000
  • 29.Amit G, Bashan A. Top-down identification of keystone taxa in the microbiome. Nat Commun. 2025, 03, 14;14(1) (2023):3951. Accessed: 10.1038/s41467-023-39459-5. [DOI] [PMC free article] [PubMed]
  • 30.Donoho DL. For most large underdetermined systems of linear equations the minimal l1-norm solution is also the sparsest solution. Commun Pure Appl Math. 59(6):797–829. 10.1002/cpa.20132. Accessed 2025-05-14
  • 31.Paszke A, Gross S, Chintala S, Chanan G, Yang E, DeVito Z, et al. Automatic differentiation in pytorch. In: NIPS-W; 2017 [Google Scholar]
  • 32.Bomze IM. Lotka-volterra equation and replicator dynamics: new issues in classification. Biol Cybern. 47:447–53
  • 33.Klemm K, Eguíluz VM. Growing scale-free networks with small-world behavior. Phys Rev E. 2025, 01, 06;65(5):057102. Accessed: 10.1103/PhysRevE.65.057102. [DOI] [PubMed] [Google Scholar]
  • 34.Solé RV, Alonso D, McKane A. Self–organized instability in complex ecosystems. Philosophical transactions of the royal society of London. Ser B: Biol Sci. 1421;357:667–81. 10.1098/rstb.2001.0992. Accessed 2025-03-12 [DOI] [PMC free article] [PubMed]

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Supplementary Materials

Supplementary Material 1 (24.9KB, zip)
Supplementary Material 2 (179.5KB, zip)
Supplementary Material 3 (343.4KB, pdf)

Data Availability Statement

KeySDL is available at https://github.com/mjgord/KeySDL. The scripts used to produce the results and figures as well as any supplementary information are available at https://github.com/mjgord/KeySDL-Manuscript-Code. Both of these codebases are also provided as supplementary files. All simulations used are available through these code repositories. The experimental datasets are available through the respective publications cited with associated results in the text.


Articles from BioData Mining are provided here courtesy of BMC

RESOURCES