Metadata-Version: 2.4
Name: skny
Version: 0.3.0
Summary: Spatial gene expression anlysis stratified by distance from tumor for multiple platform such as Xenium In Situ, CosMx, and PhenoCycler.
Home-page: https://github.com/shusakai/skny
Author: Shunsuke A. Sakai
Author-email: shusakai@east.ncc.go.jp
License: MIT license
Keywords: skny
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Requires-Python: >=3.8
License-File: LICENSE
License-File: AUTHORS.rst
Requires-Dist: matplotlib
Requires-Dist: pandas
Requires-Dist: plotly
Requires-Dist: scipy
Requires-Dist: seaborn
Requires-Dist: opencv-python
Requires-Dist: numba<=0.57.1
Requires-Dist: numpy<1.22,>=1.18
Requires-Dist: stlearn
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: home-page
Dynamic: keywords
Dynamic: license
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

.. image:: https://img.shields.io/pypi/v/skny.svg
        :target: https://pypi.python.org/pypi/skny

.. image:: https://readthedocs.org/projects/skny/badge/?version=latest
        :target: https://skny.readthedocs.io/en/latest/?version=latest
        :alt: Documentation Status

SKNY - Spatial omics analysis tools for tumor microenvironment 
==================================================================================== 

.. image:: _images/SKYN_logo.svg
   :target: https://skny.readthedocs.io
   :width: 30%


**SKNY** (SpatialKNifeY) is a tools for spatial omics analysis of tumor microenvironment for multiple platform such as `Xenium`_, `CosMx`_, and `PhenoCycler`_. 
SKNY automatically contours the tumor based on the expression data and calculates the distance from these contours to each coordinate in space.
Using this distance data, we provide two analyses: 

1. A quantitative evaluation of the peri- and intra-tumoral gene expressions.

2. "Single tumor microenvironment analysis" with bulk gene expression within each contour.

Since v0.3.0 SKNY also provides a **cell-label based variant** (``skny.pp.calculate_region``) for
cell-level data with annotated cell types (e.g. scanpy / Xenium 5K): the tumor is defined by a cell
label such as ``"Malignant"`` and every cell is assigned to the tumor ``core`` (within 15 um of a
tumor cell), the peri-tumoral ``margin`` (stroma within 100 um of the core) or ``dist`` (farther
tissue), with an all-cell tissue mask so that empty space is never counted. ``skny.pp.region_density``
then gives the density (cells / mm^2) of any cell group (e.g. immune subtypes) per region, and
``skny.pl.region_map`` / ``skny.pl.region_density_plot`` draw the results.

.. code-block:: python

   import skny as sk
   sk.pp.calculate_region(adata, "Malignant", label_key="cell_type", sample_key="sample")  # coordinates in um in adata.obsm["spatial"]
   df = sk.pp.region_density(adata, "immune_subtype", sample_key="sample")
   sk.pl.region_map(adata, sample="S1", highlight=["T cell", "Myeloid"])
   sk.pl.region_density_plot(df, groups=["CD8+ T", "Treg", "M2-like"])

Also, `anndata`_ object-based programming makes it compatible with `scanpy`_, `squidpy`_ and `stlearn`_.

**Recommended Python version:**  
We recommend using Python 3.8 or 3.9 to ensure compatibility.


Documentation
----------------

* https://skny.readthedocs.io.


Citation
----------------

* TODO




.. _Xenium: https://www.10xgenomics.com/jp/platforms/xenium

.. _CosMx: https://nanostring.com/products/cosmx-spatial-molecular-imager/

.. _PhenoCycler: https://www.akoyabio.com/phenocycler/

.. _anndata: https://anndata.readthedocs.io/en/latest/

.. _scanpy: https://scanpy.readthedocs.io/en/stable/

.. _squidpy: https://squidpy.readthedocs.io/en/stable/

.. _stlearn: https://stlearn.readthedocs.io/en/latest/


=======
History
=======

0.3.0 (2026-11-02)
------------------

* New cell-label based region analysis (a variant of ``calculate_distance`` that works on
  cell-level AnnData instead of marker expression on a grid):
  ``skny.pp.calculate_region`` (tumor ``core`` / ``margin`` / ``dist`` from the Euclidean
  distance to the nearest reference cell, with an all-cell tissue mask),
  ``skny.pp.region_density`` (cells / mm^2 of any cell group per region),
  ``skny.pl.region_map`` and ``skny.pl.region_density_plot``.
* Tutorial ``notebooks/region_analysis`` and unit tests ``tests/test_region.py``.


0.2.16 (2024-02-14)
-----------------------
0.2.8 (2024-02-01)
------------------
0.2.7 (2024-01-31)
------------------
0.2.6 (2024-01-31)
------------------

* Practice of upload to PyPI.

0.2.5 (2024-01-30)
------------------
0.2.4 (2024-01-30)
------------------
0.2.3 (2024-01-30)
------------------
0.2.2 (2024-01-30)
------------------
0.2.1 (2024-01-30)
------------------
0.1.2 (2024-01-30)
------------------
0.1.1 (2024-01-30)
------------------
0.1.0 (2024-01-21)
------------------

* First release on PyPI.

