Skip to main content

A Python package to mix-and-match conflicting clustering results in single cell analysis, and generate reconciled clustering solutions.

Project description

Documentation Status Pypi Downloads Stars DOI

scTriangulate

scTriangulate is a Python package to mix-and-match conflicting clustering results in single cell analysis, and generate reconciled clustering solutions.

scTriangulate leverages cooperative game theory (Shapley Value) in conjunction with complimentary stability metrics (i.e. reassign score, TFIDF score and SCCAF score) to intelligently integrate clustering solutions from nearly unlimited sources. Applied to multimodal datasets, this approach highlights new cell populations and mechanisms underlying lineage diversity.

Please don't hesitate to reach out to me if you have any questions (contact down the page), I will be responsive.

Overview

schema

It can be used in an array of settings:

  1. Integrate results from the same or multiple unsupervised clustering algorithms (i.e. Leiden, Seurat, SnapATAC) using different resolutions.

  2. Integrate results from both unsupervised and supervised (i.e. cellHarmony, Seurat label transfer) clustering algorithms.

  3. Integrate results from different reference atlases.

  4. Integrate labels from multi-modality single cell datasets (CITE-Seq, Multiome, TEA-Seq, ASAP-Seq, etc.).

schuma_chop

Tutorials and Installation

Check out our full documentation and step-by-step tutorials. But let's get a quick sense for a minimum example, it has been tested in python>=3.7 on MacOS, Linux and Windows PC.

pip install sctriangulate
import scanpy as sc
from sctriangulate import *
from sctriangulate.preprocessing import *
from sctriangulate.colors import *

# If you are using Mac or PC, set Matplotlib backend as Agg
sctriangulate_setting(backend='Agg')

# If you are using Linux server, make sure you have internet connections

# Your adata should have:
# (a) adata.X, properly normalized (i.e. log CPTT for RNA, CLR for ADT, etc), check sctriangulate.preprocessing.Normalization for various choices
# (b) at least two columns representing conflicting annotations in adata.obs, passed to query argument
# (c) adata.obsm['X_umap'] for automatically generate visualization, check sctriangulate.preprocessing.scanpy_recipe to generate umap 
# (d) don't have adata.raw attribute, if have, del adata.raw, this will interfere how scanpy calculate marker genes

adata = sc.read('./test/input.h5ad')
sctri = ScTriangulate(dir='./output',adata=adata,query=['sctri_rna_leiden_1','sctri_rna_leiden_2','sctri_rna_leiden_3'])
sctri.lazy_run()

# All the results will be saved in the dir you specified

Docker

You can run the main functionalities using a docker container:

docker pull frankligy123/sctriangulate:0.12.0.1
# imagine you are in the folder where your input.h5ad file sits, and you want to save your results to a new folder in the
# same directory as ./output, here is how you run the docker
docker run -v $PWD:/usr/src/app/run -t frankligy123/sctriangulate:0.12.0.1 --adata_path ./run/input.h5ad \
           --dir_path ./run/output --query sctri_rna_leiden_1 sctri_rna_leiden_2 sctri_rna_leiden_3
# access help page
docker run -v $PWD:/usr/src/app/run -t frankligy123/sctriangulate:0.12.0.1 --help

Citation

Li, G., Song, B., Singh, H. et al. Decision level integration of unimodal and multimodal single cell data with scTriangulate. Nat Commun 14, 406 (2023). https://doi.org/10.1038/s41467-023-36016-y

Reproducibility

All scripts for reproducing the analyses in the preprint are available in the reproduce folder, along with all the necessary input files and intermediate outputs which are avaiable in Synapse storage.

Contact

Guangyuan(Frank) Li

Email: li2g2@mail.uc.edu

PhD student, Biomedical Informatics

Cincinnati Children’s Hospital Medical Center(CCHMC)

University of Cincinnati, College of Medicine

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sctriangulate-0.13.0.tar.gz (151.3 kB view details)

Uploaded Source

Built Distribution

sctriangulate-0.13.0-py3-none-any.whl (157.8 kB view details)

Uploaded Python 3

File details

Details for the file sctriangulate-0.13.0.tar.gz.

File metadata

  • Download URL: sctriangulate-0.13.0.tar.gz
  • Upload date:
  • Size: 151.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.13

File hashes

Hashes for sctriangulate-0.13.0.tar.gz
Algorithm Hash digest
SHA256 dc24a47c912c15d06465ea6ec87599e5bcdf06d18955d964f96eebce445a7bc2
MD5 bf825d0ad8fa3122efddee93eaa6eaf8
BLAKE2b-256 6cd65c1880dd79845493fd5c0a6b05c056e3a6c55149ea4f838d66a2bfa03167

See more details on using hashes here.

File details

Details for the file sctriangulate-0.13.0-py3-none-any.whl.

File metadata

  • Download URL: sctriangulate-0.13.0-py3-none-any.whl
  • Upload date:
  • Size: 157.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.13

File hashes

Hashes for sctriangulate-0.13.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2e58516cc703cf0786016ee0cf6dbafd2eb3171ea88ee7ea2436bdca60a63b0b
MD5 fc96c2dd14e9c8b3c8995fb16d1d6b4f
BLAKE2b-256 b794cd22d6c7c6a4866349738a8d3e8e927f0cbff92d3a5f671a9d39e868b979

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page