All analyses presented in the article can be replicated using the different R scripts and functions provided.
Although scripts should normally be run sequentially since all scripts are using outputs from previous scripts, we here provide partial outputs meaning that each script can be run independently. Specifically,
all scripts were run on Mammals_terrestrial implying that outputs are available for all species of this taxonomig group. Yet, we also provide global outputs to allow replicating the results presented in the manuscript
- The script "1-Prepare_data.R" prepares the data (e.g. setting an appropriate resolution for climatic layers, defining environmental backgrounds using PCA) for analyses.
Input and output data are provided in the "Data" folder both for terrestrial and marine conditions.
- The script "1.bis-Alternative_BCK_envelopes.R" proposes alternative methods to derive current and future climatic limits. Contiguity measures based on these alternative climatic limits, although not
presented in the main document, are all used in the next script to measure truncation. These measures can be used to assess the sensitivity of our results to alternative approaches.
These various types of limits are found in different .Rdata files within the 'Data' folder both for terrestrial and marine conditions (e.g. the file "Data/Land/Bck_polygons_full_1deg.Rdata" contains terrestrial limits
defined using three different envelopes: alpha hull, kernel density and convex hull).
- The script "2-QuantifyTruncation.R" is the main script. It measures niche contiguity (proportion of the niche perimeter that overlaps climatic limits) for each species relative to current and future climatic limits.
Contiguity is measured using alternative approaches (e.g. grid, envelope) and climatic limits. This script can (and should) be run in parallel (al. We here provide individual output files for all terrestrial mammals in the
folder "Outputs/Mammals_terrestrial". A detailed example is provided for the species presented in the Fig. 1 of the main document (Arvicanthis niloticus).
Similar analyses can be performed for other taxonomic groups since all necessary input data are provided.
- The script "3-Compile_truncation_results.R" compiles measures of contiguity across all species and taxonomic groups. Specifically, measures of contiguity proportions estimated using different climatic limits
are provided in .txt files in the folder "Outputs" (here only across terrestrial mammals; yet contiguity measures for all species under the grid approach are also provided to allow replicating figures "Outputs/contiguity_measures_grid_full.txt").
Contiguity geometries (i.e. segment of the climatic limit where contiguity takes place) are stored in .Rdata files in folders associated to each taxonomic group (e.g. "Ouputs/Mammals_terrestrial/Global_outputs").
- The script "4-Rasterize_segments.R" makes use of contiguity geometries. Specifically, the geometries are rasterized and then stacked across species. This result in Fig.3C (for land) and Fig.3F (for oceans). The output file
containing information on the geometries stacked across all species belonging to terrestrial groups can be found here: "Outputs/rasterized_segments_Terrestrial.txt". A similar output file is provided for
marine groups: "Outputs/rasterized_segments_Marine.txt".
- The script "5-Interpolated_niche_contiguity.R" uses the rasterized geometries computed in the previous script to provide an assessment of the geography of niche contiguity i.e. how likely are the climatic conditions
found in a given location likely to entail niche contiguity. This geographically interpolated niche contiguity is estimated for each geographic pixel based on the average distance to all points associated with contiguity
in the environmental space (see interpolation approach described in the methods). The output files complied across all species for terrestrial and marine realms can be found here "Outputs/interpolated_contiguity_land.Rdata" and
here "Outputs/interpolated_contiguity_ocean.Rdata". This script further extracts the value of climatic conditions around contiguity for marine and terrestrial realms. We provide output files containing this information
for all species here "Outputs/climatic_conditions_at_truncation_grid_Terrestrial.Rdata" and here "Outputs/climatic_conditions_at_truncation_grid_Marine.Rdata".
- The script "6-LIG_non-anlogues" aims to identify the congruence between past and future conditions that are both non-analogues to current climatic conditions. This is a pre-requisite for unleashing past ecological niche ghosts.
Once these conditions are identified, their coordinates are projected in both the geographical and environmental space to identify where (spatially and environmentally) ecological niche ghosts can be unleashed.
- The script "7-Distance_contiguity_front" first defines the polygons and extract the associated coordinates of climatic conditions that are appearing or disappearing in the future for both realms. Then, for each species it computes the
distance of the species niche centroid to both appearing and disappearing conditions. The aim is to show that species concerned with contiguity are on average closer to conditions that are predicting to appear in the future.
We provide the output file from this analysis which can be found here: "Outputs/Distance_appearing_disappearing_conditions.Rdata".
- The script "8-Drivers_of_niche_contiguity" measures the distance of the species niche centroid to the contiguity line (i.e. the climatic limits to which the species niche is contiguous to). This measure of distance is then used in a linear model
together with the species niche area to determine whether the magnitude of truncation is rather due to species having large niches or niches close to climatic limits.
We provide the output file from this analysis which can be found here: "Outputs/Species_wise_distance_trunction.Rdata".
- The script "9-Biotic_attrition.R" estimates the spatial distribution of each species using a traditional niche-based approach and an alternative approach that attempt to account for niche contiguity using niche expansion/reoccupation scenarios.
For expansion scenarios, minimum volume ellipsoids are used with a 95% inclusion threshold (low expansion scenario) and a 99% inclusion threshold (high expansion scenario). Spatial predictions are then stacked across species to provide
an estimate of species richness at the global scale. By comparing species richness estimated with the traditional niche-based method and the contiguity approach, we aim to provide an assessment of the extent to which the phenomenon of biotic attrition
is affected by niche truncation. Infromation on species richness predicted at the global scale for all terrestrial species under the three approaches (niche, expansion99 and expansion95) for current and future conditions
can be found here "outputs/Nsp.suitability_Terrestrial.Rdata"
- Finally, the script "10-Figures" uses the different output files to produce various figures. To allow replicating the figures presented in the manuscript, we also provide output files combining information across taxonomic groups:
"Outputs/contiguity_measures_grid_full.txt".