scBiG for representation learning of single-cell gene expression data based on bipartite graph embedding
Overview
scBiG is a graph autoencoder network where the encoder based on multi-layer graph convolutional networks extracts high-order representations of cells and genes from the cell-gene bipartite graph, and the decoder based on the ZINB model uses these representations to reconstruct the gene expression matrix. By virtue of a model-driven self-supervised training paradigm, scBiG can effectively learn low-dimensional representations of both cells and genes, amenable to diverse downstream analytical tasks.
Installation
Please install scBiG from pypi with:
pip install scbig
Or clone this repository and use
pip install -e .
in the root of this repository.
Quick start
Load the data to be analyzed:
import scanpy as sc
adata = sc.AnnData(data)
Perform data pre-processing:
# 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 the data, calculate the gene size factor
sc.pp.normalize_per_cell(adata)
adata.obs['cs_factor'] = adata.obs.n_counts / np.median(adata.obs.n_counts)
sc.pp.log1p(adata)
adata.var['gs_factor'] = np.max(adata.X, axis=0, keepdims=True).reshape(-1)
Run the scBiG method:
from scbig import run_scbig
adata = run_scbig(adata)
The output adata contains the cell embeddings in adata.obsm['feat'] and the gene embeddings in adata.obsm['feat']. The embeddings can be used as input of other downstream analyses.
Please refer to tutorial.ipynb for a detailed description of scBiG's usage.
Release files for scbig 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| scbig-0.1.1.tar.gz | 14.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| scbig-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.0 kB
Release files / scbig-0.1.1.tar.gz
| Download URL | scbig-0.1.1.tar.gz |
|---|---|
| Size | 14.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
26d49d8d7fc363f7d85a5a0f26fca0ac56d808eeda8d1bb68135bfb7dbfd0002
|
|
BLAKE2b-256 checksum How to use checksums |
7487560dd65870c6773c6b620ff8e3efc151814e9cbeccd788244c6184aedaf3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Release files / scbig-0.1.1-py3-none-any.whl
| Download URL | scbig-0.1.1-py3-none-any.whl |
|---|---|
| Size | 16.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a7ab17c91862e9fddde5ff0380dfb5a0e6c2020842849fbccdfb6da490f304dd
|
|
BLAKE2b-256 checksum How to use checksums |
e3a5f88ae94d9dfd0889ef9d6183b205a941c741d1428891cddc0f830ba61e80
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|