DOI: 10.5061/dryad.h9w0vt4rx
title: Data from: Functional and phylogenetic dimensions of tree biodiversity reveal unique geographic patterns

description: Aim: Quantify tree functional and phylogenetic richness and divergence at
 the global scale, and explore the drivers underpinning these biogeographic
 patterns. Location: Global Time Period: Present Major taxa studied:
 Trees  Methods: Using global tree occurrence data, we outlined
 species’ observed ranges using individual alpha hulls to obtain per-pixel
 tree species composition. Using eight traits from a recent tree-trait
 database and a vascular-plant phylogeny we computed and mapped four pixel
 level biodiversity indices, including two metrics related to richness:
 phylogenetic richness and functional richness and two related to
 divergence: mean pairwise phylogenetic distance and Rao's quadratic
 entropy. To account for the effect of species richness, we also calculated
 standardized effect sizes accounting for richness for each pixel. We then
 explored the relations between richness and divergence and the latitudinal
 patterns of divergence both globally and across biomes. Finally, we used a
 random forest modeling approach to test for drivers of the different
 dimensions of diversity in trees. Results: In contrast to the latitudinal
 gradient in species richness, functional and phylogenetic divergence both
 peak in mid-latitude systems, exhibiting the highest values in temperate
 ecosystems and lowest values in boreal and tropical forests. This result
 holds for functional divergence when removing gymnosperms but the peak
 flattens for phylogenetic divergence. Phylogenetic richness is
 consistently lower than expected given the number of species, whereas
 functional richness has higher-than-expected values at mid-latitudes,
 mimicking functional divergence patterns. When considering the drivers of
 these diversity patterns, temperature and historical speciation rates
 consistently emerge as the strongest forces driving divergence, with
 negligible effects of human influence, soils or historical climate
 stability. Main Conclusions: Collectively, these results reveal unique
 similarities and disparities across biomes that are not apparent in any
 single dimension of biodiversity, highlighting the importance of
 considering multiple aspects of biodiversity in the management of natural
 ecosystems.
description: # Data from: Functional and phylogenetic dimensions of tree biodiversity
 reveal unique geographic patterns
 [https://doi.org/10.5061/dryad.h9w0vt4rx](https://doi.org/10.5061/dryad.h9w0vt4rx) This dataset contains code and data to generate maps of taxonomic, functional, and phylogenetic diversity of trees as well as resulting matrices. This includes individual tree species locality information compiled from several sources, trait data selected from Maynard et al 2022 and code to generate different subsets of the data (e.g. removing invasives, removing gymnosperms ) as presented in the article. This dataset also contains code and results from randomizations and simulations described in the main article to show robustness of the analyses.  ## Description of the data and file structure The dataset is presented as two main folders: data and code. The data folder contains all input data raw and cleaned (files that start with REV) with the later taking care of taxonomy mismatches between databases. Species data presented was cleaned based on their environmental and geographic distances using the occTest package for R. The data folder also contains all results from analyses including intermediary files required to run some of the scripts presented in the code folder. The code folder contains R scripts to recreate all analyses in the article starting with building alpha hulls from locality data , then overlapping alpha hulls to create community matrices and following with the computation of taxonomic, functional and phylogenetic richness and divergence metrics. It also provides code for randomizations of the data (randomly assigning species to communities), randomly subsampling half of the species in each community and subsampling species according to continental proportions. We also provide code to transform the matrices into raster data to visualize the results as global maps.  The code files are divided into two groups: (1 ) code to prepare data and create initial alpha hulls using the prefix "Prepare_data_" and (2) Code to compute diversity metrics from original data and resulting from randomizations with the prefix "calc_diversity". Finally a script to create maps is provided. ### List of Files with description Raw data files (referred to in scripts as inside raw data folder) 1- Database with localities for all tree species used in the analyses  after cleaning all_trees_alldb.csv    All locality data was obtained from published sources (see Table S1 of the manuscript) 2- Shapefile with the delimitation of continents for subsampling purposes : set of 4 files delimitation_continents_gatti 3- Values for different potential correlates of diversity per pixel Correlates_of_diversity_composite_values.csv as presented in table S2 of the manuscript copied here with an extra column for the variable name on the file | Potential evotranspiration (PET) | CGIAR (Zomer *et al.*, 2008)1 | \~1km | CGIAR\_PET | | :--------------------------------------- | :----------------------------------------------------: | :---------------------: | :------------------------------------------ | | Aridity index | CHELSA\_exBIO\_AridityIndex | | | | Annual mean temperature  | CHELSA (Karger *et al.*, 2017) | 30 arcsec | CHELSA\_BIO\_Annual\_Mean\_Temperature | | Temperature annual range | CHELSA\_BIO\_Temperature\_Annual\_Range | | | | Precipitation of the driest month | CHELSA\_BIO\_Precipitation\_of\_Driest\_Month | | | | Precipitation of the warmest quarter | CHELSA\_BIO\_Precipitation\_of\_Warmest\_Quarter | | | | Maximum temperature of the warmest month | CHELSA\_BIO\_Max\_Temperature\_of\_Warmest\_Month | | | | Minimum temperature of the coldest month | CHELSA\_BIO\_Min\_Temperature\_of\_Coldest\_Month | | | | Isothermality | CHELSA\_BIO\_Isothermality | | | | Mean diurnal range | CHELSA\_BIO\_Mean\_Diurnal\_Range | | | | Precipitation seasonality | CHELSAv1\_BIO\_Precipitation\_Seasonality | | | | Annual precipitation | CHELSA\_BIO\_Annual\_Precipitation | | | | Soil pH | SoilGrids (Poggio *et al.*, 2021) | \~250m | SG\_Soil\_pH\_H2O\_000cm | | Bulk density 0-15cm | SG\_Bulk\_density\_015cm | | | | Clay content 0-15cm | SG\_Clay\_Content\_060cm | | | | Cation Exchange Capacity 0-15cm | SG\_CEC\_015cm | | | | Coarse fragments 0 cm | SG\_Coarse\_fragments\_000cm | | | | H2O capacity 0-15cm | SG\_H2O\_Capacity\_015cm | | | | Absolute depth to bedrock | SG\_Absolute\_depth\_to\_bedrock | | | | Sand content 0 cm | SG\_Sand\_Content\_000cm | | | | Organic carbon concentration | SG\_SOC\_Content\_015cm | | | | Human Footprint  | WCS (Venter *et al.*, 2016) | \~1km | WCS\_Human\_Footprint\_2009 | | Global human modification | Conservation Science partners (Kennedy *et al.*, 2019) | \~1km | CSP\_Global\_Human\_Modification | | Elevation | Earth Env (Amatulli *et al.*, 2018) | 30 arcsec | EarthEnvTopoMed\_Slope | | Slope | EarthEnvTopoMed\_Elevation | | | | Forest landscape integrity index | Literature (Grantham *et al.*, 2020) | 300m | GranthamEtAl\_ForestLandscapeIntegrityIndex | | Stability | Literature (Herrando-Moraira *et al.*, 2022) | 2.5 arcmin | StabilityCSI | | MRD (Diversification rates) | Literature (Tietje *et al.*, 2022) | Botanical Country Level | mrd | 4- Miscelaneous files required for data matching (coordinates for grid cells, lists of angiosperms/gymnosperms, lists of monocots, list of invasives ANGIO_GYMNO_lookup.csv, continents_grid.csv, grid_coordinates.csv, monocot_genera.csv, matched_trait_names.csv, Invasive_glonaf.csv 5- Dataset removing monocots :      phylogenetic tree of all trees used removing monocots [no_monocots_tree.nwk],       Phylogenetic and functional richness calculated without including monocots [NoMono_matchPD_FD_gather.arrow] Cleaned data files. Data files with matching taxonomic names.  1- Matrix with trait values per species REV_Trait_matrix.csv        This matrix has species names as rows and trait names as columns . These are functional trait values for 8 traits at the species level for all trees used in the analyses. Traits are unit less as they are standardized , values are from Maynard et al 2022 Maynard, D.S., Bialic-Murphy, L., Zohner, C.M., Averill, C., Hoogen, J. van den, Ma, H., Mo, L., Smith, G.R., Aubin, I., Berenguer, E., Boonman, C.C.F., Catford, J., Cerabolini, B.E.L., Dias, A.S., González-Melo, A., Hietz, P., Lusk, C.H., Mori, A.S., Niinemets, Ü., Pillar, V.D., Rosell, J.A., Schurr, F.M., Sheremetev, S.N., Silva, A.C. da, Sosinski, Ê., Bodegom, P.M. van, Weiher, E., Bönisch, G., Kattge, J. & Crowther, T.W. (2022) Global relationships in tree functional traits. *Nature Communications*, **13**, 3185. The 8 traits are: *  Bark Thickness * Leaf phosphorus per mass  * Root Depth * Seed Dry Mass * Specific Leaf area * Stem conduit Diameter * Tree Height * Wood Density  2-Phylogenetic tree of used species REV_Pruned_tree.csv             This file contains a phylogenetic tree of trees used for analyses in newick format. Species names are spelled out.  3-Matrix of pixel species composition REV_Community_matrix.csv              This file has 3 columns, grid_id represents the id of the pixel in the base raster , present column that is coded 1 or 0 depending on whether the species in the accepted_bin column is present or absent in a given pixel.  Results and intermediate result files Files are required to run some of the scripts independently. They contain diversity metrics for different subsets of the data with the main results contained in REV_obs_results_200.csv. File names and structure including empty columns should not be changed to avoid problems rerunning the scripts.  All files contain a grid_id column this is the id of the pixel in the base raster and is needed to plot the maps, -These files will have a column per index computed with the base indices being phylogenetic diversity (pd), mean phylogenetic distance (mpd), functional divergence (raoq), functional richness (fd) and functional richness corrected by trait number (fdr). In this case phylogenetic indexes are measured in millions of years as that is the unit of the phylogenetic tree, functional metrics are unitless as they come from a PCA of the functional traits.  REV_obs_results.csv REV_obs_results_200.csv REV_obs_results_200_zvals.csv REV_obs_results_ANGIO_200.csv REV_obs_results_INV_200.csv -These files contain results from randomizations, they have a sample size column (n) that identifies the number of species, column metric that contains the metric being calculated abbreviations as above, and then each column has a summary statistic from the randomization including mean, median, standard deviation , minimum and maximum values.  REV_downsample_gatti.csv REV_downsample_gatti_200.csv REV_null_results.csv REV_null_results_200.csv REV_null_results_ANGIO_200.csv REV_null_results_INV_200.csv ## Code/Software All R scrips provided start with a call to packages specifically required by each one. Overall these scrips all require the tidyverse package and when mapping require the raster package. We provide all intermediate files in the results folder of the data section so that scripts can be run independently from each other.  ### List of Code files with description 1-Scripts to prepare the data have the prefix Prepare_data. Prepare_data_create_alpha_hulls.R [Generating alpha hull maps for each individual species based on presence information] Prepare_data_Create_community_matrix.R [Create community matrix by overlapping alpha hulls, selecting a resolution and converting to a matrix for downstream analyses] Prepare_data_GettingNeighborhoods.R [Getting neighbourhoods for each cell in the grid for downstream analyses] 2- Scripts to calculate diversity metrics including taxonomic, functional and phylogenetic richness and divergence have the prefix calc_diversity. calc_diversity_calc_Gatti.R [Subsampling to match proportions in the Gatti et al paper] calc_diversity_calc_null_PD_FD.R [Including null model of random assembly of communities] calc_diversity_calc_obs_PD_FD.R [To compute values for the observed dataset without subsampling] calc_diversity_calc_obs_PD_FD_angio_gym.R [To compute values separately for angiosperms and gymnsoperms] calc_diversity_subset_comm_matrix.R [Subsets the community matrix in different ways including the removal of invasives and the random subsetting] To subset dataset based on a maximum distance between cells containing samples of a given species [needs the three scripts to be used]:  calc_diversity_prep_community_matrix_traits.R, , calc_diversity_calc_obs_PD_FD_back.R 3-Scripts for downstream analyses: Final_shapley_value_estimation_CORRECT.R [To obtain correlates of diversity, model fit and variable contributions] Revisions_GEB_bootstrap.R [To compute GLS using bootstrap for the relation between latitude and functional and phylogenetic divergence, haversine.R needs to be loaded]