MorphoStat is a modern, interactive R Shiny application for statistical morphological analysis using geometric morphometrics. It provides a comprehensive suite of tools for analyzing landmark-based morphometric data with publication-ready visualizations.
- Multiple file formats: Morphologika (.txt), TPS (.tps), NTS (.nts), FCSV (3D Slicer)
- Project save/load: Save and restore complete analysis sessions (.rds)
- Auto-detection: Automatically detects 2D/3D landmark configurations
- Generalized Procrustes Analysis (GPA): Removes size, position, and rotation effects
- Principal Component Analysis (PCA): Identifies major axes of shape variation
- PERMANOVA: Tests for significant shape differences between groups
- PERMDISP: Tests for homogeneity of group dispersions
- Allometry Analysis: Evaluates shape-size relationships
- Pairwise Comparisons: Multiple group comparisons with distance metrics
- PCA Plots: 2D colored, black & white, and 3D scatter plots
- Shape Deformations: Mean, min, and max PC shape visualization
- Procrustes Superimposition: View all specimens or individual samples
- Interactive 3D WebGL Views: Rotate wireframes in full 3D morphospace using the mouse (Procrustes & PC Deformation)
- Wireframe Diagrams: Multiple anatomical views (dorsal, sagittal, coronal)
- Statistical Plots: Centroid size boxplots, allometry regression, eigenvalue scree plots
- Outlier Detection: Identify potential outliers based on Procrustes distance
- Custom group colors: Assign specific colors to groups
- Group renaming: Rename groups for publication
- Data spread visualization: Confidence ellipses, convex hulls, density contours
- Diagram transformations: Flip and rotate shape visualizations
- Export options: PNG and SVG formats with customizable dimensions
- Branded interface: Custom logo displayed in the title bar and About section
- Whisker representation: Choose between IQR, Min/Max, Percentile, or Std Deviation for box plots (v1.1)
- Significance bars: Pairwise p-value / star annotations on statistical plots with t-test or Wilcoxon (v1.1)
- Extended plot settings: Custom titles, axis labels, themes, coordinate flip, transparency, and size controls (v1.1)
Make sure you have R (>= 4.0.0) installed. You'll also need the following R packages:
install.packages(c(
"shiny",
"shinydashboard",
"bslib",
"shinyjs",
"ggplot2",
"DT",
"colourpicker",
"scatterplot3d",
"rgl",
"plotly"
))
# Bioconductor/specialized packages
install.packages("geomorph")
install.packages("RRPP")
install.packages("Morpho")
install.packages("vegan")
install.packages("rstatix")- Clone this repository:
git clone https://github.com/Dinuka0001/MorphoStat.git
cd MorphoStat- Open R or RStudio and run:
shiny::runApp("App.R")Or run directly:
shiny::runApp("path/to/morphostat")- Select input type: Choose your data format (Morphologika, TPS, NTS, or FCSV)
- Upload data: Use the file input to upload your landmark data
- Configure wireframe (optional): Define landmark connections
- Run analysis: Click "Run Analysis" to perform GPA, PCA, and statistical tests
- Explore results: Navigate through tabs to view plots and statistics
- Export: Download results, plots, or save the entire project
[individuals]
10
[landmarks]
48
[dimensions]
3
[names]
Specimen_01
...
[labels]
Group_A
...
[rawpoints]
12.345 23.456 5.678
...
LM=48
12.345 23.456
13.456 24.567
...
ID=Specimen_01
Define landmark connections as comma-separated pairs:
1,2, 2,3, 3,4, 4,5, 5,1
Coming soon
| Method | Purpose | Package |
|---|---|---|
| GPA | Procrustes superimposition | geomorph |
| PCA | Shape variation analysis | geomorph |
| PERMANOVA | Group difference testing | vegan, RRPP |
| PERMDISP | Dispersion homogeneity | vegan |
| Allometry | Size-shape relationship | RRPP |
If you use MorphoStat in your research, please cite:
Adasooriya, D. (2026). MorphoStat: An Interactive R Shiny Application for
Statistical Morphological Analysis. Version 1.1.0. © 2026 Dinuka Adasooriya.
Also cite the underlying R packages:
- Adams DC, Collyer ML, Kaliontzopoulou A. 2024. Geomorph: Software for geometric morphometric analyses. R package version 4.0.8.
- Oksanen J, et al. 2022. vegan: Community Ecology Package. R package version 2.6-4.
- GitHub: https://github.com/Dinuka0001/MorphoStat
- Online App: https://dinuka-morphostat.share.connect.posit.cloud/
Box Plot — Whisker Representation Control
- Added a new Whiskers Representation selector for Centroid Size and Dispersion plots
- Four modes available: Default (1.5× IQR), Min/Max, Percentiles (5th–95th), and Std Deviation (Mean ± SD)
- Uses a statistically correct
stat_summaryapproach — fully compatible with all ggplot2 versions
Box Plot — Significance Bars
- Added pairwise statistical significance annotations to Centroid Size and Dispersion plots
- Choose between t-test or Wilcoxon rank-sum test
- Label style options: star notation (
***,**,*,ns) or exact p-values - Controls for bracket spacing, tip length, and text size
- Significance bars carried through to downloaded plot files
Box Plot — Expanded Aesthetics & Layout
- Fill transparency, box line width, and box width sliders
- Point overlay controls: individual jitter width, alpha, and point size
- Custom axis labels and title for Centroid Size, Dispersion, and Eigenvalues plots
- Theme selector: Classic, Minimal, BW, Light
- Coordinate flip toggle
- Show/hide legend toggle
Eigenvalues Plot — Enhancements
- Customizable bar colour, cumulative line colour
- Bar transparency and width sliders
- Cumulative line width slider
- Theme selector + coordinate flip
2D PCA Plot — Grid Lines Toggle
- Fixed the Show Grid Lines checkbox to correctly show/hide grid lines on 2D scatter plots (both colour and black & white modes)
- Grid state is now preserved in downloaded PNG/SVG exports
- SD whisker
[object Object]: Rewrote SD whisker logic usingstat_summary(fun.data = whisker_stat_fun(...), geom = "boxplot")— the previousaggregate()matrix approach caused serialization errors in Shiny - Percentile whisker not rendering:
geom_boxplotwas incorrectly passedfun.data, which it does not support; fixed to usestat_summaryconsistently across all whisker modes - PCA grid lines not toggling:
morphostat_plot_theme()setspanel.grid.major.x = element_blank()internally; overriding withpanel.grid.majorwas insufficient — fixed by explicitly overridingpanel.grid.major.xandpanel.grid.major.yindividually - Principal Component Analysis (PCA) — 3D interactive (WebGL) wireframe
- Downloaded PCA plots missing grid:
apply_pca_download_theme()usedtheme_classic()(no grid by default) with only a grid-removal branch — added a grid-addition branch that respects the UI checkbox - Centroid Size statistics showing raw variable names:
aggregate()formula interface was used with reactive values as column names, producing labels likerv$centroid_sizein output — replaced with named data frame columns - Download buttons for statistical plots not working: Handlers
download_stat_plot_png,download_stat_plot_svg, anddownload_all_stat_plotswere missing from the server; back-ported from backup
- Generalized Procrustes Analysis (GPA) with full landmark superimposition
- Principal Component Analysis (PCA) — 2D colour plot, 2D black & white
- Data spread overlays: confidence ellipses, convex hulls, 2D density contours
- PERMANOVA and PERMDISP group difference testing
- Allometry regression (log centroid size vs PC1)
- Pairwise group comparisons with distance metrics
- Centroid Size, Dispersion, Eigenvalues, and Allometry statistical plots
- Wireframe landmark connection diagrams (dorsal, sagittal, coronal, custom views)
- Shape deformation visualizations (mean, min, max PC)
- Procrustes superimposition overlay plots
- Outlier detection based on Procrustes distance
- Group renaming and custom per-group colour assignment
- Multiple input formats: Morphologika (.txt), TPS (.tps), NTS (.nts), FCSV (3D Slicer)
- Project save/load (.rds)
- Full download suite: PNG, SVG, CSV, ZIP (all statistics), ZIP (all plots)
Dinuka Adasooriya
Yonsei University College of Dentistry
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- The R Shiny team for the excellent framework
- The geomorph package authors for their comprehensive morphometrics tools
- The vegan package authors for multivariate analysis tools
