SpecTraits





SpecTraits is a Shiny application designed to predict and build models for inferring leaf traits using spectroscopy

SpecTraits offers four main functionalities:

Predict

Predict leaf traits using user-provided Partial Least Squares Regression coefficients or Radiative Transfer Models

Build

Build Partial Least Squares Regression (PLSR) models from a user-defined dataset of leaf traits and spectra

Pre-process

Apply basic pre-processing methods on leaf spectra (e.g., resampling, transformations).

Data

Download curated datasets that integrate leaf traits and spectra

Predict leaf traits using leaf spectra



Predict leaf traits by uploading a .csv file that contains leaf spectra.

SpecTraits provides two ways for predicting leaf traits: i) by importing PLSR coefficients, and ii) by using radiative transfer models (RTM).

The spectra file most contain wavelengths (nm) as columns and samples as rows, a first column should be named ID.

For PLRS coefficients predictions, both the spectra and coefficients files should share the same columns name. For RTM predictions, the spectra file should contain columns between 400 and 2400 nm at 1 nm spacing.

Predicted traits can be validate by uploading a .csv file that contains columns of leaf traits and the exact number of samples as the spectra file.

An example of files containing leaf spectra and traits can be downloaded here.



Step 1 - Import spectra file


Step 2 - Select method


Step 3 - Apply method


Step 4 - External validation (optional)



Step 5 - Export predicted traits

Download

Build Partial Least Squares Regression (PLSR) models



Build PLSR models by uploading .csv files that contains leaf spectra and leaf trait.

The spectra file most contain wavelengths (nm) as columns and samples as rows. The first column should be named ID.

The leaf trait file most contain traits as columns and samples as rows, The first column should also be named ID.

SpecTraits provide a way to estimate the optimal number of components using machine learning frameworks.

SpecTraits also provide a way to build and export PLSR models while assessing their performance.

An example of files containing leaf spectra and traits can be downloaded here



Step 1 - Import files


Step 2 - Define data split approach


Step 3 - Evaluate the optimal number of components


Step 4 - Run final PLSR models


Step 5 - Export models



Download


PLSR Coefficients
Variable of Importance of Projection


Training
Testing

Pre-process leaf spectra



Upload a spectra file and select a preprocessing method to apply.

The spectra file (.csv) must contain wavelengths (nm) as columns and samples as rows, with a first column named ID.



Step 1 - Import spectra file


Step 2 - Select preprocessing method


Step 3 - Configure settings

Define the target spectral spacing and range for FWHM-based resampling

Spectra will be resampled using a Gaussian model that uses the Full Width at Half Maximum (FWHM) of the instrument bands (spectrolab; Meireles et al. 2022).

Define parameters for Savitzky-Golay smoothing filter

The filter smooths spectra using a polynomial fit within a moving window.

Window size must be an odd number ≥ 3. Derivative order: 0 = smoothing only, 1 = first derivative, etc.

Select a transformation to apply to the spectra

Summed-wavelet spectra using continuous wavelet transform (CWT package)
Derivative transformation with specified band window and scale order
Vector normalization using Euclidean norm (2-Norm). No parameters needed.

Step 4 - Run preprocessing

Apply FWHM-based spectral resampling

Apply Savitzky-Golay smoothing filter to spectra

Apply spectral transformation


Step 5 - Export processed spectra

Download the processed spectra as a .csv file.

Download

Original Spectra

Processed Spectra


About SpecTraits


Version 0.1 | GitHub


Leaf spectroscopy has emerged as a powerful tool for the rapid, non-destructive estimation of leaf traits. However, deriving trait information from spectral data is often not standardized across research studies and can be technically demanding, creating substantial barriers for users without expertise.

SpecTraits was developed to bridge this gap by providing an integrated, user-friendly platform that consolidates tools for deriving leaf traits from spectral data. Our goal is to make leaf spectroscopy more accessible to researchers and plant scientists who use leaves for phenotyping (e.g., ecologists, agronomists, and evolutionary biologists), enabling them to fully leverage the potential of spectroscopy to advance the understanding of plant evolution and function.


If you use SpecTraits in your research, please cite:

@software{SpecTraits,
  author = {Guzmán, J. Antonio and Cavender-Bares, Jeannine},
  title = {SpecTraits: A Shiny Application for Leaf Trait Prediction Using Spectroscopy},
  year = {2026},
  version = {0.1},
  url = {https://github.com/ASCEND-BII/SpecTraits}
}

The development of SpecTraits was supported by:

NSF DBI: 2021898


For questions, bug reports, or feature requests, please visit our GitHub Issues page or contact the development team.


Last updated: 2026-04-01