Metadata-Version: 2.4
Name: sct-python
Version: 0.1.0a2
Summary: SCTransform normalization for Python with optional GPU fitting
Author-email: Bowen Man <owenman27@126.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/Bowen-Man/SCTpy
Project-URL: Issues, https://github.com/Bowen-Man/SCTpy/issues
Keywords: single-cell,sctransform,normalization,pearson-residuals
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.23.5
Requires-Dist: scipy>=1.10
Provides-Extra: test
Requires-Dist: jsonschema>=4.23; extra == "test"
Requires-Dist: pytest>=8; extra == "test"
Requires-Dist: pytest-timeout>=2.3; extra == "test"
Provides-Extra: lint
Requires-Dist: ruff>=0.11; extra == "lint"
Requires-Dist: mypy>=1.15; extra == "lint"
Requires-Dist: scipy-stubs>=1.16; python_version >= "3.11" and extra == "lint"
Provides-Extra: benchmark
Requires-Dist: psutil>=5.9; extra == "benchmark"
Provides-Extra: real-data
Requires-Dist: h5py>=3.10; extra == "real-data"
Provides-Extra: anndata
Requires-Dist: anndata>=0.10.8; extra == "anndata"
Provides-Extra: gpu
Requires-Dist: cupy-cuda13x<15,>=14; extra == "gpu"
Provides-Extra: gpu-cu12
Requires-Dist: cupy-cuda12x<15,>=14; extra == "gpu-cu12"
Dynamic: license-file

# SCTpy

SCTransform normalization for raw UMI counts in Python, with NumPy/SciPy,
AnnData support and optional CuPy GPU fitting. Current version: **0.1.0a2 (alpha)**.

## Install

Python 3.10 or later. The PyPI distribution is `sct-python`; the import is `sctpy`:

```bash
python -m pip install "sct-python[anndata]==0.1.0a2"
```

## Quickstart

Use raw, nonnegative integer counts from an AnnData layer:

```python
from sctpy import SCTConfig, fit_transform_anndata, write_anndata

result = fit_transform_anndata(
    adata,
    layer="counts",
    config=SCTConfig.r_v2(),
)
write_anndata(adata, result, n_top_genes=2000)
```

The adapter preserves cell/gene identities and writes SCT outputs to AnnData.
The array API, `fit_transform`, also accepts dense NumPy or SciPy CSR/CSC counts
with explicit gene/cell names. Use `SCTConfig.r_v2()` for the documented v2 profile;
plain `SCTConfig()` selects the research defaults.

## GPU

Install `"sct-python[anndata,gpu]==0.1.0a2"` for CUDA 13 or
`"sct-python[anndata,gpu-cu12]==0.1.0a2"` for CUDA 12, then select:

```python
config = SCTConfig.r_v2(cox_reid_backend="cupy", cox_reid_batch_size=512)
```

The GPU backend accelerates dispersion fitting. Other stages include CPU work,
and results use NumPy/SciPy. Dense residual output can be avoided with
`residual_output="summary"`.

## Scope and documentation

SCTpy provides dispersion fitting, regularization, Pearson residuals, HVG ranking
and optional corrected UMI counts. Batch models, extra covariates and a full GPU
pipeline are outside the current release.

See the [API reference](docs/API.md), [method specification](docs/SCT_V2_SPEC.md),
[validation](docs/VALIDATION.md), [GPU details](docs/RAPIDS_INTEGRATION.md)
and [licensing and provenance](docs/LICENSING.md). Method references include
[Hafemeister & Satija (2019)](https://doi.org/10.1186/s13059-019-1874-1)
and [Choudhary & Satija (2022)](https://doi.org/10.1186/s13059-021-02584-9).

## Development

```bash
python -m pip install -e ".[test,lint,anndata]"
ruff check .
ruff format --check .
mypy
python -m pytest
```

## License

[MIT](LICENSE). Copyright (c) 2026 Bowen Man.
