Introduction

Theory and empirical evidence suggest that the main processes underlying spatial variation in species composition (i.e., spatial beta diversity; Anderson et al. 2011) include environmental selection, demographic stochasticity, and dispersal (Vellend 2016; Leibold and Chase 2018). However, even if beta diversity is driven by these processes, a central question that still needs to be answered is why some local communities and some species contribute more to the overall beta diversity (Legendre and De Cáceres 2013). Understanding these key aspects of the organization of metacommunities can help identify sites with a unique species composition and species with unique characteristics. This knowledge can also be used to identify sites in need of protection or degraded sites in need of restoration (Legendre and De Cáceres 2013; Legendre 2014). Here, we investigated the compositional uniqueness of stream communities and its relationship with instream, land-use, and spatial variables over a gradient of land-use intensification. We also explored whether the biological characteristics and taxonomic relatedness of diatoms and insects, groups that have different dispersal abilities and environmental preferences (De Bie et al. 2012; González-Trujillo et al. 2019), were correlated with the species contributions to beta diversity. If the compositional uniqueness and species contributions to beta diversity of different biological groups could be predicted, respectively, by environmental and biological characteristics, then these metrics would be good indicators of community dynamics and also useful in applied contexts.

Compositional uniqueness (or local contribution to beta diversity, LCBD; Legendre and De Cáceres 2013) is expected to be related to local environmental conditions (e.g., nutrient concentration and canopy cover), such that environmentally unique sites would harbor the most unique communities (Legendre 2014; Castro et al. 2019). However, most of the studies conducted thus far evaluating this relationship did not explicitly consider environmental uniqueness (but see Castro et al. 2019). Instead, they related LCBD to a set of environmental descriptors in their raw, absolute form (e.g., Tonkin et al. 2016; Heino and Grönroos 2017). For example, Valente-Neto et al. (2020) found that the conductivity and intermittence of the streams were positively related to the LCBD of insects but did not evaluate whether unique communities occur in the most unique environments. Furthermore, compositional uniqueness is usually weakly associated with local environmental variables (e.g., Tonkin et al. 2016; Heino and Grönroos 2017; Heino et al. 2017). Thus, LCBD may be mainly associated with patch-generating processes (e.g., land-use variability), which in turn influence the spatial isolation of sites (Heino et al. 2017; see also Vilmi et al. 2017).

Similarly, understanding why some species contribute more strongly to beta diversity may shed light on the mechanisms underlying community assembly. This is because the species contribution to beta diversity (SCBD; Legendre and De Cáceres 2013) may be related to biological traits that determine species fitness, which affects their relative abundance, occupancy and responses to environmental change (Shipley et al. 2016). For example, species with traits enhancing population growth and survival in disturbed environments are abundant and commonly the dominant species at the degraded extreme of environmental gradients (e.g., Bojsen and Barriga 2002; Colzani et al. 2013), which might affect overall beta diversity. However, the relationships between SCBD and traits have rarely been explored, and the few available studies have found contrasting results. For example, it has been suggested that the low dispersal capacity of aquatic insects is related to high SCBD (Heino and Grönroos 2017), but other studies did not find similar relationships (Li et al. 2020). Moreover, because some biological traits tend to be conserved over time (Losos 2008), phylogenetic relatedness can be a reasonable proxy of species differences explaining SCBD.

Currently, land use intensification and deforestation are key processes that affect the composition of communities and reduce biodiversity in both terrestrial (Newbold et al. 2015) and freshwater ecosystems (Reid et al. 2019; Petsch et al. 2021a). In river catchments, the conversion of forests to agricultural and urban areas is related to major changes in stream conditions, including increased siltation, nutrient inputs, and light incidence; alteration of the flow regime; and reduced leaf litter input (Allan 2004). These alterations can result in environmental homogenization across sites and, consequently, in the homogenization of biological communities (i.e., decreased beta diversity; Olden 2006; Olden et al. 2018) through the loss of sensitive species and the spread of species tolerant to degraded environmental conditions (Siqueira et al. 2015; Mouton et al. 2020). Under a scenario of gradual landscape degradation, two outcomes can be expected considering the compositional uniqueness of local communities. On the one hand, unique local communities can be those harboring sensitive and rare species at preserved sites within a degraded landscape (e.g., Heino et al. 2017). On the other hand, when only a few sites are strongly disturbed in relation to others within the landscape, unique local communities can be those in the most degraded sites (e.g., Leão et al. 2020), containing a reduced and unique set of tolerant species. This rationale assumes a strong relationship between compositional and environmental uniqueness (Castro et al. 2019), that is, more unique sites, degraded or preserved, within a region would harbor more unique communities.

Here, we evaluated the local contribution (LCBD) and the species contribution (SCBD) to beta diversity of benthic diatoms and insects along a gradient of land use intensification (from pristine forested streams to streams in agriculture catchments) in subtropical Brazil. We investigated the environmental and spatial correlates of LCBD and the biological correlates of SCBD. Because diatoms and insects are expected to be good dispersers (De Bie et al. 2012) in the spatial extent studied and the sampled sites are within a relatively small area (~ 120 km in the east–west direction and 70 km in the north–south direction), most species can potentially reach all streams. However, because some of the sampled streams are in catchments with intensive land use (Online Resource Fig. S1, S2; see also Petsch et al. 2021b), our hypothesis (H1) is that the degraded sites would be biologically unique (Legendre and De Cáceres 2013). Thus, we expected that compositional uniqueness would be positively related to uniqueness in land use and instream environmental characteristics and negatively related to the percentage of forest cover in a 400-m-wide buffer. The basic idea is that “typical” sites would be those in forested areas, whereas those sites in more degraded areas would contribute more to beta diversity. For SCBD, we expected (H2) that closely related species with similar trait combinations would contribute similarly to beta diversity and (H3) that the species that contribute the most to beta diversity would be positively related to the land use intensification gradient, being characterized by a set of traits conferring advantages in less forested streams (Bojsen and Barriga 2002; Colzani et al. 2013). Specifically, (H3a) diatoms that can attach to substrates vertically or through mucilage tubes, forming colonies and occupying the upper layer of the biofilm, should be the main contributors to beta diversity in the context of the system studied. This is because species with these traits in less forested streams benefit from light and nutrient availability (Lange et al. 2011; González-Trujillo et al. 2019). For insects, although our information on traits is less precise, we expected (H3b) that collector-filterers and free-living species, predominantly the small ones, should contribute more to beta diversity, since these traits prevail in more degraded streams (Colzani et al. 2013; Saito et al. 2015).

Materials and methods

Study area

This study was carried out in southeast Brazil between latitudes 23° 49′ S and 24° 20′ S. The sampled streams were found in catchments located within protected areas of the Atlantic Forest (Carlos Botelho, Intervales, and Alto Ribeira State Parks) and in catchments dominated by agriculture and silviculture. The climate in this region is characterized as humid subtropical with dry winters and rainy summers (Alvares et al. 2013). Annual rainfall reaches 1600 mm, and the average annual air temperature ranges from 18 to 22 °C (Alvares et al. 2013). We sampled 100 second- and third-order streams within 20 catchments (5 streams per catchment) between September and November 2015. Sampled streams within each catchment are isolated from each other, and most of them run independently into the same mainstem.

Biological and environmental variables

At each stream site, we sampled biological and environmental variables from one riffle of c. 25–50 m2. We sampled diatoms from ten stones of similar size and removed 25 cm2 of periphytic material from each stone using a soft brush and distilled water. The material from the ten stones was pooled and preserved in 4% formalin. After acid cleaning of the samples, we mounted permanent slides of diatoms using Naphrax®. We counted approximately 500 valves from each site using a light microscope with ×1000 magnification. We identified diatoms at the lowest possible taxonomic level, mostly species, using specialized literature (Metzeltin and Lange-Bertalot 2007; Spaulding et al. 2020).

We sampled insects using a kick-net (with a mesh size of 0.5 mm) for 2 min per stream in the different microhabitats of a riffle (i.e., areas with different current velocities, depths, and substrate particle sizes). The insect samples were preserved in ethanol and taken to the laboratory for further processing and identification. We counted and identified organisms from the orders Ephemeroptera, Odonata, Plecoptera, Megaloptera, Trichoptera, and Coleoptera to the genus level using specialized literature, mainly Domínguez and Fernández (2009) and Hamada et al. (2014).

Sites for which we could not count 500 diatom valves and sites with fewer than 40 insects were excluded from further analyses. For diatoms, we excluded 17 streams (all had fewer than 100 valves counted). The remaining 83 streams included 356 out of 360 species. For insects, we excluded 12 samples (as in Heino et al. 2018, which used the same dataset), retaining 88 streams and all 83 genera. The excluded streams were not specifically related to the extremes of the land use gradient or to specific land use and land cover classes. Thus, the distribution of sites among the land use and land cover classes (Online Resource Fig. S2b, c) was similar to that observed for the complete dataset (Online Resource Fig. S2a). Insect abundance is generally low in tropical and subtropical streams (e.g., Stout and Vandermeer 1975; Boyero et al. 2011; Heino et al. 2018). However, we decided to exclude sites with low diatom and insect counts that were likely affected by sampling issues. For example, some streams, in both forested and agricultural catchments, were characterized by a large amount of sand instead of the hard substrates used to sample diatoms.

At each riffle, we also obtained environmental data. We measured current velocity (m s−1) and depth (cm) at nine random locations. Stream width (m) and particle size classes were estimated at three locations. To visually estimate the particle size classes in each location, we determined the percentage of the following classes within a 0.25 m2 square: % of mud (< 0.25 mm), sand (0.25–2 mm), gravel (> 2–16 mm), pebble (> 16–64 mm), cobble (> 64–256 mm), and boulder (> 256–1024 mm). We also visually estimated the shading (% of the canopy cover of riparian vegetation) at three random points in each sampled riffle. We measured electrical conductivity (mS cm−1), pH and dissolved oxygen (mg L−1) at each site using a Horiba U-50 multiparameter probe. Water samples were collected to analyze total nitrogen (mg L−1) and total phosphorus (µg L−1), using standard laboratory methods (APHA 2017).

We analyzed land use using RapidEye multispectral imagery (Planet 2016) within a 400-m-radius buffer around each sampling site. We measured the proportion of land cover classes (native forest, secondary forest, planted forests, pasture, agriculture, urban areas, mining, bare soil, water bodies and mixed agricultural-natural land uses). We separated the three forest classes (native, secondary, and planted) because secondary forests have reduced species diversity and distinct species composition in comparison to old-growth ones (Rozendaal et al. 2019), and the planted forests at our sites are mainly monocultures of Eucalyptus and Pinus. The composition and age of riparian forests affect litter characteristics (Ferreira et al. 2016) and organic matter processing (Frainer and McKie 2021), respectively. Furthermore, canopy structure affects light penetration (Kaylor et al. 2017) and nutrient concentrations (Kaylor and Warren 2017) in streams. Thus, the composition of insects and diatoms may vary among these forest types. Native forest covered the largest area surrounding the sampled streams (mean = 53% ± 32, ranging from 0 to 100%), followed by areas occupied by planted forests (mean = 17% ± 22, ranging from 0 to 87%) and agriculture (mean = 15% ± 23, ranging from 0 to 77%; see Online Resource Fig. S1, S2).

The same datasets used in our study have been used in three other studies, except for the diatom dataset, which is used for the first time here. However, those studies had different aims from ours. For example, Heino et al. (2018) aimed to investigate the richness and abundance patterns of insects in tropical and boreal regions, whereas Siqueira et al. (2020) aimed to test whether community size affects the signal of ecological drift and niche selection in stream insects. Finally, Petsch et al. (2021b) assessed whether taxonomical and functional beta diversity of insects are affected by land use differently in subtropical and boreal regions. The present study is the first to search for environmental and biological correlates of LCBD and SCBD of diatoms and insects in Atlantic Forest streams that encompass a gradient of land use intensification from pristine forested to less forested catchments.

Compositional uniqueness and species contribution to beta diversity

We used the methods described by Legendre and De Cáceres (2013) to calculate, for each biological group, the total beta diversity (BDTotal), the relative contribution of each site (LCBD or compositional uniqueness) and of each species (SCDB) to beta diversity (Fig. 1). Sites with higher LCBD values are more unique in terms of species composition compared with other local communities and thus contribute more to the total beta diversity of a region. Similarly, species with larger SCBD contribute more to total beta diversity (Legendre and De Cáceres 2013). We used species abundance data and the Hellinger distance in all analyses. LCBD values were tested for significance using 999 permutations, and P values were corrected for multiple tests using the Holm correction. We performed these analyses using the R package ‘adespatial’ (Dray et al. 2020).

Fig. 1
figure 1

Schematic representation of the analyses conducted in this study. LCBD, local contribution to beta diversity (site compositional uniqueness); LCEHTot, stream environmental uniqueness based on the complete data set of environmental variables (excluded from further analyses due to its high correlation with LCEHPhy); LCEHPhy, stream physical uniqueness; LCEHWC, stream water chemistry uniqueness; LCEHLU, land use uniqueness; SCBD, species contribution to beta diversity; Axis1 and Axis2, first two axes scores of Principal Coordinate Analysis (PCoA) of biological traits (Traits) and taxonomic relatedness (Taxo). The grey box represents the procedure developed by Legendre and De Cáceres (2013) for calculating beta diversity as the total variance in the species composition data table, as well as the local (site) and the species contribution

Environmental and land use uniqueness

By applying the same approach used for compositional uniqueness, we also obtained environmental uniqueness (LCEHTot, local contribution to stream environmental heterogeneity) for each stream (see also Castro et al. 2019). For this, we used the Euclidean distance on environmental data (standardized to zero mean and unit variance). We also created two specific metrics of environmental uniqueness using subsets of variables corresponding to stream physical uniqueness (stream width, depth, water velocity, shading, proportion of mud, sand, gravel, pebble, cobble, and boulder; LCEHPhy) and water chemistry uniqueness (electric conductivity, dissolved oxygen, total nitrogen, total phosphorus, and pH; LCEHWC). Finally, we obtained land use uniqueness (LCEHLU, local contribution to land use heterogeneity using 400-m buffers) using Euclidean distance on land use data (arcsine square root transformed). To verify which variables contributed more to environmental uniqueness, we correlated the LCEH values with land-use classes and environmental variables using Pearson's correlation. We conducted these analyses using the R package ‘adespatial’ (Dray et al. 2020).

Species traits and taxonomic relatedness

We selected five traits for diatoms and six traits for insects that may respond to land use intensification and to our set of environmental conditions. The selected response traits are related to resource availability, resistance and resilience to disturbance, environmental variation, and dispersal (e.g., Passy 2007 and Lange et al. 2016 for diatoms; Tomanova and Usseglio-Polatera 2007 and Colzani et al. 2013 for insects). We classified all diatom species according to five size classes (based on biovolume), functional guild (low profile; high profile; motile; planktonic), life form (colonial; noncolonial), mode of attachment (unattached; prostrate; tube-forming; vertical), and length/width ratio (the only quantitative variable). We followed Rimet and Bouchez (2012) and Tapolczai et al. (2017) to assign species to size class, Rimet and Bouchez (2012) to functional guilds (a modification of Passy 2007) and life forms, and Spaulding et al. (2020) to assign species to mode of attachment. The length/width ratio was determined based on the measurement of at least 20 cells of each species whenever possible. For insects, we used refuge building (no refuge; fixed nets and retreats; portable shelter of sand, debris and/or wood; portable shelter of leaf parts), body shape (hydrodynamic; not hydrodynamic), locomotion (burrowers; climbers/crawlers; sprawlers; clingers; swimmers; skaters), functional feeding guild (collector-gatherers; collector-filterers; herbivores; predators; shredders), respiration (tegumental respiration; gill respiration; air), and body size (small: < 9 mm; medium: 9–16 mm; large: > 16 mm). We followed Tomanova et al. (2006), Mugnai et al. (2010), Oliveira and Nessimian (2010), Shimano et al. (2012), Colzani et al. (2013), and Hamada et al. (2014) and consulted specialists to assign trait information for each genus (see Petsch et al. 2021b for detailed information on insect traits).

Considering that comprehensive phylogenies are not available for diatoms or insects, we used the Linnaean classification as a proxy for phylogeny. We classified diatom species into genus, family, order, subclass, class, and subdivision levels using specialized literature. Insect genera were classified into subfamily, family, superfamily, suborder, and order levels, based on specialized literature.

We calculated trait dissimilarities between diatom species and between insect genera using the Gower distance coefficient in the R package ‘FD’ (Laliberté et al. 2014), while taxonomic distances were calculated using the Sokal-Sneath dissimilarity coefficient and the dsimTaxo function from the package ‘adiv’ (Pavoine 2020). Using these distance matrices, we performed a Principal Coordinates Analysis (PCoA) for each biological group and used the first two axes of each PCoA as explanatory variables describing trait and taxonomic differences among taxa.

Explaining compositional uniqueness and species contribution to beta diversity

We modeled variation in the LCBD and SCBD of diatoms and insects using beta regression (Ferrari and Cribari-Neto 2004) in the R package ‘betareg’ (Cribari-Neto and Zeileis 2010). This analysis is suitable for modeling variables taking values from 0 to 1, as is the case of LCBD and SCBD, and is flexible in taking into account heteroskedasticity or skewness (Ferrari and Cribari-Neto 2004). Beta regression models that used LCBD as a response variable had four predictors: LCEHPhy, LCEHWC, LCEHLU, and percentage of forest cover (all showed variance inflation factor lower than 3). We excluded LCEHTot from the models, as it was positively correlated with LCEHPhy (Pearson correlations ≥ 0.79; Online Resource Fig. S4a). LCEHPhy, LCEHWC, LCEHLU, and the percentage of forest cover were arcsine square-root transformed. Finally, to explore how LCBD relates to other community attributes, we used Pearson’s correlation to correlate LCBD values with taxa richness and the Simpson index of dominance.

We used Moran’s I-based correlograms to test for spatial autocorrelation in compositional uniqueness (LCBD) and in residuals from the LCBD model. This allowed us to evaluate whether geographically close sites were similar in their compositional uniqueness and to check for the residual independence assumption of regression models, respectively. For diatoms, the correlogram based on residuals showed a significant negative autocorrelation at the ninth distance class (Moran’s I = − 0.41, P < 0.001 after Bonferroni’s correction). Thus, we generated distance-based Moran eigenvector maps (MEM; Dray et al. 2006) and performed a global test on the residuals against all MEM variables (Blanchet et al. 2008). This global test showed that neither positive nor negative eigenvectors were significant (positive MEMs: P = 0.37; negative MEMs: P = 0.96), indicating that the spatial autocorrelation in model residuals was not strong and that it was not necessary to add spatial variables to the regression model. For insects, the residuals of the regression model were spatially independent (P values > 0.05, after Bonferroni’s correction for multiple tests; Oden 1984). We conducted these analyses using the function correlog of the R package ‘pgirmess’ (Giraudoux 2018) and the function mem.select of the R package ‘adespatial’ (Dray et al. 2020).

Beta regression models using SCBD as a response variable had as predictors the first two PCoA axes summarizing taxa traits and taxonomic dissimilarities. We also correlated the SCBD values with the abundance and occupancy of each species using Pearson's correlation. For this, we summed the number of individuals of each species over the 83 (diatoms) and 88 (insect) streams and recorded the number of streams occupied by a species as our measures of regional abundance and occupancy, respectively.

To test specific associations between SCBD and LCEHPhy, LCEHWC, LCEHLU, and percentage of forest cover, we used the fourth-corner analysis (Dray and Legendre 2008). For this, we used a matrix with sites and the four environmental variables, a second matrix containing sites and species abundances, and a vector containing the SCBD values. The significance of the correlations was tested with 2999 permutations using model 6 from Dray et al. (2014) and P values were corrected for multiple tests using the Holm correction.

To evaluate species-environment relationships, we performed a Redundancy Analysis (RDA; Legendre and Legendre 1998). For this, we used as the response the complete biological matrices, after applying the Hellinger transformation on abundance data (Legendre and Gallagher 2001; Peres-Neto et al. 2006). The predictor matrix for each biological group included forest cover in the 400-m buffer and environmental data, composed of all instream variables described above, except boulders. We removed the variable boulders to avoid multicollinearity, as the substrate classes summed to 1, being correlated to each other. All other environmental variables showed a variance inflation factor lower than 3. All variables were standardized to zero mean and unit variance. We then used a forward selection procedure to select a subset of important variables to be used in RDA. This procedure uses a double-stopping criterion: the significance level values of each explanatory variable (P < 0.05) and the adjusted coefficient of multiple determination (adjusted R2) of the reduced model (Blanchet et al. 2008). A variable was kept only if its P value was lower than 0.05 and its inclusion in the model did not surpass the adjusted R2 of the complete model. We applied an ANOVA-like procedure with 999 permutations to test for the significance of RDA axes (Legendre et al. 2011). We used the package ‘adespatial’ (Dray et al. 2020) to select environmental variables, ‘vegan’ (Oksanen et al. 2019) to perform RDAs, and ‘ade4’ (Dray and Dufour 2007) for the fourth corner analysis. All analyses were performed in the R environment (R Core Team 2021).

Results

Environmental and land use uniqueness

Environmental uniqueness, in terms of both physical (LCEHPhy) and water chemistry (LCEHWC), was not correlated with land use uniqueness (LCEHLU) or with forest cover (Online Resource Fig. S4a). Furthermore, LCEHPhy was not correlated with any type of land use, with the exception of mixed land use for the insect dataset, while LCEHWC was positively correlated with pasture and mining (Online Resource Fig. S4b). LCEHLU and forest cover were negatively correlated to each other (Online Resource Fig. S4a). In addition, LCEHLU was negatively correlated with mixed land use and positively correlated with agriculture, urban, and secondary forest land use classes (Online Resource Fig. S4b). The percentage of mud on the streambed and the width of the stream were the variables most strongly correlated with LCEHPhy (Online Resource Fig. S4c), indicating that large streams with large proportions of mud were unique among the set of streams studied.

Compositional uniqueness

The total beta diversity (BDTotal) of diatoms in 83 streams was equal to 0.77, while the BDTotal of insects in 88 streams was equal to 0.56. Compositional uniqueness did not show a clear spatial structure for diatoms (Fig. 2a, b; the correlogram as a whole was not significant; P > 0.05) or insects (Fig. 2c, d; P > 0.05).

Fig. 2
figure 2

Map of (left panels a, c) spatial variation in compositional uniqueness (local contribution to beta diversity, LCBD) and (right panels b, d) spatial autocorrelation analysis for diatoms (orange) and insects (blue). Circle size in plots a and c is proportional to LCBD values (diatoms: N = 83; insects: N = 88)

LCBD was not correlated with diatom species richness (r = –0.16; P = 0.145; Fig. 3a) or with the Simpson index of dominance (r = 0.20; P = 0.066; Fig. 3b). However, for insects, LCBD was negatively correlated with species richness (r = − 0.42, P < 0.001; Fig. 3c) and positively correlated with the Simpson index of dominance (r = 0.63, P < 0.001; Fig. 3d), indicating that unique sites included few species and high dominance.

Fig. 3
figure 3

Correlation between compositional uniqueness (local contribution to beta diversity, LCBD) of diatoms (orange; N = 83) and insects (blue; N = 88) with (left panels a, c) taxa richness and (right panels b, d) the Simpson dominance index

Local compositional uniqueness values for diatoms and insects were negatively related to forest cover (P < 0.001 for diatoms and P = 0.019 for insects; see regression coefficients and standard errors in Fig. 4a), indicating that more unique communities occurred in less forested streams. Furthermore, LCBD values for insects were positively related to environmental uniqueness in physical habitat characteristics (LCEHPhy; P < 0.001) and to land use uniqueness (LCEHLU; P = 0.008; Fig. 4a), indicating that the most unique insect communities occurred in physically more unique (i.e., large streams with large proportions of mud on the streambed) and less forested streams surrounded by more unique landscapes (i.e., mostly agricultural and urbanized areas). The LCBD values for diatoms were not associated with environmental or land use uniqueness.

Fig. 4
figure 4

Strength of the relationship between predictors and a compositional uniqueness (local contribution to beta diversity, LCBD), and b contribution of individual diatom species (orange) and insect genus (blue) to beta diversity (SCBD). A total of 83 and 88 stream sites were included in the LCBD beta regressions for diatoms and insects, respectively. SCBD beta regressions included all 356 diatom species or 83 insect genera. LCEHPhy, stream physical uniqueness; LCEHWC, stream water chemistry uniqueness; LCEHLU, land-use uniqueness; Ax1 and Ax2, first two axes’ scores of Principal Coordinate Analysis (PCoA) of biological traits (Traits) and taxonomic relatedness (Taxo). Error bars are 95% confidence intervals (CI). Pseudo coefficients of determination (\( R^2_{\text{pseudo}}\)) for each beta regression model are highlighted

Species contribution to beta diversity

Sixty-three diatom species (18% of 356 species) and 26 insect genera (31% of 83 genera) contributed more to BDTotal than the mean SCBD (Fig. 5a, d; Online Resource Table S1, S2). SCBD values for diatoms and insects were positively correlated with abundance (rdiatoms = 0.97, rinsects = 0.91; P < 0.001; Fig. 5b, e) and occupancy (rdiatoms = 0.82, rinsects = 0.87; P < 0.001; Fig. 5c, f).

Fig. 5
figure 5

Species contribution to beta diversity (SCBD) of diatoms (orange; N = 356) and insects (blue; N = 83) and its (left panels a, d) rank distribution, (central panels b, e) relationship with taxon abundance, and (right panels c, f) relationship with the number of sites occupied by each taxon

The contribution of diatom species to beta diversity was positively related to the second axis derived from the PCoA summarizing species traits (P = 0.027; Fig. 4b). This axis was positively associated with the prostrate attachment mode, the low-profile functional guild, and the size class 1 (i.e., the smallest size) and negatively associated with the length/width ratio (Online Resource Fig. S5). However, the explanatory power of the model was very low (pseudo R2 = 0.04).

The explanatory power of the model for the SCBD of insects was higher (pseudo R2 = 0.20) than the one for diatoms. The SCBD of insects was positively related to the second axis of the PCoA summarizing genus traits (P = 0.022; Fig. 4b) and negatively related to the second axis of the PCoA based on taxonomic relatedness (P = 0.006; Fig. 4b). These results indicate that the genera that contribute the most to beta diversity (high SCBD values) are medium body size, have fixed nets and leaf shelters, and belong to three feeding guilds (collector-filterers, shredders, and predators). In contrast, those with low SCDB values have a small body size and tegumental respiration and belong to the swimmer’s locomotion group (Online Resource Fig. S6a). Additionally, the SCBD values were negatively related to the order Trichoptera and positively to Ephemeroptera (Online Resource Fig. S6b).

The fourth corner analysis showed that SCBD of diatoms was positively correlated with forest cover (r = 0.18; P = 0.008), but the inverse was found for insects (r = − 0.20; P = 0.003). This indicates that the diatom species and insect genera with the highest contribution to beta diversity were related to streams with high and low forest cover, respectively.

The RDA models explained 11% and 10% (adjusted R2, both P = 0.001) of the variation in the composition of diatoms and insects, respectively. Diatom species and insect genera with the highest SCBD values occurred in environments with a wide range of characteristics (Online Resource Fig. S7, S8). Although some taxa with high SCBD values were mainly related to sites with a high percentage of forest cover, such as the diatoms Achnanthidium modestiforme and Nupela sp. 6 and the stonefly Anacroneuria, others were related to sites with low forest cover, such as the diatoms Eunotia pseudoimplicata and Eunotia pseudosudetica and the insects Cloeodes and Callibaetis. However, for insects, it is also clear that their distribution was related to instream substrate characteristics, such as cobble and mud percentage.

Discussion

Assessing the relative contributions of local communities and individual species to the overall beta diversity of a region is fundamental to advancing our understanding of metacommunity dynamics. Here, we found that the LCBD and SCBD of diatom and insect stream communities were predictably associated with a gradient of catchment-scale forest cover. The LCBD of both groups was negatively related with forest cover, but its relationship with taxa richness and dominance was group dependent. Furthermore, SCBD was related to biological traits and taxonomic relatedness, particularly for insects.

The negative relationships between compositional uniqueness and forest cover for both diatoms and insects are consistent with our expectations, as is the positive relationship between insect LCBD and stream physical and land use uniqueness. Streams that deviate from the typical regional land cover and environmental conditions in our dataset harbored more unique diatom and insect communities. This means that deforestation and land use intensification at the catchment scale and unique environmental physical characteristics of the streams selected communities with a more singular taxonomic composition. While some studies found that land use explains the compositional uniqueness of freshwater communities (e.g., Tonkin et al. 2016; Heino et al. 2017; Leão et al. 2020), it is still not clear whether more unique communities can be found in more altered or in more preserved landscapes. Theoretically, unique communities may occur at both extremes of an environmental gradient (Legendre and De Cáceres 2013), indicating their role as keystone communities (sensu Mouquet et al. 2013). Empirical evidence indicates that a high compositional uniqueness can be found in the less degraded (Heino et al. 2017) and most degraded (Leão et al. 2020) sites along gradients of land use. By critically considering these variations, LCBD may become a useful biodiversity metric to indicate sites in need of restoration within degraded landscapes or those that deserve special attention for conservation (Legendre and De Cáceres 2013). As we show here, a straightforward way to evaluate the factors that explain LCBD is to determine which sites within the region of interest most deviate from typical regional characteristics and then evaluate whether these communities are also more unique. In a broader context, and considering a dataset composed mainly of forested sites, our results suggest that forest loss may be related to a process of biotic differentiation (Arroyo-Rodríguez et al. 2013).

Although both diatoms and insects had more unique compositions in less forested streams, the effect of deforestation was not as strong for diatoms as it was for insects. Unique diatom communities did not have fewer species than typical communities, nor were they dominated by few tolerant species, as was the case for insects. Since the studied streams were not heavily polluted, it is plausible to assume that diatom communities were not driven by severe environmental filters in this region. Our prediction that diatom species with traits conferring advantages at deforested streams with increased light availability would show the highest SCBD was not corroborated. Instead, small, low-profile diatoms that live in the bottom layer of the periphytic biofilm, thus adapted to the reduced light availability (Passy 2007) typical of forested streams, contributed more to beta diversity. However, these results should be interpreted with caution given the low explanatory power of the model.

Most previous studies have shown that LCBD is negatively correlated with species richness (e.g., Legendre and De Cáceres 2013; Heino et al. 2017; Valente-Neto et al. 2020), but few have identified the biological traits that are related to SCBD (e.g., Heino and Grönroos 2017; Li et al. 2020). For insects, the streams with the most unique composition were those with fewer genera, as expected. These streams were dominated by free-living collector-gatherers or herbivores (scrapers or grazers), traits that are common in streams with reduced riparian cover (Colzani et al. 2013; Saito et al. 2015). For example, the grazer Cloeodes and the collector-gatherer Callibaetis were associated with more modified streams, with low forest cover and narrow channels with less cobble and more mud in the streambed (see Online Resource Fig. S8). The positive association between SCBD and collector-filterer organisms, such as Smicridea, could be related not to reduce forest cover but rather to stream physical uniqueness. This is because stream physical uniqueness is related to the presence of mud in the streambed, which could favor these organisms due to the large amount of organic matter available to be filtered by their nets. These results support our expectation that SCBD should be related to species sharing a particular set of traits.

The strong relationship we found between SCBD and abundance or occupancy is expected, since SCBD indicates the taxa that vary the most among sites (Legendre and De Cáceres 2013). However, the direction of this relationship may vary. On the one hand, our results support the expectation that widely distributed and regionally abundant taxa contribute the most to total beta diversity (e.g., Vilmi et al. 2017; Heino and Grönroos 2017). On the other hand, a unimodal relationship has also been reported, so that species with intermediate occupancy would contribute the most to beta diversity (e.g., Heino and Grönroos 2017; Pozzobom et al. 2020). In general, in terms of inferring mechanisms, we suggest that future studies should include biological traits and taxonomic relatedness, as we did here.

Dispersal is a key process determining compositional uniqueness (Vilmi et al. 2017). This is because strong dispersers decrease the variation in local species composition due to their capacity to colonize both suitable and suboptimal sites within a region, while poor dispersers are more heterogeneously distributed (Leibold et al. 2004). For example, Li et al. (2020) found that local stream communities composed mainly of invertebrates with weak dispersal ability were more unique in their composition than streams composed of strong dispersers. We found that the LCBD of both diatoms and insects was not spatially structured, which indicates that limited or excessive dispersal were not important in determining compositional uniqueness in our study area. This result can be attributed to the relatively small spatial extent of our study (~ 120 km in the east–west direction and 70 km in the north–south direction), which may allow sufficient dispersal among streams, thus maximizing species sorting along environmental gradients (Leibold and Chase 2018).

We showed a negative association between compositional uniqueness and forest cover for both diatoms and insects, two groups that differ in their environmental requirements and dispersal capacity, which indicates the generality of these findings. The contribution of individual species to beta diversity, although more complex, was related to a suite of traits and to taxonomic relatedness, especially for insects. Although the insect contribution to beta diversity in the studied region is associated with widespread tolerant species occurring more abundantly in degraded streams, small, abundant and widespread diatoms associated with increased forest cover contributed more to beta diversity due to variation in abundance among streams. We thus suggest that the most important species for beta diversity may occur at both ends of a land use gradient.