A statistical approach to model soil microbiota versus heavy metals: a case study on soil samples from Foggia, Southern Italy Authors: Alessandro De Santis, Antonio Bevilacqua, Maria Rosaria Corbo, Barbara Speranza, Matteo Francavilla, Giuseppe Gatta, Federica Carucci, Milena Sinigaglia Published: 2025 ABSTRACT AbstractHeavy-metal (HM) contamination undermines soil functions and food safety, while risk appraisals often rely on chemical indices that can be unstable in the presence of extremes and only indirectly reflect biological integrity. We present an integrative framework that couples standardized contamination metrics with soil microbiome profiling to deliver stable, interpretable classifications and actionable bioindicators. Twelve peri-urban soils from Southern Italy were analysed for potentially toxic elements, including Arsenic (As), Cadmium (Cd), Chromium (Cr), Copper (Cu), Nickel (Ni), Lead (Pb), and Zinc (Zn) and profiled by shotgun metagenomics. We introduce a Standardized Ecological Risk index (SPERI) that preserves the ranking conveyed by conventional composites yet reduces outlier leverage. SPERI strongly agreed with Improved Potential Ecological Risk Index (IPERI) while stabilizing variance (R² = 0.896) and improved between-site comparability. Along the contamination gradient, community structure shifted consistently: families such as Pseudomonadaceae, Xanthomonadaceae and Rhodospirillaceae increased with risk, whereas Geodermatophilaceae and Nocardiaceae declined. Simple decision-tree models trained on family-level relative abundances reliably separated SPERI classes and repeatedly selected Zn- and Cd-enriched sites as primary split drivers, aligning microbial signals with chemical risk. By combining open, reproducible analytics with jointly chemical- and microbiome-informed endpoints, this workflow improves the interpretability and transferability of ecological risk assessment and supports targeted remediation and monitoring in contaminated agro-ecosystems.Supplementary InformationThe online version contains supplementary material available at 10.1038/s41598-025-32485-x.Keywords: Classification and regression trees, Shotgun metagenomics, Standardized ecological risk index, Correlation, Ecological risk assessment, Microbial communitiesSubject terms: Ecology, Ecology, Environmental sciences, Microbiology Introduction Soil contamination by heavy metals (HMs) is one of the most persistent and widespread environmental threats, with significant implications for human health, agricultural productivity, and the ecological integrity of terrestrial ecosystems1–3. HMs commonly found as contaminants in agricultural soils that can exert toxic effects on plants and microbial communities include cadmium (Cd), lead (Pb), chromium (Cr), arsenic (As), mercury (Hg), nickel (Ni), copper (Cu), and zinc (Zn). Among these, Cd, Pb, As, Hg, and Cr are considered highly toxic and pose serious risks to plant health even at relatively low concentrations4. Unlike organic pollutants, HMs are not biodegradable and can persist in the environment for decades, accumulating in soils and entering the food chain via plants and groundwater5. These contaminants originate primarily from anthropogenic activities, including industry, intensive agriculture, vehicular traffic, and the uncontrolled disposal of solid waste6–8. Land-use intensification, and improper waste disposal can exacerbate the vulnerability of agricultural and peri-urban soils to HMs accumulation. In addition to these anthropogenic inputs, HMs may also derive from the natural weathering and erosion of parent material, contributing to baseline geochemical variability across sites. Previous context analyses of Foggia county (Southern Italy) promoted by Legambiente9 have reported environmental degradation linked to illegal dumping, highlighting the need for targeted ecological risk assessment strategies. Poor soil health can directly and indirectly affect human well-being; in fact, contaminated soils represent a vector of exposure to hazardous substances through various pathways, in particular by eating contaminated food10. More critically, contaminants such as Pb, Cd, and As can be taken up by crops4,11, entering the food chain and potentially exceeding regulatory thresholds. The consumption of such contaminated produce has been linked to chronic illnesses, including neurological disorders, kidney dysfunction, and carcinogenic effects12–14. Given these risks, ecological risk assessment (ERA) has emerged as a key framework for evaluating the potential ecotoxicological consequences of soil contamination. This approach provides an integrated framework to evaluate the potential ecotoxicological impact of soil contaminants15,16. However, traditional approaches relying solely on chemical analyses could experience a bias in capturing the complex ecological consequences of HMs pollution. Chemical data can quantify concentrations but do not reflect the actual biological functionality or ecological and health status of the soil. In recent years, attention has shifted toward integrating chemical indicators with biological metrics, in particular microbial community dynamics, which offer a more holistic and functional perspective on soil health17. Soil microbial communities play a central role in essential ecosystem processes, including organic matter decomposition, nutrient cycling, and carbon sequestration18. Due to their functional roles and sensitivity to environmental gradients, microbial communities provide integrative indicators of both contamination levels and ecosystem functioning. Exposure to HMs can disrupt microbial diversity and composition, reducing functional redundancy and ecological resilience19,20. Numerous studies have demonstrated that microbial taxonomic structure and richness are tightly linked to contamination gradients, suggesting the potential of using soil microbiota as bioindicators of ecological degradation21–24. To effectively integrate microbial and chemical evidence in ecological assessments, it is essential to adopt quantitative tools that translate complex environmental data into interpretable metrics. In this context, synthetic indices provide a means of summarizing contamination levels and potential ecological risks in a standardized, comparative format. To quantify and compare the degree of contamination across sites in a reproducible manner, several synthetic indices have been developed to condense heterogeneous chemical information into standardized metrics. The Geoaccumulation Index (Igeo) estimates HMs enrichment relative to natural background levels, distinguishing between natural and anthropogenic inputs25. The Improved Potential Ecological Risk Index (IPERI) incorporates both concentration and toxicity coefficients of individual elements26, while is proposed another index, the Synthetic IPERI (SPERI), to normalize these data, and to facilitate cross-site comparisons. Their application aligns with European geochemical baselines, such as those established by the GEMAS project27, and conforms to national regulatory frameworks, including the Italian Legislative Decree 152/2006 on environmental quality standards28. Recent advances in metagenomics and predictive statistics have opened new ways for understanding microbial dynamics in contaminated soils. Microbial community data thus offer not only diagnostic information on the current contamination state, but also predictive insights into future shifts in soil functionality and ecological degradation. In particular, decision-tree models such as Classification and Regression Trees (C&RT) have been effectively used to correlate microbial patterns with contamination levels, enabling the identification of specific microbial taxa as potential ecological risk indicators21,29. These integrated approaches not only offer insight into the current state of the ecosystem but also provide predictive tools for environmental monitoring and sustainable land management30. While several studies have explored the effects of HMs on soil microbial diversity31,32 or applied synthetic indices separately to quantify ecological risk33,34, integrated approaches that simultaneously combine chemical contamination metrics, culture-based and metagenomic microbial data, and predictive modelling, are missing. This study seeks to fill that gap by establishing an interdisciplinary framework for ecological risk assessment that bridges the divide between environmental chemistry and microbial ecology. Specifically, the objective is to construct a unified model, and to propose an approach based on Classification and Regression Tree (C&RT) that integrates chemical indicators with microbiological data derived from both traditional culturing and high-throughput sequencing. Results Characterisation of microbial communities The microbiological analysis, summarized in Table 1, showed consistent abundances of Actinomycetes, Pseudomonas spp., and mesophilic bacteria across most soil samples, with values generally above 6.5 log CFU/g. Sample 12, however, exhibited markedly lower counts for all groups, suggesting unfavourable conditions. Aerobic spore-forming bacteria ranged from moderate to high levels, peaking in sample 3 (7.00 log CFU/g), while moulds were absent in samples 3 and 6 but present elsewhere. Anaerobic spore-formers were the less abundant overall, though sample 12 showed a relative increase for this group. Total and faecal coliforms did not exhibit any detectable growth. Table 1Microbial abundance in soil samples expressed as log-transformed colony-forming units per gram of dry soil (log CFU/g). Values represent the mean ± standard deviation for each microbial group. “ND” indicates not detected.ActinomycetesPseudomonas spp.Total viable countAerobic spore-formingMouldAnaerobic spore-formingMedia ± Dev. Std.Media ± Dev. Std.Media ± Dev. Std.Media ± Dev. Std.Media ± Dev. Std.Media ± Dev. Std.17.15 ± 0.036.62 ± 0.056.82 ± 0.136.28 ± 0.324.23 ± 0.032.54 ± 0.2427.10 ± 0.066.77 ± 0.217.00 ± 0.146.75 ± 0.303.94 ± 0.243.32 ± 0.3236.89 ± 0.076.73 ± 0.126.92 ± 0.097.00 ± 0.05ND2.45 ± 0.1546.92 ± 0.026.32 ± 0.126.58 ± 0.035.62 ± 0.854.38 ± 0.343.48 ± 0.0256.82 ± 0.026.73 ± 0.266.63 ± 0.114.53 ± 0.134.31 ± 0.031.15 ± 0.1566.68 ± 0.217.00 ± 0.086.71 ± 0.034.54 ± 0.14ND2.11 ± 0.0576.70 ± 0.116.93 ± 0.027.01 ± 0.034.59 ± 0.164.15 ± 0.072.13 ± 0.0586.79 ± 0.336.68 ± 0.056.37 ± 0.264.80 ± 0.114.30 ± 0.151.56 ± 0.5697.10 ± 0.096.74 ± 0.086.72 ± 0.184.82 ± 0.024.74 ± 0.041.80 ± 0.20107.16 ± 0.026.76 ± 0.236.78 ± 0.144.72 ± 0.084.20 ± 0.071.54 ± 0.06117.28 ± 0.076.72 ± 0.587.20 ± 0.096.24 ± 0.264.07 ± 0.012.57 ± 0.27124.42 ± 0.374.02 ± 0.424.10 ± 0.584.13 ± 0.394.55 ± 0.473.29 ± 0.11 Microbial abundance in soil samples expressed as log-transformed colony-forming units per gram of dry soil (log CFU/g). Values represent the mean ± standard deviation for each microbial group. “ND” indicates not detected. Genomic profiling of microbial communities was done on both fungi and bacteria; fungi represent a significant part of microbial populations (1% or lower). However, data were variable and do not allow clustering or regression analysis with the other parameters; therefore, for modelling purposes the attention was only given to bacteria. The dataset referred to bacterial families allows to assess within-sample diversity (α-diversity), providing insights into ecosystem stability and species distribution. α-Diversity analyses showed comparable patterns across all samples. The Shannon index indicated consistently high diversity (mean ± SD: 3.8 ± 0.09), while the Simpson index (mean ± SD: 0.95 ± 0.05) confirmed low dominance and an even distribution of taxa. Together, these metrics point out a stable community structure with limited variability across the sampling sites. However, this approach on α-diversity failed in differentiate the samples; therefore, a different methodology was used, focusing only on the most abundant families, by imposing as an arbitrary cut-off a relative abundance of 1% in at least a sample. The stacked bar chart (Fig. 1) displays the relative abundance of 22 bacterial families. Relative abundance of bacterial families across twelve soil samples. Each bar represents one sample (from 1 to 12), and colours indicate the taxonomic affiliation at the family level. The values are presented as percentages of total reads per sample. Taxa contributing less than the 1% threshold are grouped under “Others”. Streptomycetaceae was consistently the most abundant, with a relative abundance of 10.84% in sample 8; Nocardioidaceae also reached high levels in the same sample. Mycobacteriaceae remained stable (3–4.7%), while Microbacteriaceae and Pseudonocardiaceae were steady contributors, especially in samples 6–9. Micromonosporaceae were at variable levels, with a relatively low abundance in sample 4 (1.89%) and high levels in samples 9–10 (4.11%-3.89%). Other moderately abundant families included Bradyrhizobiaceae, Sphingomonadaceae (notably high in sample 7, 3.86%), and Micrococcaceae (7.36%, in sample 7). Soil physicochemical traits and metal content The physico-chemical properties of the soil samples (Table 2) showed neutral to slightly alkaline pH (7.23–7.75) with minimal variation. Electrical conductivity varied widely, with sample 4 showing the highest value (16.73 dS/m), suggesting possible anthropogenic impact. Organic matter ranged from 2.14% to 9.75%, highest in sample 8, which also had the greatest phosphorus content (506 mg/kg). Table 2Physicochemical properties of the twelve soil samples; mean values. Parameters include pH, electrical conductivity (dS/m), organic matter (%), available phosphorus, moisture and dry matter content, total carbon and nitrogen (%), sulfur (%), and soil texture fractions (sand, clay, and silt %).SamplepHEC (dS/m)OM (%)Available PMoisture (%)Dry matter (%)Tot. carbon (%)N (%)S (%)Sand (%)Clay (%)Silt (%)17.601.405.8830620.5279.4812.800.460.0260103027.620.583.7911813.1786.838.270.120.9263122537.401.303.6822823.1776.8312.270.350.0532353347.4716.734.302965.4894.529.220.301.2146183657.424.135.124629.7790.2310.200.210.0655153067.234.083.622129.5190.495.680.160.0135204577.625.962.147317.9382.0710.610.070.0153103787.432.849.7550616.0883.9212.310.610.0853113697.571.264.9766811.9788.039.810.270.06501040107.661.002.2613121.3478.666.060.170.04395110117.680.902.437120.5579.454.320.070.03305317127.750.554.3213620.4679.545.340.320.01205129 Physicochemical properties of the twelve soil samples; mean values. Parameters include pH, electrical conductivity (dS/m), organic matter (%), available phosphorus, moisture and dry matter content, total carbon and nitrogen (%), sulfur (%), and soil texture fractions (sand, clay, and silt %). Total carbon followed similar patterns to organic matter, peaking above 12% in samples 1, 3, and 8. Nitrogen levels were low to moderate (0.07%–0.61%). Texture analysis indicated sandy dominance in samples 1–2 and 5–9, and higher clay content (≥ 51%) in samples 10–12 (Fig. 2). (a) USDA soil texture triangle; (b) classification of the twelve samples (green number) based on particle size distribution (sand, silt, and clay percentages). The elemental analysis of soil samples, summarized in Supplementary Table S1, revealed distinct patterns of metal and HMs distribution, likely indicative of anthropogenic influence. Pb showed strong variability, ranging from 8.51 mg/kg (sample 9) to 467.30 mg/kg (sample 11), with sample 8 also exhibiting a notable value (210.83 mg/kg), suggesting multiple contamination hotspots. Zn reached particularly high concentrations in samples 3, 1, and 10 (6,340.72, 4,061.68, and 3,572.49 mg/kg respectively), well beyond typical background levels. Cu was mostly uniform but spiked in sample 11 (1,002.15 mg/kg). Cd remained generally low, although samples 2 and 12 exceeded 1 mg/kg. As was moderately elevated in samples 2 and 12. Ecological risk indices and contamination patterns The heatmap in Fig. 3 presents the spatial distribution of HMs contamination according to Igeo, which quantifies anthropogenic enrichment relative to natural background levels, with contamination classes ranging from 0 (uncontaminated) to 6 (extremely contaminated). Heatmap of Igeo (Geoaccumulation Index) values for selected HMs (As, Cd, Cr, Cu, Ni, Pb, Zn) across 12 soil samples, showing contamination classes from Class 0 (uncontaminated) to Class 6 (extremely contaminated) based on standardized thresholds. As, Cr, and Ni generally fall within the lower classes (0–1), suggesting negligible contamination. In contrast, Cd reaches moderate to strong contamination in samples 2 and 12, indicating site-specific inputs. Cu shows pronounced heterogeneity, with Sample 11 reaching Class 5 (Igeo = 4.38), marking it as a potential hotspot. Pb follows a similar trend, with Sample 11 classified as heavily contaminated (Class 4–5). Zn stands out with extreme values in Sample 2 (Igeo = 6.10, Class 6) and Sample 9 (Igeo = 5.27, Class 5), confirming severe enrichment. These patterns highlight both localized and widespread anthropogenic influences on soil metal content. The IPERI (Supplementary Table S2) and SPERI (Supplementary Table S3) values were used to assess metal-specific and cumulative ecological risk. In the case of IPERI, Cd consistently exhibited the highest individual risk values, peaking in sample 2 (202.37) and sample 11 (96.45), indicating severe contamination potential. Additional high-risk values were observed for Cu and Pb in sample 11 (156.59 and 105.72 respectively), further establishing this sample as a major pollution hotspot. Zn, although generally moderate across most samples, reached a maximum of 390.96 in the same site, reflecting a complex multi-metal stress profile. The SPERI index, which rescales risk values between 0 and 1, allows for direct comparison across metals and samples. In this normalized framework, sample 11 again emerges as the most impacted, with Cd, Cu, Ni, Pb, and Zn all reaching a SPERI value of 1.00, indicating maximum relative risk. Notably, sample 2 and sample 12 also exhibit elevated SPERI scores for Cd and As, underscoring localized areas of concern within the dataset. Correlation analysis and index selection To assess the correlation among all the factors, the Spearman’s index was used (Supplementary Figure S1), which illustrates the correlation coefficients among soil physicochemical parameters, elemental composition, and the relative abundance of dominant bacterial families. Data reveal that soil texture exerts a significant influence on both geochemical properties and microbial community structure. Clay content correlates positively with several trace metals (e.g., Cr, iron (Fe), vanadium (Vd)). In contrast, sand content shows negative correlations with elements like As and Zn. Organic matter, total carbon, and nitrogen are closely interrelated and positively associated with bacterial families typical of nutrient-rich soils, such as Bradyrhizobiaceae, Streptomycetaceae, and Pseudonocardiaceae. Electrical conductivity aligns with calcium and barium levels—suggesting a geogenic salt source—and with bacterial groups tolerant to moderate salinity, like Pseudomonadaceae and Micrococcaceae. Available phosphorus is positively correlated with potential phosphate-solubilizing taxa, particularly Micromonosporaceae and Mycobacteriaceae. Some taxa, such as Geodermatophilaceae and Nocardiaceae, show positive associations with HMs like Pb, Cd, and Cr, indicating possible ecological tolerance. Conversely, families like Methylobacteriaceae and Sphingomonadaceae display negative correlations, suggesting sensitivity to contamination. Given the complexity of the full correlation matrix, direct ecological patterns were difficult to understand. Therefore, attention was narrowed to microbial families most directly correlated with the ecological risk indices IPERI and SPERI. The resulting correlation table (Table 3) highlights both positively and negatively associated taxa. Table 3Spearman’s correlation coefficients between selected bacterial families and the IPERI and SPERI indices. Spearman’s correlation coefficients between selected bacterial families and the IPERI and SPERI indices. Notably, Conexibacteraceae and Bradyrhizobiaceae showed strong positive correlations with both indices, suggesting their abundance increases with contamination severity. In contrast, Mycobacteriaceae, Xanthomonadaceae, and Rhodobacteraceae exhibited negative correlations, implying potential sensitivity to polluted conditions. Based on these results, the ten families most strongly correlated—positively or negatively—with the IPERI and SPERI indices were selected as candidate bioindicators. For SPERI, these included: Bradyrhizobiaceae, Conexibacteraceae, Burkholderiaceae, Rhodospirillaceae, Pseudonocardiaceae, Sphingomonadaceae, Comamonadaceae, Geodermatophilaceae, Phyllobacteriaceae, and Methylobacteriaceae. For the IPERI index, the most correlated families included Conexibacteraceae, Bradyrhizobiaceae, Burkholderiaceae, Comamonadaceae, Geodermatophilaceae, Pseudonocardiaceae, Sphingomonadaceae, Methylobacteriaceae, Phyllobacteriaceae, and Rhodospirillaceae. These families were then incorporated into a C&RT (Classification and Regression Tree) model with the goal of developing a predictive framework capable of estimating the ecological pollution status based on shifts in the soil microbial community. Predictive modelling using classification trees (C&RT) Each classification/regression tree (C&RT) diagram visually represents a set of binary decisions30 that recursively gives a partition of the dataset. In this work, based on microbial family abundance, aiming to predict the pollution state expressed by either the IPERI or SPERI index. The root node at the top of each tree contains the full sample set and splits based on a threshold value for the relative abundance of a specific bacterial family. This split generates two branches, each forming a new internal node or terminal leaf. At each node, on its top, the splitting criterion is determined by the variable (a specific bacterial family) whose abundance best reduces intra-group variability. Two key statistics are displayed in each node: mu, the mean value of the index within that node, and var, the variance of that value. While mu reflects the expected pollution state for samples within that node, var indicates the internal consistency of the prediction, lower variance implies higher predictive reliability. The classification/regression tree model (C&RT) constructed on the IPERI index (Supplementary Figure S2) reveals a branching structure that, while capturing variations in microbial abundance across the dataset, suffers from limited robustness. The model splits first on the abundance of Conexibacteraceae, separating samples with lower values (≤ 1.15) from those with higher values. The latter group (N = 4) immediately forms a terminal node with a markedly elevated mean IPERI value (mu = 263.00) but also exhibits very high internal variability (variance = 7690.62), indicating poor prediction precision. Although the model identifies microbial families associated with different pollution states, it lacks the ability to produce homogeneous, low-variance terminal nodes—reflected in large intra-group variability, particularly among the upper branches. This dispersion suggests that the model may be affected by an overfitting noise or influenced by high values in the unscaled IPERI data. Overall, the IPERI-based C&RT tree does not provide strong predictive confidence due to the instability and high internal variance of its partitions. Due to the elevated intra-node variance and the limited robustness of the IPERI-based C&RT, because of the influence of unscaled and high values, the normalized SPERI index was subsequently tested as an alternative predictor, with the aim of improving model stability, reducing dispersion, and enhancing the biological interpretability of node partitions. To assess whether the normalized SPERI index retains the ecological risk patterns captured by IPERI while enhancing interpretability, a scatter plot analysis was performed. The resulting plot (Supplementary Figure S3), in line with previous findings35, revealed a strong positive linear relationship (R² = 0.896). Despite being a normalized index, SPERI preserves the original contamination gradient and relative sample rankings established by IPERI, while minimizing dispersion and enhancing comparability. This strong correlation confirmed the suitability of SPERI not only as a normalized risk descriptor but also as a reliable proxy for predictive modeling, prompting its implementation in a refined C&RT framework. Compared to IPERI, the SPERI tree not only reduces noise but also avoids the influence of high levels HMs by virtue of the normalized scale. In contrast to the IPERI-based model, the decision tree built on the SPERI index demonstrates a markedly more robust and reliable predictive structure. The first split occurs on the abundance of Mycobacteriaceae, effectively separating a single high-value outlier (Node 2, mu = 0.668) from the rest of the samples (Node 3, N = 11). This early partitioning reduces overall variance significantly. Subsequent branches—particularly those involving Xanthomonadaceae and Rhodospirillaceae—progressively segment the remaining samples into increasingly homogeneous groups. Each terminal node exhibits very low within-node variance (e.g., Var = 0.000172 and 0.000881), underscoring the model’s stability and discriminative power. This structure allows the user to input microbial abundance data and, by sequentially applying the decision thresholds, predict the contamination state. The SPERI decision tree (Fig. 4) must be interpreted by following a top-down logic, where each internal node represents a binary decision rule based on the relative abundance of a specific bacterial family. The root node begins with Mycobacteriaceae: if the abundance is ≤ 2.60, the sample is likely to have a higher SPERI value (at least 0.67, Node 2), whereas values > 2.60 lead to further refinement but generally are related to lower SPERIs and thus to less contaminated soils. In this context, a further classification can be done through the other families; in fact, the subsequent split on Xanthomonadaceae and then on Rhodospirillaceae further stratifies samples into narrow, well-defined ranges of SPERI scores, each with minimal internal variance. Decision classification/regression tree model (C&RT) based on the SPERI index. Values on the branches represent the abundance of microbial families, while the box contain mean values (mu) and variance (var) of SPERI. In particular, a lower abundance of Xanthomonadaceae (0.90) indicates soil with medium contamination levels (SPERI of 0.39), while less contaminated soils have a higher abundance of Xanthomonadaceae (SPERI at 0.14). Finally, a further refinement is possible through Rhodospirillaceae. In conclusion, low-contaminated or uncontaminated soils are characterized by high abundance of Mycobacteriaceae and Xanthomonadaceae e lower levels of Rhodospirillaceae. Discussion The results of this study offer a comprehensive assessment of the ecological impacts of HMs contamination on soil microbial communities in a Mediterranean agricultural region subject to heterogeneous anthropogenic pressure. Both culture-based and metagenomic analyses revealed a generally high microbial richness across the sampled soils, supported by alpha-diversity indices and the relative abundance of dominant bacterial families such as Streptomycetaceae, Nocardioidaceae, and Mycobacteriaceae. However, distinct compositional shifts were observed among sampling sites, reflecting variations in contamination levels, soil texture, salinity, and organic matter content. The potentially toxic elements (PTEs) were selected based on three main criteria: (i) their regulatory relevance, as they are listed among the contaminants regulated by Italian legislation28 and explicitly mentioned in the recent European Soil Monitoring and Resilience Law proposal36 as priority substances for the identification of contaminated sites; (ii) their well-documented ecotoxicological effects on soil organisms and terrestrial ecosystems, as widely reported in the scientific literature35,37,38; and (iii) the availability of harmonized geochemical background values, provided by the GEMAS project27, which allows robust and comparable application of synthetic ecological risk indices. These PTEs also represent the most frequently reported inorganic contaminants in both agricultural and urban soils across Italy, making them particularly relevant for national and European risk assessments. Given their environmental and regulatory relevance, the analysis of these PTEs using synthetic indices provides an integrated understanding of both contamination levels and their potential ecological consequences. Among the three synthetic indices applied to quantify contamination Igeo, IPERI, and SPERI, the latter demonstrated superior interpretability, effectively reducing the influence of high values and providing a more balanced view of ecological risk. This was particularly evident in samples 2 and 11, where high concentrations of Zn and Cd significantly affected IPERI, while SPERI yielded ecologically interpretable risk classifications. These findings are in line with Zhang et al.39, who highlighted that unnormalized risk indices may inflate the influence of extreme values, supporting the adoption of normalization strategies such as those used in SPERI. Similarly, Ferreira et al.25 highlighted that unnormalized indices such as Igeo and IPERI can overemphasize the contribution of highly concentrated. In contrast, SPERI’s formulation enhances comparability and supports more proportionate ecological interpretations across heterogeneous environmental matrices. Correlations between microbial taxa and contamination gradients revealed consistent trends. Families such as Bradyrhizobiaceae and Conexibacteraceae were positively associated with SPERI and IPERI, suggesting their potential tolerance or adaptive advantage under HMs stress. These results are in line with other studies in which both families are involved in HMs resistance mechanisms40–42. In contrast, Mycobacteriaceae and Rhodobacteraceae were consistently depleted in highly contaminated samples, supporting their role as sensitive bioindicators. These families belong to the phyla Actinobacteria and Proteobacteria, respectively, both of which are commonly regarded as taxonomically and functionally versatile microbial groups in soil ecosystems. Interestingly, although Mycobacteriaceae are generally recognized for their metabolic flexibility and high resistance to environmental stressors, their marked decline in this study may reflect the crossing of a critical ecological threshold beyond which even resilient taxa are adversely affected. This observation aligns with findings from recent metagenomic studies showing that long-term or cumulative HMs exposure can destabilize microbial community structures43 and eliminate key generalist taxa, including Actinobacteria and Proteobacteria, under elevated ecological risk levels24,41,44. Importantly, many of the bacterial families observed in contaminated soils were also present in less impacted samples, albeit at different relative abundances. This supports the idea that microbial responses to contamination are not binary (presence/absence) but rather occur as compositional rebalancing across ecological gradients. Such shifts, even in the absence of biodiversity loss, can alter ecosystem functionality. These insights reinforce the need to combine diversity metrics with structural and functional analyses to capture the full ecological consequences of contamination19,45. Another relevant finding relates to the consistent dominance of Streptomycetaceae across all samples, regardless of contamination levels. Given their known capabilities in decomposing organic matter and producing secondary metabolites, members of this family may contribute to ecosystem stability and functional compensation under stress. Their abundance may reflect structural resilience in the face of pollution, as proposed by Pu et al.46 in studies on metal-impacted soils. The Classification and Regression Tree (C&RT) model built on SPERI values confirmed the predictive potential of microbial data, with a stable structure and informative splits based on Mycobacteriaceae, Xanthomonadaceae, and Rhodospirillaceae. Notably, no single microbial taxon was sufficient to classify ecological risk levels with high reliability; rather, it was the combination of multiple taxa, in specific hierarchical arrangements, that allowed for robust risk discrimination. These findings are in line with previous studies highlighting the advantages of multivariate, model-based approaches for environmental microbiology and risk classification. Xu et al. and Wijaya et al.47,48 demonstrated that microbial indicators, when evaluated via decision tree or learning models, offered high-resolution classification of contamination status, outperforming single-taxon indicators. Similarly, Cipullo et al.49 emphasized that complex environmental signals require multidimensional interpretation through non-linear machine learning methods to support accurate ecological risk prediction. Several site-specific patterns further enriched the interpretation of our findings. Sample 12 exhibited a reduction in CFU counts across all cultured taxa, suggesting a collapse in microbial viability potentially linked to cumulative or chronic contamination stress. Comparable cases of microbial suppression under Zn and Cu pressure have been documented by Song et al.50, who showed significant biomass C and ATP declines in soils exposed to single and combined metal stressors. In contrast, samples 1 and 8—despite moderate HMs levels—displayed high organic matter content and relatively rich microbial assemblages. This may reflect the protective role of organic matter in buffering metal bioavailability and sustaining microbial viability. Recent studies have demonstrated that dissolved organic matter (DOM), particularly from compost and waste sources, can reduce metal toxicity by complexation, while simultaneously supporting microbial diversity and enzymatic activity under HMs stress51–53 . Soil physicochemical properties also played a non-negligible role. Clay-rich soils appeared to harbor higher microbial abundances than sandy ones, even when contamination levels were similar. This finding supports earlier work by Naylor et al. and Bhaduri et al.17,18, who emphasized the buffering and stabilizing effects of finer soil textures through improved retention of water and nutrients and lower metal mobility. In addition, sample 4 exhibited high electrical conductivity and an enrichment in halotolerant taxa such as Halomonadaceae and Nocardioidaceae, suggesting co-selection driven by salinity and HMs stress. These patterns align with recent findings by Diba et al., Orji et al. and Sodhi et al.3,54,55, who described the presence of halotolerant and metal-resistant bacterial consortia in hypersaline, metal-contaminated environments. Their work emphasizes the ecological relevance of co-adaptive traits under multiple stressors in marginal and salt-affected soils. Finally, the observation that alpha-diversity indices remained high even in some contaminated soils warrants attention. This finding suggests that biodiversity alone may not be a sufficient indicator of ecological integrity, as functional shifts in the microbial community may occur without significant changes in richness. This reinforces the value of integrating taxonomic, functional, and ecological dimensions when assessing soil health in contaminated environments. In conclusion, this study presents an integrative framework for ecological risk assessment in contaminated soils, combining traditional chemical indices with culture-based and metagenomic microbial analyses. By applying synthetic risk metrics (Igeo, IPERI, and SPERI) and constructing classification models based on microbial community data, the work illustrates that normalized indices such as SPERI offer enhanced ecological interpretability and robustness against data skewness. Furthermore, compositional shifts in key microbial families, such as the decline of Mycobacteriaceae and Rhodobacteraceae and the persistence of Streptomycetaceae, provide functional insights into ecosystem resilience and degradation. The consistent patterns uncovered by C&RT models reinforce the potential of microbial indicators as predictive tools for environmental monitoring. However, the predictive power arises not from individual taxa, but from their collective interactions and hierarchical configurations. The findings underscore the importance of incorporating microbial community structure and soil physicochemical traits into ecological risk frameworks, moving beyond mere biodiversity counts to encompass compositional and functional shifts. Despite the robustness of these findings, this study has some limitations that warrant consideration. The relatively limited sample size and geographic scope constrain the generalizability of the results, while the taxonomic resolution, restricted to the family level, ensures statistical stability but may obscure finer ecological signals. Moreover, although SPERI demonstrated enhanced interpretability over traditional indices, the assignment of toxicological weights remains semi-empirical and would benefit from local calibration. Future research should expand the spatial and temporal scope of sampling, adding functional gene profiling techniques, and refining risk indices through site-specific toxicological parameters. The integration of such approaches based on a more complex machine learning and high-throughput microbial data offers strong potential for the development of next-generation, biologically informed tools for ecological risk assessment. Methods Soil sampling strategy and site selection criteria Soil samples were collected from twelve distinct locations in the peri-urban area surrounding the city of Foggia (41°27′30.42″N, 15°33′06.77″E) (Southern Italy), within a radius of approximately 6–12 km from the urban centre. All sampling points were positioned in areas impacted by recurrent episodes of uncontrolled and illegal waste disposal documented in municipal and regional reports. These dumping activities represent the primary and most persistent source of inputs of HMs into local soils, making this territory a suitable model for evaluating contamination patterns and testing the proposed ecological-risk indices. This activity is an exploratory action focusing on soil samples (< 50 g) collected solely for methodological purposes aimed at the isolation and/or characterization of bioremediating microbiota and not an official environmental monitoring activity. Therefore, according to national and local guidelines and regulations a preliminary approval is not required. Site selection was guided by the presence of visible indicators of anthropogenic disturbance. Soil samples were retrieved from the uppermost 0–10 cm of the soil profile using sterile sampling tools to avoid cross-contamination. At each site, five individual soil cores were collected within a 3 × 3 m area using stainless-steel corers and spatulas disinfected with 70% ethanol between collections. The five cores were pooled into a single composite sample of approximately 0.5 kg of soil. In the laboratory, composite samples were homogenised under aseptic conditions in sterile polyethylene trays, manually cleared of coarse debris (stones and roots), and sieved through a 2-mm stainless-steel mesh. The homogenised soil was then subdivided into aliquots dedicated to physicochemical analyses, CFU enumeration, and DNA extraction, as described in the next paragraphs. All samples were kept refrigerated immediately after collection (4 °C), transported to the laboratory in insulated containers, and processed within 24 h to preserve microbial viability and community structure. This procedure was repeated twice to have biological replicates. Microbiota characterisation A 10 g aliquot of each soil sample was suspended in 90 mL of a 0.9% (w/v) saline solution. After mechanical homogenization for 30 min, the suspension was serially diluted. The culture media (Oxoid, Milano, Italy) adopted for microbial enumeration included Plate Count Agar (PCA) both for total viable bacteria and aerobic spore-forming bacteria at 30 °C for 24 h. The latter preceded by a heat shock treatment at 80 °C for 10 min to inactivate vegetative cells. Pseudomonas Agar Base (PAB) medium supplemented with Cetrimide-Fucidin-Cephaloridine (CFC) (Oxoid), incubated at 25 °C for 72 h, was used to quantify Pseudomonas spp. Coliform bacteria were quantified using Violet Red Bile Agar, incubated at 37 °C and 44 °C for 18–24 h to differentiate between mesophilic and thermotolerant strains. Sulfite-reducing bacteria were detected on SPS medium, while Potato Dextrose Agar (PDA) was utilized for the isolation and growth of fungi. Actinomycetes were cultivated using an optimized medium (10 g/L bacteriological peptone, 5 g/L beef extract, 5 g/L NaCl, 10 g/L glycerol, 20 g/L Agar) for their recovery. DNA isolation and wet lab procedures Genomic DNA was isolated from approximately 200 mg of soil using the Chemagic™ DNA Soil 250 Kit on the Chemagic™ 360 instrument (Revvity, Waltham, MA, USA), following the manufacturer’s protocol. Mechanical cell disruption was carried out using Bashing bead lysis tubes and the Omni Bead Ruptor Elite (OMNI International, Kennesaw, GA, USA) with five cycles of 1-minute bead beating at 4.2 m/s followed by 30-second resting intervals, totalling 5 min of lysis. Purified DNA was eluted in 90 µL of nuclease-free water. DNA concentration was quantified using the Equalbit™ DNA BR Assay Kit (Vazyme, Nanjing, PRC) and measured on an Infinite Pro 200 F Nano + fluorescent plate reader (Tecan, Männedorf, Switzerland). For shotgun metagenomic library preparation, the VAHTS® Universal Plus DNA Library Prep Kit for Illumina V2 with unique dual indexes (UDIs) was used according to the manufacturer’s instructions. Fragment size distribution was assessed by capillary electrophoresis on the LabChip GX Touch HT system using the DNA NGS 3 K Assay Kit (Revvity). Final library quantification was performed with the Equalbit 1× dsDNA HS Assay Kit (Vazyme) on the same plate reader. Libraries were pooled and diluted to 140 pM for paired-end 2 × 150 bp sequencing using the 300-cycle 25B Reagent Kit on the NovaSeq X Plus System (Illumina, San Diego, CA, USA). Bioinformatic analyses Each sample generated more than 20 million raw reads. Demultiplexing and adapter trimming were performed using NovaSeq Control Software, while FastQ Toolkit (Illumina) was applied to remove reads with a mean quality score below 30 or a length shorter than 100 bp. Quality control of filtered reads was carried out using FastQC v0.12.1. High-quality reads were then analyzed using the DRAGEN™ Metagenomics Pipeline v3.5.13 (Illumina, BaseSpace), which includes host filtering, taxonomic classification (Kraken2 using the PlusPF-8 reference database), and relative abundance profiling. As a second step, eukaryotic reads (including human, plant and fungal sequences) were automatically removed by the host-filtering module of the DRAGEN pipeline, and only prokaryotic reads were retained for downstream analyses. Low-abundance taxa representing less than 0.01% of total prokaryotic reads per sample were excluded to eliminate singletons, doubletons and other spurious low-frequency assignments. Family-level classification represented the lowest taxonomic rank consistently detected across samples, whereas genus- and species-level assignments were sparse and unreliable. Therefore, all downstream analyses, including diversity metrics and C&RT modelling, were performed at the family level. Physical and chemical characterisation of soils Soil samples collected from each experimental site were subjected to a comprehensive analysis of their physico-chemical characteristics. The soil pH was determined using a 1:2.5 (w/v) soil-to-water suspension, while electrical conductivity (EC) was assessed in a 1:2 (w/v) aqueous extract. Total nitrogen (N) content was quantified according to the Dumas method56. Available phosphorus, expressed as P₂O₅, was extracted using the sodium bicarbonate method developed by Olsen et al.57. Total organic carbon (TOC) content was evaluated via chemical oxidation with potassium dichromate, followed by titration with ferrous sulfate (FeSO₄), in accordance with the Walkley-Black procedure58. The percentage of organic matter (OM) was then estimated by multiplying the TOC value by the conversion factor 1.724. The total sulphur was quantified by a LECO Elemental Analyzer, model S832 (St Joseph, MI, USA). The particle size distribution (clay, sand, silt) was conducted by a laser diffraction analysis59 using a Mastersizer 3000 (Malvern Panalytical LTD., Malvern, UK). Total metal composition (Al, As, B, Ba, Ca, Cd, Cr, Cu, Fe, K, Mg, Mn, Na, Ni, P, Pb, Si, Sr, Ti, V, Zn) was determined by inductively coupled plasma optical emission spectrometry (ICP-OES, Thermo Scientific iCAP 7000 series), after microwave-assisted acid digestion of 0.5 g of air-dried soil samples with 9 mL of HNO₃ (65%) and 3 mL of HCl (37%), according to EPA Method 3051 A60. Quality assurance was ensured by including blanks, duplicates, and certified reference materials (CRM) in the analytical run. Ecological risk assessment To evaluate the ecological risk potentially associated with HMs contamination in the sampled soils, a multi-index approach was applied, integrating the calculation of the Geo-accumulation Index (Igeo)35, the Improved Potential Ecological Risk Index (IPERI)26, and the Synthetic Potential Ecological Risk Index (SPERI) based on the study of37. These synthetic indices were calculated for selected potentially toxic elements (PTEs), namely As, Cd, Cr, Cu, Ni, Pb, and Zn. The Igeo was calculated as described in Eq. 1: where Cn is the measured concentration of the element in the sample and Bn is its corresponding geochemical background value obtained from GEMAS European geochemical baselines27. According to the classification originally proposed by Grattacaso et al.61, the geo-accumulation index (Igeo) is divided into seven contamination levels, each corresponding to a defined soil quality class: Class 0: Igeo ≤ 0 (Practically uncontaminated), Class 1: 0 < Igeo ≤ 1 (Uncontaminated to moderately contaminated), Class 2: 1 < Igeo ≤ 2 (Moderately contaminated), Class 3: 2 < Igeo ≤ 3 (Moderately to heavily contaminated), Class 4: 3 < Igeo ≤ 4 (Heavily contaminated Class), Class 5: 4 < Igeo ≤ 5 (Heavily to extremely contaminated), Class 6: Igeo > 5 (Extremely contaminated). To assess the ecological risk posed by each element, the Improved Potential Ecological Risk Index (IPERI) was calculated as follows (Eq. 2): Where CFi is the contamination factor of the ith metal, is the toxic response coefficient (Cd = 30, Pb = 5, Cu = 5, Cr = 2, Ni = 5, Zn = 1, As = 10)37,38. The cumulative IPERI was used to classify ecological risk into the following categories: RI < 150 (low risk), 150 ≤ RI < 300 (moderate risk), 300 ≤ RI < 600 (considerable risk), and RI ≥ 600 (very high risk). The last index SPERI, a normalized index, was calculated according to the Eq. 3, as follows: Where: n is the number of metals, Ci is the observed concentration of the ith metal in the sample, Cimin and Cimax are, respectively, the minimum and maximum observed concentrations of the ith metal across the dataset. Statistics For each sampling site, physicochemical and culture-based measurements were obtained from two independent biological samples, with all laboratory determinations performed in technical duplicate. Statistical analyses were carried out on the mean values of the two biological replicates per site. Shotgun metagenomic sequencing, instead, was performed on one representative biological sample per site, as detailed in the Bioinformatic Analyses section. α diversity was quantified using the Shannon and Simpson indices, and the differences among the twelve soil samples were evaluated through the Kruskal–Wallis test. In addition, relative abundance of bacterial families were analyzed either by the Wilcoxon rank-sum test (two groups) or the Kruskal–Wallis test (multiple groups). P-values were adjusted using the Benjamini–Hochberg procedure. These analyses were done through Statistica v.14 (Statsoft, Tulsa, USA). Correlation analysis was carried out using PAST v.5.262, based on Spearman’s coefficients, to evaluate potential associations between factors and identify co-occurrence trends. In addition, scatter plots were generated using Statistica v.14 to visually explore bivariate relationships between the risk indices (IPERI and SPERI), with linear regression lines and R² values used to confirm the strength of associations. The same software was used to develop a Classification and Regression Tree (C&RT) model aimed at classifying samples according to the combined SPERI/IPERI ecological risk category and the corresponding microbiota composition. Classification and regression tree (C&RT) modelling Classification and Regression Tree (C&RT) analyses were performed using Statistica StatSoft v14 . The SPERI and IPERI classes were used as dependent variables in two separate models. Predictors consisted of relative abundances of bacterial families derived from the metagenomic dataset. The most dominant families across all samples (Bradyrhizobiaceae, Conexibacteraceae, Mycobacteriaceae, Xanthomonadaceae, Rhodospirillaceae, Rhodobacteraceae, Streptomycetaceae, Nocardioidaceae, Burkholderiaceae and Comamonadaceae) were selected as predictors for model construction. These values were obtained after quality filtering, host read removal and exclusion of low-abundance taxa (< 0.01% of prokaryotic reads), and represent the only predictors included in the C&RT framework. In the resulting decision trees, the numeric values displayed at each splitting node represent thresholds of metagenomic relative abundances for the bacterial families contributing most strongly to the classification. Model construction followed the standard implementation of the C&RT algorithms in Statistica. Node splitting was based on the Gini impurity criterion, with equal misclassification costs and estimated prior probabilities. A minimum of five observations was required to form a node, and tree growth was constrained using the “prune on variance” stopping rule to prevent overfitting. Model stability and robustness were evaluated through cross-validation following Statistica’s default settings. Supplementary Information Below is the link to the electronic supplementary material. Supplementary Material 1 Author contributions Conceptualization, A.B., M.S., M.R.C. and A.D.S.; methodology, A.B., M.S. and M.R.C.; investigation, A.D.S., B.S., G.G., F.C., and M.F.; data curation, A.B. and A.D.S.; software, A.D.S., and A.B.; writing original draft preparation, A.D.S. and A.B.; writing—review and editing, all authors; supervision, A.B. All authors have read and agreed to the published version of the manuscript. Funding No funding received for this research. Data availability The datasets generated during and/or analysed during the current study are available from the corresponding author on reasonable request. Declarations Competing interests The authors declare no competing interests. Permission This research is an exploratory action focusing on soil samples collected solely for methodological purposes. Therefore, according to national and local guidelines and regulations a preliminary approval is not required. Footnotes Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. References Associated Data Supplementary Materials Supplementary Material 1 Data Availability Statement The datasets generated during and/or analysed during the current study are available from the corresponding author on reasonable request.