Skip to main content

biospc

Project description

Bio-SPC

Bio-SPC — A Python library for identifying cliff points along time/pseudotime trajectories based on single-cell RNA-seq data.

Overview

Bio-SPC leverages a 1D ResNet architecture to perform feature extraction and dimensionality reduction on single-cell gene expression matrices. By adopting a sliding-window scanning strategy across the time/pseudotime axis, it integrates three quantitative metrics, including Bhattacharyya distance, Wasserstein distance, and Isolation Forest anomaly score. These indicators are adaptively fused into a unified CPI (Cliff Point Index) curve via the entropy weight method. This framework enables the automatic detection of critical cliff points during biological processes including development, senescence, and disease progression. Corresponding key cells can be further extracted for downstream analytical workflows.

Install

pip install biospc

Quick Start

import scanpy as sc
import pandas as pd
from biospc import bio_spc_pipeline

# 1. Loading data
adata = sc.read("your_data.h5ad")
metadata = pd.read_csv("your_metadata.csv", index_col=0)
adata.obs['Pseudotime'] = metadata['Pseudotime']

# 2. Running Bio-SPC Pipeline
peak_report = bio_spc_pipeline(
    adata=adata,
    time_col='Pseudotime',
    random_seed=42,
    do_plot=True,
)

# 3. Viewing Results
print(peak_report[['Rank', 't', 'Confidence']])

Core Parameters

Parameter Default Description
time_col 'Pseudotime' Name of the pseudotime column
out_dim 30 Output dimension of the ResNet
hidden_dim 128 Hidden layer dimension of the ResNet
epochs 1000 Number of training epochs for the ResNet
lr 1e-4 Learning rate
step_ratio 0.02 Step size ratio for the sliding window
safe_margin_ratio 0.02 Safety margin ratio at the edges
min_cells_ratio 0.025 Minimum cell count ratio
smooth_window 7 Window size for Savitzky–Golay smoothing
prominence 0.1 Peak prominence
distance 5 Minimum distance between peaks
extract_ratio 0.04 Half-window ratio for cell extraction
random_seed 42 Global random seed

Output

  • Peak Report: A DataFrame containing Rank, time/pseudotime point t, and Confidence.
  • CSV File: A list of cell barcodes corresponding to each cliff point.
  • Visualization: CPI curve with multi-peak annotations (optional).

Dependencies

  • Python >= 3.8
  • numpy, pandas, scanpy, anndata
  • torch >= 1.10
  • scikit-learn, scipy, matplotlib

License

MIT

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

biospc-0.1.0.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

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

biospc-0.1.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file biospc-0.1.0.tar.gz.

File metadata

  • Download URL: biospc-0.1.0.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for biospc-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5067f038984f0d7bdad79f655df27d9231255733f6ad36f3353c332409fb8470
MD5 d40cfb132ae1c3c757224ed63591b125
BLAKE2b-256 0e565af26c9dea4160a9988693d25848df51f6e516020355cc602b5a65046e1e

See more details on using hashes here.

File details

Details for the file biospc-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: biospc-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for biospc-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2b5a401d5552d5463cd43de1905bd65dd1724035b760c03171c0fae422eb5904
MD5 245a6653b742f42e3f70a05801c3a0c3
BLAKE2b-256 4bc3c7d2e7c11e78ac6f612d1f1ce851e407b3f4b3744a6e0e68a632e6612356

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