Skip to main content

An adaptable deep-learning model for mechanical stress inference in tissues

Project description

StressNET

StressNET: an adaptable deep-learning model for mechanical stress inference in tissues

CI Documentation Status Docs build PyPI version Python 3.10 License DOI


What is StressNET?

StressNET is an open-source Python library for data-driven mechanical stress inference in tissues. It implements Graph Neural Network models that infer intercellular stress from tissue geometry, without requiring users to specify a fixed physical model. The package includes pretrained models for stress prediction and utilities to finetune them on in silico and in vivo datasets.

It can be used to:

  • preprocess Surface Evolver outputs or skeletonized microscopy images into graph data,
  • load pretrained or finetuned StressNET model weights,
  • infer stress/tension values on tissue interfaces,
  • compare StressNET predictions against ground truth or other method predictions when available,
  • plot inferred stress maps.

Installation

pip install stressnet

Or with Poetry:

poetry add stressnet

Quick start

import stressnet

print(stressnet.__version__)

From a repository checkout, run the test suite with:

poetry install --with dev
poetry run pytest

Or, if make is available:

make install-dev
make test

Usage

The recommended entry points are the worked example notebooks in examples/:

  • examples/inference_in_silico.ipynb: inference on synthetic Surface Evolver data.
  • examples/inference_in_vivo.ipynb: inference on experimental skeleton/myosin image data.
  • examples/finetuning.ipynb: finetuning a pre-trained StressNET model on user-provided graph data.

These notebooks show the complete workflow, including data loading, model loading, inference, metrics, plotting and fine-tuning.

AI assistants for users

This repository includes AGENTS.md, a user-facing grounding document for AI assistants. It helps assistants write scripts or notebook cells that use StressNET to load data, run inference, compare metrics, generate plots and fine-tune models on new datasets.

To avoid stale duplicated instructions, treat AGENTS.md as the source document and make tool-specific files point back to it when possible.

Development setup

Requires Poetry and Python 3.10 (TensorFlow 2.8 / NumPy constraints in pyproject.toml).

git clone https://github.com/nicolasaldecoa/StressNET.git
cd StressNET
poetry install --with dev
poetry run pytest

Common development shortcuts are available through the Makefile:

make lint       # run Ruff checks like CI
make lint-diff  # preview Ruff auto-fixes
make lint-fix   # apply Ruff auto-fixes
make test       # run pytest with coverage
make docs       # build local HTML documentation
make build      # build wheel and source distribution
make check      # run lint, tests, and package build

Documentation

poetry install --with docs
poetry run python docs/build_docs.py

Or, with make:

make install-docs
make docs

Open docs/_build/html/index.html in a browser.

Running examples

The example notebooks assume the repository layout is available. Clone the repo, start Jupyter from the repository root, and open notebooks under examples/ so relative paths such as examples/example_data/... resolve as written.

Installing stressnet from PyPI provides the library package only; running the publication examples also requires this repository's examples/ folder and any downloaded example data.

Example finetuning dataset

The radial_1d_2d_inverted_9v dataset is intentionally not tracked in git because of its size.

Download it to the expected examples path with:

python examples/download_radial_1d_2d_inverted_9v.py

You can also import ensure_dataset_downloaded from examples/download_radial_1d_2d_inverted_9v.py in a notebook.

How to cite

If you use the StressNET software, cite this repository/software package:

@software{stressnet,
  author  = {Aldecoa Rodrigo, Nicolás},
  title   = {{StressNET}: an adaptable deep-learning model for mechanical stress inference in tissues},
  version = {1.0.0},
  url     = {https://github.com/nicolasaldecoa/StressNET},
  license = {BSD-3-Clause},
}

Software citation metadata is also available in CITATION.cff.

License

BSD 3-Clause © Nicolás Aldecoa Rodrigo

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stressnet-1.0.0.tar.gz (29.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stressnet-1.0.0-py3-none-any.whl (32.1 kB view details)

Uploaded Python 3

File details

Details for the file stressnet-1.0.0.tar.gz.

File metadata

  • Download URL: stressnet-1.0.0.tar.gz
  • Upload date:
  • Size: 29.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for stressnet-1.0.0.tar.gz
Algorithm Hash digest
SHA256 91dba44fcd09b3a14bc316449bd5c29adca63b3b4f343311f06babf8b97ef98c
MD5 9cb8e14a878eeb185cc4d089a92ab31c
BLAKE2b-256 ddd74da089b6d6b0cc12c61d22272bd248644282006855892106a7e2290538b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for stressnet-1.0.0.tar.gz:

Publisher: publish.yml on nicolasaldecoa/StressNET

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stressnet-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: stressnet-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 32.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for stressnet-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5d723998068bbbab100cb53b9996e0d8c44ff13d09f0b8aa4ff97d3889c4be5b
MD5 07f6d53cb6acd5e9a5ff0137652e4468
BLAKE2b-256 4d56175d53bc3fce34f9b870583d12b8b089b336894ccbd267b09ec443add605

See more details on using hashes here.

Provenance

The following attestation bundles were made for stressnet-1.0.0-py3-none-any.whl:

Publisher: publish.yml on nicolasaldecoa/StressNET

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page