Skip to main content

Single-cell perturbation modeling toolkit

Project description

A Multi-modal LLM-Knowledge Fusion Framework for Predicting Single-cell Genetic Perturbation Effects

scPert, a multi-modal transformer framework that integrates large language model embeddings with structured biological knowledge to predict single-cell transcriptomic responses to genetic perturbations. Through hierarchical fusion of knowledge graph representations, contextual embeddings from foundation models, and gene-specific encodings, scPert achieves significant performance improvements in both single-gene and combinatorial perturbations over existing methods. In cancer-relevant applications, scPert demonstrates the capability to reveal p53 pathway dynamics and immune checkpoint regulatory mechanisms. Systematic evaluation on 42 cancer dependency genes demonstrates scPert's ability to identify critical potential therapeutic targets. Our framework establishes a powerful computational foundation for virtual cell construction and accelerates drug target discovery.

scPert Model

Installation

Install PyG, and then do pip install scpert

Requirement

  • anndata==0.9.2
  • scanpy==1.9.8
  • torch==2.3.0
  • torch-geometric==2.6.1
  • scvi-tools==0.20.3
  • pandas==2.0.3
  • numpy==1.24.4
  • scipy==1.10.1
  • cell-gears==0.0.2
  • nvidia-cublas-cu12==12.1.3.1
  • nvidia-cudnn-cu12==8.9.2.26
  • flash_attn==0.2.8

Usage

embedding_dir: Directory containing gene embedding files (.npy)

data_path: Base directory for perturbation datasets

model_path: Pretrained model directory containing model.pt

pert_file:CSV file specifying perturbation pairs with columns: gene1,gene2

You can train scPert on your perturbation dataset simply running the Python script:

python ./scripts/train.py

You can use scPert to predict single gene or gene pairs perturbations by running the scripts:

python ./scripts/infer.py

Using API Interface:

from scpert import ProcePertdata,scPert

pertData = ProcePertdata(data_path)
pertData.load(DataName = 'norman')

# training
SCPert = scPert(pertData, device = 'cuda:0')
SCPert.model_initialize(hidden_size = 64)
SCPert.train(epochs = 20)

# saving or loading model
SCPert.save_model(model_path)
SCPert.load_pretrained(model_path)

# predict
SCPert.predict([['PRDM1+CBFA2T3'], ['FEV']])
SCPert.GI_predict(['CBL', 'CNN1'])

Cite Us

This work is currently under peer review.

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

scpert-0.1.1.tar.gz (36.4 kB view details)

Uploaded Source

Built Distribution

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

scpert-0.1.1-py3-none-any.whl (39.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for scpert-0.1.1.tar.gz
Algorithm Hash digest
SHA256 62292ae1e35a4ab194408a172c950b6015c79d9b3bb15bfda51398d31ea8e19b
MD5 6b1113b7f0e8dd18b2cde590021110b4
BLAKE2b-256 a3d2d5b9d4ff3c9d86dd24f1a32c5fc407b3a51db39c6f7956eb5dd4ab453337

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for scpert-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7e6ec3f76cebcc233e41bc2b59c2310be1b6953abeaa2eafec443db1509c9cc2
MD5 30679d317ed7b167974911d12d7fda77
BLAKE2b-256 059e619a4bc0dd4d803d57ac3336c86bc9c44cb504ea417fdf5f1fa979cae5aa

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