Introduction

Coastlines are composed by a mosaic of discontinuous habitats with varying levels of connectivity and heterogeneity (Rattray et al. 2015; Boyé et al. 2019). In these coastal habitats, passive dispersal and connectivity of benthic communities, as well as seafloor sediment heterogeneity, are tightly coupled with wave exposure (Rattray et al. 2015; Rodil et al. 2017). In sandy beaches, for instance, waves and currents are constantly resuspending and transporting sediments and animals, so that sediments are in general more homogeneous and invertebrate communities are mainly structured by physical/advective forces (Mermillod-Blondin and Rosenberg 2006; Rodil et al. 2017). Mangroves and estuarine tidal flats, on the contrary, are characterized by lower wave exposure, resulting in muddier and more heterogenous sediments where biogeochemical/diffusion gradients are important structuring forces (Mermillod-Blondin and Rosenberg 2006; Vieira and Fonseca 2013). Consequently, these different sedimentary habitats harbor benthic communities with distinct structure and composition. However, it is still not clear if these different habitat attributes could also lead to distinct mechanisms driving metacommunity dynamics.

The metacommunity concept refers to the exchange of species (in space and time) from distinct communities (Holyoak et al. 2005). There are two ways to explore metacommunity dynamics, the mechanism-based approach (Leibold et al. 2004) and the pattern-based approach (Leibold and Mikkelson 2002). The first evaluates the role of four mechanisms in metacommunity assembly, i.e., patch dynamics (PD), species sorting (SS), mass-effects (ME), and neutrality (NE), according to the dominance of the structuring mechanism, such as species competition (in the case of PD), environmental filtering (SS), dispersion (ME), and species equivalence (NE) (Leibold et al. 2004; Brown et al. 2017). The pattern-based approach has become more widely used in the last few years (Leibold and Mikkelson 2002). This method explores the three main elements of metacommunity structure (EMS): coherence, turnover, and boundary clumping, and evaluates how empirical data fit to the conceptual distribution models (Presley et al. 2010).

Through the sequential analysis of the coherence, turnover and boundary clumping the EMS framework can evaluate the fitting of ecological communities to at least 8 distribution patterns and another 4 quasi patterns (Presley et al. 2010). The emerging empirical distribution is in general shaped by a combination of ecological processes, e.g., dispersal, habitat specialization, competition, predation, tolerance to abiotic conditions, environmental heterogeneity, and often hard to disentangle and quantify (Valanko et al. 2015; Presley 2020). Therefore, the same mechanisms driving community assembly can lead to different spatiotemporal patterns. Despite this, some generalizations can be made, for example, species-sorting or patch-dynamics can result in turnover or nestedness patterns under strong environmental filtering (Gascón et al. 2016; Josefson 2016). Also, metacommunities without significant coherence (i.e., checkerboard and random) can emerge as a function of mass-effect dynamics where interspecific differences in species dispersion are unimportant due to high connectivity (Datry et al. 2016; Presley et al. 2019). Thus, it is possible to infer that coherence in metacommunity decreases when species dispersion overcomes the effects of environmental heterogeneity (Vanschoenwinkel et al. 2007; Rodil et al. 2017). In this case, there is a transition between the mechanisms driving community assembly from environmental-based (species-sorting or patch-dynamics) to dispersion-based mechanisms (mass-effect and neutral).

The EMS approach has been recently applied to understand the spatiotemporal dynamics of invertebrate communities from streams (Datry et al. 2016), lakes (Dümmer et al. 2016), and coastal ecosystems (Valanko et al. 2015; Rodil et al. 2017; Alves et al. 2020). It has been suggested that environmental heterogeneity and connectivity are determined by hydrodynamic patterns (Vanschoenwinkel et al. 2007; Yeh et al. 2015; Rodil et al. 2017), with metacommunities showing coherent species distribution at moderate hydrodynamics and random patterns when hydrodynamics is high (Yeh et al. 2015). For soft-bottom coastal ecosystems, where habitat limits are not visually evident, the EMS approach can be very informative, helping us to understand whether distinct habitats can be considered as metacommunities’ boundaries and whether they harbor distinct communities which may display different patterns of organization (Presley et al. 2010; Gascón et al. 2016).

In this study, we investigated, by means of the EMS approach, the types of free-living nematode metacommunities from three distinct coastal habitats with increasing degrees of wave-exposure: mangroves, estuarine tidal flats, and sandy beaches. We chose nematodes as model organisms because they are widely distributed, highly diverse, and abundant across the landscape (Schratzberger and Ingels 2018). Specifically, we tested the hypotheses that (1) due to strong environmental filtering, metacommunities from distinct coastal habitats are characterized by species mostly limited to its habitat, with a high turnover in species composition (i.e., taxa replacement) among habitats and a clumped distribution and (2) metacommunity structure from the three coastal habitats will differ according to habitat attributes; i.e., the increased wave exposure and connectivity will decrease the importance of environmental filtering (Fig. 1). As such, we expect sandy beaches, given their higher wave-exposure and connectivity, to present a random pattern of species distribution (i.e., non-significant coherence). In contrast, unvegetated estuarine tidal flats and mangroves, given their lower exposure to waves, lower connectivity, and higher environmental heterogeneity, are expected to exhibit a non-random pattern, which could be either a negative (nested) or a positive (clumped) turnover pattern among locations.

Fig. 1
figure 1

Theoretical framework of the habitats’ attributes driving meiobenthic metacommunity structure in coastal ecosystems. Numbers are indicating the presupposed degree of habitat’s exposure to hydrodynamics. Intertidal mangrove areas (1); unvegetated tidal flats (2); oceanic sandy beaches (3). The relative importance of ecological processes along the gradient is given by color bars (i.e., importance increasing from yellow to red)

Methods

Study Area

The study was carried out in the subtropical coast of São Paulo, Brazil (between 25° 3′36.83″ and 23°20′16.02″ S and 47°55′45.53″ and 44°53′19.11″ O; Fig. 2). The region is located in the São Paulo Bight sector of the Southern Brazilian continental shelf, still under the influence of sediments from Río de La Plata and by confluence between Brazil and Malvinas currents (Mahiques et al. 2010). The littoral zone is composed of several estuarine systems dominated by mangrove forests, which are intercalated by barrier islands and sandy beaches of different sizes and orientation (Schaeffer-Novelli and Cintrón-Molero 1990).

Fig. 2
figure 2

Map of the study area at the coast of São Paulo, SE Brazil, with the sampling design used in the study. Locations 100 km distant (Lo) are respectively Cananéia (A), Juréia (B), Boracéia (C), and Ubatumirim (D)

Sampling Design

One sampling campaign was conducted in February 2011 at the intertidal zone of three different coastal habitats: mangroves, estuarine unvegetated tidal flats, and oceanic sandy beaches (Fig. 2). Each habitat was sampled in four different locations (hundreds of kilometer distant) at the littoral zone of São Paulo, Brazil SE (Fig. 2). At each location, replicates were arranged in two random plots (5 × 20 m) positioned parallel to the water line 700–1000 m apart from each other. Within each rectangular plot, 10 equally spaced subdivisions were done and 4 were drawn randomly for sampling. For nematode assemblage analysis, samples in mangrove and tidal flats were taken with a 2.5-cm diameter core, down to a depth of 5 cm. In sandy beaches, they were done with a 3-cm diameter corer pushed to a depth of 10 cm (Fig. 2). Sandy beach cores were larger and deeper given the lower densities and wider range of vertical distribution of meiofauna at sandy beaches (Steyaert et al. 2003; Somerfield and Warwick 2013). Four sediment samples (2 g each) were also collected for chloroplastic pigment content and four samples for granulometric analysis (10 g each). Samples for meiofauna analyses were fixed in 4% formaldehyde. Sediment samples for the photosynthetic pigments and grain size analyses were stored in a cooler in the field and frozen at −20 °C in the laboratory.

Sample Processing

Samples for nematode assemblage analysis were washed through a 45-μm mesh sieve. After washing, the flotation method with colloidal silica solution (Ludox TM-50) adjusted to a specific gravity of 1.18 was used to separate organisms from the sediment (Giere 2009). All nematodes were counted on a Dolffus plate under a stereoscopic microscope. For each sample, 20% of total nematodes were randomly picked, evaporated to anhydrous glycerol and mounted on permanent slides for identification. A lowest and highest limit of 100 and 250 nematodes were established (i.e., when the total of nematodes was lower than 100, all individuals were picked for identification, and when the total was higher than 250, only 250 individuals were taken). Nematodes were identified to genus level and further separated into species or putative morphospecies (Platt and Warwick 19831988; Warwick et al. 1998; Bezerra et al. 2019).

To evaluate the influence of the habitat sediment properties in the spatial patterns of variation of the nematode fauna, chlorophyll-a, and phaeopigments (as a proxy for microphytobenthos), sediment grain size and redox potential were sampled. Pigments were extracted with 10 ml acetone (100%) for 24 h in the dark at 4 °C. The extract was centrifuged at 4000 rpm for 5 min. Pigments were analyzed from absorbance spectra at 665 nm and 750 nm before and after acidification with HCL through a digital spectrophotometer. Concentrations of pigments were estimated using the equations of Lorenzen (1967). Sediment granulometry was determined by sieving dried samples and total organic content by difference in dry weight after combustion for 4 h at 550 °C. The redox potential was measured at the sediment surface (ca. 1 cm depth) using a Hanna Instruments HI 991,003.

Data Analysis

Spatial Variation on Metacommunity Structure

To test the hypothesis that distinct coastal habitats host metacommunities with distinct structure and composition, nested multivariate permutational analysis of variance (PERMANOVA) was performed on Bray–Curtis dissimilarity matrices of nematode community using “adonis” function of the R package “vegan” (Oksanen et al. 2019). Multivariate nematode data was Hellinger-transformed prior the analysis (Legendre and Gallagher 2001). In addition, univariate PERMANOVAs based on Euclidean distances of nematode taxa richness and total density, Pielou’s evenness, and Shannon’s diversity indexes were made (see supplementary material Fig. S2). PERMANOVA performed in a single response variable using Euclidean distance return the classical univariate F statistic. Hence, PERMANOVA can be used to do a univariate ANOVA, where p-values are obtained by permutation, thus avoiding the assumption of normality (Anderson 2017).

To investigate the role of environmental filtering in the different habitats, the relationships between nematode community structure and environmental variables were tested using distance-based RDA (Peres-Neto et al. 2006) in the R package “vegan” (Oksanen et al. 2019). Sediment grain size and sorting, sediment organic matter content, sediment chlorophyll-a and phaeopigment concentrations, and redox potential were included as environmental descriptors.

Elements of Metacommunity Structure

The elements of metacommunity structure (EMS) framework was used to test the hypothesis that metacommunity spatial structure differ according to habitat attributes; i.e., sandy beaches will present a random pattern of species distribution, whereas unvegetated estuarine tidal flats and mangroves will exhibit either nested or positive turnover patterns. The EMS were estimated and interpreted according to Leibold and Mikkelson (2002) and Presley et al. (2010). The EMS approach tests the fit of empirical data to several types of metacommunity structure, such as checkerboard, nested, evenly spaced, Gleasonian, Clementsian, and random (Leibold and Mikkelson 2002; Presley et al. 2010). These patterns can be described by consecutive evaluation of three properties of metacommunity structure: coherence, turnover, and boundary clumping (Fig. 3). The metrics were calculated from a presence–absence matrix, with sites as rows and species presence/absence as columns. The interaction matrix was ordinated via reciprocal averaging. Coherence was measured by comparing the number of observed absences in the ordination matrix to the number of absences in randomized null matrices. A smaller number of embedded absences (Abs) than expected by chance indicates positive coherence, while many absences (i.e., absence is significantly larger than expected by the null models) indicates negative coherence. Non-significant coherence suggests a random metacommunity and there is no need to proceed with other tests. Further analysis presupposes that community matrices have a positive coherence. Turnover was measured as the number of times one species replaced another (Repl). Significantly negative turnover refers to nestedness, whereas significantly positive turnover (i.e., Repl is significantly larger than expected by chance) indicates evenly spaced, Gleasonian or Clementsian metacommunities (Fig. 3). Significant positive coherence combined with a nonsignificant turnover can be interpreted as a quasi-structure (Presley et al. 2010). The evenly spaced, Gleasonian or Clementsian metacommunity types can be distinguished subsequently based on the index of boundary clumping (Fig. 3). Boundary clumping was analyzed using Morisita’s I dispersion index. Statistical significance was obtained by comparing the observed range boundary of samples against a chi-square distribution. Coherence (Abs) and turnover (Repl) indices were tested using the fixed-proportional null model “r1,” where row sums are fixed (i.e., the species richness of each site was maintained), but column marginal frequencies (i.e., species frequencies of occurrence) were used as probabilities. Random matrices were produced based on 999 simulations, and statistical significance of Abs and Repl was assessed by comparing the observed outcomes to the distribution of outcomes derived from the randomizations (Leibold and Mikkelson 2002). Elements of metacommunity structure were evaluated based on axis 1 of reciprocal averaging. EMS analyses were done using the R package “metacom” (Dallas 2014) in the R environment (version 3.5.2, R Core Team 2018). Posteriorly, the correlation between site scores obtained from EMS ordination and environmental variables was investigated through least squares multiple regression to provide evidence of the importance of environmental filtering in structuring species distributions (see supplementary material Fig. S1; Table S1).

Fig. 3
figure 3

adapted from Leibold and Mikkelson (2002) and Presley et al. (2010). Negative ( −), positive ( +), and non-significant (ns), lower than 1 (< 1) greater than 1 (> 1) values for coherence, turnover, and boundary clumping indexes

Decision tree showing the analytical steps of the elements of metacommunity structure (EMS) framework,

Results

Spatial Variation on Metacommunity Structure

We observed a total of 77 nematode taxa with average total abundance of 73 ± 202 ind.cm−2 (mean ± SD) in the mangrove, a total of 62 taxa with average total abundance of 81 ± 222 ind.cm−2 in estuarine tidal flat, and a total of 63 taxa with average total abundance of 101 ± 207 ind.cm−2 at sandy beach habitat (Fig. S2). There were no differences in total density of nematodes among habitats (p = 0.456; Fig. S2a). Average taxa richness (p = 0.050; Fig. S2b) and Shannon`s diversity (p = 0.030; Fig. S2c) were lower at estuarine tidal flats compared to mangrove and sandy beach habitats. Also, there were no differences in Pielou`s evenness among habitats (p = 0.060; Fig. S2d). However, the frequency of occurrence of rare species (occurrence in < 10% of samples) was higher at sandy beach (Fig. S3).

Nematode species composition differed among mangroves, tidal flats, and sandy beaches (Table 1; Fig. 4a–b). In the habitat less exposed to wave energy, i.e. mangroves, the fauna was structured by sediment organic matter content and variations in grain size and sorting; moreover, the dominant species were Terschellingia longicaudata and Anoplostoma subulatum (Fig. 4a; Fig. S4). In tidal flats, nematode species distribution was associated with chlorophyll-a and phaeopigment concentrations (Fig. 4a; Fig. S4). Typical species of tidal flats were Desmodora cazca, Daptonema sp. 5, Viscosia sp. 1, and Spirinia sp. 1. Nematode communities inhabiting sandy beaches were structured by sediment sorting and asymmetry, and by organic matter content. Sandy beaches with coarser sediments hosted slightly different communities from those observed in fine and very fine sandy beaches (Fig. 4a; Fig. S4). Overall, the sandy beaches were characterized by the presence of Omicronema sp. 1 and Paracanthonchus cochlearis. The first two CAP axes explained together 62% of the overall constrained variability in community structure (R2 = 0.295).

Table 1 Multivariate and univariate permutational analyses of variance PERMANOVA for metacommunity structure, and univariate descriptors of community structure. df = degrees of freedom, MS = mean squares, (n = 4)
Fig. 4
figure 4

Constrained analysis of principal coordinates (CAP) based in the Bray–Curtis dissimilarities on nematode metacommunity among coastal ecosystems. Mangrove (diamond symbols), tidal flat (squares), and sandy beach (cirles) are shown in panel (a). Colors represent locations (100 km). Cananéia (gray), Juréia (dark gray), Boracéia (black), and Ubatumirim (white). In panel (b), eigenvectors are proportional to the variability explained by the environmental variables. Median grain size (MGS), sorting coefficient (Sorting), asymmetry coefficient (Asy), percentage of medium sands (Msand), very fine sands (VFsand), silt (Silt), and organic matter content (OM), chlorophyll-a (Chl-a), and phaeopigments (Phaeo) concentration. Only the species representing 10% of total nematode abundances were plotted

Elements of Metacommunity Structure

The overall nematode metacommunity considering the three habitats from the coastal ecosystem was coherent (z = 5.87, p < 0.001). Also, metacommunity presented more species replacement (Repl) than expected by chance (z = −8.11, p < 0.001) and significant boundary clumping (Morisita’s I = 1.65, p < 0.001). This suggests that nematode species respond to a structuring gradient as a group (Clementsian structure; Table 2). Local communities from mangroves, estuarine tidal flats, and sandy beaches were composed by different species groups that replaced each other along the coastal seascape (Fig. 5). Environmental variables explained 81.3% of the variance in scores obtained from EMS analysis (p < 0.001). The best regression model according to a backward stepwise selection included the fraction of very coarse sand and silt, phaeopigment concentrations, sediment sorting, and the fraction of fine sand as significant explanatory variables (Table S1; Fig. S1).

Table 2 Summary results of the elements of metacommunity analysis (EMS) for the overall model including all habitats as well as for each habitat. Simulated mean (Sim), embedded absences (Abs), and replacement (Repl). Metacommunity structure: nested pattern with clumped species loss (NCSL), and random pattern (Random)
Fig. 5
figure 5

Elements of metacommunity (EMS) site by species occurrence ordered matrices of the overall nematode metacommunity structure

Coherence was positive in mangrove and estuarine tidal flats (Table 2). Mangrove metacommunity showed less species replacement (Repl) than expected by chance (z = 1.91, p < 0.001) and significant boundary clumping (Morisita’s I = 1.34, p < 0.001), characterizing a nested pattern with clumped species loss (Table 2). In unvegetated tidal flats, species replacement was higher than expected by chance (z = −2.24, p < 0.050), and significant boundary clumping was observed (Morisita’s I = 1.21, p < 0.001) suggesting a Clementsian structure (Table 2), where species groups replace each other along and within locations. There was no coherence in the sandy beach metacommunity structure (z = 0.41, p = 0.113), which suggests a random pattern where species were not structured by a major gradient (Table 2).

Discussion

Our results supported hypothesis 1, that metacommunities from distinct coastal habitats are characterized by species mostly limited to their habitat, suggesting that distinct coastal habitats act as metacommunity boundaries. Despite being adjacent environments with a strong interrelationship, mangroves, tidal flats, and sandy beaches hosted nematode metacommunities with different species composition. Indeed, the dominant species observed on each habitat were those commonly reported for mangroves (Pinto et al. 2013; Brustolin et al. 2018), tidal flats (Vieira and Fonseca 2013; Fonseca and Netto 2015), and sandy beaches (Gheskiere et al. 2004; Gheskiere et al. 2005; Maria et al. 2013). Assemblages from each habitat were related to different environmental variables pointing to environmental filtering as an important mechanism of metacommunity assembly for coastal soft-bottom communities at the landscape scale.

Environmental gradients affect metacommunity organization creating discrete communities (Heino et al. 2015b; Valanko et al. 2015; Menegotto et al. 2019). Particularly, the transition between terrestrial/freshwater and marine ecosystems creates complex and dynamic environments resulting in a highly heterogeneous landscape, and the metacommunity spatial structure is more likely explained by a combination of mechanisms (Leibold and Loeuille 2015; Brown et al. 2017; Presley 2020). The clumped distribution with positive species turnover (Clementsian) of the metacommunity across habitats observed here indicates that nematode species displayed interdependent responses, where distinct species groups replace each other along a transition gradient between mangrove and sandy beach environments. This supports the current notion that under strong environmental gradients, metacommunities are not randomly distributed across habitats (Gascón et al. 2016; Josefson 2016; Alves et al. 2020) and that at the scale of the landscape, habitat selection might be the most important mechanism shaping coastal communities. This agrees with the strong habitat selection also observed for deep-sea nematodes (Vanreusel et al. 2010). In this study, the meiofauna inhabiting unvegetated tidal flats were composed by either mangrove or sandy beach species at the edge of their distribution range. Such observation supports the idea that estuarine systems represent two-ecoclines, instead of an ecotone harboring a unique set of species (Attrill and Rundle 2002; Lallias et al. 2015).

The results discussed above, i.e. local communities inhabiting the same habitat type kilometers apart, resemble each other more than communities from different habitats embedded in the same landscape, also indicate that discontinuous coastal habitats are, to a certain extent, connected. Like on rocky shores (Caro et al. 2010), variation in the supply of recruits from the regional pool seems not to affect the similarity in the structure of adult communities, even at the regional scale. Therefore, environmental filtering and priority effects are important in the assembly even when dispersion and passive recruitment are high. Differences in the sediment properties between habitats, rather than the distance, were the main drivers in structuring landscape metacommunity in our study (Fig. 4). Mangrove fauna was associated with muddier and poorly sorted sediments, fauna from estuarine sandflats was linked to higher concentrations of photosynthetic pigments, whereas sandy beach nematodes were associated with high asymmetry in grain size and well-sorted sandy sediments. Although mangroves, tidal flats, and sandy beaches are considered open systems (Valanko et al. 2015), the observed results are comparable to those of closed systems, such as lakes and temporary freshwater rock pools, where environmental limits are well defined. In these cases, dispersal ability is very important in metacommunity assembly (Vanschoenwinkel et al. 2007; Dümmer et al. 2016), as it is for macrofaunal community assembly in soft bottom open coastal systems (Heino et al. 2015a; Rodil et al. 2017). Because wave energy can affect species dispersal, and therefore connectivity, differences in wave exposure between habitats might also be an important driver of differences in the mechanisms of community assembly (Valanko et al. 2015).

Corroborating our second hypothesis, benthic communities from the different habitats showed distinct patterns of organization, which suggests they are structured by different mechanisms depending on the attributes of the environment (Fig. 6). In our study, the negative (Nested) and positive turnover (Clementsian) patterns observed at lower wave energy mangroves and tidal flats, respectively, suggest limited connectivity and environmental filtering as a principal structuring mechanism (Vanschoenwinkel et al. 2007; Gansfort et al. 2020), whereas random patterns at wave-dominated sandy beaches suggests higher species mobility probably due to the passive remobilization and transport of particles (Rodil et al. 2017).

Fig. 6
figure 6

Summary of our findings based on the EMS framework (Leibold and Mikkelson 2002; Presley et al. 2010) and the processes and mechanisms most likely influencing the observed spatial patterns of nematode metacommunities. Nematode metacommunity displayed a Clementsian pattern with the three habitats representing ecologically distinct entities (a). Metacommunities from Mangrove showed a Nested pattern with clumped species loss (b). Tidal flat a Clementsian pattern with positive species turnover (c). Sandy beach a random pattern (d). The importance of environmental filtering and species-sorting dynamic increases with the decrease in wave exposure and the consequent changes in sediment texture towards estuarine and mangrove habitats

Mangrove habitat was distinguished by a pattern of species loss. Nematode species richness was higher in large drainage basins with well-preserved mangroves such as Cananéia, than in smaller mangrove fragments (Fig. S2). According to the EMS framework, the interaction between species sorting and patch-dynamics most probably drive metacommunity organization at mangroves. It is possible that abiotic conditions, such as the oxygen-reduced environment, typical of mangrove sediments, selects a specific pool of species capable of tolerating such reduced environment (Fonseca and Netto 2015). Aside from the differences in habitat specialization or abiotic tolerance, the consequent pattern of nested subsets observed for the mangrove fauna might be a result of interspecific differences in dispersal ability and the colonization/extinction dynamics (Presley 2020). Differences in the size and complexity of drainage basins and mangrove forests (Brustolin et al. 2018) might affect richness at larger-scales (Huxham et al. 2010; Watt and Scrosati 2013). These results suggest that larger forests and drainage basins can operate as hot-spots of nematode species richness, while smaller and more isolated mangroves are cold-spots that harbor smaller subsets of those species adapted to mangrove environmental conditions. Hence, meiofaunal communities associated with smaller areas of mangrove forest may be more sensitive to disturbance than those associated with larger mangrove areas. In addition, environmental changes affecting the fitness of source populations might promote changes in populations at sinking areas impacting beta-diversity of the habitat (Boughton 1999; Munguia 2015).

Tidal flats, on the other hand, were characterized by a positive species turnover along the coastal seascape, suggesting that local communities are composed by species with different environmental requirements, dispersal capacity, and life-history traits (Pulliam and Danielson 1991; Fonseca and Netto 2015). Estuarine communities are simultaneously affected by multiple environmental gradients, such as granulometry, depth, salinity, dissolved oxygen, or the amount and quality of organic matter (Brustolin et al. 2014; Lallias et al. 2015; Valanko et al. 2015; Menegotto et al. 2019). Spatially structured environmental gradients may have favored the higher species replacement among the different locations. In addition, limited dispersal among isolated sites can drive spatial structure even among passive dispersers (Gansfort et al. 2020). Therefore, according to the EMS framework, species sorting is the most probable mechanism explaining the metacommunity organization at tidal flats.

Conversely, dispersion-based mechanisms likely drive nematode distribution at sandy beaches, which result in higher occurrence of rare species (species that occurred in < 10% of the samples) compared to mangrove and tidal flats (see supplementary material Fig. S3). Hence, the importance of environmental filtering is lower in this habitat. The metacommunity was randomly structured, which means species have independent responses to multiple environmental gradients. In addition, higher habitat homogenization, due to the higher wave exposure, as well as the spatial connectivity of this habitat (Yeh et al. 2015), likely reduce the effects of biotic interactions allowing species coexistence. Randomness can be associated with high connectivity; hence, mass-effect and neutral mechanisms most likely drive the assembly of soft-bottom communities at sandy beaches (Yeh et al. 2015; Gascón et al. 2016).

Here, we demonstrated that environmental variability shapes metacommunity at heterogeneous landscapes. Within habitats, however, assemblages showed distinct patterns of organization that depended on environmental attributes such as wave energy, connectivity, and related parameters (Fig. 6). These results support the hypothesis that wave energy may modulate species dispersal and the role of environmental filtering in structuring metacommunities at different habitats being an important driver of metacommunity structure in soft-bottom coastal communities. From a conservation perspective, the present results support the idea that distinct habitats need different management strategies (Pulliam and Danielson 1991; Fahrig 2003; Boyé et al. 2019). For instance, the degradation of larger areas of mangroves threatens many more species than the degradation of multiple smaller areas of mangroves. Moreover, if we expect some level of connectivity among mangroves, the effect of degradation in large forests may propagate to smaller neighboring fragments. For the sandy beaches, their high connectivity implies that in addition to preserving its environmental conditions, it is necessary to consider the process of dispersion and colonization in order to maintain connectivity and viable populations.