Metadata-Version: 2.3
Name: sctypepy
Version: 0.0.1
Summary: Sc-Type, but in Python
Requires-Dist: scanpy
Requires-Dist: scipy
Requires-Dist: pandas
Requires-Dist: numpy
Requires-Python: >=3.12
Description-Content-Type: text/markdown

# sctypepy

A Python implementation of [ScType](https://github.com/IanevskiAleksandr/sc-type) for automatic cell type annotation of single-cell RNA-seq data.

## Installation

```bash
pip install sctypepy
```

## Quickstart

```python
import scanpy as sc
from sctypepy import run_sctype

# Load and preprocess your data
adata = sc.datasets.pbmc3k()
sc.pp.neighbors(adata)
sc.tl.leiden(adata)

adata = run_sctype(adata, tissue_type="Immune system", groupby="leiden")

print(adata.obs["sctype_classification"].value_counts())
```

## Example
Example usages can be found in the [example](example/) directory.

## Usage

### Auto-detect tissue type

If you're unsure which tissue type to use:

```python
from sctypepy import auto_detect_tissue_type

tissue_df = auto_detect_tissue_type(adata, groupby="leiden")
print(tissue_df.head())
```

### Available tissue types

```python
from sctypepy import get_available_tissues

print(get_available_tissues())
```

### Custom marker database

Provide your own markers as a DataFrame with columns: `tissueType`, `cellName`, `geneSymbolmore1`, `geneSymbolmore2`.

```python
import pandas as pd

custom_db = pd.DataFrame({
    "tissueType": ["Brain", "Brain"],
    "cellName": ["Neuron", "Astrocyte"],
    "geneSymbolmore1": ["SNAP25,SYT1,RBFOX3", "GFAP,AQP4,S100B"],
    "geneSymbolmore2": ["", ""],
})

adata = run_sctype(adata, tissue_type="Brain", db=custom_db)
```

## Output

After running `run_sctype()`:

- `adata.obs["sctype_classification"]` — predicted cell type per cell
- `adata.obsm["sctype_scores"]` — raw scores for each cell type

