Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

talmolab/sleap-roots

Open more actions menu

Repository files navigation

sleap-roots

CI codecov Release PyPI

Analysis tools for SLEAP-based plant root phenotyping.

📖 Documentation | 📊 HackMD Trait Reference | 📝 Paper


📦 Installation

For End Users

pip install sleap-roots

For Development (Recommended: uv)

uv is a fast Python package manager (10-100x faster than conda):

# Install uv (one-time setup)
curl -LsSf https://astral.sh/uv/install.sh | sh

# Clone and setup
git clone https://github.com/talmolab/sleap-roots && cd sleap-roots
uv sync

# Run commands
uv run pytest tests/
uv run black sleap_roots tests

Why uv? Environment setup in ~30 seconds (vs 10-15 minutes with conda) with reproducible builds via lockfile.

Alternative: conda

conda env create -f environment.yml
conda activate sleap-roots

🌱 Usage

Trait pipelines supported:

  • DicotPipeline – Primary + lateral roots (e.g. soy, canola)
  • YoungerMonocotPipeline – Primary + crown roots (e.g. early rice)
  • OlderMonocotPipeline – Crown roots only (e.g. later rice)
  • PrimaryRootPipeline – Primary root only
  • LateralRootPipeline – Lateral roots only
  • MultipleDicotPipeline – Multi-plant dicot setup (batch from a single image)

🔁 Example: Dicot Pipeline

1. Compute traits for a single plant

import sleap_roots as sr

series = sr.Series.load(
    series_name="919QDUH",
    h5_path="tests/data/canola_7do/919QDUH.h5",
    primary_path="tests/data/canola_7do/919QDUH.primary.slp",
    lateral_path="tests/data/canola_7do/919QDUH.lateral.slp"
)

pipeline = sr.DicotPipeline()
traits = pipeline.compute_plant_traits(series, write_csv=True)

2. Compute traits for a batch

paths = sr.find_all_slp_paths("tests/data/soy_6do")
plants = sr.load_series_from_slps(paths, h5s=True)

pipeline = sr.DicotPipeline()
batch_df = pipeline.compute_batch_traits(plants, write_csv=True)

3. Use a single trait utility

from sleap_roots.lengths import get_root_lengths

pts = series.get_primary_points(frame_idx=0)
lengths = get_root_lengths(pts)

👁️ Prediction Viewer

Validate SLEAP predictions before computing traits with an interactive HTML viewer:

sleap-roots viewer predictions/ --output viewer.html

Features keyboard navigation, confidence scores, and multiple output modes. See the Prediction Viewer Guide for details.

🧬 Trait-Extractor Service

Turn sleap-roots-predict per-scan output into a sleap-roots-contracts ResultEnvelope for Bloom write-back:

python -m trait_extractor <input_dir> <output_dir>

The trait_extractor/ service package lives at the repo root and is intentionally not shipped in the sleap-roots wheel. It is also published as a container image, ghcr.io/talmolab/sleap-roots-trait-extractor. See the Trait-Extractor Service guide for docker run usage, the tag scheme, and the ScanMetadata sidecar schema.


📓 Notebooks & Tutorials

Explore tutorials under notebooks/:

cd notebooks
jupyter lab

You can use the test data in tests/data or replace it with your own.


🧪 Development

Using uv (Recommended)

# 1. Clone the repository
git clone https://github.com/talmolab/sleap-roots && cd sleap-roots

# 2. Install dependencies (creates .venv automatically)
uv sync

# 3. Run tests
uv run pytest tests/

# 4. Format code
uv run black sleap_roots tests

# 5. Check docstrings
uv run pydocstyle sleap_roots/

Adding dependencies:

uv add numpy  # Add runtime dependency
uv add --group dev pytest  # Add dev dependency

Using conda (Alternative)

# 1. Clone the repository
git clone https://github.com/talmolab/sleap-roots && cd sleap-roots

# 2. Create environment
conda env create -f environment.yml
conda activate sleap-roots

# 3. Run tests
pytest tests/

📖 Trait Reference

See the latest trait documentation here:

👉 HackMD: sleap-roots Trait Docs


🤝 Acknowledgments

Created by the Talmo Lab and Busch Lab at the Salk Institute, as part of the Harnessing Plants Initiative.

Contributors

  • Elizabeth Berrigan
  • Lin Wang
  • Andrew O'Connor
  • Talmo Pereira

Citation

E.M. Berrigan et al., "Fast and Efficient Root Phenotyping via Pose Estimation", Plant Phenomics.
DOI: 10.34133/plantphenomics.0175

About

Analysis tools for SLEAP-based plant root phenotyping.

Resources

Stars

Watchers

Forks

Releases

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.