Metadata-Version: 2.4
Name: pyscry
Version: 0.1.0
Summary: Binomial deviance feature selection for single-cell count data (AnnData)
Author: Shahroze Abbas
Requires-Python: >=3.10
Requires-Dist: anndata>=0.10
Requires-Dist: numpy>=1.23
Requires-Dist: pandas>=2.0
Requires-Dist: scipy>=1.9
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == 'dev'
Description-Content-Type: text/markdown

# pyscry

[![PyPI version](https://img.shields.io/pypi/v/pyscry)](https://pypi.org/project/pyscry/)

Python implementation of binomial deviance feature selection for **single-cell count data** (non-negative integer matrices), following the multinomial-model view in [Townes et al. (2019)](https://doi.org/10.1186/s13059-019-1861-6) and the [`scry`](https://bioconductor.org/packages/release/bioc/html/scry.html) R package. Typical uses include scRNA-seq UMIs and scATAC-seq (or similar) peak or bin counts in `AnnData`; the method ranks **features** (`adata.var`) by deviance under a common null proportion.

## Installation

```bash
pip install pyscry
```

## Usage

```python
import pyscry

pyscry.highly_deviant_features(adata, n_top_features=2000)
```

Expects raw (or raw-like) **non-negative integer counts** in `adata.X` or a named layer (e.g. UMIs, or ATAC fragments per peak).

### Parameters

| Parameter | Type | Description |
|---|---|---|
| `adata` | `AnnData` | Count matrix (cells × features; e.g. genes or peaks) |
| `n_top_features` | `int` | Number of top features to select |
| `layer` | `str \| None` | Layer to use instead of `adata.X` |
| `subset` | `bool` | Subset `adata` to selected features (default `False`) |
| `inplace` | `bool` | Write results into `adata.var` (default `True`) |
| `batch_key` | `str \| None` | Obs key for batch; deviance is summed across batches |
| `check_values` | `bool` | Warn if data are not non-negative integers (default `True`) |

### Outputs

When `inplace=True`:

- `adata.var['binomial_deviance']` -- deviance score per feature
- `adata.var['highly_variable']` -- boolean selection mask

## Citation

If you use `pyscry`, cite the original method paper (written in the scRNA-seq setting; the deviance feature-screening idea applies to other **multinomial-style count tables** as well):

> Townes FW, Hicks SC, Aryee MJ, Irizarry RA (2019).
> **Feature selection and dimension reduction for single-cell RNA-Seq based on a multinomial model.**
> *Genome Biology* 20:295.
> [https://doi.org/10.1186/s13059-019-1861-6](https://doi.org/10.1186/s13059-019-1861-6)

If citing this Python implementation specifically:

> pyscry: Binomial deviance feature selection for AnnData (2026).
