Skip to main content

"Cluster Independent Algorithm for the identification of RAre cell types."

Project description

CIARA
(Cluster Independent Algorithm for the identification of RAre cell types)

Python implementation of the CIARA algorithm that integrates into scanpy's analysis with the AnnData format.

The package can be installed via pip:

python -m pip install ciara_python

Note: The package only works on UNIX / MacOS operating systems, not on Windows systems, due to the copy-on-write multiprocessing setup used.

Tutorial

The functions are designed to work with scanpy's AnnData objects. For an interactive tutorial check out the Human Gastrula IPython Notebook which is also part of this repository.

First you load your dataset as a scanpy object and after normal preprocessing calculate the knn-network:

import scanpy as sc

pbmc = sc.datasets.pbmc3k()
sc.pp.filter_cells(pbmc, min_genes=50)
sc.pp.filter_genes(pbmc, min_cells=10)
sc.pp.log1p(pbmc)

sc.pp.pca(pbmc)
sc.pp.neighbors(pbmc)

The CIARA package contains the two main functions get_full_background() and ciara() which should be imported via:

from ciara_python import get_ background_full, ciara

Afterwards, the background genes get marked by running the get_full_background() function on your scanpy dataset. This adds the boolean column 'CIARA_background' to your pbmc.var AnnData slot, where relevant background genes are marked.

get_background_full(pbmc, threshold=1, n_cells=2, n_cells_high=5)

Finally, the ciara() function is run on the dataset. This adds the column 'CIARA_p_value' to your pbmc.var object, where the calculated p_values for each of the previously marked background genes are stored.

ciara(pbmc, n_cores=4, p_value=0.001, odds_ratio=2, approximation=True, local_region=1)

We can then extract the top markers or rare cells (lowest CIARA_p_value) and plot them onto the UMAP:

from matplotlib.pyplot import rc_context

sc.tl.umap(pbmc)

top_markers = pbmc.var.nsmallest(4, ["CIARA_p_value"],)

with rc_context({'figure.figsize': (3, 3)}):
    sc.pl.umap(pbmc, color=top_markers.index.tolist())

UMAP of top 4 rare cell type markers for PBMCs

R package

Link to R package:

https://github.com/ScialdoneLab/CIARA/

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

ciara_python-1.0.3.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

ciara_python-1.0.3-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file ciara_python-1.0.3.tar.gz.

File metadata

  • Download URL: ciara_python-1.0.3.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.5 tqdm/4.62.2 importlib-metadata/4.5.0 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.8

File hashes

Hashes for ciara_python-1.0.3.tar.gz
Algorithm Hash digest
SHA256 23e77f70066c585ba4e9c69160595096f8f65137e1da883d20e2b2ee69d3e1fd
MD5 2f9288285206d103364054979fc1a260
BLAKE2b-256 54128e3e9d13d6485d9bc656cad100f6452c00a4538a57dfc4fd3238202d7adf

See more details on using hashes here.

File details

Details for the file ciara_python-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: ciara_python-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.25.1 requests-toolbelt/0.9.1 urllib3/1.26.5 tqdm/4.62.2 importlib-metadata/4.5.0 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.8

File hashes

Hashes for ciara_python-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c58236b00112e9d67f341cbbd821932e2cb7d25a18aed9d4c293e637615f41d4
MD5 c8a0a9bdc59a5f4e559c1ad1002d01fd
BLAKE2b-256 ad2db3ae079a8647651eca18fbcb4277a75f0bf36f04148f5f9dd82718df601d

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