A frequent question about lconnect

Some users of our package lconnect (CRAN, paper) have reached out with questions regarding the upload of shapefiles to R, as an object of class “lconnect”, using the function upload_land.

These issues are related to the fact that, in the shapefile, the first column must have the landcover class.

The package is based upon simplifying landscapes as two classes of landcover, habitat and non-habitat. This way habitat patches are defined amongst a matrix of non-habitat. For example, let’s say you have four classes of landcover, only one is the “habitat”: this classes must be in the first column of your shapefile. If only “shrubland” is what you want to identify as “habitat” (e.g. because it is the preferred habitat of your focal species), this should be identified in the “habitat” argument. As such:

landscape <- upload_land(vec_path,  # the path to the shapefile
                         bound_path = NULL,  # is a landscape boundary shapefile available?
                         habitat = "shrubland", # the landcover to be classified as "habitat"
                         max_dist = 500) # the maximum distance to consider habitat patch clusters (can be set to NULL, if all patches are to be considered independent)

I hope this was helpful!

That’s it. Thanks for using lconnect.

Visualizing Power Models in Species-Area Relationships Using R Shiny: An Interactive Educational Tool

Considered one of the “few general rules” in ecology, the species-area relationship (SAR) – the ubiquitous pattern indicating that larger islands or habitat patches harbor more species than smaller ones – has played a pivotal role in shaping ecological theories (Lomolino 2000, 2001, Tjørve 2003, 2009, Dias et al. 2020). These theories aim not only to describe patterns of species diversity in patchy environments but also to comprehend the underlying mechanisms driving ecological community dynamics in space. Given its paramount importance for biodiversity, SAR has significantly influenced the development of biodiversity conservation strategies, particularly in the design of protected areas and the selection of habitat patches in fragmented landscapes.

Although a large plethora of models have been used to describe SAR (Tjørve2003, 2009), the relationship between area and species richness has been traditionally modeled as a power law, as first developed by Arrhenius (1921): 

S=cAz

where S represents the number of species in a habitat patch (or island), A denotes the area of the patch, and c and z are constants that govern the relationship. 

As the use of simple linear models make it easy to estimate the model’s parameters, ecologists have traditionally used a log-linearizable power function, log-transforming both S and A. Under this approach, z and c (more specifically log[c]) are then estimated using the subsequent regression model:

log (S) = log(c) + z log(A) 

In addition to simplifying parameter estimation, this log transformation also brings some biological meaning for model parameters, as in the logarithm space, log(c) now represents the expected number of species when the area is one unit, and the parameter z reflects the proportional change in species richness per unit change in log(area).

However, as has been pointed out by the now classic works of Gould (1979) and Lomolino (1989, 2000, 2001), the interpretation of parameters c and z in the context of SAR is often misunderstood, despite being crucial quantities in ecology. Solely relying on z values can lead to misinterpretations regarding the rate at which species richness increases with area, if c is not constant when comparing different archipelagos, formed by either true island or habitat patches. Therefore, it’s essential to consider both c and z values together, as they provide a more comprehensive understanding of the relationship. 

Given that the species-area relationship (SAR) constitutes a central topic in undergraduate and graduate programs in ecology, biogeography, and conservation biology, being able to visualize the shape of this relationship and the effect of these two critical parameters on SAR models is crucial for student comprehension. With that in mind, I developed a simple R Shiny app to aid students in visualizing SAR in both arithmetic and logarithmic scales. This tool could prove useful for courses in biogeography, ecology, and related fields.

The R shiny app should look like this:

Here is the code!

#rm(list=ls())

###Load packages
require(shiny)
require(ggplot2)

### Define user interface
ui = fluidPage(
  titlePanel("Specie-Area Relationship - Power Model"),
  
  sidebarLayout(
    sidebarPanel(
      sliderInput("c", "Value of c:", min = 0.1, max = 10, value = 1), #bar to define values for c

      sliderInput("z", "Value of z:", min = 0.1, max = 2, value = 0.5),#bar to define values for z
      numericInput("area", "Area:", value = 1000, min = 1),#define range for area
      numericInput("num_species", "Number of Species:", value = 50, min = 1, max = 1000),#define rangefor species richness
      checkboxInput("loglog", "Log-Log Axes"),
      width = 3
    ),
    
    mainPanel(
      plotOutput("species_area_plot")
    )
  )
)

### Define the server
server = function(input, output) {
  output$species_area_plot <- renderPlot({
    
    ### Generate data
    area <- seq(1, input$area, length.out = 1000)
    species <- input$c * area^input$z
    
    ### Create plot
    p = ggplot() +
      geom_line(aes(x = area, y = species), color = "blue") +
      geom_hline(yintercept = input$num_species, linetype = "dashed", color = "red") +
      labs(x = "Area", y = "Species") +
      theme_minimal()
    
    # Log-Log Axes
    if (input$loglog) {
      p <- p + scale_x_log10() + scale_y_log10()
    }
    
    print(p)
  })
}

### Execute app
shinyApp(ui = ui, server = server)

References

Arrhenius, O. (1921). Species and area. Journal of Ecology9(1), 95-99.

Dias, R. A., Bastazini, V. A. G., Knopp, B. D. C., Bonow, F. C., Gonçalves, M. S. S., & Gianuca, A. T. (2020). Species richness and patterns of overdispersion, clustering and randomness shape phylogenetic and functional diversity–area relationships in habitat islands. Journal of Biogeography47(8), 1638-1648.

Gould, S. J. (1979). An allometric interpretation of species-area curves: the meaning of the coefficient. The American Naturalist114(3), 335-343.

Lomolino, M. V. (2001). The species-area relationship: new challenges for an old pattern. Progress in physical geography25(1), 1-21.

Lomolino, M. V. (1989). Interpretations and comparisons of constants in the species-area relationship: an additional caution. The American Naturalist133(2), 277-280.

Lomolino, M. V. (2000). Ecology’s most general, yet protean pattern: The species–area relationship. Journal of Biogeography, 27, 17–26.

Tjørve E. (2003) Shapes and functions of species-area curves: a review of possible models. Journal of Biogeography, 30, 827– 835.

Tjørve, E. (2009). Shapes and functions of species–area curves (II): A review of new models and parameterizations. Journal of Biogeography, 36, 1435–1445.

Simple and Fast Visualization of Biodiversity Occurrence Data using GBIF and R Shiny

As an ecologist, being able to easily visualize biodiversity occurrence data is an essential need as this kind of data visualization provides critical insights into species distribution patterns and ecological requirements, which is essential for understanding biodiversity dynamics in space and time. Moreover,  for pragmatic reasons, fast and simple biodiversity data visualization can help us to define sampling and monitoring strategies in the field, optimizing resource and time allocation. As someone who is a passionate enthusiast for wildlife and nature, being able to visualize species occurrence is also particularly important when I am planning a trip to a new place I have never been, or just “virtually exploring” a far and unknown corner of the planet. 

In this post, I will show a simple way to create a R Shiny app to visualize biodiversity occurrence based on data from the Global Biodiversity Information Facility, aka GBIF, which “is an international network and data infrastructure funded by the world’s governments and aimed at providing anyone, anywhere, open access to data about all types of life on Earth. Global Biodiversity Information Facility aggregates data from various scientific sources, and as of today, it contains over 2 billion records of species occurrence from all over the world.

This simple R Shiny app allows users to explore species distributions by selecting a taxonomic group and defining a geographic area of interest using latitude and longitude coordinates to define a polygon (only min and max latitude and longitude are used to define the polygon, thus complex boundaries can not be included here), which will be used to retrieve species occurrence data from GBIF within this quadrilateral. The data will be displayed on an interactive map using the R package leaflet.

In the source code, you can also change  the taxa of interest to be shown in the user interface and the months of the year in which the data was collected, which might be useful for seasonal species.

The user interface should look like this:

Here is the R code!

# Install packages
install.packages(c("shiny", "rgbif", "leaflet", dependencies=T))

# Load packages
require(shiny)
require(rgbif)
require(leaflet)

# Define function to search for occurrences of  specified clades within a polygon (i.e, bounding box=bbox)
search_occurrences <- function(bbox, clade) {
  occ_search_result <- occ_search(
    geometry = paste("POLYGON((", bbox["min_longitude"], " ", bbox["min_latitude"], ",", 
                     bbox["min_longitude"], " ", bbox["max_latitude"], ",", 
                     bbox["max_longitude"], " ", bbox["max_latitude"], ",", 
                     bbox["max_longitude"], " ", bbox["min_latitude"], ",", 
                     bbox["min_longitude"], " ", bbox["min_latitude"], "))"),
    month = 1, 12,###define months of the year
    scientificName = clade,
    hasCoordinate = TRUE
  )
  return(occ_search_result)
}

# Define user interface
ui <- fluidPage(
  titlePanel("Species Occurrence"),
  sidebarLayout(
    sidebarPanel(
      selectInput("clade", "Choose a clade:",
                  choices = c("Aves", "Coleoptera", "Amphibia", "Plantae", "Mammalia", "Actinopterygii", "Insecta"),#you can change the default clades according to your taste in biodiversity
                  selected = "Aves"), #first clade to be shown in the drop down box
      numericInput("min_longitude", "Minimum Longitude:", value = -9),##by default you will have the approximate borders of portugal, but this can be changed in the user interface or directly here
      numericInput("max_longitude", "Maximum Longitude:", value = -6),
      numericInput("min_latitude", "Minimum Latitude:", value = 36),
      numericInput("max_latitude", "Maximum Latitude:", value = 42)
    ),
    mainPanel(
      leafletOutput("map")
    )
  )
)

# Define server logic
server <- function(input, output) {
  # Render the leaflet map based on user's clade selection and polygon coordinates
  output$map <- renderLeaflet({
    clade <- input$clade
    bbox <- c(
      min_longitude = input$min_longitude,
      min_latitude = input$min_latitude,
      max_longitude = input$max_longitude,
      max_latitude = input$max_latitude
    )
    
    occ_search_result <- search_occurrences(bbox, clade)
    
    leaflet() %>%
      addTiles() %>%
      addCircleMarkers(
        data = occ_search_result$data,
        lng = ~decimalLongitude,
        lat = ~decimalLatitude,
        popup = ~species,
        radius = 5,
        color = "blue",
        fillOpacity = 0.7
      ) %>%
      setView(
        lng = mean(bbox[c("min_longitude", "max_longitude")]),
        lat = mean(bbox[c("min_latitude", "max_latitude")]),
        zoom = 14
      )
  })
}

#et voilà! You can run the application
shinyApp(ui = ui, server = server)


Do roads disturb food webs? Yes.

We (me, Vinicius and Fernando Ascensão) have just recently pusblished a new preprint (currently submitted elsewhere) which makes me really proud! In this paper, entitled “Wildlife-vehicle collisions simplify regional food webs” we demonstrate that, for example, in areas surrounding major cities there might be a drastic loss of trophic interactions (about 90%).

A total of 186 species faced significant risks of local extinction due to direct roadkill effects, while 190 species had trophic interaction losses due to indirect effects, such as the loss of their prey species.

Apex predators exhibited lower direct roadkill impacts while basal-level species are more exposed to direct effects, potentially triggering a cascade of interaction disruptions. This is probably because top-level species were already affected by the effects of roads, and that effect is already present in the occurrence data.

Our findings underscore the necessity for tailored conservation measures to reduce roadkill risk, targeting different trophic levels, to preserve ecological network integrity amidst road development programs.

Here’s the preprint!

Just Out: Temporal mismatches in flight activity patterns between Pipistrellus kuhlii and Prays oleae in olive farms: Implications for biocontrol services potential

Our new paper about temporal mismatches in flight activity can be downloaded here.

Here is the abstract:

  1. Biocontrol services are widely recognized to provide key incentives for bat conservation. However, we have virtually no information on whether and how disruptions in bat-mediated biocontrol services are driven by mismatches between the temporal activity patterns of insectivorous bats and insect pests.
  2. We investigated the temporal relationship between the nightly activity patterns of the common pipistrelle bat (Pipistrellus kuhlii) and the olive fruit moth (Praysoleae). Temporal mismatches between species pairs were estimated as the time difference (expressed as a percentage of the night) at which P. kuhlii and P. oleae reached 50% of their abundance.
  3. The study was carried out during spring, summer, and fall between 2017 and 2019 in 60 olive farms representing increasing levels of structural simplification(as a surrogate of agricultural intensification). Olive farms were classified as exhibiting high (i.e. HIGH olive farms; n = 27), intermediate (MID; n = 18), and low(LOW; n = 15) structural complexity.
  4. Temporal mismatches between the activity levels of P. kuhlii and P. oleae varied between seasons and types of olive farms, being comparatively lower in summer than in spring and fall. Furthermore, summer was the only season in which temporal mismatches between species pairs differed between types of olive farms, with higher temporal mismatches found in LOW than in HIGH and MID olive farms.
  5. Overall, our work demonstrates the existence of temporal mismatches between the nightly activity patterns of P. kuhlii and P. oleae. Furthermore, it demonstrates that the structural simplification of olive farms increases temporal mismatches between species pairs, particularly in summer when bat-mediated biocontrol services are most needed.
  6. Synthesis and applications. Future research should consider mismatches between the temporal activity patterns of insectivorous bats and insect pests. Otherwise, the actual impact of agricultural intensification on bat-mediated biocontrol services as well as the economic impact of their loss on the agriculture industry might be underestimated. To enhance biocontrol services, we propose increasing the availability of suitable roosting and foraging sites as well as conserving areas of remnant native woodland and scattered hollow-bearing trees.

Simulating Phylogenetically Structured Networks*

*Contributed by Vinicius Bastazini and Vanderlei Debastiani

“Nothing in biology makes sense except in the light of evolution.” (Dobzhansky 1973)

“Nothing in evolutionary biology makes sense except in the light of ecology.” (Grant and Grant 2008)

“Nothing in evolution or ecology makes sense except in the light of the other. ” (Pelletier et al. 2009)

Understanding the interplay between evolutionary and ecological processes is crucial for describing patterns of species diversity in space and time. Historically, community ecology and evolutionary biology have followed separate paths. However, in the past decades, the inclusion of phylogenetic data has expanded the toolkit for community ecologists, shedding light on large range of biological processes such as species interactions, community assembly and disassembly, species distribution, and ecosystem functioning. Phylogenetic information has also provided a sort of  “temporary” solution for missing data in ecological databases.

This novel and integrative approach has given rise to Ecophylogenetics, an interdisciplinary field of study that combines principles from both ecology and phylogenetics. It focuses on understanding the evolutionary relationships among species in the context of ecological processes and patterns. 

In this context, phylogenetically structured models have thus revolutionized our understanding of ecological phenomena, by providing a framework to explore and interpret the patterns of species evolution, diversity, and interactions. This is especially relevant in Network Ecology, a branch of ecology interested in investigating the structure, function, and evolution of ecological systems using network models and analyses. Phylogenetic approaches have been incorporated into the study of ecological networks formed by interacting species, in order to describe distinct ecological phenomena, such as network assembly and disassembly (see a related post here),  and its ability to cope with cascading effects such as species loss (see a related post here). 

Examples of some of the possible eco-evolutionary dynamics of bipartite mutualistic networks. Species interactions are represented by black cells in the bi-adjacency matrices along with their evolutionary trees and traits ( blue and red circles). Trait values are represented by circle size.

In the following example, we will demonstrate how to simulate phylogenetically structured networks using  R.

In this example we will simulate ultrametric phylogenetic trees for two distinct sets of species, such as consumers ( e.g., predator, pollinator or seed disperser) and resources (prey, flowering plants), following a uniform birth–death process, which reflects the underlying evolutionary dynamics of taxa. Additionally, we will simulate the evolution of a single trait by employing a family of power transformations to the branch lengths of these simulated phylogenetic trees. The choice of this transformation parameter defines the tempo and mode of trait evolution. Networks of interacting species will be generated using a single-trait complementarity model (Santamaria and Rodriguez-Girones 2007). According to the single-trait complementarity model, each species in the network is represented by a mean trait value and its variability, and a pair of species is more likely to interact if their trait values overlap. You can find further information on this sort of simulation  in Debastiani et al. (2021a, 2021 b) and Bastazini et al. (2022).

#### Load R packages
require(ape)
require(geiger)
require(plotrix)

#### Define phylo_web, a function  that generates phylogenetic structured networks
# The inputs are: number of species in each set of interacting species and the level of phylogenetic signal

phylo_web = function(n_spe_H, n_spe_L, power_H, power_L) {
  
  # Generate a phylogenetic tree for consumer species (H)
  tree_H = geiger::sim.bdtree(b = 0.1, d = 0, stop = "taxa", n = n_spe_H, extinct = FALSE)
  for (y in 1:length(tree_H$edge.length)) {
    if (tree_H$edge.length[y] <= 0)
      tree_H$edge.length[y] = 0.01
  }
  
  # Generate a phylogenetic tree for resource species  (L)
  tree_L = geiger::sim.bdtree(b = 0.1, d = 0, stop = "taxa", n = n_spe_L, extinct = FALSE)
  for (y in 1: length(tree_L$edge.length)) {
    if (tree_L$edge.length[y] <= 0)
      tree_L$edge.length[y] = 0.01
  }
  
  # Assign labels to the tips of the trees
  tree_H$tip.label = sprintf("H_%.3d", 1:length(tree_H$tip.label))
  tree_L$tip.label = sprintf("L_%.3d", 1:length(tree_L$tip.label))
  
  # Generate trait data for consumers
  trait_H = matrix(NA, nrow = n_spe_H, ncol = 1)
  for(n in 1:1) {
    trait_H[, n] = ape::rTraitCont(compute.brlen(tree_H, power = power_H), model = "BM")
  }
  trait_H[,1] = plotrix::rescale(trait_H[,1], newrange = c(0, 1))
  rownames(trait_H) = tree_H$tip.label
  colnames(trait_H) = sprintf("Tr_H_%.3d", 1:ncol(trait_H))
  
  # Generate trait data for resources
  trait_L = matrix(NA, nrow = n_spe_L, ncol = 1)
  for(n in 1:1) {
    trait_L[, n] = ape::rTraitCont(compute.brlen(tree_L, power = power_L), model = "BM")
  }
  trait_L[,1] = plotrix::rescale(trait_L[,1], newrange = c(0, 1))
  rownames(trait_L) = tree_L$tip.label
  colnames(trait_L) = sprintf("Tr_L_%.3d", 1:ncol(trait_L))
  
  # Generate bi-adjacency interaction  matrix based on trait differences and niche overlap
  d_H = matrix(runif(n_spe_H, max = 0.25), nrow = n_spe_H, ncol = 1)
  d_L = matrix(runif(n_spe_L, max = 0.25), nrow = n_spe_L, ncol = 1)
  web = matrix(NA, nrow = n_spe_L, ncol = n_spe_H)
  for(i in 1:n_spe_L) {
    for(j in 1:n_spe_H) {
      II = abs(trait_H[j] - trait_L[i])
      III = 0.5 * (d_H[j] + d_L[i])
      web[i,j] = ifelse(II < III, yes = 1, no = 0)
    }
  }
  colnames(web) = tree_H$tip.label
  rownames(web) = tree_L$tip.label
  
  # Ensure there are no species with no interactions
  z_H = which(colSums(web) == 0)
  if (length(z_H) > 0) {
    for(i in 1:length(z_H)) {
      web[sample(1:n_spe_L, size = 1), z_H[i]] = 1
    }
  }
  z_L = which(rowSums(web) == 0)
  if (length(z_L) > 0) {
    for(i in 1:length(z_L)) {
      web[z_L[i], sample(1:n_spe_H, size = 1)] = 1
    }
  }
  
  # Return the results as a list
  RES = list(tree_H = tree_H, tree_L = tree_L, trait_H = trait_H, trait_L = trait_L, web = web)
  return(RES)
}

#### Generate networks  using the phylo_web function

# Here, we are  generating a network formed by 10 resource species (e.g., flowers) , 10 consumers (pollinators),  simulating a Brownian motion process for trait evolution:

n_spe_HA = 10 # Number of consumer species 
n_spe_LA = 10 # Number of resource species 
power_HA = 1 # Grafen's rho of consumer species
power_LA = 1  # Grafen's rho of resource species

web = phylo_web(n_spe_HA, n_spe_LA, power_HA, power_LA)

# The result is list containing  a bi-adjacency matrix for two sets of interacting species,  their phylogenies and trait values.

web

Now we can plot the bi-adjacency matrix along with their evolutionary trees and traits. Trait values are represented by circle size.

# Create and arrange the plot for the phylogenetic trees, species traits, and the network

par(mar = c(0.4, 0.4, 0.4, 0.4))
layout(matrix(c(0, 0, 1, 0, 0, 2, 3, 4, 5), nrow = 3, ncol = 3, byrow = TRUE), 
       widths = c(0.4, 0.4, 1), 
       heights = c(0.4, 0.4, 1))


# Plot
ape::plot.phylo(web$tree_H, show.tip.label = FALSE, 
     direction = "downwards")
plot(web$trait_H[,1], rep(1, times = length(web$trait_H[,1])), 
     xlab = "", ylab = "", 
     xaxt = "n", yaxt = "n", 
     type = "n", bty = "n",
     ylim = c(0.9, 1.1), xlim = c(1, length(web$trait_H[,1])))
points(1:length(web$trait_H[,1]), rep(1, times = length(web$trait_H[,1])),
       cex = web$trait_H[,1]+1, pch = 19)
ape::plot.phylo(web$tree_L, show.tip.label = FALSE,
     direction = "rightwards")
plot(web$trait_L[,1], rep(1, times = length(web$trait_L[,1])),
     xlab = "", ylab = "", 
     xaxt = "n", yaxt = "n", 
     type = "n", bty = "n",
     xlim = c(0.9,1.1), ylim = c(1, length(web$trait_L[,1])))
points(rep(1, times = length(web$trait_L[,1])), 1:length(web$trait_L[,1]),
       cex = web$trait_L[,1]+1, pch = 19)
plotrix::color2D.matplot(web$web,
                cs1 = c(1, 0), cs2 = c(1, 0), cs3 = c(1, 0), 
                yrev = FALSE,
                ylab = "", xlab = "", 
                xaxt = "n", yaxt = "n",
                border="white", axes = FALSE)

Et voilà!!!

Biogeography of ecological networks: getting information on the interactions

Darwin marvelled at the diversity of life on Earth. He wrote, in the “Origin of Species”: “Thus, from the war of nature, from famine and death, the most exalted object which we are capable of conceiving, namely, the production of the higher animals, directly follows. There is grandeur in this view of life, with its several powers, having been originally breathed into a few forms or into one; and that, whilst this planet has gone cycling on according to the fixed law of gravity, from so simple a beginning endless forms most beautiful and most wonderful have been, and are being, evolved.”.

However, at the very end of “Origin”, Darwin hinted at something more… he had written a masterwork, the most relevant book to ever be written (yes not that one!), explaining the mechanisms generating biodiversity. But there was something more, not only these species were there in all their diverse magnificence, but all interacted in a complex network: “It is interesting to contemplate a tangled bank, clothed with many plants of many kinds, with birds singing on the bushes, with various insects flitting about, and with worms crawling through the damp earth, and to reflect that these elaborately constructed forms, so different from each other, and dependent upon each other in so complex a manner, have all been produced by laws acting around us.

In recent years biogeographers have been turning their attention to these “tangled bank” or ecological networks, which natural forces shape them and how they are affected by human disturbance to ecosystems. Biogeography of ecological networks has raised so much attention because food webs in particular depict the flow of energy through ecosystems (Moore & de Ruiter, 2012) and are a perfect framework to evaluate the impacts of environmental changes on ecosystem services (Montoya et al. 2003).

However, to address this issue we need data, good (enough) data. What kind of data? Well, we need information on the biotic interactions of communities at large spatial scales, continental to global. Where to get this information from? From two main sources: i) databases of local empirical networks and ii) inference of local networks from co-occurrence, species trait data and/or diet. To be rigorous, the first is proper data, while the second is not, but let’s let this one pass. I’ll try to weigh the advantages and disadvantages of each approach.  

Databases of Ecological Networks

There are several databases that can be used to get these local empirical networks: GLOBI, mangal and EcoBase are the ones that I think are more used (these are the ones I’ve used anyway). These (at least GLOBI and mangal) can be accessed from R with the packages rglobi and rmangal. Additionally, a few years ago, I created an R package called fw, available in GitHub, to download food webs from different databases with a common format (I haven’t maintained it for some time, so some errors might arise).

Advantages

The main advantage of ecological networks downloaded from these databases is that these represent empirically, “real”, verified biotic interactions. Contrary to inferred ecological networks, here we have real proper data.

Disadvantages

Uneven spatial distribution – much more sampling in Europe and North America (more studies there).

Multiple spatial scales – ecological networks can be local (e.g. one small study site) or continental/oceanic (e.g. North Atlantic).

Multiple temporal scales – Researchers aggregate the interactions and species present in their study site for a given period of time, which impacts network structure.

Multiple node resolution within (basal nodes are frequently aggregated) and between networks (e.g. species, functional or taxonomic groups). If we have a network in which each node is a species and another using trophic aggregation (aggregating all species with common predators and prey species) can we really compare both? Additionally, food webs tend to have more taxonomically aggregated nodes as we go to lower trophic levels.

Multiple definitions of “interaction” (this might seem strange, but what is an interaction?). What is the threshold to say “these species are interacting”?

Using different sampling strategies to identify nodes (e.g. camera traps, environmental DNA), and interactions (e.g. stable isotopes). This has an impact on which species and interactions are present in the network.

Some databases do not have metadata (e.g. information on the methods used, scale, sampling effort and date). This makes comparability between samples difficult or impossible, which is quite problematic.

Inferred networks

Let’s say we have a metaweb of biotic interactions across Europe (like the one by Maiorano et al 2020) and we know species occurrence in our study site (there are a lot of sources for this information). We can assume that, if in the metaweb a wolf eats rabbits, then whenever wolves and rabbits co-occur this interaction is present. This is admittedly a very simplistic description of the method, but is good enough to give an idea (but check Morales-Castilla et al. 2015).

Advantages

One of the main advantages of inferring local interactions using this approach is that it provides an even spatial cover (with no spatial bias characteristic of the databases).

Another great advantage is that, for the better and for the worse, all networks are created using exactly the same methodology (node presence and interaction presence are defined with the same set of rules).

Disadvantages

The main point against this approach is that it does not represent verified interactions. Additionally, these are not presented at the spatial scale that they occur (species generally interact at a much finer scale than the one in use here, for example, 10km2 grids).

The reliability of interaction inference is dependent upon the criteria used (is it a metaweb, species traits, species diet?). Some researchers challenge this approach, arguing that species co-occurrence (which is used to identify which species are present in a local network) is not enough to assume interactions (if the species are known to interact).

Finally…

We have discussed the issues related to resorting to databases of ecological networks elsewhere (Mestre et al. 2022a). Additionally, there is a good discussion (worth reading!) in the scientific literature about whether species co-occurrence (on which inferred networks are partially based) is a good proxy for interactions (some references below). I tend to agree with the argument that, at least, “Co-occurrence is a necessary but not sufficient condition for a biotic interaction to occur.” (Stephens et al. 2020a).

The number of advantages and disadvantages of each of the two approaches is not, in itself, relevant. For instance, for the databases of local ecological networks, I identified only one advantage… but it is a major one: the fact that these are empirically verified, not inferred, interactions. On the other hand, the fact that these empirical databases are obtained with a multiplicity of methods, and temporal, spatial and taxonomic aggregations make these really difficult to compare (trust me, I know!).

I have used in my own research datasets based on databases Mestre et al. (2022b), but I´m also currently using inferred networks in something else I’m working on. Choosing each of these approaches is dependent on the kind of research question, considering that, as we move from databases to inferred networks, there is a loss of empirically verified interactions but a gain of technical data quality (same node resolution, same spatial distribution). Which is better suited to each research question is a choice that must be defended by the researcher.

As we have written in Mestre et al. (2022a), to improve the usability of ecological networks from databases, data must be integrated into a database (such as mangal), providing adequate metadata information. The goal is to have comparable datasets in which we can either account for their differences or sub-select comparable samples thus lessening some of the problems with this approach.

However, neither source of information is perfect (perfect would be to have empirical ecological networks systematically sampled in multiple points with the same methods across a large enough region).

These are the sources of information that we have. And this is what we must work with!

References

Maiorano, L., Montemaggiori, A., Ficetola, G. F., O’connor, L., & Thuiller, W. (2020). TETRA‐EU 1.0: a species‐level trophic metaweb of European tetrapods. Global Ecology and Biogeography, 29(9), 1452-1457.

Montoya, J. M., Rodríguez, M. A., & Hawkins, B. A. (2003). Food web complexity and higher‐level ecosystem services. Ecology Letters, 6(7), 587-593.

Moore, J. C., & de Ruiter, P. C. (2012). Energetic food webs: an analysis of real and model ecosystems. Oxford Ecology and Evolution.

Morales-Castilla, I., Matias, M. G., Gravel, D., & Araújo, M. B. (2015). Inferring biotic interactions from proxies. Trends in Ecology & Evolution, 30(6), 347-356.

Mestre F, Gravel D, García-Callejas D, Pinto-Cruz C, Matias MG, & Araújo MB. (2022a) Disentangling food-web environment relationships: a review with guidelines. Basic and Applied Ecology, 61: 102-115.

Mestre F, Rozenfeld A & Araújo MB (2022b). Human disturbances affect the topology of food webs. Ecology Letters.

References on the use of co-occurrence

Blanchet, F. G., Cazelles, K., & Gravel, D. (2020). Co‐occurrence is not evidence of ecological interactions. Ecology Letters, 23(7), 1050-1063.

Cazelles, K., Araújo, M. B., Mouquet, N., & Gravel, D. (2016). A theory for species co-occurrence in interaction networks. Theoretical Ecology, 9, 39-48.

Holt, R. D. (2020). Some thoughts about the challenge of inferring ecological interactions from spatial data. Biodiversity Informatics, 15(1), 61-66.

Morueta‐Holme, N., Blonder, B., Sandel, B., McGill, B. J., Peet, R. K., Ott, J. E., Violle, C., Enquiest, B. J., Jorgensen, P. M. & Svenning, J. C. (2016). A network approach for inferring species associations from co‐occurrence data. Ecography, 39(12), 1139-1150.

Peterson, A. T., Soberón, J., Ramsey, J., & Osorio-Olvera, L. (2020). Co-occurrence networks do not support identification of biotic interactions. Biodiversity Informatics, 15(1), 1-10.

Stephens, C. R. (2020a). Can we infer species interactions from co-occurrence patterns? A Reply to Peterson et al.(2020). Biodiversity Informatics, 15(1), 57-60.

Stephens, C. R., González-Salazar, C., Villalobos, M., & Marquet, P. (2020b). Can ecological interactions be inferred from spatial data?. Biodiversity Informatics, 15(1), 11-54.

Latitudinal gradient in bat-ectoparasitic fly networks

Latitudinal Diversity Gradient (LDG), i.e.,  the increase in species richness, from high to low latitudes, is one of the most enduring patterns recognized in nature.  Alexander von Humboldt was the first naturalist to acknowledge it, during his South American expedition at the end of the 18th century. Humboldt gracefully described the LDG in his classic book “Le voyage aux régions équinoxiales du Nouveau Continent”:

“The nearer we approach the tropics, the greater the increase in the variety of structure, grace of form, and mixture of colors, as also in perpetual youth and vigor of organic life.”

The LDG is a widespread pattern, found in most ecosystems across both hemispheres (refer to meta-analyses here and here). Consequently, it has captivated scientists from various fields within Ecology and Biogeography. Since Humboldt’s time, ecologists have sought to generalize the LDG  to other facets of biodiversity, such as functional or phylogenetic diversity, and other ecological phenomena, such as species specialization. The idea of a latitudinal specialization gradient  (LSG) has been pivotal in empirical and theoretical ecology and biogeography, although not without some controversy (see for instance Moles & Ollerton 2016). In any case, the core assumption here is that high niche partitioning among species would foster coexistence, leading to greater species specialization in the tropics and, consequently, highly diverse tropical communities.

The intricate warfare between parasites and their hosts has long fascinated scientists for its role in shaping evolutionary processes and patterns of species diversity across space and time. This is especially true for ectoparasitic bat-flies, which exhibit remarkable specificity in their interactions with bat hosts, making them an interesting model system to explore LSG, and how networks formed by interacting species vary across spatial gradients . The ecological effects of species specific specialization can spread across levels of biological organization, influencing the overall structure of ecological networks. There are many uncertainties about how spatial gradients define bat-fly interactions across spatial scales, prompting many questions on how the networks, formed by their interactions,  respond to these gradients.

Nycteribiidae bat-fly. Image source: Wikipedia.

In a recent study, led by Luana Biz, we explored the intricate relationships between bats and their ectoparasitic flies, belonging to the families Streblidae and Nycteribiidae across the Neotropical region. To do so, we compiled data on 97 bat species and 128 ectoparasitic fly species, creating 57 unique interaction networks spanning latitudes from 29ºS to 19ºN in the Neotropics. We then combined network and parasitological  analyses to explore  how the complexity of interaction networks would shift as latitude changes, and its effects on  network size (total number of species within a network), specialization (the degree to which species within a network interact with a limited subset of other species), modularity (the degree to which an ecological network can be divided into distinct subgroups of interacting species), nestedness (the orderliness of interactions within a network, in which, specialists interact with a subset of the species that generalists interact with), and connectance (the proportion of realized interactions  relative to the total possible interactions).

Sampling locations for the 57 bats and ectoparasitic bat-flies networks used in Biz et al. (2023). Alongside are illustrations of some of the networks employed.

As anticipated, network metrics and parasitic indices varied along the latitudinal gradient, with  a clearer pattern of richer networks closer to the equator, and overall network structure changes across the latitudinal gradient.  Regions closer to the equator also  tended to have higher parasite loads. We found that Latitude affected network structure indirectly,  essentially by controlling network size. As latitude increases, networks become more connected, more modular and specialized.  This indicates that the classic ecological tenet that species have a tendency to specialize more in the tropics is not always true, which among other things, imply that additional stabilizing mechanisms are at work for the diversity gradient in bat-fly networks

Our findings highlight that interaction network metrics display a latitudinal gradient, and that  these interactions, when examined locally, mask differences that become apparent at larger scales. Consequently, ectoparasites like bat flies are influenced not only by host ecology and biology but also by various environmental factors directly affecting their distribution and survival.

To find out more, read our new paper “Network and parasitological analyses reveal latitudinal gradient in bats-ectoparasitic flies interactions across the Neotropic” just published in the journal Ecology and Evolution.

Just out! Paper describing the lconnect R package

The lconnect R package was devised as a simple tool to be used in conjunction with other packages within the R environment in the context of landscape ecology or biodiversity conservation studies.

Our short communication describing it was just published in Ecological Modelling.

Here’s the abstract:

Biodiversity conservation faces significant challenges due to human-induced climate and habitat change. Understanding these threats’ effects and interactions is crucial for effective conservation planning. Here, we present the lconnect R package, a user-friendly tool for assessing landscape connectivity and prioritizing habitat patches. The package allows researchers to analyze and quantify structural connectivity metrics and prioritize patches based on their contribution to overall landscape connectivity. By facilitating the evaluation of landscape connectivity and patch prioritization, lconnect supports informed decision-making in landscape ecology and conservation biology. The package’s advantages, relative to other available tools, are discussed, and an example of its application is presented. Overall, the lconnect R package presents a valuable addition to the toolbox of landscape ecologists, empowering them to better understand and address the challenges of habitat fragmentation and loss in biodiversity conservation.

If you want to know how to use it here are two posts that you might find useful:

Package lconnect: patch connectivity metrics and patch prioritization (link)

Exporting lconnect outputs as shapefiles (link)