Winter warming from climate change threatens the global hotspot of salamander diversity
收藏资源简介:
Data and code supporting: Winter warming from climate change endangers the global hotspot of salamander diversity. Important READ ME instructions: Code descriptions: Dormancy_inactive_cody.py is a Python script that calculates spatial patterns of lipid consumption during winter dormancy across the species’ range. The code was written and tested in Python 3.9.14, and we only verified functionality with this version; we therefore recommend running it with Python 3.9.x to avoid compatibility issues. Installing Python To run the script, you first need a working Python installation: Go to the official Python website:https://www.python.org/downloads/ Download the installer for your operating system (Windows, macOS, or Linux) for Python 3.9 (or the closest available 3.9.x release). Run the installer and, on Windows, ensure the option “Add Python to PATH” is checked. Complete the installation following the on-screen instructions. On most modern computers, this is a straightforward process and finishes quickly. Alternatively, you may install Python via a scientific distribution such as Anaconda (https://www.anaconda.com) and create a dedicated environment with Python 3.9. Required input data The script requires gridded climate data in ASCII raster (.asc) format as described in the Methods. Use the climate .asc files provided in the associated data repository and ensure that: The .asc files are downloaded and stored locally (e.g. in a data/ or climate/ directory). The file paths in Dormancy_inactive_cody.py point to the correct location of these .asc files (edit the input paths near the top of the script if necessary). How to run the script You can run the script either from a command-line interface (Terminal, PowerShell) or from an IDE such as Spyder: Option 1 – Terminal / command line Open a Terminal (macOS/Linux) or Command Prompt / PowerShell (Windows). Navigate to the directory containing Dormancy_inactive_cody.py, for example: cd /path/to/your/code Run the script with Python 3.9: python Dormancy_inactive_cody.py (If you have multiple Python versions installed, you may need python3 instead of python.) Option 2 – Spyder or similar IDE Open Spyder (e.g. from an Anaconda installation). Open the file Dormancy_inactive_cody.py in the editor. Make sure the working directory in Spyder is set to the folder containing the script and input .asc files. Click Run to execute the script. Expected output and runtime When executed successfully, Dormancy_inactive_cody.py produces ASCII raster (.asc) files estimating the amount of lipids consumed across the range map over winter dormancy. These output rasters are written to the output directory specified in the script (see comments in the code for the output path). On a typical workstation, the full run generally completes in under one hour, depending on hardware and the spatial extent and resolution of the input climate data. Reproducing figures Instructions for reproducing the figures in the manuscript from the model outputs are provided in the Methods section of the main text (and/or the accompanying analysis scripts, as referenced there). lipids_analysis_summary_data.py: This script processes ASCII raster maps representing the proportion of lipids lost during winter dormancy across the Plethodon jordani species complex. It imports climate-derived lipid depletion maps, reads the species’ range map, and calculates summary statistics for each scenario, including (1) the number and proportion of grid cells with fully depleted lipid stores, (2) the mean proportion of lipids lost across the range, and (3) the standard deviation of lipid depletion. The script outputs a CSV file (winter_dormancy_summary_stats.csv) containing these summary metrics. It was written in Python and uses standard scientific libraries (numpy, pandas, glob, and matplotlib). lipid_analysis_ms.R: This script implements a logistic regression analysis to test whether the proportion of lipids consumed during winter dormancy predicts the probability of species presence across the landscape. The workflow includes data import, cleaning, model fitting, result export, and visualization of predicted relationships.vco2_upload.R: This script conducts mixed-effects modeling and visualization of salamander metabolic rates (VCO₂) across temperature treatments, seasons, and elevations. It imports metabolic data, fits linear mixed models using lme4, performs post-hoc comparisons with emmeans, and generates predicted effects using ggeffects The script produces publication-quality figures showing seasonal and elevational patterns in log-transformed VCO₂, as well as analyses of winter mass retention relative to metabolic rates. Output files include ANOVA tables and several PNG figures saved to user-specified directories. boxplot_histology_elevation_season.R: This script generates boxplots of histological traits across seasons and elevations. It imports histological datasets (GutDiameter.csv, SkinThickness.csv, and VillusNumber.csv) and uses ggplot2 to visualize variation in gut diameter, skin thickness, and villus number. For each dataset, the script produces boxplots by season and faceted boxplots by elevation, allowing comparison of seasonal patterns within and across elevations. Figures are rendered in the R plotting window and can be saved by the user for inclusion in manuscripts (e.g., Fig. 2). Required packages include ggplot2. sensitivity_lipid_analysis.R: This script conducts logistic regression analyses to examine how the proportion of lipids consumed influences species presence across a range of assumed lipid reserve scenarios. It imports presence and pseudoabsence datasets corresponding to different lipid reserve values, combines and formats these data, and fits a binomial generalized linear model (glm) with an interaction between lipid consumption and lipid reserves. Model coefficients are exported as a CSV file. The script uses ggeffects to generate predicted relationships and ggplot2 to produce a publication-quality figure showing predicted probability of presence as a function of lipid consumption across reserve scenarios. Output includes a regression summary file (lipid_reserves_logistic_regression_output.csv) and a PNG figure (comparing_reserves_logistic_fig.png). Required packages include sjPlot, effects, ggplot2, ggeffects, and dplyr.reciprocal_transplant_elevation_v2.R: This script performs an in silico reciprocal transplant analysis to compare predicted winter metabolic rates of salamanders from high- and low-elevation populations under alternative thermal environments. It imports metabolic rate data to fit elevation-specific linear models relating log-transformed VCO2 to temperature and body mass, then applies these equations to environmental temperature records from field logger data. The script generates predicted metabolic rates for high- and low-elevation salamanders under both native and transplanted temperature regimes, summarizes these predictions, and produces boxplots comparing metabolic distributions across elevation and metabolic scenarios. Output includes boxplots displayed in the R plotting window and summary statistics of predicted metabolic rates by elevation and metabolic category. Required packages include base R functions only. sensitivity_analysis_predicting_beyond_empirical_range.R: This script evaluates whether metabolic rate can be reliably predicted outside the empirical temperature range used to fit the model. It imports VO2 data, fits linear mixed-effects models relating log-transformed VO2 to temperature and body mass using lme4, and compares a full model fit across 6–24°C with a reduced model fit only across 12–24°C. The reduced model is then used to predict VO2 at 6°C, allowing assessment of extrapolation accuracy. The script calculates summary metrics of predictive performance, including RMSE, MAE, and R2, and uses ggplot2 to generate a figure comparing observed versus predicted VO2 at 6°C. It also fits a simple linear model to quantify the relationship between observed and predicted values. Output includes printed model performance statistics in the R console and a plot displayed in the R plotting window. Required packages include lme4, dplyr, and ggplot2.



