Skip to main content

Run Gene Imputation Methods

PyPI version Downloads

spagim is a package for gene imputation of spatial transcriptomics data from single-cell RNA sequencing data. It provides a unified interface for various imputation methods, making it easy to apply them to your data.

Installation

Create a conda environment

conda create -n spagim-env python=3.9
conda activate spagim-env

Install JAX via pip:

pip install -U "jax[cuda12]"

Install spagim via pip:

pip install spagim

Usage

Here is a simple example of how to use spagim:

import spagim.benchmark as benchmark
import scanpy as sc
import torch

# Load your spatial transcriptomics data
adata_sp = sc.read_h5ad("path/to/your/spatial_data")

# Load your single-cell RNA sequencing data
adata_sc = sc.read_h5ad("path/to/your/single_cell_data")

# Initialize the imputation model
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
models = benchmark.Imputation(device=device, seed=42)

# Run imputation
adata_impute = models.forward(
    adata_sc,
    adata_sp,
    # choose your method among ['Pearson','Spearman','Cosine','KNN','SpaGE','Harmony','Tangram','ENVI','GIMVI']
    method='Pearson',
    # n_split is the number of splits for the data for ['Tangram','Pearson','Spearman','Cosine'] only
    n_split=1,
    # batch_size is the number of samples per gradient update, for 'GIMVI' only
    batch_size=1024,
    # k is the number of nearest neighbors for ['KNN','Pearson','Spearman','Cosine','Harmony'] only
    k=100
)

Metadata

Release files for spagim 1.0.2

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

Source distribution (sdist)

Source distribution for spagim 1.0.2
File Size Uploaded
spagim-1.0.2.tar.gz 12.8 kB Details

Built distribution (wheel)

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

Total release size: 26.0 kB

Release files / spagim-1.0.2.tar.gz

Download URL spagim-1.0.2.tar.gz
Size 12.8 kB
Tags Source
SHA-256 checksum
How to use checksums
8cc964543aecad5913c6d24765af8ca0bd5511f6b451c16e6451221bf52e6820
BLAKE2b-256 checksum
How to use checksums
a62f98efcc0badef3fa8e52d6db8f0b170314bf1413a371df1d6d5e03b5d7bbb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.15

Release files / spagim-1.0.2-py3-none-any.whl

Download URL spagim-1.0.2-py3-none-any.whl
Size 13.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2bbe816c24045d26fbc5e7abba5cda10eb4a1030c4a7dc835a18f1040e9658d0
BLAKE2b-256 checksum
How to use checksums
c51b873892c478707da649b46aa1bcb5ff28d6d25b115c98cc3aa9ac2ba1eeba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.15

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

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