Skip to main content
overview

PyPI Python Version License Read the documentation at https://convexgating.readthedocs.io/ Build Package Status Run Tests Status Codecov pre-commit Black

Features

ConvexGating is a Python package to infer an optimal gating strategy from flow, cyTOF or Ab/CITE-seq data. Convex gating expects a labelled input (for instance, from clustering) and returns a gating panel to separate the selected group of events (e.g. a cluster) from all other events (see Fig. 1a). For each cluster, it reports the purity (precision), yield (recall) and the harmonic mean of both metrics (F1 score) for each gate hierarchy and the entire gating strategy. It relies on the scanpy/anndata for the data format and data pre-processing and further on PyTorch for stochastic gradient descent. Therefore, resulting gates may slightly vary.

overview

The iterative procedure to find a suitable gate before applying the convex hull is illustrated in the following graphic.

Update

Installation

We recommend using Python 3.9 and setting up a new conda environment.

conda create -n ConvexGating_env python=3.9
conda activate ConvexGating_env

Then, install ConvexGating the following way.

git clone https://github.com/buettnerlab/convexgating.git
cd convexgating
pip install -e .

Installation time should not exceed 5 minutes. Installation has been successfully tested on Windows and Linux operating systems. We experienced issues with MacOS with Apple Silicon M1/M2 CPUs.

Usage

Single Target Population

Generating gating strategy for cells or events labeled ‘cluster_A’ from an AnnData object (adata) using labels found in adata.obs[cluster_string].

import convexgating as cg
import scanpy as sc

adata = sc.read_h5ad(adata_path)
cluster_string = 'clustering'                                       #column in adata.obs
target_cluster = 'cluster_A'                                        #category in adata.obs[cluster_string]
save = save_path
cg.tools.CONVEX_GATING(adata=adata,
          cluster_numbers = [target_cluster],
          cluster_string = cluster_string,
          save_path=save)

Multiple Target Population

Generating a series of gating strategies for cells or events labeled ‘cluster_A’,’cluster_B’,’cluster_C’ from an AnnData object (adata) using labels found in adata.obs[cluster_string].

import convexgating as cg
import scanpy as sc

adata = sc.read_h5ad(adata_path)
cluster_string = 'clustering'                                          #column in adata.obs
target_clusters = ['cluster_A','cluster_B','cluster_C']                #categories in adata.obs[cluster_string]
save = save_path
cg.tools.CONVEX_GATING(adata=adata,
          cluster_numbers = target_clusters,
          cluster_string = cluster_string,
          save_path=save)

Example

A usage example is available in the docs/tutorials/tutorial_01.ipynb file located in this repository.

Further Details

Please see the Command-line Reference for further details.

Credits

This package was created with cookietemple using Cookiecutter based on Hypermodern_Python_Cookiecutter.

Release files for convexgating 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for convexgating 1.0.0
File Size Uploaded
convexgating-1.0.0.tar.gz 27.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for convexgating 1.0.0
File Interpreter ABI Platform
convexgating-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 57.4 kB

Release files / convexgating-1.0.0.tar.gz

Download URL convexgating-1.0.0.tar.gz
Size 27.4 kB
Tags Source
SHA-256 checksum
How to use checksums
474742902ad148ee35190165262b9ed6615eba0d34d2a4b0b84ac37a054f03bb
BLAKE2b-256 checksum
How to use checksums
e84cff8d2d190e9630e73fd42d64da15cc1137c931b6ef9ee9541e837470db84
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.2 CPython/3.10.11 Windows/10

Release files / convexgating-1.0.0-py3-none-any.whl

Download URL convexgating-1.0.0-py3-none-any.whl
Size 30.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ce37233f5fafed4818bbca2f1c2c255a03107f7b16342e356a4c1ef8f588b5d8
BLAKE2b-256 checksum
How to use checksums
b01c6a4e13a6e51a58146ae8eae89b6e1f664e4255ddd5d9d9f6de3b113da7d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.2 CPython/3.10.11 Windows/10

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page