# scAce: an adaptive embedding and clustering method for scRNA-seq data
## Overview
![Overview](./Overview.png)
scAce is consisted of three major steps, a pre-training step based on a variational autoencoder, a cluster initialization step to obtain initial cluster labels, and an adaptive cluster merging step to iteratively
update cluster labels and cell embeddings. In the pre-training step, scAce takes the single-cell gene expression matrix as its input to train a VAE network. For each gene, the VAE learns and outputs three parameters of a ZINB distribution (mean, dispersion, and proportion of zero). In the cluster initialization step, scAce offeres two manners. With *de novo* initialization, Leiden is used to obtain initial cluster labels; with clustering enhancement, initial cluster labels are obtained by applying a cluster splitting approach to a set of existing clustering results. In the adaptive cluster merging step, given the pre-trained VAE network and the initial cluster labels, the network parameters, cell embeddings, cluster labels and centroids are iteratively updated by alternately performing network update and cluster merging steps. The final results of cell embeddings and cluster labels are output by scAce after the iteration process stops.
## Installation
Please install `scAce` from pypi with:
```shell
pip install scace
```
Or clone this repository and use
```shell
pip install -e .
```
in the root of this repository.
## Quick start
Load the data to be analyzed:
```python
import scanpy as sc
adata = sc.AnnData(data)
```
Perform data pre-processing:
```python
# Basic filtering
sc.pp.filter_genes(adata, min_cells=3)
sc.pp.filter_cells(adata, min_genes=200)
adata.raw = adata.copy()
# Total-count normlize, logarithmize and scale the data
sc.pp.normalize_per_cell(adata)
adata.obs['scale_factor'] = adata.obs.n_counts / adata.obs.n_counts.median()
sc.pp.log1p(adata)
sc.pp.scale(adata)
```
Run the scAce method:
```python
from scace import run_scace
adata = run_scace(adata)
```
The output adata contains cluster labels in `adata.obs['scace_cluster']` and the cell embeddings in `adata.obsm['scace_emb']`. The embeddings can be used as input of other downstream analyses.
<ins>Please refer to `tutorial.ipynb` for a detailed description of scAce's usage.<ins>
Raw data
{
"_id": null,
"home_page": "https://github.com/sldyns/scAce",
"name": "scace",
"maintainer": "Kun Qian",
"docs_url": null,
"requires_python": "",
"maintainer_email": "kun_qian@foxmail.com",
"keywords": "single-cell RNA-sequencing,clustering,cluster merging",
"author": "Kun Qian, Xinwei He",
"author_email": "kun_qian@foxmail.com",
"download_url": "https://files.pythonhosted.org/packages/eb/8e/d9f1b28346b9837dac34c91a9611de2e451c4542a43081f186d59a251c9e/scace-0.1.2.tar.gz",
"platform": "any",
"description": "# scAce: an adaptive embedding and clustering method for scRNA-seq data\n\n## Overview\n\n![Overview](./Overview.png)\n\nscAce is consisted of three major steps, a pre-training step based on a variational autoencoder, a cluster initialization step to obtain initial cluster labels, and an adaptive cluster merging step to iteratively\nupdate cluster labels and cell embeddings. In the pre-training step, scAce takes the single-cell gene expression matrix as its input to train a VAE network. For each gene, the VAE learns and outputs three parameters of a ZINB distribution (mean, dispersion, and proportion of zero). In the cluster initialization step, scAce offeres two manners. With *de novo* initialization, Leiden is used to obtain initial cluster labels; with clustering enhancement, initial cluster labels are obtained by applying a cluster splitting approach to a set of existing clustering results. In the adaptive cluster merging step, given the pre-trained VAE network and the initial cluster labels, the network parameters, cell embeddings, cluster labels and centroids are iteratively updated by alternately performing network update and cluster merging steps. The final results of cell embeddings and cluster labels are output by scAce after the iteration process stops.\n\n## Installation\n\nPlease install `scAce` from pypi with:\n\n```shell\npip install scace\n```\nOr clone this repository and use\n\n```shell\npip install -e .\n```\nin the root of this repository.\n## Quick start\n\nLoad the data to be analyzed:\n\n```python\nimport scanpy as sc\n\nadata = sc.AnnData(data)\n```\n\nPerform data pre-processing:\n\n```python\n# Basic filtering\nsc.pp.filter_genes(adata, min_cells=3)\nsc.pp.filter_cells(adata, min_genes=200)\n\nadata.raw = adata.copy()\n\n# Total-count normlize, logarithmize and scale the data \nsc.pp.normalize_per_cell(adata)\nadata.obs['scale_factor'] = adata.obs.n_counts / adata.obs.n_counts.median()\n\nsc.pp.log1p(adata)\nsc.pp.scale(adata)\n```\n\nRun the scAce method:\n\n```python\nfrom scace import run_scace\nadata = run_scace(adata)\n```\n\nThe output adata contains cluster labels in `adata.obs['scace_cluster']` and the cell embeddings in `adata.obsm['scace_emb']`. The embeddings can be used as input of other downstream analyses.\n\n<ins>Please refer to `tutorial.ipynb` for a detailed description of scAce's usage.<ins>\n\n\n\n",
"bugtrack_url": null,
"license": "MIT Licence",
"summary": "scAce: an adaptive embedding and clustering method for single-cell gene expression data",
"version": "0.1.2",
"project_urls": {
"Homepage": "https://github.com/sldyns/scAce"
},
"split_keywords": [
"single-cell rna-sequencing",
"clustering",
"cluster merging"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6a347c32d3428231ef94f58b4422b3770dfca47788cff8041338675f82ec408c",
"md5": "e69df3d77f63c4908c7c0b20b50d28da",
"sha256": "3020024a7a1f4dc32288fc358436c574053a4bf61c956c7f97700f403e8487ae"
},
"downloads": -1,
"filename": "scace-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e69df3d77f63c4908c7c0b20b50d28da",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 13440,
"upload_time": "2023-09-08T10:00:52",
"upload_time_iso_8601": "2023-09-08T10:00:52.278348Z",
"url": "https://files.pythonhosted.org/packages/6a/34/7c32d3428231ef94f58b4422b3770dfca47788cff8041338675f82ec408c/scace-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "eb8ed9f1b28346b9837dac34c91a9611de2e451c4542a43081f186d59a251c9e",
"md5": "a3dcb1061ea1b9bf9887496777318bf6",
"sha256": "5ebd434902a3614f4a57d9cf36844e4932845f81c7fb1415ea177f69e653a53d"
},
"downloads": -1,
"filename": "scace-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "a3dcb1061ea1b9bf9887496777318bf6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 12104,
"upload_time": "2023-09-08T10:00:55",
"upload_time_iso_8601": "2023-09-08T10:00:55.869451Z",
"url": "https://files.pythonhosted.org/packages/eb/8e/d9f1b28346b9837dac34c91a9611de2e451c4542a43081f186d59a251c9e/scace-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-08 10:00:55",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sldyns",
"github_project": "scAce",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "scace"
}