sleap-roots


Namesleap-roots JSON
Version 0.0.9 PyPI version JSON
download
home_pageNone
SummaryAnalysis tools for SLEAP-based plant root phenotyping.
upload_time2024-04-23 18:33:54
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseBSD-3-Clause
keywords sleap plants roots phenotyping
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # sleap-roots

[![CI](https://github.com/talmolab/sleap-roots/actions/workflows/ci.yml/badge.svg)](https://github.com/talmolab/sleap-roots/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/talmolab/sleap-roots/branch/main/graph/badge.svg)](https://codecov.io/gh/talmolab/sleap-roots)
[![Release](https://img.shields.io/github/v/release/talmolab/sleap-roots?label=Latest)](https://github.com/talmolab/sleap-roots/releases/)
[![PyPI](https://img.shields.io/pypi/v/sleap-roots?label=PyPI)](https://pypi.org/project/sleap-roots)

Analysis tools for [SLEAP](https://sleap.ai)-based plant root phenotyping.

## Installation
```
pip install sleap-roots
```

If you are using conda (recommended):
```
conda create -n sleap-roots python=3.9
conda activate sleap-roots
pip install sleap-roots
```

## Usage

Detailed trait documentation per pipeline is available here:
[sleap-roots HackMD](https://hackmd.io/DMiXO2kXQhKH8AIIcIy--g)


### `DicotPipeline`

**1. Computing traits for a single plant:**

```py
import sleap_roots as sr

plant = sr.Series.load(
    "tests/data/canola_7do/919QDUH.h5",
    # Specify the names of the primary and lateral roots for trait calculation
    primary_name="primary",
    lateral_name="lateral"
)
pipeline = sr.DicotPipeline()
traits = pipeline.compute_plant_traits(plant, write_csv=True)
```

**2. Computing traits for a batch of plants:**

```py
import sleap_roots as sr

plant_paths = sr.find_all_series("tests/data/soy_6do")
plants = [
    sr.Series.load(
        plant_path,
        # Specify the names of the primary and lateral roots for trait calculation
        primary_name="primary",
        lateral_name="lateral",
    ) for plant_path in plant_paths]

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

**3. Computing individual traits:**

```py
import sleap_roots as sr
import numpy as np
import numpy as np
# Import utility for combining primary and lateral root points
from sleap_roots.points import get_all_pts_array

plant = sr.Series.load(
    "tests/data/canola_7do/919QDUH.h5",
    primary_name="primary",
    lateral_name="lateral"
)

frame_index = 0
primary_pts = plant.get_primary_points(frame_index)
lateral_pts = plant.get_lateral_points(frame_index)
pts = get_all_pts_array(primary_pts, lateral_pts)
convex_hull = sr.convhull.get_convhull(pts)
```

### `YoungerMonocotPipeline`

**1. Computing traits for a single plant:**

```py
import sleap_roots as sr

plant = sr.Series.load(
    "tests/data/rice_3do/0K9E8BI.h5",
    primary_name="primary",
    lateral_name="crown"
)
pipeline = sr.YoungerMonocotPipeline()
traits = pipeline.compute_plant_traits(plant, write_csv=True)
```

**2. Computing traits for a batch of plants:**

```py
import sleap_roots as sr

plant_paths = sr.find_all_series("tests/data/rice_3do")
plants = [
    sr.Series.load(
        plant_path,
        primary_name="primary",
        lateral_name="crown"
    ) for plant_path in plant_paths]

pipeline = sr.YoungerMonocotPipeline()
all_traits = pipeline.compute_batch_traits(plants, write_csv=True)
```

**3. Computing individual traits:**

```py
import sleap_roots as sr
import numpy as np
from sleap_roots.points import get_all_pts_array

plant = sr.Series.load(
    "tests/data/rice_3do/0K9E8BI.h5",
    primary_name="primary",
    lateral_name="crown"
)

frame_index = 0
primary_pts = plant.get_primary_points(frame_index)
lateral_pts = plant.get_lateral_points(frame_index)
pts = get_all_pts_array(primary_pts, lateral_pts)
convex_hull = sr.convhull.get_convhull(pts)
```

## Tutorials
Jupyter notebooks are located in this repo at `sleap-roots/notebooks`.

To use them, activate your conda environment which includes JupyterLab (recommended):
```
conda activate sleap-roots
```

Clone this repository if you haven't already:
```
git clone https://github.com/talmolab/sleap-roots.git && cd sleap-roots
```

Then you can change directories to the location of the notebooks, and open Jupyter Lab:
```
cd notebooks
jupyter lab
```

Go through the commands in the notebooks to learn about each pipeline. 
You can use the test data located at `tests/data` or copy the notebooks elsewhere for use with your own data!


## Development
For development, first clone the repository:
```
git clone https://github.com/talmolab/sleap-roots && cd sleap-roots
```

Then, to create a **new conda environment** and install the package in editable mode:
```
conda env create -f environment.yml
```
This will create a conda environment called `sleap-roots`.

If you have an **existing conda environment** (such as where you installed SLEAP), you
can just install in editable mode directly. First, activate your environment and then:
```
pip install -e ".[dev]"
```
*Note:* The `[dev]` makes sure that the development-only dependencies are also
installed.

To **start fresh**, just delete the environment:
```
conda env remove -n sleap-roots
```

To **run tests**, first activate the environment:
```
conda activate sleap-roots
```
Then run `pytest` with:
```
pytest tests
```

## Acknowledgments

This repository was created by the [Talmo Lab](https://talmolab.org) and [Busch Lab](https://busch.salk.edu) at the Salk Institute for Biological Studies as part of the [Harnessing Plants Initiative](https://www.salk.edu/harnessing-plants-initiative/).

### Contributors

- Elizabeth Berrigan
- Lin Wang
- Talmo Pereira

### Citation

E.M. Berrigan, L. Wang, H. Carrillo, K. Echegoyen, M. Kappes, J. Torres, A. Ai-Perreira, E. McCoy, E. Shane, C.D. Copeland, L. Ragel, 
C. Georgousakis, S. Lee, D. Reynolds, A. Talgo, J. Gonzalez, L. Zhang, A.B. Rajurkar, M. Ruiz, E. Daniels, L. Maree, S. Pariyar, W. Busch, T.D. Pereira.  
"Fast and Efficient Root Phenotyping via Pose Estimation", *Plant Phenomics* 0: DOI:[10.34133/plantphenomics.0175](https://doi.org/10.34133/plantphenomics.0175).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "sleap-roots",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "sleap, plants, roots, phenotyping",
    "author": null,
    "author_email": "Elizabeth Berrigan <eberrigan@salk.edu>, Lin Wang <linwang@salk.edu>, Talmo Pereira <talmo@salk.edu>",
    "download_url": null,
    "platform": null,
    "description": "# sleap-roots\n\n[![CI](https://github.com/talmolab/sleap-roots/actions/workflows/ci.yml/badge.svg)](https://github.com/talmolab/sleap-roots/actions/workflows/ci.yml)\n[![codecov](https://codecov.io/gh/talmolab/sleap-roots/branch/main/graph/badge.svg)](https://codecov.io/gh/talmolab/sleap-roots)\n[![Release](https://img.shields.io/github/v/release/talmolab/sleap-roots?label=Latest)](https://github.com/talmolab/sleap-roots/releases/)\n[![PyPI](https://img.shields.io/pypi/v/sleap-roots?label=PyPI)](https://pypi.org/project/sleap-roots)\n\nAnalysis tools for [SLEAP](https://sleap.ai)-based plant root phenotyping.\n\n## Installation\n```\npip install sleap-roots\n```\n\nIf you are using conda (recommended):\n```\nconda create -n sleap-roots python=3.9\nconda activate sleap-roots\npip install sleap-roots\n```\n\n## Usage\n\nDetailed trait documentation per pipeline is available here:\n[sleap-roots HackMD](https://hackmd.io/DMiXO2kXQhKH8AIIcIy--g)\n\n\n### `DicotPipeline`\n\n**1. Computing traits for a single plant:**\n\n```py\nimport sleap_roots as sr\n\nplant = sr.Series.load(\n    \"tests/data/canola_7do/919QDUH.h5\",\n    # Specify the names of the primary and lateral roots for trait calculation\n    primary_name=\"primary\",\n    lateral_name=\"lateral\"\n)\npipeline = sr.DicotPipeline()\ntraits = pipeline.compute_plant_traits(plant, write_csv=True)\n```\n\n**2. Computing traits for a batch of plants:**\n\n```py\nimport sleap_roots as sr\n\nplant_paths = sr.find_all_series(\"tests/data/soy_6do\")\nplants = [\n    sr.Series.load(\n        plant_path,\n        # Specify the names of the primary and lateral roots for trait calculation\n        primary_name=\"primary\",\n        lateral_name=\"lateral\",\n    ) for plant_path in plant_paths]\n\npipeline = sr.DicotPipeline()\nall_traits = pipeline.compute_batch_traits(plants, write_csv=True)\n```\n\n**3. Computing individual traits:**\n\n```py\nimport sleap_roots as sr\nimport numpy as np\nimport numpy as np\n# Import utility for combining primary and lateral root points\nfrom sleap_roots.points import get_all_pts_array\n\nplant = sr.Series.load(\n    \"tests/data/canola_7do/919QDUH.h5\",\n    primary_name=\"primary\",\n    lateral_name=\"lateral\"\n)\n\nframe_index = 0\nprimary_pts = plant.get_primary_points(frame_index)\nlateral_pts = plant.get_lateral_points(frame_index)\npts = get_all_pts_array(primary_pts, lateral_pts)\nconvex_hull = sr.convhull.get_convhull(pts)\n```\n\n### `YoungerMonocotPipeline`\n\n**1. Computing traits for a single plant:**\n\n```py\nimport sleap_roots as sr\n\nplant = sr.Series.load(\n    \"tests/data/rice_3do/0K9E8BI.h5\",\n    primary_name=\"primary\",\n    lateral_name=\"crown\"\n)\npipeline = sr.YoungerMonocotPipeline()\ntraits = pipeline.compute_plant_traits(plant, write_csv=True)\n```\n\n**2. Computing traits for a batch of plants:**\n\n```py\nimport sleap_roots as sr\n\nplant_paths = sr.find_all_series(\"tests/data/rice_3do\")\nplants = [\n    sr.Series.load(\n        plant_path,\n        primary_name=\"primary\",\n        lateral_name=\"crown\"\n    ) for plant_path in plant_paths]\n\npipeline = sr.YoungerMonocotPipeline()\nall_traits = pipeline.compute_batch_traits(plants, write_csv=True)\n```\n\n**3. Computing individual traits:**\n\n```py\nimport sleap_roots as sr\nimport numpy as np\nfrom sleap_roots.points import get_all_pts_array\n\nplant = sr.Series.load(\n    \"tests/data/rice_3do/0K9E8BI.h5\",\n    primary_name=\"primary\",\n    lateral_name=\"crown\"\n)\n\nframe_index = 0\nprimary_pts = plant.get_primary_points(frame_index)\nlateral_pts = plant.get_lateral_points(frame_index)\npts = get_all_pts_array(primary_pts, lateral_pts)\nconvex_hull = sr.convhull.get_convhull(pts)\n```\n\n## Tutorials\nJupyter notebooks are located in this repo at `sleap-roots/notebooks`.\n\nTo use them, activate your conda environment which includes JupyterLab (recommended):\n```\nconda activate sleap-roots\n```\n\nClone this repository if you haven't already:\n```\ngit clone https://github.com/talmolab/sleap-roots.git && cd sleap-roots\n```\n\nThen you can change directories to the location of the notebooks, and open Jupyter Lab:\n```\ncd notebooks\njupyter lab\n```\n\nGo through the commands in the notebooks to learn about each pipeline. \nYou can use the test data located at `tests/data` or copy the notebooks elsewhere for use with your own data!\n\n\n## Development\nFor development, first clone the repository:\n```\ngit clone https://github.com/talmolab/sleap-roots && cd sleap-roots\n```\n\nThen, to create a **new conda environment** and install the package in editable mode:\n```\nconda env create -f environment.yml\n```\nThis will create a conda environment called `sleap-roots`.\n\nIf you have an **existing conda environment** (such as where you installed SLEAP), you\ncan just install in editable mode directly. First, activate your environment and then:\n```\npip install -e \".[dev]\"\n```\n*Note:* The `[dev]` makes sure that the development-only dependencies are also\ninstalled.\n\nTo **start fresh**, just delete the environment:\n```\nconda env remove -n sleap-roots\n```\n\nTo **run tests**, first activate the environment:\n```\nconda activate sleap-roots\n```\nThen run `pytest` with:\n```\npytest tests\n```\n\n## Acknowledgments\n\nThis repository was created by the [Talmo Lab](https://talmolab.org) and [Busch Lab](https://busch.salk.edu) at the Salk Institute for Biological Studies as part of the [Harnessing Plants Initiative](https://www.salk.edu/harnessing-plants-initiative/).\n\n### Contributors\n\n- Elizabeth Berrigan\n- Lin Wang\n- Talmo Pereira\n\n### Citation\n\nE.M. Berrigan, L. Wang, H. Carrillo, K. Echegoyen, M. Kappes, J. Torres, A. Ai-Perreira, E. McCoy, E. Shane, C.D. Copeland, L. Ragel, \nC. Georgousakis, S. Lee, D. Reynolds, A. Talgo, J. Gonzalez, L. Zhang, A.B. Rajurkar, M. Ruiz, E. Daniels, L. Maree, S. Pariyar, W. Busch, T.D. Pereira.  \n\"Fast and Efficient Root Phenotyping via Pose Estimation\", *Plant Phenomics* 0: DOI:[10.34133/plantphenomics.0175](https://doi.org/10.34133/plantphenomics.0175).\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "Analysis tools for SLEAP-based plant root phenotyping.",
    "version": "0.0.9",
    "project_urls": {
        "Homepage": "https://github.com/talmolab/sleap-roots",
        "Repository": "https://github.com/talmolab/sleap-roots"
    },
    "split_keywords": [
        "sleap",
        " plants",
        " roots",
        " phenotyping"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eac53e6ed37896ccb87a7c3660a93e5b84a1779d8b4a7038b43564a53477fb73",
                "md5": "68b6e83c625183ae598cfc2b5d7b7047",
                "sha256": "dcf4f60946d15f69a853b19aa94d75d014625142012f6fea22a3576e19b4fae5"
            },
            "downloads": -1,
            "filename": "sleap_roots-0.0.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "68b6e83c625183ae598cfc2b5d7b7047",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 43644,
            "upload_time": "2024-04-23T18:33:54",
            "upload_time_iso_8601": "2024-04-23T18:33:54.158589Z",
            "url": "https://files.pythonhosted.org/packages/ea/c5/3e6ed37896ccb87a7c3660a93e5b84a1779d8b4a7038b43564a53477fb73/sleap_roots-0.0.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-23 18:33:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "talmolab",
    "github_project": "sleap-roots",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "sleap-roots"
}
        
Elapsed time: 0.33916s