Skip to main content

SCHdeepinsight

SCHdeepinsight is a Python package for hierarchical annotation of immune cells in single-cell RNA sequencing (scRNA-seq) data. By combining DeepInsight transformation with a hierarchical CNN model, it provides accurate classification of immune cell types with both base-level and detailed subtype identification.

Features

  • Batch Correction: Aligns query data with the integrated reference dataset using STACAS integration
  • Image Transformation: Converts gene expression matrices to image representations
  • Hierarchical Classification: Two-level annotation providing both major cell types and detailed subtypes
  • Rare Cell Detection: Identifies potential rare cell populations based on prediction confidence

Installation

Install SCHdeepinsight using pip:

pip install SCHdeepinsight

Additionally, the package requires pyDeepInsight:

pip install git+https://github.com/alok-ai-lab/pyDeepInsight.git#egg=pyDeepInsight

R Dependencies

For batch correction functionality, the following R packages are required:

# Install required CRAN packages
install.packages(c("Seurat", "Matrix", "SeuratDisk"))

# Install packages from GitHub
if (!requireNamespace("remotes", quietly = TRUE)) {
  install.packages("remotes")
}

# Install STACAS
remotes::install_github("carmonalab/STACAS")

Usage

Here's how to use SCHdeepinsight to analyze your scRNA-seq data:

from SCHdeepinsight import immune

# Initialize with output directory
classifier = immune("./output_dir")

# Complete pipeline: batch correction, image transformation, and prediction
results = classifier.run_pipeline(
    input_file="path/to/query.h5ad",
    ref_file="path/to/reference.rds", 
    batch_size=128
)

# Access prediction results
print(results.head())

# Save results
results.to_csv("./immune_cell_predictions.csv")

Step-by-Step Approach

For more fine-grained control, you can run each step separately:

from SCHdeepinsight import immune

# Initialize
classifier = immune("./output_dir")

# Step 1: Batch correction
corrected_file = classifier.batch_correction(
    input_file="path/to/query.h5ad",
    ref_file="path/to/reference.rds"
)

# Step 2: Transform gene expression to images
classifier.image_transform(corrected_file)

# Step 3: Predict cell types
results = classifier.predict(
    batch_size=128,
    rare_base_threshold=60,
    rare_detailed_threshold=10
)

Prediction Results

The results DataFrame contains:

  • barcode: Cell identifiers
  • predicted_base_type: Major cell type classification
  • predicted_detailed_type: Detailed subtype classification
  • base_type_probability: Confidence score for base type prediction
  • detailed_type_probability: Confidence score for detailed type prediction
  • is_potential_rare: Boolean flag for potential rare cell types

Metadata

Release files for SCHdeepinsight 0.3.5

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

Source distribution (sdist)

Source distribution for SCHdeepinsight 0.3.5
File Size Uploaded
schdeepinsight-0.3.5.tar.gz 341.3 kB Details

Built distribution (wheel)

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

Total release size: 680.9 kB

Release files / schdeepinsight-0.3.5.tar.gz

Download URL schdeepinsight-0.3.5.tar.gz
Size 341.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d0b681ad08fc6be8a1ab53401d3fbde3fac95544f1e6e8932d589c6b2b1d3eab
BLAKE2b-256 checksum
How to use checksums
fb0927b2151153691bf3694300feddff4c828a37dfbe954f849400cded55eef0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.18

Release files / schdeepinsight-0.3.5-py3-none-any.whl

Download URL schdeepinsight-0.3.5-py3-none-any.whl
Size 339.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6c6872aae7694d2beb09fe8a88374ccbe7025bcff3f8b80f27e002609cae9d61
BLAKE2b-256 checksum
How to use checksums
ce9b03f907c90e1db91000086d82407f345682e04a528023def227539117a6e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.18

Release history Release notifications | RSS feed

This release

0.3.5 This release

2 release files

0.2.20

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