Skip to main content

An advanced gene set scoring package for single-cell RNA sequencing data with GPU acceleration

Project description

Gene Scoring Package

An advanced Python package implementing a novel gene set scoring methodology for single-cell RNA sequencing data analysis. This package builds upon and extends techniques from widely used single-cell analysis toolkits such as Seurat and Scanpy, introducing several key improvements for more accurate gene set scoring.

Key Features

  1. Weighted Gene Contributions

    • Each gene in the evaluated module is assigned an appropriate weight based on its correlation with the phenotype of interest
    • Weights can be normalized to sum to 1 (optional)
  2. Individualized Background Selection

    • Background genes are selected independently for each gene of interest
    • Control features are selected from the same expression bin in the histogram
    • Background can be based on control sample, entire dataset, or a selected pool of genes
  3. Variance-scaled Gene Contribution

    • Individual gene contributions are scaled by their variance under examined conditions
    • Helps account for gene expression variability in different conditions
  4. Optimized Computation

    • GPU-accelerated score calculation for improved performance
    • Support for sparse matrices and chunked processing for large datasets
    • Efficient background gene selection algorithm

Installation

Basic Installation

pip install gene_scoring

Installation with GPU Support

pip install gene_scoring[gpu]

Mathematical Foundation

The scoring methodology is defined by the following formula:

S_c = Σ (w_l / (σ_c,l + ε)) * (X_c,l - X̄_l,control)

Where:

  • n: number of genes in the gene list
  • w_l: weight for gene l
  • X_c,l: mean expression value of gene l in condition c
  • X̄_l,control: average expression of control genes in the background
  • σ_c,l: standard deviation of gene expression in condition c
  • ε: small constant to avoid division by zero

Usage

from gene_scoring import GeneScorer

# Initialize the scorer
scorer = GeneScorer(
    normalize_weights=True,  # Normalize weights to sum to 1
    abs_diff=False,         # Use signed difference (not absolute)
    weighted=True           # Use weighted scoring
)

# Calculate scores
scores = scorer.calculate_scores(
    expression_matrix,    # Gene expression matrix (genes x cells)
    gene_list,           # List of genes to score
    weights=gene_weights  # Optional weights for each gene
)

Parameters

The main parameters for score calculation include:

  • normalize_weights: If True, weights are normalized to sum to 1
  • abs_diff: If True, use absolute difference between expression and background
  • weighted: If True, use weighted scoring (otherwise all weights = 1)
  • ctrl_size: Number of control genes to use per target gene
  • gpu: Whether to use GPU acceleration
  • chunk_size: Size of chunks for processing large datasets
  • random_state: Random seed for reproducibility

For detailed parameter descriptions and additional options, see the function documentation.

Requirements

  • Python ≥ 3.7
  • NumPy ≥ 1.19.0
  • Pandas ≥ 1.0.0
  • SciPy ≥ 1.5.0
  • CuPy ≥ 9.0.0 (optional, for GPU support)

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

gene_scoring-0.1.1.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

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

gene_scoring-0.1.1-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file gene_scoring-0.1.1.tar.gz.

File metadata

  • Download URL: gene_scoring-0.1.1.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.8

File hashes

Hashes for gene_scoring-0.1.1.tar.gz
Algorithm Hash digest
SHA256 236b8a064369b3af7ca1aa98c33b503599534cff1bc56cb2c5611ba8a7b1da15
MD5 ee956bac4e09a36841ce1245c1171aae
BLAKE2b-256 231ff0ef6c309fed3fbe677947e78eef0902bbcd0bd5519c26bd8ea2e9887595

See more details on using hashes here.

File details

Details for the file gene_scoring-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: gene_scoring-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.8

File hashes

Hashes for gene_scoring-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 09722789fc330df91dee209d51d2d03f3cb5b2640a3b65372b5b470c6dbec2a3
MD5 e9d21a51d21229d11e754b1be664cf88
BLAKE2b-256 737ea4f3ffd1e25bb00d59eb8bcfa395623e7a063353e8f245ba8eb711075596

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