Skip to main content

A tool for processing and hierarchically annotating immune scRNA-seq data with DeepInsight and CNN.

Project description

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

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

schdeepinsight-0.3.5.tar.gz (341.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

schdeepinsight-0.3.5-py3-none-any.whl (339.6 kB view details)

Uploaded Python 3

File details

Details for the file schdeepinsight-0.3.5.tar.gz.

File metadata

  • Download URL: schdeepinsight-0.3.5.tar.gz
  • Upload date:
  • Size: 341.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.18

File hashes

Hashes for schdeepinsight-0.3.5.tar.gz
Algorithm Hash digest
SHA256 d0b681ad08fc6be8a1ab53401d3fbde3fac95544f1e6e8932d589c6b2b1d3eab
MD5 a413d2d40520ee5ebb813969ff24ae83
BLAKE2b-256 fb0927b2151153691bf3694300feddff4c828a37dfbe954f849400cded55eef0

See more details on using hashes here.

File details

Details for the file schdeepinsight-0.3.5-py3-none-any.whl.

File metadata

  • Download URL: schdeepinsight-0.3.5-py3-none-any.whl
  • Upload date:
  • Size: 339.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.18

File hashes

Hashes for schdeepinsight-0.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6c6872aae7694d2beb09fe8a88374ccbe7025bcff3f8b80f27e002609cae9d61
MD5 2ab5c660ecfd1d006238774edf5f0d26
BLAKE2b-256 ce9b03f907c90e1db91000086d82407f345682e04a528023def227539117a6e0

See more details on using hashes here.

Supported by

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