Skip to main content

Python port of the gitter colony quantification pipeline.

Project description

gitter-colony

Python 3.13 rewrite of the original R gitter package for quantification of pinned microbial colonies.

Documentation: https://cyberstefnef.github.io/gitter-colony/

Installation

Install with pip:

pip install gitter-colony

Install with uv:

uv add gitter-colony

Python Usage

from gitter_py import gitter, plot_results

df = gitter(
    image_file="examples/extdata/sample.jpg",
    plate_format=1536,
    verbose="n",
)

fig = plot_results(df, kind="heatmap", title="Sample")
fig.savefig("sample.png", dpi=200)

gitter(...) returns one row per colony position with:

  • row
  • col
  • size
  • circularity
  • flags

gitter(...) is single-plate quantification only. If your source image contains multiple plates, split it explicitly first with PlateSplitter. It accepts either a file path or an in-memory numpy.ndarray.

CLI (Optional)

gitter run examples/extdata/sample.jpg --plate-format 1536 --out sample.csv
gitter read sample.csv
gitter plot sample.csv --plot-type heatmap --out sample.png

Multi-plate Splitting

from pathlib import Path

from gitter_py import PlateSplitter, gitter

splitter = PlateSplitter(min_confidence=0.95)
result = splitter.split(
    "examples/scanomatic/250417_saltLBtest_35_35_Bran_0060_37101.4909.tiff"
)
splitter.save(result, "split_save")

for plate_file in sorted(Path("split_save").glob("*__plate_*.tiff")):
    plate_df = gitter(
        image_file=str(plate_file),
        plate_format=1536,
        verbose="n",
        inverse=True,
        autorotate=True,
    )
    print(plate_df["size"].median())

for plate in result.plates:
    plate_df = gitter(
        image_file=plate.crop,
        plate_format=1536,
        verbose="n",
        inverse=True,
        autorotate=True,
    )
    print(plate_df["size"].median())

Splitter behavior:

  • only plates with confidence >= 0.95 are extracted by default
  • set autorotate=True on gitter(...) to rotate portrait plate crops before quantification
  • call splitter.save(...) to write layout and crop artifacts
  • for scanomatic-style crops, pass inverse=True to gitter(...) when needed

R Parity Tests (Optional)

docker build -t gitter-r-parity:4.3.3 -f docker/r-parity.Dockerfile .
uv run --extra dev pytest -q tests/test_parity_r_sample.py
GITTER_ENABLE_R_LIVE=1 uv run --extra dev pytest -q -m r_live tests/test_parity_r_live.py

The parity checks are intentionally calibrated for biological agreement with the original R implementation, not exact pixel-for-pixel equality.

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

gitter_colony-1.3.0.tar.gz (551.6 kB view details)

Uploaded Source

Built Distribution

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

gitter_colony-1.3.0-py3-none-any.whl (26.1 kB view details)

Uploaded Python 3

File details

Details for the file gitter_colony-1.3.0.tar.gz.

File metadata

  • Download URL: gitter_colony-1.3.0.tar.gz
  • Upload date:
  • Size: 551.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gitter_colony-1.3.0.tar.gz
Algorithm Hash digest
SHA256 d682ad420de10dfbeb7b9523d17144180f65cbe789442f37084e660a1009993a
MD5 a33ad4ebddc46066dd5fdf9538c210ce
BLAKE2b-256 01c4a22c20266c930f86882a7114f6f6d12bc42f3b3c991c26708ec2d89241b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for gitter_colony-1.3.0.tar.gz:

Publisher: release-please.yml on CyberStefNef/gitter-colony

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

File details

Details for the file gitter_colony-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: gitter_colony-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 26.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gitter_colony-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 af99169707b8632d92d33d0fcfd23aec6dab5b00f11dd1ce4eb16e16c0ed2d76
MD5 5ed3bb7d904e8007df18ea6038c832d3
BLAKE2b-256 0227f79670a39518af82d1094d52426fe00d9c44ebf1502b38d5f72a616e0d94

See more details on using hashes here.

Provenance

The following attestation bundles were made for gitter_colony-1.3.0-py3-none-any.whl:

Publisher: release-please.yml on CyberStefNef/gitter-colony

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