Skip to main content

LabGrymace

LabGrymace (LabGym + grimace) is an open-source tool for quantifying pain-related facial expressions in freely moving mice.

  • Objective and reproducible — Facial grimace is a widely used indicator of pain in mice, but manual scoring is labor-intensive and subjective. LabGrymace automatically quantifies pain-related facial movements from the tracking output generated by LabGym.
  • A biologically calibrated pain score — Ear, eye, and nose movements are integrated into a single pain score that is continuous over time and calibrated to biological reference points, which enables quantitative comparisons across animals and experiments.
  • Easy to use — A point-and-click GUI generates summary spreadsheets, computes pain scores, and produces annotated videos with the score displayed on every frame. No programming required.

This repository contains two parts:

  • LabGrymace, the graphical application for pain-score computation and visualization.
  • LabGym_LabGrymace, a modified version of LabGym 2.9.0, which performs facial region tracking and generates the input files used by LabGrymace.

LabGrymace Outputs:

1. Annotated video

An .mp4 copy of the original recording with the continuously updated pain score overlaid on each frame, allowing direct comparison between the quantified pain score and the animal's behavior.

Below is an example comparing a recording with a high pain score and one with a low pain score:

Chemically induced pain Baseline
High-CNO overlay Baseline overlay

2. Summary spreadsheets

Three Excel files (ear_summary.xlsx, eye_summary.xlsx, nose_summary.xlsx) containing frame-by-frame measurements for each facial region. Frames removed by the mirror-reflection filter are highlighted in orange, and the merged measurements used for pain-score calculation are highlighted in yellow.

Summary spreadsheet

3. Pain score analysis

The analysis includes:

  • pain_scores.xlsx — one row per 100 s window, plus a Summary sheet with each recording's overall score.
  • pain_scores_per_frame.xlsx — a pain score for every frame.
  • pain_score_chart.png — a dot plot of the batch, one point per recording.

Pain score


Usage

LabGrymace GUI

The LabGrymace workflow consists of two steps:

  1. Generate summary files — Select the folder containing the LabGym output. LabGrymace generates ear_summary.xlsx, eye_summary.xlsx, and nose_summary.xlsx files for each recording.
  2. Compute pain scores — Select the folders containing the summary files. LabGrymace generates pain_scores.xlsx, pain_scores_per_frame.xlsx, pain_score_chart.png, and (optionally) an annotated video with pain score overlaid on each frame.

The reflection filter is disabled by default and can be enabled with a checkbox during step 2. The figures in the accompanying manuscript were generated with this filter enabled, and the reproduction scripts set it automatically.


Documentation


Licensing

LabGrymace is available under a dual-licensing model.

Open-source license

This repository is licensed under the GNU General Public License v3.0 (GPL-3.0). See LICENSE for details.

This repository includes a modified version of LabGym (Ye Lab, University of Michigan), which is licensed under GPL-3.0. The original attribution and license are preserved in LabGym_LabGrymace/LICENSE.txt.

Commercial licensing

Commercial licenses are available from Behaviora LLC for organizations that wish to use LabGrymace under terms different from the GPL-3.0 license, including proprietary commercial applications, redistribution, enterprise deployment, and commercial support.

For commercial licensing or support inquiries, please contact: contact@labgym.org


Citing LabGrymace

If you use LabGrymace in publications, please cite LabGrymace, LabGym1, and LabGym2.

Installation

Metadata

Release files for LabGrymace 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for LabGrymace 1.0.0
File Size Uploaded Provenance Actions
labgrymace-1.0.0.tar.gz 77.9 kB Without provenance Details for labgrymace-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for LabGrymace 1.0.0
File Interpreter ABI Platform Actions
labgrymace-1.0.0-py3-none-any.whl Python 3 none any Details for labgrymace-1.0.0-py3-none-any.whl

Total release size: 155.7 kB

Release files / labgrymace-1.0.0.tar.gz

Download URL labgrymace-1.0.0.tar.gz
Size 77.9 kB
Tags Source
SHA-256 checksum
How to use checksums
fd0912a2cd955dd0f70e85eeeb9cc5e6e919723f16fb3449869d962d7da80d15
BLAKE2b-256 checksum
How to use checksums
da94bad259a0e785d8ba0d14e436687e3400a42e331c0d0b544c768ea7fb6b48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.20

Release files / labgrymace-1.0.0-py3-none-any.whl

Download URL labgrymace-1.0.0-py3-none-any.whl
Size 77.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
26a8f5f452cc9dc4b5967a938531a6be10c1d3d49afdf11ea39a263c4a4275da
BLAKE2b-256 checksum
How to use checksums
a90ef5de7e202162bbe7083f91e8f4391ba51a469dba37d623f6aa26a3bfb765
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.20

Security for LabGrymace 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page