Metadata-Version: 2.4
Name: goatpy
Version: 0.2.0
Summary: Spatial Glycomics Analysis Toolkit — MALDI imaging + H&E registration and analysis.
Author-email: Andrew Causer <causer.ag@gmail.com>
License: MIT License
        
        Copyright (c) 2025 Andrew Causer
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/agc888/goatpy
Project-URL: Documentation, https://goatpy.readthedocs.io
Project-URL: Repository, https://github.com/agc888/goatpy
Project-URL: Bug Tracker, https://github.com/agc888/goatpy/issues
Keywords: spatial,glycomics,MALDI,imaging,spatialdata,H&E,registration
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: Topic :: Scientific/Engineering :: Image Processing
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=2.2
Requires-Dist: pandas>=2.3
Requires-Dist: anndata>=0.11
Requires-Dist: spatialdata>=0.4
Requires-Dist: spatialdata-io>=0.3
Requires-Dist: tifffile>=2025.5
Requires-Dist: scanpy>=1.11
Requires-Dist: squidpy>=1.6
Requires-Dist: geopandas>=1.0
Requires-Dist: shapely>=2.0
Requires-Dist: opencv-python>=4.8
Requires-Dist: pillow>=10.0
Requires-Dist: pyimzml>=1.5
Requires-Dist: joblib>=1.3
Requires-Dist: scipy>=1.11
Requires-Dist: scikit-learn>=1.3
Requires-Dist: matplotlib>=3.7
Requires-Dist: psutil>=5.9
Requires-Dist: sopa>=2.0
Requires-Dist: metaspace-converter>=1.1
Provides-Extra: napari
Requires-Dist: napari>=0.4.19; extra == "napari"
Requires-Dist: napari-spatialdata>=0.5; extra == "napari"
Requires-Dist: pyqt5>=5.15; extra == "napari"
Requires-Dist: qtpy>=2.0; extra == "napari"
Provides-Extra: docs
Requires-Dist: sphinx>=7.0; extra == "docs"
Requires-Dist: sphinx-rtd-theme>=2.0; extra == "docs"
Requires-Dist: sphinx-autoapi>=3.0; extra == "docs"
Requires-Dist: myst-parser>=2.0; extra == "docs"
Requires-Dist: nbsphinx>=0.9; extra == "docs"
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Requires-Dist: black>=23.0; extra == "dev"
Requires-Dist: ruff>=0.1; extra == "dev"
Dynamic: license-file

<p align="center">
  <img src="https://raw.githubusercontent.com/agc888/goatpy/main/docs/source/_static/logo.png" width="200">
</p>

# goatpy — Spatial Glycomics Analysis Toolkit

[![PyPI version](https://badge.fury.io/py/goatpy.svg)](https://badge.fury.io/py/goatpy)
[![Documentation Status](https://readthedocs.org/projects/goatpy/badge/?version=latest)](https://goatpy.readthedocs.io/en/latest/?badge=latest)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)

**goatpy** is a Python toolkit for spatial glycomics analysis, combining MALDI mass spectrometry imaging with H&E histology. It provides automatic image registration, pseudo-image generation, spatial PCA, and annotation tools built on top of the [SpatialData](https://spatialdata.scverse.org/) framework.

## Features

- **Automatic H&E registration** — align MALDI ion images to whole-slide H&E images using normalised cross-correlation with full 360° rotation search
- **QuPath annotation support** — transform GeoJSON annotations from QuPath into the registered coordinate system
- **Spatial GraphPCA** — dimensionality reduction with optional spatial smoothing via k-nearest-neighbour graphs
- **Pseudo-image generation** — create spatial images from categorical or continuous obs columns
- **Landmark alignment GUI** — interactive napari-based landmark alignment tool
- **SpatialData native** — all outputs are standard `SpatialData` objects, compatible with the scverse ecosystem

## Installation

### Recommended: conda environment

Download [`environment.yml`](https://github.com/agc888/goatpy/blob/main/environment.yml) and create the environment:

```bash
conda env create -f environment.yml
conda activate maldi
pip install goatpy
```

### PyPI

```bash
pip install goatpy
```

For napari visualisation support:

```bash
pip install "goatpy[napari]"
```

### From source

```bash
pip install git+https://github.com/agc888/goatpy.git
```

## Quick start

```python
import goatpy as gp

# Load and register MALDI + H&E
sdata = gp.load_and_align(
    imzml_path="my_sample.imzML",
    he_path="my_sample.svs",
    geojson_path="annotations.geojson",  # optional QuPath annotations
)

# Normalise intensities
sdata = gp.normalize_spatialdata(sdata, table_name="maldi_adata", method="TIC")

# Dimensionality reduction
sdata = gp.graphpca_spatialdata(sdata, n_components=30, alpha=0.5)

# Cluster
sdata = gp.get_kmean_clusters(sdata, n_clusters=8)

# Visualise in napari
from napari_spatialdata import Interactive
Interactive([sdata]).run()
```

## Documentation

Full documentation is available at [goatpy.readthedocs.io](https://goatpy.readthedocs.io).

## Citation

If you use goatpy in your research, please cite:

> Causer, A. (2025). goatpy: Spatial Glycomics Analysis Toolkit. https://github.com/agc888/goatpy

## License

MIT — see [LICENSE](LICENSE) for details.
