phenop: Multidimensional Analysis of Phenotypic Plasticity
https://img.shields.io/badge/R-%253E%253D%25204.0.0-blue
https://img.shields.io/badge/license-MIT-green
https://img.shields.io/badge/status-active-success
https://img.shields.io/github/issues/leonelstazione/phenop
https://img.shields.io/github/stars/leonelstazione/phenop
Overview
phenop is an R package providing novel methods for analyzing phenotypic plasticity across multiple traits and environmental variables, with special focus on insect-fungus host-pathogen systems. It implements original multidimensional plasticity indices and interaction analyses not available in other packages.
The package bridges the gap between ecological, evolutionary, and phenotypic studies by offering comprehensive tools for plasticity analysis in eco-evolutionary contexts.
Key Features
Multidimensional Plasticity Indices - Novel metrics for assessing plasticity across multiple traits
Host-Pathogen Interaction Analysis - Specialized methods for insect-fungus systems
Environmental Optimization - Find optimal conditions considering multiple traits
Reaction Norm Visualization - Advanced plotting for genotype-environment interactions
Meta-Analysis Tools - Comprehensive analysis of plasticity studies
Trade-off Analysis - Quantify trade-offs between plasticities of different traits
Data Simulation - Generate realistic data for plasticity studies
Installation From GitHub (Development Version)
if (!require("devtools")) install.packages("devtools")
# Install phenop from GitHub
devtools::install_github("leonelstazione/phenop")
Local Installation (from source)
# Download the package source and install
devtools::install_local("path/to/phenop")
Quick Start
# Load the package
library(phenop)
# Generate simulated plasticity data
sim_data <- simulate_plasticity_data(
n_genotypes = 10,
n_environments = 5,
n_traits = 3
)
# Perform G×E ANOVA for plasticity analysis
anova_results <- anova_plasticity(
data = sim_data,
response = "trait_value",
genotype = "genotype",
environment = "environment"
)
# Visualize reaction norms
plot_reaction_norm(
data = sim_data,
trait = "trait1",
genotype = "genotype",
environment = "environment"
)
# Calculate multidimensional plasticity index
mpi_results <- multidim_plasticity(
data = sim_data,
traits = c("trait1", "trait2", "trait3"),
environment = "environment",
genotype = "genotype"
)
Main Functions
Core Analysis Functions
multidim_plasticity() - Calculate Multidimensional Plasticity Index (MPI)
safe_multidim_plasticity() - Robust version with error handling
anova_plasticity() - G×E ANOVA for phenotypic plasticity
plasticity_tradeoffs() - Identify trade-offs between plasticities
plasticity_meta_analysis() - Meta-analysis of plasticity studies
Host-Pathogen Analysis
host_pathogen_interaction() - Analyze phenotypic plasticity in host-pathogen systems
host_pathogen_interaction_extended() - Comprehensive analysis with extended features
Environmental Optimization
optimize_multidim_environment() - Find optimal environmental conditions
environmental_optimization() - General environmental optimization
Visualization
plot_multidim_plasticity() - Visualize multidimensional plasticity
plot_reaction_norm() - Create reaction norm plots
plot_multidim_plasticity_extended() - Advanced SAFE visualizations
Data Management
simulate_plasticity_data() - Generate realistic simulated data
Multiple datasets - pheno_parameters, pheno_spatial, pheno_time_series
Package Structure
phenop/
├── R/ # Source code
│ ├── analyze.R # Statistical analysis functions
│ ├── multidim_plasticity.R # Multidimensional plasticity indices
│ ├── host_pathogen_interaction.R # Host-pathogen analysis
│ ├── visualize.R # Visualization functions
│ └── ... (25+ additional files)
├── data/ # Package datasets
│ ├── pheno_parameters.rda # Phenological parameters dataset
│ ├── pheno_spatial.rda # Spatial phenology data
│ └── pheno_time_series.rda # Time series data
├── tests/ # Test suite
│ └── testthat/ # Unit tests
├── vignettes/ # Tutorials and examples
│ ├── phenop_vignette.Rmd # Main tutorial
│ └── phenop_vignette_complete.Rmd # Complete demonstration
└── man/ # Documentation
Example Analysis
Complete Workflow Example
library(phenop)
library(ggplot2)
# Load example data
data("pheno_parameters")
# Analyze plasticity across environments
plasticity_results <- multidim_plasticity(
data = pheno_parameters,
traits = c("sos", "eos", "los", "ndvi_max"),
environment = "year",
genotype = "site"
)
# Visualize results
plot_multidim_plasticity(plasticity_results)
# Perform meta-analysis of plasticity
meta_results <- plasticity_meta_analysis(
data = plasticity_results,
effect_size = "plasticity_index",
study_id = "site"
)
# Analyze trade-offs
tradeoff_results <- plasticity_tradeoffs(
data = plasticity_results,
traits = c("sos", "eos", "los")
)
Host-Pathogen System Analysis
# Analyze insect-fungus interactions
host_pathogen_results <- host_pathogen_interaction(
data = fungi_insect_data,
host_trait = "host_size",
pathogen_trait = "infection_rate",
environment = "temperature"
)
# Extended analysis with multiple traits
extended_results <- host_pathogen_interaction_extended(
data = fungi_insect_data,
host_traits = c("host_size", "immune_response"),
pathogen_traits = c("infection_rate", "sporulation"),
environmental_gradient = "temperature"
)
Datasets Included
pheno_parameters
Size: ~1000 observations, 44 variables
Description: Comprehensive dataset of phenological parameters across multiple sites and species
Variables: Includes SOS, EOS, LOS, NDVI metrics, GPP, environmental variables, soil properties
Use: General plasticity analysis, environmental correlations
pheno_spatial
Size: 150 spatial features, 24 variables
Description: Spatial dataset with geographical and ecological context
Variables: Coordinates, elevation, climate, land cover, disturbance history
Use: Spatial analysis, landscape-scale plasticity studies
pheno_time_series
Size: Time series data with 29 variables
Description: Temporal observations of phenological metrics
Variables: Daily/seasonal measurements, vegetation indices, climate data
Use: Temporal trends, seasonality analysis, time-series plasticity
fungi_insect_data
Size: Simulated dataset for host-pathogen interactions
Description: Phenotypic plasticity in fungus-insect host-pathogen systems
Variables: Host traits, pathogen traits, environmental conditions
Use: Host-pathogen coevolution, infection dynamics
Technical Details
Dependencies
Imports:
dplyr (>= 1.0.0), ggplot2 (>= 3.4.0), lme4 (>= 1.1.0),
mgcv (>= 1.8.0), viridis (>= 0.6.0), patchwork (>= 1.1.0),
ggridges (>= 0.5.0), maps (>= 3.4.0), performance (>= 0.10.0),
FactoMineR (>= 2.4.0), cluster (>= 2.1.0), MASS (>= 7.3.0),
magrittr (>= 2.0.3), plotly (>= 4.10.0), sf, tidyr, stats, methods
System Requirements
R version >= 4.0.0
100MB disk space (primarily for example datasets)
Standard R installation capabilities
Performance
Optimized for datasets with up to 10^5 observations
Parallel processing capabilities for large analyses
Memory-efficient implementations for multidimensional calculations
Documentation Vignettes
# Access built-in tutorials
vignette("phenop_vignette", package = "phenop")
vignette("phenop_vignette_complete", package = "phenop")
Help System
?multidim_plasticity
?plot_reaction_norm
?pheno_parameters
# List all exported functions
ls("package:phenop")
Testing The package includes comprehensive tests covering:
Functionality verification
Input validation
Output structure checks
Edge case handling
Performance benchmarks
Run tests with:
devtools::test("phenop")
Contributing We welcome contributions! Please follow these steps:
Fork the repository on GitHub
Clone your fork locally
Create a branch for your feature (git checkout -b feature/amazing-feature)
Commit your changes (git commit -m 'Add amazing feature')
Push to the branch (git push origin feature/amazing-feature)
Open a Pull Request
Contribution Guidelines
Follow the tidyverse style guide
Add tests for new functionality
Update documentation accordingly
Ensure compatibility with existing functions
Citation
If you use phenop in your research, please cite:
@software{phenop_package,
title = {phenop: Multidimensional Analysis of Phenotypic Plasticity},
author = {Leonel Stazione},
year = {2026},
url = {https://github.com/leonelstazione/phenop},
note = {R package version 0.1.0}
}
License This package is licensed under the MIT License. See the LICENSE file for details.
Bug Reports and Issues Please report bugs, issues, or feature requests on the GitHub Issues page.
Contact Author: Leonel Stazione Email: leonelstazione@hotmail.com GitHub: leonelstazione
Acknowledgments
This package was developed as part of research on phenotypic plasticity in insect-fungus systems. Special thanks to contributors and testers.