Metadata-Version: 2.5
Name: mantispy
Version: 0.1.0a2
Summary: Image-based profiling on AnnData
Project-URL: Changelog, https://github.com/scverse/mantispy/releases
Project-URL: Documentation, https://mantispy.readthedocs.io/
Project-URL: Forum, https://discourse.scverse.org/
Project-URL: Homepage, https://github.com/scverse/mantispy
Project-URL: Issues, https://github.com/scverse/mantispy/issues
Project-URL: Source, https://github.com/scverse/mantispy
Author: scverse
Maintainer-email: Tim Treis <tim.treis@scverse.org>, Lukas Heumos <lukas.heumos@scverse.org>
License: BSD 3-Clause License
        
        Copyright (c) 2026, scverse
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
        1. Redistributions of source code must retain the above copyright notice, this
           list of conditions and the following disclaimer.
        
        2. Redistributions in binary form must reproduce the above copyright notice,
           this list of conditions and the following disclaimer in the documentation
           and/or other materials provided with the distribution.
        
        3. Neither the name of the copyright holder nor the names of its
           contributors may be used to endorse or promote products derived from
           this software without specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
License-File: LICENSE
Keywords: Cell Painting,anndata,bioinformatics,computational-biology,high-content screening,image-based profiling,morphological profiling,morphology,scverse
Classifier: Development Status :: 3 - Alpha
Classifier: Framework :: Jupyter
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: BSD License
Classifier: Natural Language :: English
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: Topic :: Scientific/Engineering :: Visualization
Classifier: Typing :: Typed
Requires-Python: >=3.12
Requires-Dist: anndata>=0.13
Requires-Dist: decoupler>=2.3
Requires-Dist: matplotlib>=3.9
Requires-Dist: numba>=0.60
Requires-Dist: numpy>=1.26
Requires-Dist: pandas>=2.1
Requires-Dist: platformdirs>=4
Requires-Dist: pooch>=1.8
Requires-Dist: pyarrow>=16
Requires-Dist: pynndescent<0.7
Requires-Dist: scanpy>=1.12
Requires-Dist: scikit-learn>=1.4
Requires-Dist: scipy>=1.11
Requires-Dist: scverse-misc[datasets]>=0.1.6
Requires-Dist: session-info2
Provides-Extra: harmony
Requires-Dist: harmonypy>=2; extra == 'harmony'
Provides-Extra: integration
Requires-Dist: scib-metrics>=0.5.1; extra == 'integration'
Provides-Extra: interactive
Requires-Dist: plotly>=5; extra == 'interactive'
Provides-Extra: map
Requires-Dist: copairs>=0.5.5; extra == 'map'
Provides-Extra: spatial
Requires-Dist: dask>=2024.4; extra == 'spatial'
Requires-Dist: geopandas>=1; extra == 'spatial'
Requires-Dist: h5py>=3.10; extra == 'spatial'
Requires-Dist: imagecodecs>=2024.1; extra == 'spatial'
Requires-Dist: imageio>=2.34; extra == 'spatial'
Requires-Dist: scikit-image>=0.24; extra == 'spatial'
Requires-Dist: shapely>=2; extra == 'spatial'
Requires-Dist: spatialdata>=0.3; extra == 'spatial'
Description-Content-Type: text/markdown

<img src="https://raw.githubusercontent.com/scverse/mantispy/main/docs/_static/mantispy-logo.png" width="400" alt="mantispy">

[![Tests][badge-tests]][tests]
[![Build][badge-build]][build]
[![Coverage][badge-codecov]][codecov]
[![Documentation][badge-docs]][documentation]
[![PyPI][badge-pypi]][pypi]
[![Python Version][badge-pyversions]][pypi]
[![License][badge-license]][license]
[![pre-commit][badge-precommit]][pre-commit]

[badge-tests]: https://img.shields.io/github/actions/workflow/status/scverse/mantispy/test.yaml?branch=main&label=tests
[badge-build]: https://img.shields.io/github/actions/workflow/status/scverse/mantispy/build.yaml?branch=main&label=build
[badge-codecov]: https://codecov.io/gh/scverse/mantispy/graph/badge.svg
[badge-docs]: https://app.readthedocs.org/projects/mantispy/badge/
[badge-pypi]: https://img.shields.io/pypi/v/mantispy?include_prereleases
[badge-pyversions]: https://img.shields.io/pypi/pyversions/mantispy
[badge-license]: https://img.shields.io/badge/license-BSD--3-blue
[badge-precommit]: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white

mantispy brings Cell Painting and other image-based profiling data into the scverse ecosystem, from reading what a
pipeline wrote through quality control, normalization and batch correction to evaluating what survived.
It is for biologists and computational scientists who analyze Cell Painting or similar image-based screens in Python.
mantispy is in alpha: the API may still change.

```python
import mantispy as mt
import scanpy as sc

cells = mt.io.read_profiles("analysis/", platemap="platemap.csv")  # an ExportToSpreadsheet directory, or profile files
mt.pp.annotate_controls(cells)  # assumes the negative control is labeled "DMSO"; see negcon= for other names
mt.pp.image_qc(cells)  # which fields were out of focus
mt.pp.normalize(cells, by="Metadata_Plate", reference="negcon")  # robust MAD against the negative controls
wells = mt.tl.aggregate(cells)  # cells -> wells

mt.pp.feature_select(wells)  # flags features in var["selected"]
wells = mt.pp.subset_features(wells)  # keeps only those
sc.pp.pca(wells, n_comps=20)  # hit calling reads distances on a PCA, as the covariance of all features is singular
mt.tl.hit_calling(wells, use_rep="X_pca")  # which perturbations moved
mt.pl.hits(wells)
```

`pp` prepares, `tl` computes, `pl` plots, `metrics` evaluates a correction, `io` reads and
writes, and `ds` downloads public screens. Everything operates on an `AnnData`, so scanpy's
PCA, neighbors, UMAP and Leiden work on the same object. `io.read_plate` reads the images
behind the profiles as `SpatialData`.

To start, [From a CellProfiler run][tutorial-1] shows how to read a screen and [Hits, effects and cell
loss][tutorial-5] how to call hits on it. Neither needs your own data, and `mt.ds.bbbc021()`
downloads a public screen.

Set `mt.settings.verbosity = 2` when you first run your own screen. Several steps drop
features or wells, and they log it at that level.

Please refer to the [documentation][], in particular the [API documentation][].

## Installation

You need to have Python 3.12 or newer installed on your system.
If you don't have Python installed, we recommend installing [uv][].

We recommend managing dependencies in project-specific virtual environments to avoid dependency conflicts.
This is most convenient using package managers such as [uv][].
Choose from the options below to install mantispy:

1. Install the latest release from [PyPI][]. The current release is an alpha pre-release, so pip needs `--pre`:

   ```bash
   pip install --pre mantispy  # (or `uv add --prerelease allow mantispy`)
   ```

1. Install the latest development version:

   ```bash
   pip install git+https://github.com/scverse/mantispy.git  # (or `uv add`)
   ```

Reading images needs the `spatial` extra:

```bash
pip install 'mantispy[spatial]'
```

## Release notes

See the [releases page](https://github.com/scverse/mantispy/releases).

## Contact

For questions and help requests, you can reach out in the [scverse discourse][].
If you found a bug, please use the [issue tracker][].

## License

mantispy is released under the BSD 3-Clause license.

## Citation

> A preprint describing mantispy is in preparation. Until then, cite the
> [repository][mantispy] directly.

[uv]: https://github.com/astral-sh/uv
[scverse discourse]: https://discourse.scverse.org/
[issue tracker]: https://github.com/scverse/mantispy/issues
[tests]: https://github.com/scverse/mantispy/actions/workflows/test.yaml
[build]: https://github.com/scverse/mantispy/actions/workflows/build.yaml
[codecov]: https://codecov.io/gh/scverse/mantispy
[pre-commit]: https://github.com/pre-commit/pre-commit
[documentation]: https://mantispy.readthedocs.io
[api documentation]: https://mantispy.readthedocs.io/page/api.html
[pypi]: https://pypi.org/project/mantispy
[license]: https://github.com/scverse/mantispy/blob/main/LICENSE
[mantispy]: https://github.com/scverse/mantispy
[tutorial-1]: https://mantispy.readthedocs.io/page/tutorials/data/cellprofiler.html
[tutorial-5]: https://mantispy.readthedocs.io/page/tutorials/compounds/hits.html

## scverse

mantispy is part of the scverse® project ([website](https://scverse.org), [governance](https://scverse.org/about/roles)) and is fiscally sponsored by [NumFOCUS](https://numfocus.org/).
If you like scverse® and want to support our mission, please consider making a tax-deductible [donation](https://numfocus.org/donate-to-scverse) to help the project pay for developer time, professional services, travel, workshops, and a variety of other needs.

<div align="center">
<a href="https://numfocus.org/project/scverse">
  <img
    src="https://raw.githubusercontent.com/numfocus/templates/master/images/numfocus-logo.png"
    width="200"
  >
</a>
</div>
